Eytan Mann

HOW TO MAKE (ALMOST) ANYTHING_MAS.863/4.140

Week 12 - Networking & Communications


NRF24L01 Module
For my final project, I need wireless communication between 2 boards. I decided to go with NRF24L01 with the RF24 Arduino Library. There are other ways to talk to the NRF24L01 that you will find here http://playground.arduino.cc/InterfacingWithHardware/Nrf24L01 Here is how to wire the NRF24L01 to your FabDuino, in my case I made my own with ATmega328p, which is the same as the Arduino UNO https://github.com/TMRh20/RF24
Project 02a

In the Arduino IDE
Running the example Code: libraries/RF24-master/examples/GettingStarted_CallResponse/GettingStarted_CallResponse.ino
or Arduino file menu: File > Example > RF24-master …
Once I upload the sketch I get the following serial data on both of my Arduinos. You need a pair of Arduino with NRF24L01 to test this, but you should get the message below with just one.
Note: Serial. bud rate is 57600

Project 02a

Project 02a

Transmitting joystick potentiometer




Modeling nRF24 communications with two Arduinos::

DATA STRUCTURE IN CODE:
/**
Create a data structure for transmitting and receiving data
This allows many variables to be easily sent and received in a single transmission
See http://www.cplusplus.com/doc/tutorial/structures/
*/
struct dataStruct {
unsigned long _micros; // to save response times
int button_r;
int button_l; //
int button_up;
int button_f;
} myData;