ALL SECURITY RELATED TOPICS ON IoT wILL BE POSTED THERE
2015-11-25
>> RF 433Mhz RADIO COMMUNICATION WITH AN ARDUINO
In this technological day and age - who needs wires for communication!
While shopping around recently for some hardware I came across from 433Mhz
RF radio components that I just had to pick up and see what I could do with
them. The components I purchased were the 433Mhz
ASK
modulation based
RF Link Transmitter
and
RF Link Receiver.
So how difficult is it for two Arduino's to communicate over the 433Mhz
frequency band?
But what is the 433Mhz frequency band?
Officially, it is called
LPD433
which stands for Low Power Device 433Mhz - which is a UHF radio band that is
license free where devices are allowed to operate. It is commonly available
and you may even be using it without knowing - if you have a garage door;
or some remote control for lighting; chances are it will utilize the 433Mhz
frequency band.
The hardware is also extremely cheap - so getting started isn't going to cost
a lot.
The first step for doing anything with these components was to get access
to the data sheets for each one to know exactly which PINs on them mean
what and where they should be connected. The two components I purchased
had data sheets hosted on sparkfun:
The Arduino world is full of open-source libraries that one can find easily
and thankfully; someone has already implemented the ASK modulation logic
for processing the raw signals from these components. I first came across the
VirtualWire library - but, it has been since merged into the
more advanced
RadioHead
library covering a large range of hardware.
The library is extremely well documented - a good sign for the community!
The subsection of the library we want to use is called
RH_ASK
that is designed specifically for these components. Of course; they have
some great simple examples which can be used out of the box - in fact, they
are the basis for the demo which I have prepared.
The library defaults at 2000 baud and matches RX to PIN11, TX to PIN12 and
PPT to PIN10.
In addition to aligning the components to use this configuration
(to avoid changes) and I also added on the receiving device an LED that we
plan to turn on and off based on values sent from the transmitter. The
fritzing diagram for the receiver is as follows:
On the transmitting device, I have wired up a push button with a 220Ω
resistor to detect presses on the Arduino (fritzing diagram below) to allow
for some interaction. The idea is that when the button is pressed; the LED
should light up on the receiver and turn off when it is rreleased.
Notice that there is a small antennae (approx 13cm) that must be connected to
both components.
The complete sketches are available above - the library isn't limited to sending
a single value; up to sixty-seven bytes of data can be sent in each packet.
Detailed information on how it is implemented is available on the RadioHead
libraries website - a good read for sure.
The console log of the transmitter should look like:
Originally the sketch had a 500 millisecond delay (as in video) which could
have some latency in transmission. I have since updated it to 25 millisecond
delay and the reponse is almost instananeous - keep in mind the smaller the
delay; the more broadcasting on 433Mhz frequency.
I may do some further investigation to see if I can get multiple transmitters
talking to the receiver at the same time as it could open up a very cheap
and simple way to have a number of sensors communicate to each other over
fairly long distances. In the mean time; do not go out there hacking people's
garage door openers or other devices.
advertisement (self plug):
need assistance in an IoT project?
contact us
for a free consultation.
DISCLAIMER:
All content provided on this blog is for informational purposes only.
All comments are generated by users and moderated for inappropriateness periodically.
The owner will not be liable for any losses, injuries, or damages from
the display or use of this information.