New Products Flash Sale
Thread Tools
Old May 04, 2015, 01:51 AM
elewon is offline
Find More Posts by elewon
Registered User
elewon's Avatar
United States, CA, Sacramento
Joined Feb 2013
346 Posts
Discussion
DIY Radio with Mega2560 and OpenTx

So, I recently upgraded my 9XR to OpenTx. Actually, I was quite happy with the stock 9XR except I was running out of 16 model slots. So, I switched to OpenTx just to get 30 models and I'm amazed by the capabilities of the firmware and the companion SW. Haven't even looked at LUA yet!

Since it was first time ever I was trying to upgrade to OpenTx, I had to walk through a whole bunch of information and in that process I came across the DIY radio version of OpenTx with Arduino MEGA2560 board and that's the project I'm working on these days. DIY radio involves fitting the gimbals, switches, pots etc in a home made box. Arduino MEGA2560 board is then flashed with OpenTx and hooked up to the controls to complete the radio. The radio supports PPM/DSM protocols and appropriate add-on RF module can be used for RF link.

However, this is too much work for me. So my idea is to sacrifice the FS T6 radio I have lying around. The T6 is useless for me because I blew up the main board in the process of trying to use a 3S LiPo. I could not find a replacement main board either and had to buy a 9XR. So I already have the Tx box with most of the controls required for radio already in place. I just need a LCD display and additional switches/Pot. Then the plan is to try and fit the Arduino, LCD, and rest of the electronics in the T6 box.

When I started out, I was surprised by lack of building information online. So I thought of starting this thread to record my experience, in case someone else wants to do this too. I will post the pics and other information as I make progress and once I have the radio working, I intend to post a "build guide" to help ease the build for others.

Meanwhile, it'd be interesting to see if anyone has done work in this area. Ideas/suggestions/questions are welcome too!

BTW just in case, here are some of the features of MEGA2560 DIY Radio:
* Open TX Firmware
* Up to 16 Chs
* 4 gimbals
* 3 Pots (All three can be converted to 3 position switches)
* DR switches for THR/RUD/ELE/AIL channels
* Thr cut and Trainer switch
* A 3 Position switch
* Upto 2 Rotary encoders (1 can be used for menu navigation)
* 6 Menu navigation keys - Menu/Exit/Left/Righ/Up/Down
* Audio
* SD Card
* Telemetry
* Support for PPM/DSM/DMS2 (I think)

