So after receiving my communicators last week, I finally got the shipment of the Arduino Uno, and yeah I know that it is in fact a cheaper Chinese clone of the Uno, the schematic and on board chip are the same, so I think its fine to test with this board for now. The NRF24L01 is a nifty little radio communicator but I have had next to zero experience with radio communcation so I thought it would be wise to learn about the communication a bit before trying to hack away at the quad-copter remote control protocol.
How the NFR24L01 works:
As explained last week, the NRF24L01+ module works over the SPI interface to communicate with a controller. The eight pins connect to the corresponding pins on the controller board (i.e. the SCK pin connects to the SCK pin on the controller board), the exceptions being the Chip Enable (CE) and Chip Select (CS) pin which are user configurable. The VCC for the module is rated at 3.3V and this is important to remember because the module will not be able to handle a 5V supply at all and might blow. It does tolerate 5V inputs though. After reading the datasheet for a while, it was easy enough to understand the SPI timing and the instruction sets. In a nutshell, the chip select (CS) pin is held high until the module is requested to either send or receive data. When sending data, the chip select (CS) pin is held low and the data being sent is clocked in on the rising edge of the clock frequency. Once data interchange is done, the chip select (CS) pin is pulled high once again and the module goes into idle mode. There are 6 data pipes available on the module and a maximum payload length of 32 bytes.
Getting the modules to work on my Arduino Boards
Using two different models of Arduino boards meant that I had to refer to the schematic of each board quite alot of figure out the SPI connections. On the Uno, it was fairly simple as the SPI pins are specific Digital pins (namely 11, 12, 13 for MOSI, MISO, SCK). On the Leonardo however, these pins are exclusively on the ICSP.
After appropriate connections were made, I tried using some arduino libraries online to get myself going on the communication part. I tried out the “Mirf” library, but for one reason or another, the modules didn’t seem to work on the sketch. I moved onto a different library dedicated for the module called “RF24+” by maniacbug on github. After a bit of tinkering with the source code, I was able to get the modules to work. As an example, I wrote a short Arduino sketch to send the characters ‘T’ ‘E’ ‘S’ ‘T’ to one another and the displayed over the serial monitor. Once the code started working, I conducted a simple experiment to see how far the range of communication was and impressively, the module itself could efficiently communicate with eachother from my bedroom to my kitchen (about 20 ft. through obstacles).
Trying to hack the Quad-copter communication
Some time ago, I ran into this hack on toy quad copters by Dzl (http://dzlsevilgeniuslair.blogspot.dk/) where he was able to hack into the communication protocol of the Remote Control handset and hijack the communication using an Arduino. He went on to publish an Arduino library with his results and this was exciting as it seemed like the perfect thing for my project. I tried loading the library into the Arduino and followed the instruction from the blog, but unfortunately, the quad-copter refused to bind. Of course, I’m not even sure if I am transmitting properly with the module, so I need to spend more time understanding the library and trying to work it with the module I have. I would try my best to exhaust all options trying to work the quad copter with the NRF24L01 module before ripping out the communication module inside the remote control. I’ll spend some time in the coming week trying to figure out how to communicate with the quad copter with the library provided in the blog as it would greatly reduce a lot of work on my end.