Arduino Project #00004 - NRF24l01 to Serial Port module on Orange Pi One

Let`s imagine you have your home full of Arduinos, and sensors and appliances, but not connected to wifi, independent and not communicating with each other. But how could you than use a Node-Red, and make an smartphone App for controlling them... or even building custom remote control!?

The only possible answer is that they must communicate to a central "node" (mqtt broker in my case), send status to this node, and receive commands from it. In my case, I plan to use my Orange Pi One for this function; it has already node-red and mosquitto installed.

The simpler but in my point of view, not the best solution, would be hang up an NRF20l01 directly to the Orange Pi One, since it provides 3.3v logic level pins (this solutions seems to be widely used). 

The inconvenient I see here is that you have to install and configure a lot of unwanted and complicated software, and it`s so easy to mistake the pinout if for some reason you need to unplug it / and plug it again later. What I will do is simply communicate via a serial port, no software needed, and since the module in connected via USB, you can just plug it in another board.

Anyway, if you intend to do so (NRF24l01 direct to the Orange Pi board), the pinout and connections is as the following:



And here the NRF24l01 connections to many boards.

Reference: http://tmrh20.github.io/RF24/

The connections should looks like here in my attempt (just tested, not continued this idea)


Well, let`s build our module!

First you need to create something to send data. I used an arduino nano on a small breadboard, a BME280 sensor, a 0.96" oled display to show the last message sent, and sure an NRF24l01 module. Arduino code is here.



Here is the NRF connections and pinout. Note that IRQ is not connected (not used).

I know that each module can send and receive data, but for sake of simplicity I did just one way (board with the sensor sending, and the module for Orange Pi receiving).

And here is the connections for the display, and for the BME280 sensor. Note that both are i2c, just that the sensor is 3v only,  and the display might be connected on 3v or 5v, I opted for 5v.


The module that will be plugged via USB will be even simpler than the sender. It`s all of it, but without the sensor.


Ok, now is just solder everything according to the connections (sorry for my bad skills on it).


And test it:


Now, since my soldering dont look very good, I also added a layer of hot glue to make sure that any cable won`t lose from the board.

Since it`s connected on the USB, the arduino will show it in ttyUSB0 probably. In this example (here is the code) it`s reading from NRF24l01 and displaying on the oled and also printing on the Serial Port. Read what`s coming is simple like this.



Well, concept tested and working!

What to do next in this project?
- Software needs a lot of fixes, and also when writing to the serial port, make it send to NRF24.
- Change the display to show the last message sent and the last received.

Links:
Arduino lib to work with the NRF24l01 module - https://github.com/nRF24/RF24

More about the NRF24l01 module - https://howtomechatronics.com/tutorials/arduino/arduino-wireless-communication-nrf24l01-tutorial/


Update 2018-09-22

My solder skills just killed me, and the display was not working anymore. So I decided to make it simpler. Just an Arduino Nano and an NRF module as receiver & transmitter connected to the serial. By the way, I wrote a better version of the code that runs in the Arduino, also I`m adding bellow my flow in the Node-Red. Simple right!? Whatever came in Serial (Radio to Serial) I re-transmit on MQTT topic, and whatever came in another MQTT topic, i write to the Serial, and as consequence to the Radio.





2018-09-02 22:16:00
Computers and science as a way to live

As you may know, I`m a programmer, I work most in web projects, but not only. This area is a mess! Each day you have to recycle what you know in many ways. The thing is, a knowledge that change so often can`t afford wait to be translated to Portuguese for instance, at that time, the known will be already deprecated. English to me is a functional requirement. I can`t imagine my daily life without it. I have been studding English for serious since 2009. In this section you can see what I`m working on. Have fun as I do.
RSS Feed
"A vida é curta demais para ser pequena / The live is so short to be small / Das leben zu kurz sind für kleine sein". (Benjamin Disraeli)