Gyro GA250 + alternative Firmware: The Best of the Cheap!?
The title is provocative, I know, but you are welcome to prove or disprove it!
I think I don't have to tell much about the Assan GA250 MEMS gyro, sold at Hobbyking for 9.99$, and which is discussed in any detail here The New Cheapest MEMS Gyro. According to the reports, it initially suffered from some serious firmware bugs, but seems to have become reasonable with the latest firmware update few months ago.
Hardware-wise, however, the GA250 is well designed and in fact a little gem for anyone interested in DIY microcontroller projects, as it is based on the Atmel Atmgea8 microcontroller and - particularly pleasing - provides easy access to all the pins which you need to reprogram it with a new firmware. All details, including the electronic scheme, you can find here http://www.olliw.eu/2011/gyro-ga250/.
As it happens I am one of those interested in DIY microcontroller projects and am a heli flyer, so I started using it for my own purposes, and the first project was the GA250 gyromixer project intended for coax helicopters. However, in view of the limitations of the original GA250 firmware developing an alternative firmware is obviously an attractive goal. Cruzado started such a firmware project, see e.g. A Free firmware project for the GA250 Gyro. I myself went into this a bit later, and my first firmware releases (versions v0.10 to v0.15) I presented in cruzado's thread. However, with the latest firmware release, v0.16, the project has become so different from cruzado's work in essentially all aspects, that I decided to start now a separate thread on it.
A major problem with any heading hold gyro is to achieve simultaneously a strong heading hold capability and crisp pirouette stops without backbounce. I believe that the latest firmware v0.16 does an excellent job here, and in fact a much better job than the commercial competitors in this price segment, and even somewhat higher priced gyros (one should of course not compare to gyros such as the Spartan Quark!)(although a comparison would be interesting). For instance, I threw out the GP780 in my TRex 450 Sport and replaced it by the GA250 with alternative firmware, and like it much better.
The basic of a gyro is a controller. It is not exactly a PID controller as you find it in "textbooks", but it is based on a PID controller. The stronger heading hold with my firmware, which I am convinced you will feel in e.g. pitch pumps, comes from the tuning recipe I suggest, which IMHO leads to a significantly larger I term than you would find in commercial gyros. The pirouette performance is the tricky part, and in the earlier firmwares I followed, so to say, the "standard" approach to deal with the intrinsic backbouncing of a "naked" heading hold controller. For details see e.g. The Heli Gyro as a Controller: Theory and Experiment. This controller structure provides IMHO a good performance, the pirostops however could clearly be better. Since the beginning I elaborated on this point, i.e., on what one could/should do here, and went through many literature, considerations, simulations, and experiments touching all the buzzwords like feedforward, gain scheduling, set point weighting, 2DOF, fuzzy PID, predictive control, model based control, blabla blabla blabla blabla blabla, but though all these "solutions" of course allow to improve things, and if only because they provide additional tuning parameters, none of them IMHO really address the actual reason for the pirostop/backbounce issue. The set point weighting did very well though - in simulations, its simulated performance was stunning. In real live, however, with a real helicopter, I didn't liked the performance at all. Continuously elaborating on this topic, it only happened two weeks ago that a thought stroke me, and it was immediately clear to me that this should be the way to go, as it is so logical. Moreover it is surprisingly simple to implement. Unfortunately, the simulations didn't yielded as good behavior as e.g. the set point weighting, and I was a bit disappointed first. However, with the real helicopter I simply liked the result very much. And this has now become version v0.16 of the firmware, which introduces a parameter Debounce (for both CCW and CW piros).
You see, I must admit that, I am a bit "proud" about this development and have a lot of faith into it. Hence the title. The GA250 with the alternative firmware is IMHO the best gyro among the "cheap" gyros.
Of course, as it stands, all this is a claim, and at the moment it is based on the perception of essentially only one guy (me :D), and you rightly may doubt it (there are some few further users though). However, as I said in the beginning: You are welcome to prove or disprove the claims!
Besides the performance aspect, the alternative firmware offers also loads of other options rarely found in commercial gyros. It can be updated through a link to the computer and its parameters can be programmed via a PC Windows GUI or "in-field" via a programming box. It also offers some "special" parameters which allow for a torque compensation from varying pitch (Revo, DMA), which may be useful also for applications in FP helis, and a setting to make it more suitable for fixed wing applications (these latter options I have however not tested in practice!).
There are, of course, also some limitations. Except of the gain which can be adjusted via the transmitter as you are used to it, all the other parameters can only be adjusted via the Windows GUI or the programming box (one of those is hence mandatory). Also, you can't achieve as high piro rates as you could with e.g. a Spartan Quark. This is a limitation of the hardware as it is. But don't worry, the maximum piro rate is about 1.5 turns per sec (or maybe if one stretches it slightly faster), which should be way enough for almost anyone except of hard 3D flyers. Then, the firmware is supposed to work for any reciever, but had been used so far by only few individuals (as much as I know). Hence, I cannot claim or even guarantee that it will work for any (but if not I will work hard to resolve the issue). I know it works for Spektrum and Turnigy 9X/FlySky 9x. Finally, I can't fly 3D, so I can't know how the gyro behaves in such situations.
If you are not afraid of German, or reading a google English translation, you may follow the project also here: http://www.olliw.eu/2011/ga250-gyro-firmware/. This page will always be the most updated one.
In the following few posts I will provide some further info.
The project consists of three hardware items and three pieces of software/firmware.
- GA250 gyro
- USB adapter (optional, but highly recommended)
- programming box (optional)
- Firmware for the GA250 gyro
- Windows GUI AvrConfig (requires USB adapter)
- Windows flash tool AVRootloader (requires USB adapter)
What the GA250 and Ga250 firmware is for is hopefully clear (:D). The USB adapter allows one to connect the gyro to a Windows computer. With such a link established the gyro parameters can then be adjusted using the configuration tool AvrConfig. Also, the firmware can be updated using the flash tool AVRootloader written by Hagen Re. Alternatively the programming box can be connected to the gyro, which allows to set the gyro's parameters "in-field", independently of a computer. In principle only either the USB adapter or the programming box is needed for operation. However, I strongly recommend to have the USB adapter in any case, since only with it a firmware update is possible.
In order to set up everything you need however some more hardware and software/firmware:
- solder iron + some spare cables
- ISP AVR programmer
- ISP AVR programmer software for operating the ISP AVR programmer
- Bootloader for the GA250 gyro
For building the USB adapter and/or the programming box you of course also need the respective hardware and software to do that. Since there are, however, many many different possibilities for building them, and anyone may find her/his "best" procedure I can't give a final list here. I will though describe two solutions below, which are based on the Arduino JY-MCU USB Adapter and the Robbe Programming Box No 8642 and which in some sense you can consider my recommendation, but you are of course free to do what you want.
- GA250 gyro: $9.99 at HK + shipping
- USB adapter: ca. $13 incl. shipping and all materials
- programming box: ca. $25, but the Robbe Box seems to be difficult to get in the US
- ISP AVR programmer: <$5 incl. shipping
Please remember, the programming box is optional. Also, each the USB adapter and ISP AVR programmer is needed only once since they can be used for any GA250. In the figures below are shown the GA250, a USB adapter, a programming box, the AvrConfig, and the AVRootloader. All software/firmware except that for the ISP programmer can be downloaded as a zip file via the link provided here.
USB adapter (based on Arduino JY-MCU USB adapter):
Windows GUI AvrConfig:
Programmig box (based on Robbe Programmer Box No. 8642):
What you need
For modding the GA250 you need:
1 x Assan GA250 gyro (HK Produkt ID: GA-250)
1 x ISP AVR programmer (e.g. HK USBasp AVR Programming Device)
1 x six cables to connect the GA250 to the ISP AVR programmer (thin and flexible cables!)
1 x solder iron, solder
- software for operating the ISP AVR programmer
- flash tool AVRootloader (you find it in the firmware zip, or download here)
- bootloader for the GA250 (it is the file BL_4GA250CpGyro_BlackServoPlug.hex you find in the firmware zip)
- firmware for the GA250 (it is the file Ga250_Cp_Gyro_Firmware_v016.hex you find in the firmware zip)
Any ISP AVR programmer does the job. If you don't yet own an ISP AVR programmer, you may consider buying the USBasp programmer (originally by fischl). I don't use it myself but it is recommended by everyone, and it is very cheaply available. You can buy it at HK for $4.95 + shipping (Produkt ID: 9171000003) or via ebay for less than $4 incl. shipping. Since it is that widely used you can find tons of information on how to use it on the web. You need a software to operate it. You may consider avrdude (the latest version 5.11 can be downloaded here) if you don't mind or even prefer to work textbased in a command shell. You also can use the Windows GUI program AvrBurnTool which I specifically wrote to make the flashing of the GA250 as simple as possible.
For building the USB adapter you need:
1 x USB FTDI Adapter (e.g. HK FTDI Adapter USB Controller)
1 x 100 Ohm resistor
1 x 1N4148 diode
1 x servo extension cord
1x some additonal cables as liked
shrinking tubes as liked
- FT_PROG.exe and driver FTD2XX_NET.dll (you find both in the firmware zip, or download here)
As said before, there are 1000 ways to build an appropriate USB adapter. Some solutions are extremly cheap, but unfortunately do not work without tweaking on any computer platform. The cheapest solution I know which so far has worked reliably on anybody's system, and which I hence recommend, uses USB TTL serial adapters with FT232RL chip ("FT232RL" is the important key word to look for). It is now available at HK, FTDI Adapter USB Controller Produkt ID: 009000003, and at a cost of $6.37+shipping it is also the cheapest I know; I can recommend it (it doesn't come with cables though). The second cheapest I know is the Arduino JY-MCU USB adapter, which I also can recommend. You can buy it from dealextreme (JY-MCU USB Serial Port Adapter) for $9.10 incl. shipping or from eaby for similar costs (be careful though that it really is this unit!).
The servo extension cord as well as shrinking tubes you may get from HK. The 100 Ohm resistor and the 1N4148 diode are very standard devices and you should get them for few cents at local electronic shops.
For building the programming box you need:
1 x Robbe programming box No. 8642
1 x servo extension cord with female-female plugs
1 x ISP AVR programmer
1 x six cables to connect the GA250 to the ISP AVR programmer
1 x solder iron, solder
- software for operating the ISP AVR programmer
- flash tool AVRootloader (you find it in the firmware zip, or download here)
- bootloader for the Robbe box (it is the file BL_4RobbeProgger_m88pa.hex you find in the firmware zip)
- firmware for the Robbe box (it is the file Robbe_ProgBox_v014b_m88pa.hex you find in the firmware zip)
The ISP AVR programmer is the same you have used for modding the GA250. Suitable servo extension cords you may find at HK.
As for the USB adapter, there are also many ways to build the programming box. I use the Robbe box because it just needs to be reprogrammed and otherwise comes ready to use, and it is not that expensive and really very handy. However, sadly enough, it seems not to be available in the US. Alternatively one can build the programming box using few through pin devices on a card board at a cost of <$10, but this is maybe not for everyone.
How to build it
The modding of the GA250 goes in three steps:
1) open the case, solder six cables to the ISP pins at the GA250 board and connect these to your ISP AVR programmer
2) burn the bootloader into the GA250 using the ISP AVR programmer software
3) connect the GA250 to the computer using the USB adapter and flash the firmware into the GA250 using the flash tool AVRootloader
Step (1) needs some basic soldering work. Anyone who has ever used a solder iron should be capable of accomplishing this step. The pads one has to solder to are somewhat smaller than usual; please be careful not to rip them off the board. Use thin and flexible wire, and don't overheat the pads!
Fortunately enough, rcgroups member HolgiB has written an excellent manual on how to do all these steps: Idiot's Guide to Olliw's GA250 Firmware [pdf]
Also, rcgroups member scottyvisco has given some excellent info, including a video, on the usasge of the USBasp programmer with the eXtreme Burner GUI in cruzado's thread. The steps are identical to those needed here, except of course of different values for the fuses and a different hex file. Good entry points are: post #115, post #120, post #132, post #174, post #183
The fuses have to be set as:
low fuse: 0xBF (ChkOpt = 1, SUT1:0 = 11, CKSEL3:0 = 1111, BODEN = 0, BODLEVEL = 1)
high fuse: 0xDC (BOOTSZ1:0 = 10, BOOTRST = 0)
The hex file with the bootloader is named:
The hex file with the firmware is named:
How to use it
as regards the usage of such things one can never write to much, which is hower too much to be done at once. I hence will fill in this post as the discussion proceeds.
I have written a manual for the firmware in version v0.16, which also describes a bit the meaning of the paramters and suggest a tuning procedure. Download it from the project web page http://www.olliw.eu/2011/ga250-gyro-firmware/#firmware.
And now, have fun :)
It's great that people make the effort to do this, and I look forward to seeing how well you can get the GA-250 working. :popcorn:
I guess your current firmware doesn't consume all 8k; so if you would install the bootloader factoryside (if I remember correctly Hagen Re. has allowed commercial usage) you would make it easy for anyone to use this and similar work, which might be much appreciated by many. It wouldn't cost you anything but would possibly attract more customers to your product.
PS: I think that nothing alike what the debounce parameter does has been used/implemented in any of your products. So, interested in a little game? What does your chief engineer think it does? Few keywords which allow me to infer his guess would be sufficient as answer :)
Nice write up Olli! It is nice to see this get it's own thread now. I will get together a list of software and hardware I used to flash the bootloader and parts list for the USB/serial adapter I am using. Afterwards I just use the AvrConfig and AVRootloader your provide to flash the firmware and change the settings.
For now I just updated to v0.16 and solved the only 1 problem I had that bothered me. That was a single bounce back on clockwise piros. I started with my settings I had in v0.14 and adjusted the de/accel back to 30 (default) and started adjusting the CW Debounce. I had to bring it from 30 down to 5 to get a nice crisp stop. Both my HK 450 GT and my HK 450 TT Pro will hold the tail in aggressive pitch pumps, full pitch climbs, and piro stops in both directions have crisp sudden stops. These are done with a strong motor and ESC that doesn't bog and I limit my piro speed to 60%. Good job on this update Olli!
The only thing I notice now, which is barely noticeable, is while hover very still I can see the tail doing extremely small wags. I may just have to play with the PID I and gain to iron that out. I have PID I set at 7 and gain set at 50 (-100 -> 100 scale). I have very little play in both of my tails. Like I said though, you can't see it unless you are hovering very still, like in the garage, and look closely.
Again thanks for all the hard work. I will be picking up a few more GA250's just to have.
THANKS for trying and reporting back. I really appreciate your contributions very much. I am glad the v016 improved things for you.
One point bothers me a bit. Debounce = 5 appears quite low. On both my 450er I have around 10. Is there any reason to assume, from your configuration, that the tail response (servo speed, rpm, small tail blades, etc) is somewhat slower than usual? Otherwise I could imagine that maybe your PID I is too small. It is important that with Debounce = 30 (=off) PID I is tuned such that you get a most short and aggresive backbounce at a stop. It doesn't matter if it has a "huge" amplitude, it is most important that it is as short as possible (without getting multiple backbounces). As an example, with my 450 the backbounce is easily as large as 30°!
Just a consideration. If you are satisfyed with how it is, then the setting is probably right. It's most important that the flying is fun, isn't it :D
As regards your small wags in hover I suggest to tune down gain a bit. Lower it in 0.5% steps (don't forget to flip the gain switch at your Tx to rate and back to HH everytime you change gain). If this doesn't help then I wouldn't know what to do from top of my head. You did't had this wag before? I ask because my changes to the controller should not have affected the behavior in hover.
BTW: are your flying skills sufficient to fly backwards (not inverted, with the tail head on)? I know from reading that this requires a good gyro, and this makes sense to me. So, it would be an interesting test, but unfortunately I can't do that.
Have fun, Olli
I will keep tweaking. I did try to lower my gain but I didn't realize I had to switch between rate and back for it to take effect. I will try these out and report back soon.
I also found out something. The stops are perfect, I mean perfect with 100% rudder now. With 60% rudder I have a really really small bounce back but only cw. Ccw stops at 60% are just a perfect. So I lowered the debounce to 5 for cw and my 60% stops are now perfect but the 100% stops will bounce before it stops. I decided to leave my debounce set for 10 for now. Thoughts?
Also my flying still level is about par with yours, or maybe even less. I did fly a few times backwards going as fast as I can handle coming back to me then stopping. The tail fly just as good backwards as forwards for me. I don't know anyone around here that has any better skill level to try it out for you.
I will charge up the batteries and start the 450 Pro from scratch again tomorrow. The params should be close to the 450 GT. They have the same motor, ESC and tail servo. The 450 Pro just has 1 extra tooth on the pinion and runs 200 RPM faster.
Thanks again Olli,
P.S. To clarify, by % of rudder I mean the limit I set on the rudder in the controller. This limits how fast my piros are.
wau, a lot good info, Rob!
Since it's kind of anoying to always think about whether one has to do it or not, I just recommend to ALWAYS flip the gain switch back and forth after a gain change. This way one is always on the safe side. I got very quickly used to this practice, and I assume so it will be with others. :D
Interesting tests you do. Never considered that before.
|All times are GMT -5. The time now is 04:08 PM.|