Wireless Radio

To facilitate wireless communication between the base station and hover station, two nRF24L01 radios were utilized.  Configuring these radios was highly time consuming due to a number of issues with the software environment and driver.  Both radios were wired to the Uno and Mega according to the following chart:

Radio Pins Uno Pins Mega Pins
CE 8 8
CSN 9 9
SCK 13 52
MISO 12 50
MOSI 11 51
IRQ 2 2

These pins are set in the pins_arduino.h file associated with each board, and therefore, must be must be wired exactly as according to this chart.  In the Arduino core code, the correct pins_arduino.h file for the board being used must be present.  The VCC pin may be connected to another digital out pin on either Arduino bored, which is useful to reset the radio by turning it on and off at the beginning of the program.  GND may also be connected to a ground pin on the Arduino board.

Base Station with wireless radio

The driver used to control the wireless radio is available from Neil MacMillan’s Lab Guide.  The driver allows one station (the sender) to send a string of 23 characters or less to a receive station (the receiver).  The receiver then sends an acknowledgement packet back to the sender.  An explanation of the driver can alo be found on the Lab Guide.

Although the driver can be modified to send data other than a string, the ball hovering apparatus only required a single character to be sent from the base to the hover station to make communication simple.  Since the sole job of the base station was to take input from the Logitech game pad to control the height of the ball, the number of the button pressed was sent as a character to the hover station.  The hover station then increased or decreased the height of the ball based on the button number received.

Problems With The Wireless Radio Driver

Configuring the wireless radio was very time consuming due to a couple unusual problems.  After initial setup, the base station was able to send a string of data to the receive station, but the packet was corrupted from 2 bytes of data shifted right.  This was due to a compiler optimization setting which did not use short enums, which were used in the packet struct to keep data at a maximum of 32 bytes.  To fix this, the “pack structs” and “Short enums” options must be set in the Eclipse project settings under Optimization for the AVR compiler and AVR C++ compiler.

The second problem encountered was due to the Arduino core libraries used in the project.  Initially the project code imported the Arduino core libraries directly from the Arduino IDE.  Using these libraries, the receive station could not send an acknowledgement packet back to the sender because of a problem with the packet struct.  Switching to the highly optimized libArduinoUnoCore and libArduionMegaCore libraries available from Neil MacMillan solved this problem.  Other groups experienced similar issues also resolved by switching to these core libraries.

5 thoughts on “Wireless Radio

    • This actually isn’t a controller; it’s a wireless radio that can transfer digital data which I hacked to control the copter eventually. Technically, there are no channels in the way you are thinking, only different addresses. I would not recommend it to control a quad copter in general, but it was what we had to work with.

    • According to the data sheet:
      Software selectable channel from 2400MHz to 2525MHz (125 Selectable channels).

  1. Hey there, I think your blog might be having browser compatibility issues.

    When I look at your blog site in Safari, it looks fine but when opening in Internet Explorer, it has some
    overlapping. I just wanted to give you a quick heads up!
    Other then that, awesome blog!

Comments are closed.