This week was a very informative one. Most of the information that was presented was new to me and I liked learning about different communication methods. The assignment was to design, build, and connect wired or wireless node(s)
with network or bus addresses. There was a group assignment to send a message between two projects but, unfortunately, under the current circumstances this would've taken more time than we could afford.
I chose to use the nRF24L01 module which a transceiver module that can send and receive data. The original idea was to control the servo with the joystick control used in several previous assginements. However, I really wanted to try connecting a keypad and learn how to use it.
Individual assignment
Like mentioned above, I used a keypad to communicate with an LCD that is connected to a differen't Arduino. I'll try to go throught the steps of connecting the two devices wirelessly via nRF24L01.
The photo above show the devices we want to connect. The communication will be done through 2 Arduino Unos. The arduino set up is shown in the photo below.
I will now go through the exact detaild on how the LCD was connected as this was covered in another project. Also, the keypad connection is straight forward. I used the library shown below to read the data from the keypad.
The button on the keypad are connected in a 4x4 matrix and each button has a column number and a row number. This is why a 4x4 keypad takes 8 pins on the arduino.
The library (shown below) does a great job organizing the pins and the buttons.
That's all it takes to connect these devices to the arduinos. Now comes the part where we will have to send data between the two arduinos. The nRF24L01 uses SPI connection to connect to the arduino. The wiring is shown below:
VCC is connected to a 3.3V source. SCK, MOSI, MISO are connected to 13, 11, 12, respectively. the two remaining pins are CSN and CE and they can be connected to any user-specified digital pin. They will have to be assigned in the code later.
After connecting the modules on both arduinos, it's time to write the code for each one. One will be the TX (transmitter) code and the other will be the RX (received) code.
First, RF24 library was installed to Arduino IDE. Then I took the code from https://www.elec-cafe.com/arduino-wireless-temperature-lcd-display-nrf24l01-dht11/ and changed it to fit my project.
Transmitter code:
Receiver code:
Here is a video showing the final result of the assignment:
Lessons learned
There were some hiccups along the way while trying to figure out how to do this assignment. I had to look at multiple examples in order to learn how to use the library properly. Also, I still need to learn how to send mupltiple digits to use, for example, as passkey. The assignment currently sends 1 character at a time. I will try to connect a servo and control it via nRF24 just to keep improving the assignments i've been working on.