built-in USBasp 5V

General mods that are considered worth doing; regardless of the end firmware you use.
Post Reply
User avatar
Radian
Posts: 19
Joined: Fri Oct 17, 2014 1:58 pm
Country: United Kingdom
Location: Dorset

built-in USBasp 5V

Post by Radian » Wed Nov 05, 2014 10:51 pm

I hard-wired a USBasp programmer into my TGY 9X and fitted a USB socket inside the case. As usual, the 5V USB power line is connected to 5V on the R/C mainboard. With the main (battery) switch off and USB plugged in the micro obviously runs and (most) things operate as normal. Not quite though as the AD conversions seem to fall short causing poor stick/pot positions.

It's pretty close to being an handy battery elimination scheme though (well, it suits my needs perfectly with a laptop nearby) so I'm thinking of putting a boost (5V->9V) regulator on the USB power input and connecting it to the switched side via a blocking diode. This way I figure the on-board regulator will have enough headroom to regulate 5V as well as it would using the battery. Keeping the boost voltage low should reduce the input power to a sensible value and prevent any issues if the battery is switched in (I would tend to leave the main switch off anyway). Does this sound sensible?

I recently had problems that went away after re-flashing the same firmware back in and using USB as 5V supply leaves a fair bit to be desired. Even using the beefiest USB lead I have, by the time it reaches the micro it's down to around 4.7V with a few hundred mV noise according to my scope.

One thing I'm not so sure of is what happens if I don't connect USB 5V through to the micro? When the USB isn't connected but the R/C is battery operated all the programming signals have a "dead" (unowered) USPasp hanging on them. I'm pretty sure this will cause trouble e.g. with the reset. So does everyone always put up with the USBasp being powered all the time the battery is used to power the R/C?

User avatar
jhsa
Posts: 18129
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: built-in USBasp 5V

Post by jhsa » Thu Nov 06, 2014 4:22 am

Some people had trouble when installing the programmer permanently inside the radio..
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW

User avatar
Kilrah
Posts: 9666
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: built-in USBasp 5V

Post by Kilrah » Thu Nov 06, 2014 5:57 am

I connected the USBASP power to the radio's 5V, so whenever the radio is on the USBASP is powered, no floating lines.
Then didn't connect USB power to avoid conflicts, and flash the radio with power on obviously.

But yes make sure to check reliability, some crappy USBASPs with missing caps can create a lot of power supply noise and cause reboots of the radio when connected. I had that problem, jsut added the missing caps and was fine since.

User avatar
Radian
Posts: 19
Joined: Fri Oct 17, 2014 1:58 pm
Country: United Kingdom
Location: Dorset

Re: built-in USBasp 5V

Post by Radian » Fri Nov 07, 2014 11:48 am

Obviously the stock voltage supply can be greatly improved on. For one thing the 7805 linear regulator is a huge waste of power with a 12V battery input. Using a switch-mode regulator at around 80~90% efficiency, the battery current drain can be halved. So given that I also want to be able to boost if only supplied from USB as well as buck when the battery is used I'm building a SEPIC convertor that can happily do both. The whole circuit replaces the stock 7805 three terminal regulator and the design looks like this at the moment:

Image

User avatar
Bill
Posts: 195
Joined: Thu Jul 04, 2013 5:54 pm
Country: -

Re: built-in USBasp 5V

Post by Bill » Fri Nov 07, 2014 12:55 pm

One like this is a simple drop in saves a lot of space:
http://uk.rs-online.com/web/p/switching ... s/6664379/
“A good politician is quite as unthinkable as an honest banker”
They used to say "if you don’t want to work at McDonald’s, go to college." Now they say "if you want to work at McDonald’s, go to college.”


User avatar
Radian
Posts: 19
Joined: Fri Oct 17, 2014 1:58 pm
Country: United Kingdom
Location: Dorset

Re: built-in USBasp 5V

Post by Radian » Fri Nov 07, 2014 1:03 pm

Bill wrote:One like this is a simple drop in saves a lot of space:
http://uk.rs-online.com/web/p/switching ... s/6664379/
Hi Bill, yes those are handy - but I'm building a regulator that will both boost sagging USB voltages and buck higher battery voltages. So sometimes the regulator has to put out more volts than are coming in, sometimes less. The design above does this.

I found that with USB only powering the board it was only around 4.7V by the time it got there and the sticks/pots were giving bad readings. I want to be able to run the 9X properly from USB and/or efficiently from battery and this circuit rolls all these requirements into one so I think the effort is worth it.

User avatar
jhsa
Posts: 18129
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: built-in USBasp 5V

