For several months now, I have not written anything new in the blog, but learning is in full swing. I’ll try to catch up. Let’s start with an inexpensive way of communicating between devices of various kinds.
I was always surprised by people who bought an Arduino or a Pi, and see what they to do with them. In my case, everything is much simpler. I know that I want to control several sensors and switches at home, “a smart home”. As soon as I got more than one device at home, the task of communication between them arose. In my case, the Pi and several Arduinos, but it could be several Arduinos or several Pis. For the development period, the Arduino board is going to be connected to the Raspberry Pi via a USB cable, but after that, it would be useful to be able to send and receive data between devices that are not connected by a cable and the distance between them is about 100 meters. It can be temperature sensors in the courtyard or on the balcony, motion sensors, sensors for lighting, humidity, flooding, light switches in the garage, electric kettle, iron, TV, computer, light in the room …
So, how can the communication between Arduino and the Pi be arranged? There are many ways to make several devices communicate with one another, among which main options can be distinguished, each of which has its pros and cons.
- Cable
- Bluetooth module
- 433Mhz radio module
- WiFi module
- NRF24l01 module
The criteria by which they can be distinguished: Availability, Price, Features, Ease of programming, Practicality of use in the real world.
Cable | Bluetooth | 433Mhz | WiFi | NRF24l01 | |
Cheap (price) | v | – | v | – | v |
2 way communication | v | v | – | v | v |
Long range (up to 400m) | – | – | – | – | v |
Simplicity | v | – | v | v | – |
Reception acknowledgement | v | v | – | v | v |
Little about the requirements:
- If we make a switch, we need to know its state, otherwise there is no way of telling that the light in the hallway is turned on. Thus, two-way communication is an important criterion. This means that 433Mhz radio does not meet the requirement.
- Since the circuit breakers can be located in other rooms, it can be difficult to pull the low current cable wires there (at least in my case it is so). The cable connection is not an option for me.
- The distance between devices in my case can be well over 15 meters. This means that Bluetooth modules are not suitable.
The choice between WiFi and NRF24
WiFi is a great option, but I use the WiFi module on the Raspberry Pi to connect to the Internet, and the modules themselves are expensive, it is also a high possibility that WiFi channels can be heavily loaded (busy) due to the widespread use of frequencies, and of course the working distance is not the best of the best (usually around 50m).
NRF24l01 – Cheap module, working distance of the modules with an external antenna are around 400 meters, but programming them is not the easiest task. NRF24 is a two-way communication module that is fairly fast (up to 2Mb/s). Since the modules are not expensive, I’ve decided to start with them and ordered several modules with an external antenna for verification. It turned out to be a very good decision as a budget option. The distance is good, programming (there will be a separate post about programming) NRF24l01 using a library is OK for a beginner.
In other words, if you are looking for an inexpensive way to communicate with several devices wirelessly – I would recommend NRF24L01!
Specifications for NRF24:
- Working frequency – 2.4Ghz
- Data transfer rate – up to 2Mb /s
- Range – up to 1000 meters (400 meters in real world)
- Energy consumption – 50 mA