IAN LANG ELECTRONICS

Which title encapsulates the essence of this article neatly- we are going to make the Arduino talk by using three kinds of contactless technology. Firstly, we'll have an infra-red control, then a radio control, then a proximity sensor which can cause the Arduino to shout a "backoff warning" rather like that on car alarms.

Making your Arduino Talk by Remote Control

Go Back

So, although the activating technology will differ greatly, the heart of the system won't. It's this thing on the left, which is an ISD1932 breakout board.

"Is it?"

"It is, yes."

"Oh."

"Yes."

"That's rather good then?"

 

As a matter of fact it is very good indeed. The ISD series are high quality chips that can record brief analogue sounds, record them digitally at varying sample rates which you can set and play them back. If you haven't come across this device before, here's an article all about them:

 

 

 

 

They are made by Sparkfun, on sale directly from them in the United States of America and in the UK from Proto-Pic. Click on their logo for the webpage.

ianlangelectronic.webeden.co.uk/#/voice-recorder/4562321245

So, let's get on with the infra-red thing then. To do this, we are going to use another one of Sparkfun's rather excellent little products, The IR Control Kit, also available in the UK from Proto-Pic.

Within this pack you get a keychain remote with seven channels and thoughtfully the battery to work it, two ICs that detect the modulated output of the remote, two IR LEDs if you want make an octocouple from your Arduino and somewhat bizarrely about two dozen 330 ohm resistors (at least in the two packs I bought you did so I presume it's the same for all of them). I don't know why so many resistors but on the basis that you can't have too many bits, into the box they went.

 

The IC that comes in this package is a TSOP 382.

In one small package not much bigger than a T092 transistor it contains a photo-diode, amplifier, filter and demodulator and it ouputs high when no IR is detected and low when IR at 38 kHz is present.

Why 38 kHz? because every source of light and heat emits infra-red radiation. Very few indeed do so at 38 kHz, and so any IR at that frequency is most likely to come from an artificial source. Most IR controllers work at this frequency, and indeed when I first pressed the power button on the keychain remote supplied, it switched the television on. Oops.

The form of the modulation is pulse-code modulation and more specifically it is a kind of Manchester Code. Put simply, the transmitter's IR LED can be in two states, high or low. If we take a measurement every 600 microseconds, and do it for a given number of samples, we can make a binary number out of those samples by placing a 1 or 0 in succession. Each button causes a slightly different rate of modulation within the 38 kHz band and thus if we detect that we have a constant with which we can measure which button has been pressed on the transmitter.

If you did not understand a word of that last paragraph, don't worry you aren't alone. This is quite high level physical computing that you'd find on the first or even second year of a degree course so if you haven't done such a course nobody expects you to be au fait with this principle. Even people who have done such a course find it difficult.

Now, we could spend days analysing the output, and constructing an Arduino sketch, then refining it, and finally getting it perfect. We could do that. Oh yes indeed.

We aren't though. Because Sparkfun has done the hard work for us and written the base code. It's in their quick start guide, which the link on the left leads to. Set up your Arduino as shown, and copy and paste the sketch in, and press some keys on the transmitter. Here's a sample of what you'll see in the serial monitor:

 

Waiting:

Key Recieved: Power

Key Recieved: Power

Key Recieved: Power

Key Recieved: Power

Key Recieved: CH Up

Key Recieved: CH Up

Key Recieved: CH Up

Key Recieved: CH Up

Key Recieved: CH Down

Key Recieved: CH Down

Key Recieved: CH Down

Key Recieved: CH Down

Key Recieved: Mute

Key Recieved: Mute

Key Recieved: Mute

Key Recieved: Mute

Key Recieved: VOL Right

Key Recieved: VOL Right

Key Recieved: VOL Right

Key Recieved: VOL Right

Key Recieved: VOL Right

Key Recieved: VOL Right

Key Recieved: VOL Left

Key Recieved: VOL Left

Key Recieved: VOL Left

Key Recieved: VOL Left

Key Recieved: AV/TV

Key Recieved: AV/TV

Key Recieved: AV/TV

Key Recieved: AV/TV

Key Recieved: AV/TV

 

 

 

We're going to use that code and modify it to our own needs. The first thing we need to do is to record some messages on to the voice recorder breakout board. There's seven buttons on that remote, and so it would seem sensible to have seven messages available to us at a length for each message of 5.7 secs and a sample rate of 6.4kHz. It's up to you what messages or sounds you record but I'm going to use bits of famous poems. Just lately, uploading videos to YouTube has not been going well for me and I do not know why. The videos are fine when I play them in three different media players, but YouTube seems to be mangling them at their end. If this video does not play well, let it download itself fully first.

www.sparkfun.com/tutorials/291

Sparkfun's tutorial page, where you will find the code mentioned in the text right as well as lots more interesting facts and figures, is here:

Here's a Fritzing diagram of how this is wired up. It shows the old-style VR board, but follow the wiring diagram anyway. It's just the same.

Note that FMC1 is low and the other two are high. The output from the TSOP382 is marked as the yellow and goes to pin 2 of the Arduino. I have only seven messages on this and pin E3 of the breakout board is thus not connected, and we are not bothering with an external LED this time.

 

Over the page we go then for the code to work this device.

More>