Post by jhsa » Fri Nov 07, 2014 1:28 pm

won't a switching regulator put some noise on the analog inputs? I think that was a reason why people didn't start replacing the 5V regulator with a switching one but used as 7805 instead..

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW

ReSt
Posts: 1477
Joined: Tue Dec 27, 2011 11:34 pm
Country: -

Re: built-in USBasp 5V

Post by ReSt » Fri Nov 07, 2014 1:36 pm

Wouldn't this do the same job?

http://www.ebay.de/itm/DC-DC-Boost-Buck ... 5d427b6be7

Reinhard

User avatar
jhsa
Posts: 18129
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: built-in USBasp 5V

Post by jhsa » Fri Nov 07, 2014 1:47 pm

Hmmm, that one looks interesting, but for other applications ;)
Thanks for the link :D

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW

User avatar
Radian
Posts: 19
Joined: Fri Oct 17, 2014 1:58 pm
Country: United Kingdom
Location: Dorset

Re: built-in USBasp 5V

Post by Radian » Fri Nov 07, 2014 2:29 pm

jhsa wrote:won't a switching regulator put some noise on the analog inputs? I think that was a reason why people didn't start replacing the 5V regulator with a switching one but used as 7805 instead..

João
In simulation there's a couple of mV ripple using the above circuit. I'm not expecting that to cause any trouble, but even if it did, another 10uH inductor positioned between the two output caps would reduce that by an order of magnitude. Ćuk converter topology would also do buck/boost and don't exhibit switching ripple but it can only produce a -ve output which isn't any good for this application

As for EMC, shielded inductors should contain things - also their currents are antiphase in SEPIC configuration so careful placement might be able to cancel anything that does radiate. This is why I'm prototyping this one.

I can't seem to lay my hands on a fully realistic schematic for the 9X but the one I have suggests a crazy design if it's right - the ATMEGA analogue/ref has an inductor filter but it doesn't appear to feed the pots (which aren't shown on the schematic). If these are fed at the top by unfiltered 5V that would explain sensitivity to the regulated supply.

If it is a problem, I can always use my buck/boost as a pre-regulator to the 7805 by setting the output to around 7V. Some efficiency gains are still available but it's not as attractive.

User avatar
MikeB
9x Developer
Posts: 15805
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: built-in USBasp 5V

Post by MikeB » Fri Nov 07, 2014 3:16 pm

The best known circuit for the 9X is the one on this post: viewtopic.php?f=95&t=199&p=52925&hilit= ... al+#p52925.

You are quite right that the stick/pots are fed from VCC, but also use AGND.
There is a potential problem with the horizontal trim switches, noticed when using either '128 or '2561 processors, as the small PCBs they are mounted on connected AGND to the switches instead of GND. There is a rebooting problem when using the trim switches sometimes. So the choice of using VCC/GND/AVCC/AGND seems to have been a bit arbitrary.

Mike.
ersky9x/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

User avatar
Radian
Posts: 19
Joined: Fri Oct 17, 2014 1:58 pm
Country: United Kingdom
Location: Dorset

Re: built-in USBasp 5V

Post by Radian » Fri Nov 07, 2014 3:39 pm

Yes, very arbitrary. I will have a poke around to see if it might be possible to swap the pots to AVCC. What reference source does the firmware use? I guess it has to be AVCC otherwise the Vref would need to be fed into the top end of all the pots.

The prototype is working now. Switching noise is around 50mV which is a bit disappointing - probably because I built it on stripboard but other than that it works fine.

Image

User avatar
Bill
Posts: 195
Joined: Thu Jul 04, 2013 5:54 pm
Country: -

Re: built-in USBasp 5V

Post by Bill » Fri Nov 07, 2014 5:30 pm

Mmm the elephant in the room here is what happens if you disconnect the BASP from the tx circuit after programming maybe it is producing an unexpected current drain.
In my TX's I have left a connector for the programmer built in and removed the programmer after use,because I wanted to use the programmer on several other Atmel projects.
I have always programmed on the three and a bit volts setting with good results using the mySmart USB light.
“A good politician is quite as unthinkable as an honest banker”
They used to say "if you don’t want to work at McDonald’s, go to college." Now they say "if you want to work at McDonald’s, go to college.”

User avatar
bob195558
Posts: 1901
Joined: Sun Dec 16, 2012 7:24 pm
Country: United States
Location: New England, Vermont
Contact:

Re: built-in USBasp 5V

Post by bob195558 » Fri Nov 07, 2014 11:31 pm

Hi Radian,

