Wireless works better with Wires

There is apparently a difference between seems to work, and actually working. I spent a good chunk of today finding this out. The devices you can see here are used to send wireless signals from one place to another. You put a signal into the input pin on the transmitter (the one at the top) and it emerges from the receiver.  People say they seem to work. So I thought I'd have a go with them.

The first thing I did needed to do was prove that the devices work so I wired up a couple of Arduino controllers and used the lovely VirtualWire library to waggle the wireless signals up and down and transfer data. It worked first time. Yay for me. 

I really wanted to use these devices to transmit signals to control some lights, so the next thing to do was write some code that turned the lights on when it received the appropriate commands. So I wrote that and ran it and it worked. But only once. Not so much yay.

So I built a theory that light software and the VirtualWire library were fighting over Arduino hardware and losing data as a result. And I spent a while trying isolate the usage of the signal pins that they use. And getting nowhere. 

And then I had a brainwave. I took out the wireless devices and replaced them with a piece of wire between the two Arduinos. And the program worked perfectly. Flickering lights and everything. 

Most confusing. After a bit of thought I reckon I've figured out what is happening. The receiver likes being given a nice healthy 5 volt supply. And when the program starts running it gets exactly that. But when I send the command to turn some lights on this causes the voltage to drop (taking current out of a system often causes this) and so the receiver stops working. I'm now working finding a few volts from somewhere to beef up performance.

Working with hardware devices is like this. You don't just have to get the software to behave, you also have to consider the electrical environment too. But I'm still having fun.