In this essay we will talk about some general aspects when making cheap wireless communications systems between low-cost embedded microprocessors, using in the code, the new library “RadioHead”. We will focus in a famous platform based on Atmel embedded microprocessors called Arduino working with the cheapest RF transmitters that use ASK Modulation for setting up the essentials components of a functional low-cost communication system. Firstly we have to tell some general aspects about the platform we are going to use.
Arduino is a free embedded microprocessors hardware platform that allows making easily, projects that need the interaction of software and hardware. This platform has a big community of users and also a lot of documentation, libraries, tutorial and examples, that can be found in their web page. Furthermore, that platform is very cheap so is suitable for any type of D.I.Y projects.
For wire communication systems, Arduino Boards have an UART port for serial communication. In addition, some Arduinos Boards as Arduino Mega or Arduino Due, have more than one UART port and you can also make Virtual Ports with “SoftwareSerial.h” library in any Arduino Board.
The problem with these communication ports are that they cannot be use when we want to make wireless communications. These types of communications need some codification in order to detect corrupt messages and remove interference noise. These problems are not frequent in wire communications but are very common in wireless communications. So for wireless communication systems we need extra hardware and also extra software to manage this hardware.
Around April 2014, Mike McCauley published the first release of “RadioHead.h”, a new library that allows making easily wireless communications between embedded microprocessors as Arduino. The library can be used with a lot of transmitters and receivers of data. That library will help solve the problems that appear when we star using wireless communication systems.
In this essay we will implement a system based in ASK modulation hardware but others are supported as well. We select ASK because they are the cheapest ones, about 2$ each pair of Transmitter (TX) and Receiver (RX) with a real range about 50 meters. With two Arduinos micro of 3$ each and some batteries, we will have a complete wireless communication system. This is the best hardware for making our first functional wireless communication system. For this system any Arduino board is suitable, if you are prototyping probably an Arduino Uno will be the best choice instead of choosing an Arduino Micro which is normally used for finished projects. In this part of the essay we are going set up the simplest wireless communication system using the knowledge and the hardware presented above.
Firstly, after having selected the hardware, we are going to set up all the connections that are needed in order to start working with the hardware.
We just need 3 wires for each module. Two of them for
powering the TX/RX connected to the pins of the Arduino 5+ and Gnd, and the
other for passing the data. In our system we will use default pins, D12 in TX
and D11 in RX for transmitting the data.
Secondly, we have to start working on the software but first we need some general knowledge about Radiohead library. The library has two parts. The first one is “Drivers” and the other is “Managers”. For working with this library you have to choose one driver and one manager. This design of the library is very useful because if you improve your hardware you will just need to change the driver and not to change all the code, which in most cases is very complex.
In our case we selected the “RH_ASK.h “driver, if we want to use other hardware we just change the driver that the hardware we selected needs. We also need a manager, as you have read above. In our case we will use the simplest one “RHDatagram”.
Without entering in complex details about the code, we are going to update the example to test that the hardware is wire correctly and prove if or system is functional or not. So, we plug both Arduinos to the computer and using Arduino IDE (for more information about basic use of Arduino check Arduino.cc) upload the example codes that you will find in the Radiohead library (the links are below).
If everything is okay you will receive in your RX module the string “Hello World”. In this case you have successfully implemented your low cost communication system using the new library Radiohead. Now you can improve it by changing the managers and making strongest communications.
For concluding, we have seen that wireless communication systems between low-cost embedded microprocessors are complex than wire communication systems, because they need extra hardware and software in order to work. Using the previous concepts we have made our low-cost platform using Arduino with a pair of ASK Modules and the RadioHead library that helps to deal with all the typical problems in our wireless communication system.