Here is some info about the horizontal trims, potential rebooting problem that Mike was talking about:
(viewtopic.php?f=95&t=3594&p=69475&hilit ... ing#p69475).

Here is wear Bill talked about horizontal trims rebooting problem: (viewtopic.php?f=95&t=3594&p=69475&hilit ... ing#p61209).

You may have already found this info about upgrading the 9x stock 5V regulator: (viewtopic.php?f=95&t=3819).

I do have a question about upgrading the 9x stock 5V regulator.
Would it have been OK to use a Turnigy 5A SBEC in place of the 9x stock 5V regulator ? (http://www.hobbyking.com/hobbyking/stor ... _Lipo.html) :?:

Bob B.
ErSky9x on Taranis, Sky9x, 9Xtreme, Er9x on 9x with Smartieparts Programmer with TelemetrEZ Board
3D Printing: (http://openrcforums.com/forum/viewforum.php?f=85)

User avatar
Radian
Posts: 19
Joined: Fri Oct 17, 2014 1:58 pm
Country: United Kingdom
Location: Dorset

Re: built-in USBasp 5V

Post by Radian » Sat Nov 08, 2014 10:32 am

Hi Bob, I think the trim re-boot probem is another issue altogether but thanks for the heads up - I hadn't come across that one before. The USBasp board wires into some shared signal lines so it can't just be left connected and powered down. Upgrading the 7805 with a switch-mode regulator is definitely a worthwhile exercise as far as I'm concerned. The potential to increase the operating time from any given battery has to make it worth doing. But the difficulty is with the noise associated with switch mode designs. It's not insurmountable - but I wouldn't expect the 5A SBEC you linked to to be particularly quiet. Sure it will work - as will any switch mode 5V regulator board, but the linear regulator will always provide less noise.

User avatar
Kilrah
Posts: 9666
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: Re : built-in USBasp 5V

Post by Kilrah » Sat Nov 08, 2014 2:24 pm

Radian wrote:Upgrading the 7805 with a switch-mode regulator is definitely a worthwhile exercise as far as I'm concerned. The potential to increase the operating time from any given battery has to make it worth doing.
The 5V regulator only powers the mainboard, which is about <40mA and less than half of the system's total draw. Makes any difference pretty much negligible especially compared to the drawbacks.
At least unless you really need to fly night and day for more than the 15 hours or so that the typical batteries used with the 9x provide..

Sent via mobile

User avatar
jhsa
Posts: 18129
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: built-in USBasp 5V

Post by jhsa » Sat Nov 08, 2014 3:14 pm

it's probably worth it to replace the 78L05 with a low dropout regulator so we can power the radio with less voltage. that would make it a bit more efficient due to less heat..

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW

User avatar
Radian
Posts: 19
Joined: Fri Oct 17, 2014 1:58 pm
Country: United Kingdom
Location: Dorset

Re: Re : built-in USBasp 5V

Post by Radian » Sun Nov 09, 2014 9:52 am

Kilrah wrote: The 5V regulator only powers the mainboard, which is about <40mA and less than half of the system's total draw. Makes any difference pretty much negligible especially compared to the drawbacks.
At least unless you really need to fly night and day for more than the 15 hours or so that the typical batteries used with the 9x provide..

Sent via mobile
Yes, the Transmitter module has a direct connection to the 12V battery and a lot of the current goes in there - I haven't taken a peek in there yet but there's bound to be another regulator of some form. Has anyone looked into it? With only 5V supplying the Transmitter it still appears to function OK (indoors at least).

The scheme I would propose then is to leave the existing linear regulator(s) as they are, and use a buck/boost regualtor as a pre-regulator set just above the drop-out voltage of the linear regulators. Of course lower drop-out versions could be used to gain a little extra headroom. The linear regulators then only remove any switching noise and with only their drop-out voltage * current as power to dissipate may run cool enough to deliver the additional current many people need for add-ons to the transmitter.

The buck/boost regulator really suits my preferred power scheme as it can be diode-or'd with both battery and 5V USB - and, for disposable batteries, squeezes out every last bit of juice (Joule thief). The battery level indicator would also report the pre-regulation level e.g. ~7V and the slightest drop would really need to be paid attention to. Alternatively the AD input could be re-routed to the battery for a more granular reading.

User avatar
jhsa
Posts: 18129
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: built-in USBasp 5V

Post by jhsa » Sun Nov 09, 2014 10:58 am

Yeah, I think the radio would measure only the pre-regulated voltage? I think the real battery voltage makes more sense.

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW

Post Reply

Return to “Electronic Mods”