Update: May 19, 2015: Added a mini build guide to post #12 along with pre-compiled .hex for MEGA2560
elewon is offline Find More Posts by elewon
Last edited by elewon; May 19, 2015 at 11:43 PM. Reason: More background info
Reply With Quote
Sign up now
to remove ads between posts
Old May 04, 2015, 05:15 AM
renatoa is online now
Find More Posts by renatoa
Registered User
Romania, Dolj, Craiova
Joined Sep 2007
17,391 Posts
Better get a STM32F205 $24 board and build yourself a Taranis like radio, no idea why people still hang on the '80s technology that is Atmel 8bit 16Mhz...
renatoa is online now Find More Posts by renatoa
Reply With Quote
Old May 04, 2015, 03:34 PM
elewon is offline
Find More Posts by elewon
Registered User
elewon's Avatar
United States, CA, Sacramento
Joined Feb 2013
346 Posts
Thanks! It's amazing that 80's tech is still so relevant, isn't it?
I think main strength of Taranis isn't electronics but the case design and the HW around sticks and controls. As you said electronics is commodity, firmware is almost free.
I'd much rather buy a Taranis than replicating the electronics with the cheap FS T6 case I have.
Also, I already ordered the MEGA 2560 Arduino and LCD. So I'll have to stick with the plan.
elewon is offline Find More Posts by elewon
Last edited by elewon; May 14, 2015 at 02:57 PM.
Reply With Quote
Old May 08, 2015, 03:57 PM
elewon is offline
Find More Posts by elewon
Registered User
elewon's Avatar
United States, CA, Sacramento
Joined Feb 2013
346 Posts
I've been busy but finally things are starting to move.
So, here is my FS T6 with fried main board that's just lying around. I plan to modify it to take the 2560 and the LCD, so I won't have to build a case, hopefully. We'll see how it goes.
The T6 will also be getting more switches and a Pot to match 9XR. Not sure about rotary encoders yet.
Also received my 2560 board and the LCD from amazon. BTW, they took forever to ship it but finally it's here.
Getting exciting
elewon is offline Find More Posts by elewon
Last edited by elewon; May 11, 2015 at 12:24 PM.
Reply With Quote
Old May 09, 2015, 10:09 PM
elewon is offline
Find More Posts by elewon
Registered User
elewon's Avatar
United States, CA, Sacramento
Joined Feb 2013
346 Posts
So just wanted to boot open Tx without any controls hooked up. This itself looks like is a big step! I had to download and compile the source code and then I found that the LCD has 0ohm path between VDD/VSS! Lots of debug/soldering/desoldering. Didn't expect it to be so difficult
elewon is offline Find More Posts by elewon
Reply With Quote
Old May 11, 2015, 12:41 PM
elewon is offline
Find More Posts by elewon
Registered User
elewon's Avatar
United States, CA, Sacramento
Joined Feb 2013
346 Posts
So the LCD has a 0ohm pull down placed to configure the card for SPI interface and if you flip the switch to make it parallel interface, the 0ohm will short out VDD to VSS!!
Decided to get rid of the little piggyback card that holds the headers/switches and directly solder wires to the LCD board itself. Also removed the 0 ohm and hooked up the LCD to the Arduino.
With that was able to power the board, however LCD was still blank like before . More search online revealed that the LCD I'm using is not supported in OpenTx! However, I was able to find the right driver for my LCD online and compile OpenTx. With that I finally have the LCD working and OpenTx booting on my MEGA2560!!
elewon is offline Find More Posts by elewon
Reply With Quote
Old May 12, 2015, 01:27 AM
elewon is offline
Find More Posts by elewon
Registered User
elewon's Avatar
United States, CA, Sacramento
Joined Feb 2013
346 Posts
Alright, more progress on getting the Tx case ready to house the electronics.
Bad news is although the LCD itself is same size as T6, the PCB holding the LCD is way to big to fit in the case. When I ordered the LCD, I had ensured the dimensions match with T6 but didn't think about the PCB dimensions. So I'll have to mount the LCD outside the case rather than inside. Will look bit ugly but no other option for now.
Drilled bunch of holes to fit additional switches and the 3rd pot. Looks like it is taking shape and except for the LCD it should look like a nice Tx.
elewon is offline Find More Posts by elewon
Reply With Quote
Old May 13, 2015, 01:39 PM
elewon is offline
Find More Posts by elewon
Registered User
elewon's Avatar
United States, CA, Sacramento
Joined Feb 2013
346 Posts
More progress. Got the LCD mounted on the front panel. Also mounted all the push button switches on the front and back. Since there is no place for the up/down/left/right menu navigation buttons on the front, I decided to mount them on the back so that they are easily accessibly while holding the Tx. Will have to see how it works out however at least for now it feels more natural.
elewon is offline Find More Posts by elewon
Reply With Quote
Old May 14, 2015, 04:39 AM
_AL_ is offline
Find More Posts by _AL_
Slow builder
Australia, NSW, Hornsby
Joined Jul 2005
1,375 Posts
Watching with interest...

Al
_AL_ is offline Find More Posts by _AL_
Reply With Quote
Old May 14, 2015, 12:05 PM
elewon is offline
Find More Posts by elewon
Registered User
elewon's Avatar
United States, CA, Sacramento
Joined Feb 2013
346 Posts
Thanks! It helps to know someone's interested
elewon is offline Find More Posts by elewon
Reply With Quote
Old May 14, 2015, 01:16 PM
elewon is offline
Find More Posts by elewon
Registered User
elewon's Avatar
United States, CA, Sacramento
Joined Feb 2013
346 Posts
BTW, here is a better picture of the menu navigation keys on the back panel.
Also, notice the cell count! I'm concerned about current draw and don't want the little SMT 7805 regulator to get too hot in the closed space. So going to go with 6 NiMH. Pretty sure even high drop out 7805 will work down to Vin=7V. 6 cell NiMH is roughly 3V less than 8 cells so that's at least 300mW less power to waste and hopefully the regulator will be cooler as well.
2S LiPo was another option too but the battery compartment is designed for AA and I have no LiPo that will fit. Also, for the Tx I prefer NiMH over Lixx and eneloops are good with retaining charge as well.
elewon is offline Find More Posts by elewon
Last edited by elewon; May 14, 2015 at 01:24 PM.
Reply With Quote
Old May 15, 2015, 02:09 PM
elewon is offline
Find More Posts by elewon
Registered User
elewon's Avatar
United States, CA, Sacramento
Joined Feb 2013
346 Posts
Build Guide

