IAN LANG ELECTRONICS

My family have the unerring knack of giving me things I would never want for Christmas. For example, I stopped drinking many years ago, but I used to like Buffy the Vampire Slayer. My sister, in the full knowledge that I didn't drink, gave me a set of whisky glasses with the Buffy logo on them. When I wear a shirt, I like to roll the sleeves up neatly so the cuffs don't peep out of my jacket, and when I can't do that I always use button cuffs, so naturally I get cufflinks.

One thing I really do not like is radio controlled cars. I get one every year. Except for the year I passed my Fork-Lift Driving Test. That year I got a radio controlled fork-lift toy. I usually wait until about April/May when they've forgotten about it and disassemble the thing to see if there's any bits I can use for something else.

Invariably I get loads of gears and motors, but much more precious is the radio control board. Now, you can make RC boards, but it takes a great deal of time and a largish wad of cash. You can buy them ready made, it takes no time but you won't be going to Tesco for much that week because you'll have spent all your hard-earned on the board. Ridiculously, a cheap RC toy can yield a board that is sometimes just as good as one you buy new, and it comes supplied with a transmitter.

Which, in case you are wondering what the point of the above was, is how I'm going to introduce my Arduino to the idea of doing what the transmitter tells it to.

Radio Control your Arduino

Go Back

Above is a little video which shows the prototype construction working. I took the RC board from a dodgem car that came in a set of two from (as I later learned) John Lewis for £12.99. Not bad, considering a well-known chain wanted to charge me £35 for a single RC board.

Without a transmitter, I might add. That's extra.

Investigating this board it transpired that the board and the RF generation (27 MHz) have their own separate power supplies but both can work with the 5V supply from the Arduino, and the ground is common and so only one wire is needed to feed back to the Arduino. Huzzah!

There were four wires for the motors. I used two. I attached one to A0 and the other to A5, and this gave me two channels to work with; one button for on and one button for off. You'll notice that for testing I didn't bother with any fancy connections; just twisted the RC board wires round the end of a couple of jump wires.

In the initial testing, all I did was attach the wires, and got the Arduino to serial print to the IDE what the analogRead value at A0 and A5 was when I pressed a button on the transmitter. In this way I could see what activated where. Then I thought: I know, to put this to practical use I'll make a radio-controlled siren that can be switched off and on by the transmitter. That's what you're looking at in the video above. This is similar to the talisman system old people used to have to summon help. This Tx-Rx pair only works across about ten feet, but it's still good enough for what we want.  Later on I might make an RF amplifier for the receiver and see if the range goes up a bit. Anyway, here's the schematic for the above circuit.

And here's the code that works the Arduino:

 

int (alflag)=0;

void setup(){

}

 

void loop(){

         if (analogRead(A0)>1000){

    alflag=1;}//set flag to siren on

      if (analogRead(A5)>1000){

    alflag=0;}//set flag to siren off

  if (alflag==1){ //flag =1 siren on flag=0 siren off

    for (int j=200; j<400;j=j+5){//loop for nl value

    tone (10,j,30); // tone (PIN,FREQUENCY,DURATION)

delay (30);} //wait until duration period has passed

  } //close of  if (alflag==1

 

}//close of function

 

 

 

And as you can see all it does is detect when an input is high and set a flag accordingly. It really is as simple as that. This sort of application has all sorts of implications; using this method we could remotely control absolutely anything.

 

Ian Lang October 2011