Are you looking to make your own quadcopter drone or RC car with Arduino but don't know where to start? Perhaps you already bought some 433MHz RF modules only to find out they weren't as simple to use as you thought? Try this out!
You'll learn to wire a simple proportional control transmitter and receiver with button trimmers and send the signal over a UDP-like setup. The code can handle as many channels as you'd like to use (in practice you'll probably use 4 channels for THROTTLE, YAW, PITCH, and RUDDER) but in this example I'll demonstrate a 1 channel setup and display the data on the Serial Window to give you the basic idea of how it works. This is intended as a learning tool to get you started into the world of wireless transmission.
What you need can be found on eBay (links below):
- 2 x Arduino UNO + USB cables
- 2 x computers available to plug your transmitter and receiver Arduinos
- 2 x mini prototyping breadboards
- 1 x 10K potentiometer (per channel)
- 2 x push-buttons (per channel)
- 3 x 1k resistors (per channel)
- 1 x 433MHz transmitter + receiver modules (315MHz might work also)
- male-to-male jumper cables
- short breadboard wires
NOTE: You might be able to use other models of Arduino, but you have to check for compatibility with the libraries that we're going to download and use in step 2. Also, you can use less ohmage if you like just be careful not to draw more than 40mA per output pin or sink more than 200mA per ground pin; and to be safe I wouldn't draw more than 200mA from the 5V pin on the Arduinos.
Step 1: Wire Up the Circuit As Shown in the Image:
For your own learning:
- the buttons are connected to pull-down resistors (pulled to ground), this guarantees that their digital readings will be 0V when the buttons aren't pressed instead of floating.
- the potentiometer and the first 1kΩ resistor form a voltage divider. The 1kΩ is necessary to prevent a short from 5V to ground when the potentiometer reaches 0Ω.
***NOTE: all red cables are VCC (+5V) and black cables are GND, check carefully when wiring up your transmitter / receiver modules. Also for the receiver module, both DATA pins give the same signal so pick any.***
Step 2: Download Appropriate Arduino Library
I've written two versions of the transmitter / receiver code:
- one for the current RadioHead library (download library from here: http://www.airspayce.com/mikem/arduino/RadioHead/)
- one for the VirtualWire Library (which has been superceded by RadioHead but you can use if you like: http://www.icstation.com/ebay/IC/All%20data%20modu...)
You can learn more about the libraries and how they work by reading the details in their header (.h) files. Simply put, they contain special functions which handle all the sophisticated firmware, registers, connection setup etc. VirtualWire can only do UDP whereas RadioHead can do UDP and other more reliable types of wireless transmissions. These libraries don't come standard with the Arduino IDE, so you'll need to install them. The instructions are here if you haven't installed new libraries before: https://www.arduino.cc/en/Guide/Libraries.
Step 3: Download Transmitter and Receiver Codes and Upload to Arduino
You only need one pair of transmitter / receiver code, either RadioHead or VirtualWire. Pick whichever you like, feel free to experiment with both. Althougth RadioHead is newer, I seem to be getting slightly better results with VirtualWire, but that can probably be fixed with more testing. Once the codes are opened in the Arduino IDE, make sure to select the appropriate COM port which the UNO is connected to, click upload and then open the Serial Windows to display readings.
Step 4: Experiment
On the left hand window we have the transmitter stats:
- channel ID: a simple character to distinguish it from other channels, 'A' in this case. So if you had throttle, rudder, pitch and yaw each of those would be designated a letter from A to D so the receiver arduino can know which motor or servo to control with a given received signal.
- joystick reading: the raw potentiometer reading, a 10-bit number by default from the arduino ADC
- trimmer: offset based on how many button presses you've made
- overall position: the sum of joystick and trimmer and is between 0 and 1023 (only the ID and position needs to be sent).
On the right hand window we display the data we receive: the channel ID and the position reading for that channel.
Notice how more data gets sent than is received: that's to be expected of a UDP-like connection which is simple to use but somewhat unreliable (i.e. some data is lost in transmission). In a future instructable I hope to show you a more reliable method of transmitting data than UDP but for now this will do.
You can increase the number of channels by simply changing the value POT_NUM in the #define section of the code and adding in new potPin[ ] and buttonPin[ ][ ] values for the extra channels in the setup section; then it takes care of everything else.
Remember this is intended as a learning tool, personally I'm hoping to build on it to make a 4 channel quadcopter shortly. If you make improvements on the code or circuit design I'd love to hear how you went with it and what you made out of it in the comments below. It's fine if you publish your improvements based on this work but please give credit where it is due. If you are looking to 3D print a case for your controller and / or a chassis for your model, here are some 3D printing services:
If you enjoyed this instructable and would like to see more like this, please consider supporting me by purchasing your materials for this project through the affiliate links in the materials section or donating below:
Your support is greatly appreciated! Happy DIY'ing!