Alright, since I already have relevant information in this post, I'm going to use it as the build guide.

First of all I'm just borrowing information from others, especially the OpenTx guys. Here are a few links, more links on OpenTx homepage:
- Open Tx download page:
http://www.open-tx.org/downloads.html

- OpenTx 2560 download page:
http://www.open-tx.org/2015/04/18/M2...documentation/

Now, there are three aspects of this project - hardware, firmware, and software and here the details for each.

Hardware
Most important piece of hardware is the computer that will be hooked up to all the controls on the Tx box - the switches, gimbals, and pots. The computer does all the work like generating PPM pulses, menu, reacting to switches and keys etc. The computer is also connected to the LCD screen to display appropriate information. The computer is the MEGA2560 Arduino board. Second piece of HW is the Tx box itself and all the controls you want to have on the box. I have listed various controls supported in post #1 but it's OK to not have some of those controls if you like. For example, you could have just 1 gimbal or no DR switches or no rotary encoders and so on. Just leave those pins on MEGA open or "no connect". Attached is the schematic OpenTx guys have on the 2560 download page and for my purpose I simplified it by not implementing following:
1. trainer port/simulator support
2. SD card
3. Telemetry
4. Audio

This gives me a Tx that's roughly same capabilities as 9XR (minus trainer port). So once you know what features your Tx will have, you just start hooking things up based on the schematic. BTW, you don't need resistor/capacitor (RC) filter on all switches. You also don't need the amplifier shown for various pots. Also, none of the pull ups are required as I'm pretty sure all the inputs pins have pull ups built in. Finally, if you use 5V tolerant LCD none of the voltage dividers on LCD pins are needed. The back light is a simple LED mostly which can be directly driven by the MEGA through a series resistor. Just for reference, attached is the table that shows my implementation details. Finally, Arduino board can be directly connected to 7-12V supply. On board 5V regulator will ensure smooth operation even though the supply voltage changes. A word of caution: on board regulator is quite small so I'd limit the power dissipation to ~500mW. I use 6 NiMH so max voltage is 8.4V (delta of ~3.5V max) and RF module is directly connected to battery rather than using +5V from Arduino board.

So, here are the hardware components you'll need:
- Arduino MEGA2560 board
- 128x64 LCD
- A homemade/old Tx box that will fit Arduino, LCD, and controls
- Toggle switches, push button keys, Pots
- Hook up wire
- Single Row Straight Pin Headers
- Some resistors etc

Firmware
Firmware is the software that gets flashed in the MEGA2560. It's kind of the program that runs on MEGA2560 computer, so that the Tx box collectively works as a system. For the purpose of this discussion, the firmware is OpenTx. However, theoretically it is possible to flash any appropriate firmware or develop own custom firmware but we'll not go in that discussion.

Once the hardware is all hooked up and ready to be powered on, you'll need to first flash OpenTx before the hardware will start working as Tx. There are two ways to flash the firmware - USB and ICSP. USB method works using just the regular USB port available on MEGA2560 board while ICSP requires an in-circuit programmer like USBASP. I prefer ICSP method because I already have USBASP and I can just use a simple command line to flash the MEGA.

USBASP programmer requires a utility called AVRDUDE that runs on your PC. Here is how you install AVRDUDE: http://www.instructables.com/id/Atme...lling-AVRDUDE/

