Once I ran out of jumper cables, I've made a slot to hold the nRF module that sits directly onto Arduino UNO digital pins.
I've change the CSN pin from pin7 to pin9 and swap the LCD pin9 to pin7. This is reflected in my latest codes below.
// Set up nRF24L01 radio on SPI pin for CE, CSN ( *** older codes uses Pin 7 instead )
RF24 radio(8,9);
LiquidCrystal lcd(10, 7, 3, 4, 5, 6);
// Make way for the SPI pins
// 10 -> LCD 4
// 7 -> LCD 6
// 3 -> LCD 11
// 4 -> LCD 12
// 5 -> LCD 13
// 6 -> LCD 14
Arduino with nRF slot directly to digital pins |
I've re-wrote both the program on the Raspberry Pi and Arduino to make it more practical use. I've made the Raspberry Pi as the central hub to receive sensor data from Arduino nodes and returned back the same data to the sender for calculating the round-trip time (rtt).
You can download the updated codes at the summary links below.
I'm using all the pipes for each of the nodes, so if you want to use this codes, uncomment the pipes for different nodes to send payload to the Raspberry Pi using different node address.
// Radio pipe addresses for the 2 nodes to communicate. Uncomment for the active node
const uint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL };
// const uint64_t pipes[2] = { 0xF0F0F0F0E2LL, 0xF0F0F0F0D2LL };
// const uint64_t pipes[2] = { 0xF0F0F0F0E3LL, 0xF0F0F0F0D2LL };
// const uint64_t pipes[2] = { 0xF0F0F0F0F1LL, 0xF0F0F0F0D2LL };
// const uint64_t pipes[2] = { 0xF0F0F0F0F2LL, 0xF0F0F0F0D2LL };
// Pipe0 is F0F0F0F0D2 ( same as reading pipe )
*** You can either connect a small buzzer or LED to pin2 for audio/visual acknowledgement the payload once it is returned and matched the outBuffer payload sent to the RPi.
Summary Links :-
- RF24 libs/codes on github:- https://github.com/stanleyseow/RF24 ( all Arduino & Raspberry Pi codes are on github )
No comments:
Post a Comment