DesignSpark Electrical Logolinkedin
Menu Search
Ask a Question

How to Remote Control a Thing

 

Ever wanted to make things come alive via remote control - similar to a car key fob? The Parallax Key Fob 433MHz Remote Control Development Kit (RS Stock No. 843-0812) is a great way to do it.

 

The board requires a 5V input - the fob comes with a pre-installed 12V battery.

The data sheet shows which pins on the board go high when a  key fob button is pressed. 

 

 

If the thing you want to control wants to be on when you press the button (or requires just a pulse input) then the D pin can trigger a transistor and turn your item on (This is described in more detail in the Thingatron article).
 
However, if you want to program your thing to stay on for longer, to switch on and off or to do anything fancy, another microprocessor board, such as the Adafruit Trinket - RS Stock No. (124-5506) can be used.
 
The breadboard circuit below uses an Adaftuit PowerBoost 500 to take a 3.7V input from a LiPo battery (orange wires) and converts it into 5V (red wires) to power the Parallax Remote Control Development Board.
 
As the signal output (white wire) from the Development Board is also 5V, a 5V Trinket is required (rather than the 3.3V version).
 
 
 
When programming the Trinket, it also gets power from the laptop - so a diode is used between the Development Board and the Trinket to prevent current flowing the wrong way.
 
The green PCB terminal blocks are used to make life easier. The positive wire from a LiPo battery is connected in the 3V7 hole, ground in the GND hole. P0 and P1 can be used as the inputs to two Thingatrons and therefore two "things" can be controlled. The Thingatrons also need to be connected to the Ground PCB pin. The Trinket can control more outputs - this example just uses two - the yellow and the blue wires. It could also respond to more inputs - but just the one (white wire) is used in this example.
 

Programming the Trinket

 
The Trinket is a little different from programming other Arduino-style microprocessors - especially the bootloader. Please refer to https://learn.adafruit.com/introducing-trinket/introduction - take note that some computers' USB v3 ports don't recognize the Trinket's bootloader. So use a USB v2 port or a USB hub in between. Also, The Trinket does not appear in the serial ports drop-down - you program it using the USBTinyISP setting.
 

Here's the  code:

--------------------------------------------------------

// react to digital input
// by Andy Stanford-Clark with embellishments by Lucy Rogers

// when INPUT goes high, pulse both OUTPUT0 and Output1 high for 30 sec

#define INPUTA 2
#define Output0 0
#define Output1 1

void setup() {
// put your setup code here, to run once:

//pinMode(INPUT, INPUT);
pinMode(INPUTA, INPUT);
pinMode(Output0, OUTPUT);
pinMode(Output1, OUTPUT);

}

void loop() {


if (digitalRead(INPUTA)) {
digitalWrite(Output0, LOW);
digitalWrite(Output1, LOW);
delay(0.5*1000);
digitalWrite(Output0, HIGH);
digitalWrite(Output1, HIGH);
delay(30*1000);
digitalWrite(Output0, LOW);
digitalWrite(Output1, LOW);
delay(20*1000);
}

--------------------------------------------------------

 
You can change the time period the Things will be on for by changing the "delay(30*1000)".
The initial "delay(0.5*1000)" is to make sure the Thing is off at the beginning.
 
At the end, the "delay(20*1000)" is to ensure there is a 20-second gap before the Things are re-triggered.
 
Once the Breadboard version was working I soldered the whole thing on to veroboard - which has made a robust system which I could insert into any project - such as a Banksy Shredder Frame or a Dragon that breathes smoke (see articles below!).


Articles in this series

  1. How to Remote Control a Thing - make the remote element
  2. Dragon Breath - electronics for the eyes and smoke
  3. Experiments in Casting a Dragon - creating the mould

I'm the Founder of the Guild of Makers (www.guildofmakers.org). and invent and make bespoke items that solve problems. I'm a Fellow of the Institution of Mechanical Engineers and have a PhD in bubbles. I was a judge on BBC Robot Wars and "Inventor in Residence" on the "Josh Widdicombe will make your life better" show. I wrote the foreword to: “Robot: Meet the Machines of the Future” £14.99, published by DK (www.dk.com).

27 Dec 2018, 10:16