The next thing is OpenTx binary. This is the file that gets flashed in the MEGA. Currently, the best way to get the binary is to compile it on your PC. Here is the page that describes compilation process for OpenTx for Windows.
https://github.com/opentx/opentx/wik...d-Instructions

Here are the instructions for Linux:
https://github.com/opentx/opentx/wik...d-Instructions

There are a number of options that can be passed on to make. Here are the options I use:
OpentxSrc\opentx-next\radio\src> make FAI=CHOICE HELI=YES NAVIGATION=ROTENC AUTOSWITCH=YES AUTOSOURCE=YES PWM_BACKLIGHT= NO DEFAULT_MODE=2 GVARS=YES MIXERS_MONITOR=YES PCB=MEGA2560

Just in case, I have also attached the binary that I flashed on my system. To summarize, here are the things needed for firmware:
- USBASP programmer
- WinAVR/AVRDUDE
- OpenTx source code
- Setup to compile OpenTx

Software
Finally, the software part. Software is the one that runs on your PC. Although, software is not required for the Tx box to work, it's a nice way to be able to change parameters on your Tx box like models, radio settings etc using your PC. This is done using the Companion9x software. Currently, companion does not support MEGA2560 although version 2.1 onwards we should have the support. So not much write here but will update this post once I have more information.
elewon is offline Find More Posts by elewon
Last edited by elewon; May 20, 2015 at 02:36 PM.
Reply With Quote
Old May 16, 2015, 05:27 PM
elewon is offline
Find More Posts by elewon
Registered User
elewon's Avatar
United States, CA, Sacramento
Joined Feb 2013
346 Posts
All Done!

Great news folks! All done with the wiring! It was more work than I expected but didn't take much longer once I figured out the problem I was facing.
The problems was the male pins on cable I bought were too tall for the front and back cover to fit together. So had to come up with ways to shorten them. Finally, I ended up not using the cable at all and had to use the stranded hook up wire. But the good news is all the electronics fits in the case, although bit messy. However, everything is soldered and insulated with heat shrink so hopefully it will last a long time. Attached is a picture of the internal wiring.
I also made a cable to bring the ICSP header out so it could be housed in the battery compartment. That way I don't have to take the case apart every time I want to update the FW or EEPROM. So going with 6AAs helps here too
Attached are couple (more like 5!) screen shots I took. Need to spend more time with the Tx and I'll upload more pictures and my experience with it. So far very happy with the way it's turned out. Love the inverted color scheme on LCD!
elewon is offline Find More Posts by elewon
Reply With Quote
Old May 17, 2015, 06:22 AM
_AL_ is offline
Find More Posts by _AL_
Slow builder
Australia, NSW, Hornsby
Joined Jul 2005
1,375 Posts
Looking good.

Al
_AL_ is offline Find More Posts by _AL_
Reply With Quote
Old May 17, 2015, 05:53 PM
Gerhard34 is online now
Find More Posts by Gerhard34
Registered User
Austria, NÍ, Deutsch-Wagram
Joined Dec 2013
14 Posts
Quote:
Originally Posted by elewon View Post
Thanks! It helps to know someone's interested
I just came across this post - very interesting as I'm converting my Futaba FX-18 right now

cheers
Gerhard
Gerhard34 is online now Find More Posts by Gerhard34
Reply With Quote


Thread Tools

Similar Threads
Category Thread Thread Starter Forum Replies Last Post
Discussion FrSky - We need a Taranis for Surface Radios with OpenTx! Thorvald Radios 6 Jan 26, 2015 05:48 PM
Data OwnTX / OpenTX - Displays, MCU boards etc. that work with OpenTX and similar firmware xnalpf Radios 5 Oct 09, 2013 01:33 PM
Wanted 9x Tx with Er9x/Open9x or OpenTx DrewV Aircraft - General - Radio Equipment (FS/W) 0 Aug 29, 2013 09:21 PM
Sold Turnigy 9X with LED(LCD), and OpenTX illconn Aircraft - General - Radio Equipment (FS/W) 1 Aug 17, 2013 10:52 PM
Sold Turnigy 9X(LED, OpenTx) with DragonLink V2 illconn Aircraft - General - Radio Equipment (FS/W) 0 Aug 12, 2013 04:48 PM