Unoffical empeg BBS

Quick Links: Empeg FAQ | RioCar.Org | Hijack | BigDisk Builder | jEmplode | emphatic
Repairs: Repairs

Page 1 of 3 1 2 3 >
Topic Options
#355246 - 28/09/2012 21:01 24VAC to 5VDC ?
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14496
Loc: Canada
Originally Posted By: mlord
The 1-amp rated Samsung AC charger supplied with my Galaxy Nexus has pins D- and D+ shorted.

The cheap china car charger I got from DX has proper resistor networks to signal 500mA max per port (2 USB ports). I just now hacked it, adding 200ohms across D- D+, to trick my phone into charging at (up to) 1amp from it, instead of trickle charging as it normally would.


On a semi-related topic..

I'm making my own internet-connected thermostat. Pretty simple stuff, except for how to power it.

Here in Canada (and the USA), thermostats get 24VAC from the heating system. So my puzzle is how best to convert that into regulated 5VDC or less, to power the micro-controller I'm using (atmega328p). No worries about lots of voltage/current for relay coils, as I'm using a solid-state relay (aka. an opto-isolated TRIAC circuit).

I googled the subject, and discoved lots of people with the exact same question, and the "best" answers are always the same: rectify the 24VAC with a diode bridge, filter it with a huge capacitor, and then feed it into a DC-DC converter circuit (a form of switching supply) to get whatever regulated DC voltage I want.

Seems like a lot of fuss though.

Then I looked at the teensy little 100-250VAC adapters that litter my work area. These all put out regulated 5VDC (+/-0.4V), in the form of a USB-A jack.

Mmm.. they're all just switching supplies internally, with some kind of voltage feedback to allow them to adapt to inputs of 100-250VAC, I wonder if they'll also adapt to lower inputs?

Tried three no-name "China chargers", and they all work just fine on the 32VAC (output) transformer at my work bench. Not quite as low as 24VAC, but that's all I have handy. The 9VDC switching adapter I have here also puts out 9VDC just fine when powered by only 32VAC. Encouraging.

Then I tried a Blackberry charger.. it outputs only 4VDC, with fluctuations. No good.

Tried the Samsung charger from my Galaxy Nexus kit: 0VDC output. Same thing with the ASUS charger for the Nexus 7 tablet: 0VDC.

Obviously everyone isn't using quite the same circuitry.
Any of you electronic types have any opinions or suggestions on this?

Right now, I'm planning to just go with one of the "China chargers", since they work. I'll have to retest against true 24VAC first though.. mmmm.. perhaps the doorbell transformer.. mm...

Top
#355247 - 28/09/2012 21:12 Re: 24VAC to 5VDC ? [Re: mlord]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14496
Loc: Canada
Originally Posted By: mlord
Right now, I'm planning to just go with one of the "China chargers", since they work. I'll have to retest against true 24VAC first though.. mmmm.. perhaps the doorbell transformer.. mm...


Okay, I tried two of them on the 24VAC doorbell circuit: one still gave it's usual 5.3VDC, but the other drooped to a steady 4.0VDC. No Load yet.

I don't expect loading them to make much difference, but it could, I guess. My total load with everything running and the LCD backlight lit will likely be 150mA or less.

Top
#355255 - 29/09/2012 22:30 Re: 24VAC to 5VDC ? [Re: mlord]
altman
carpal tunnel

Registered: 19/05/1999
Posts: 3457
Loc: Palo Alto, CA
The issue is likely to be the transformer windings; taking one of those off-the-shelf PSUs and either reducing primary windings or increasing secondary windings would likely to do the job.

That said, rewinding transformers isn't a lot of fun or easy to do smile

A rectifier and high voltage buck is the most efficient way to do it.

Top
#355256 - 29/09/2012 23:33 Re: 24VAC to 5VDC ? [Re: altman]
Shonky
pooh-bah

Registered: 12/01/2002
Posts: 2009
Loc: Brisbane, Australia
Those supplies will still be rectifying and are probably flyback converters. I'm a little surprised they work that far down. Rewinding the transformer would be difficult since they are probably all encapsulated.

Edit: If you can get a China charger to work properly under load, then great.

As Hugo says, just rectify (half wave should be enough but a full bridge can small enough) and use a high efficiency switching buck convertor. Just need to watch for the input voltage rating since you'll have a fairly high output from the rectifier.


Edited by Shonky (29/09/2012 23:34)
_________________________
Christian
#40104192 120Gb (no longer in my E36 M3, won't fit the E46 M3)

Top
#355257 - 30/09/2012 00:57 Re: 24VAC to 5VDC ? [Re: Shonky]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14496
Loc: Canada
Yeah, I've got some 40V bucks on order via eBay, but thinking these china chargers are even simpler.

For the buck -- just a diode in front, or also a big cap?

-ml

Top
#355258 - 30/09/2012 09:03 Re: 24VAC to 5VDC ? [Re: mlord]
Shonky
pooh-bah

Registered: 12/01/2002
Posts: 2009
Loc: Brisbane, Australia
You'll definitely need some sort of filtering/smoothing particularly if only using a single diode to rectify. Even with a full wave it will drop to zero every half cycle:



So enough capacitance to ride through that drop every 16ms (assuming it's 60Hz). You can fairly accurately size it. Probably won't have to be that large since the peak voltage is much higher than what will be the minimum input voltage to the buck for your 5V.

So it's 24VAC *RMS*? And you need 150mA at 5V?
_________________________
Christian
#40104192 120Gb (no longer in my E36 M3, won't fit the E46 M3)

Top
#355259 - 30/09/2012 09:36 Re: 24VAC to 5VDC ? [Re: Shonky]
Shonky
pooh-bah

Registered: 12/01/2002
Posts: 2009
Loc: Brisbane, Australia
OK. So really rough numbers.

750mW is what you need at the output. Assuming you get 75% efficiency from the buck so you need to put 1W into it. 1 Joule/sec or 0.016 Joules every 16ms.

Capacitor stores 0.5CV^2. Assuming 8V is the minimum input voltage to your regulator and the peak is 24V x 1.41 = ~34V.

Therefore absolute lowest cap size would be (assuming the worst case that the AC supply is instantly charging the cap only once a cycle and not actually powering):

0.016 = 0.5xCx34^2 - 0.5xCx8^2
C = ~30uF

But make it something like 100-220uF and you'll be fine but put it on a scope if you can. Best to keep the DC level fairly smooth if you can. Ripple isn't good for caps.

There are other rule of thumb formulas too that will give you the same sort of results. Things like C = load_current/(2*freq*ripple_voltage). That will give you 220uF for a 5V ish ripple.
_________________________
Christian
#40104192 120Gb (no longer in my E36 M3, won't fit the E46 M3)

Top
#355261 - 30/09/2012 11:38 Re: 24VAC to 5VDC ? [Re: Shonky]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14496
Loc: Canada
Good. I always assumed it would need a largish cap there, but was wondering some after the comments here about just adding a rectifier or bridge. smile

There should be no problem with going larger on that cap, so I'll use whatever I can find on hand -- likely 470uF/50V as I have lots of those.

It'll be a couple more weeks before the bits and pieces from China come trickling in, or perhaps longer since it's holiday time over there right now.

Thanks

Top
#355270 - 30/09/2012 23:30 Re: 24VAC to 5VDC ? [Re: mlord]
Shonky
pooh-bah

Registered: 12/01/2002
Posts: 2009
Loc: Brisbane, Australia
That should be fine and more is better unless you go way way over board since the inrush current stresses the rectifier diode.

No good with the Chinese chargers?
_________________________
Christian
#40104192 120Gb (no longer in my E36 M3, won't fit the E46 M3)

Top
#355271 - 01/10/2012 00:51 Re: 24VAC to 5VDC ? [Re: Shonky]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14496
Loc: Canada
Oh, one of the chargers is good, but I'm thinking of going all 3.3V instead of 5V. So I'd need an extra stage with the charger, making it about the same fuss as the bridge+cap+buck.

The buck board has adjustable output (multi-turn pot), so I can tune it nicely for exactly 3.3V output.

Still, the final choice will come once all of the pieces have arrived. The LCD I'm using wants 3.3V, the RTC is 3.3V, the temperature sensors don't care, and the ethernet adapter also wants 3.3V.

So I may as well just run the Atmega328p at 3.3V as well.

Cheers

Top
#355272 - 01/10/2012 00:52 Re: 24VAC to 5VDC ? [Re: mlord]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14496
Loc: Canada
Or I suppose I could replace a resistor in the charger with a trim pot and try tuning it for 3.3V output.. might do that just for fun regardless. smile

Top
#355282 - 01/10/2012 14:15 Re: 24VAC to 5VDC ? [Re: mlord]
K447
old hand

Registered: 29/05/2002
Posts: 798
Loc: near Toronto, Ontario, Canada
The simplest way to power an off the shelf power adapter in this case is to connect another 120 to 24 VAC transformer 'backwards'.

Connect the 24 volt secondary of the transformer to your 24 volt AC source in the wall (at or near the thermostat location). The transformer primary will then provide full line voltage. Feed that 110-120VAC into your DC power adapter of choice.

You can wire the transformer 'output' to a standard AC wall outlet and then plug in your adapter. All this can be enclosed within your thermostat box, or tucked into the wall cavity behind.

Top
#355285 - 01/10/2012 19:14 Re: 24VAC to 5VDC ? [Re: K447]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14496
Loc: Canada
Simpler than that would be to just run 120VAC to the thermostat.

But no need -- there's already 24VAC there, and as discussed above I've got a couple of 5VDC adapters that work just fine off the 24VAC. But they give me 5VDC, not the 3.3VDC I now think I'll need.

Cheers

Top
#355321 - 03/10/2012 16:19 Re: 24VAC to 5VDC ? [Re: mlord]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14496
Loc: Canada
Originally Posted By: mlord
.. the final choice will come once all of the pieces have arrived. The LCD I'm using wants 3.3V, the RTC is 3.3V, the temperature sensors don't care, and the ethernet adapter also wants 3.3V.


Ugh. Actually, the RTC wants 5V, not 3.3V. So I'm likely to end up having to supply dual voltage on the board, starting with 5V, and using an LDO regulator on that to get 3.3V.

Or maybe find a 3.3V RTC to use instead of the 5V one.

Top
#355323 - 03/10/2012 16:45 Re: 24VAC to 5VDC ? [Re: mlord]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14496
Loc: Canada
DS1338 3V RTC module. Expensive ($12 vs. $2.80), but simpler.

Top
#356003 - 31/10/2012 11:31 Re: 24VAC to 5VDC ? [Re: mlord]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14496
Loc: Canada
In the end I've gone with a buck regulator found on eBay for $1.70. The chip on it is rated for up to 40V input, tolerating 45V absolute maximum. I tuned the module to give 5.00V output (needed for the relay coils), and further regulate that down to 3.3V (LDO tab regulator) to run the electronics.

This all works fine, but I'm very slightly concerned about something. The DC input produced from the "24VAC" supply ends up being about 38V after the filter cap. That's under 40V, but not by much at all.

To give a little more head room, I've inserted three diodes in series with the 38VDC, dropping it to about 36.8V (gotta double check that measurement). The current flow through it is typically less than 100mA, up to 225mA peak when all five relay coils are active.

The slightly nagging worry is that there's still not much margin there at the input to the buck regulator. It does appear to be of good quality -- 50V input cap, 35V output cap, etc.

Should I be concerned (much)?
I wonder if a 40V zener across the DC input might be useful?

Top
#356006 - 31/10/2012 12:33 Re: 24VAC to 5VDC ? [Re: mlord]
Shonky
pooh-bah

Registered: 12/01/2002
Posts: 2009
Loc: Brisbane, Australia
24V RMS is going to be 34V peak (68V peak to peak). Really shouldn't be able to get any higher than 34V DC. Is the 24VAC really 24VAC?

Is this full wave rectified? How are you getting DC from the 24VAC? How "DC" is the DC?

Have you had a look at any waveforms on a scope? Pics?

Also remember that a zener will clamp and effectively short circuit the input at higher voltages so could end up dissipating quite a bit for long term high input voltage. If the regulator can truly withstand 40V I'd run with just that. There should be enough further headroom above that (and the 5% you have from the 2V gap from 38-40V). I'm not sure how consistent this 24VAC supply should be though.

Also diodes aren't always the greatest for voltage drops since they will vary a bit with current draw particularly with lower currents.

What (brand/part) is the buck regulator? I presume this is a pre built module of some description you are using.
_________________________
Christian
#40104192 120Gb (no longer in my E36 M3, won't fit the E46 M3)

Top
#356008 - 31/10/2012 12:57 Re: 24VAC to 5VDC ? [Re: Shonky]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14496
Loc: Canada
The 24VAC is the "nominal" output from the furnace, probably running closer to 26VAC I suspect, but I haven't put a meter on it 28VAC.

The "24VAC" goes to a bridge rectifier salvaged from a computer PSU, and then past a 470uF capacitor to the buck. I've inserted the three extra diodes between the bridge rectifier and the 470uF capacitor.

The "24VAC" supply will fluctuate with line voltage. It should be pretty constant with the odd dip, but can have spikes just like the wall sockets do.

The buck regulator is a standard circuit from the LM2695S-ADJ datasheet. The datasheet says "45V absolute maximum; but only up to 40V for the operating range".

So we're under 40V, I'd just like a little more margin, or some protection against the odd spike -- thus the thought of perhaps a 40V zener.

Cheers


Attachments
buck.jpg




Edited by mlord (31/10/2012 13:23)

Top
#356010 - 31/10/2012 13:12 Re: 24VAC to 5VDC ? [Re: mlord]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14496
Loc: Canada
Okay, I bypassed the safety shutoffs on the furnace and measured the "24VAC" there: 28VAC according to my (non-RMS) meter.

Edit: It was probably designed to output 24VAC minimum at 110VAC input, all at 60.000HZ. But here in Ottawa, the line voltage is usually between 120VAC and 125VAC -- currently showing 123VAC on my (non-RMS) meter.

Cheers


Edited by mlord (31/10/2012 13:17)

Top
#356011 - 31/10/2012 13:31 Re: 24VAC to 5VDC ? [Re: mlord]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14496
Loc: Canada
Now I'm thinking there may be a better way do reduce the (effective) input voltage. Since it is AC to begin with, perhaps a TRIAC with appropriate bias could be used to chop it down in front of the bridge rectifier, getting things into a safer 10-12V range perhaps.

???

Though I suppose if I'm at all concerned, I should probably just remove the entire front-end and instead drop in one the USB chargers discussed earlier. It will take the 24-28VAC input and produce 5.1VDC regulated output with no worries, and about the same amount of space taken up inside the box.


Top
#356012 - 31/10/2012 13:38 Re: 24VAC to 5VDC ? [Re: mlord]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14496
Loc: Canada
Or perhaps remove the bridge rectifier and replace it with a single diode, and maybe add more capacitance to the diode output. I don't know much about electronics, but I think that should give a lower (filtered) DC output. ?

Top
#356046 - 31/10/2012 23:16 Re: 24VAC to 5VDC ? [Re: mlord]
gbeer
carpal tunnel

Registered: 17/12/2000
Posts: 2665
Loc: Manteca, California
_________________________
Glenn

Top
#356049 - 01/11/2012 00:22 Re: 24VAC to 5VDC ? [Re: gbeer]
Shonky
pooh-bah

Registered: 12/01/2002
Posts: 2009
Loc: Brisbane, Australia
Half wave or a smaller cap will only increase the ripple on the rectified DC. A larger cap will decrease the ripple, but increase in the initial inrush current when switching on.

The peak voltage of 28VAC RMS = 39.5V peak minus the diode drop in the rectifier diode(s) will still exist either way.

As for the original zener idea, I would put something with some margin over what's normal. Something like 42-43V perhaps. The voltage regulator should be able to run with that. The zener should be thought of as a last resort protection really.

If your current consumption is reasonably constant, you could just use an appropriately rated resistor in series. The voltage drop is proportional to the current. This is not efficient though and the resistor will be just burning that power.

Some numbers:

Say we look for a 5V drop.
You mention 100mA-250mA (at 5V).
Assuming say 70% total efficiency on the buck regulator/rectifier means about 500mW-1.25W output or 700-1.8W input power.
At 40V that's ~20-45mA. 5V at 20mA is 250R. At 45mA it's ~100R.
Sooo.... let's put a 100R resistor in series.
At 20mA that's 2V drop and only 40mW dissipated in the resistor
At 45mA that's 4.5V drop and 200mW dissipated in the resistor

You need to consider your worst case power consumption since that will decide how much is dissipated in the resistor.


Edited by Shonky (01/11/2012 00:35)
_________________________
Christian
#40104192 120Gb (no longer in my E36 M3, won't fit the E46 M3)

Top
#356052 - 01/11/2012 01:09 Re: 24VAC to 5VDC ? [Re: Shonky]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14496
Loc: Canada
Okay, non-issue. At the thermostat, with my new thermostat installed and connected, the rectified voltage measures 34.8VDC. That's with the three extra diodes inline to provide a small drop. Looks like they might not even have been necessary.

(previous AC measurements were with the original thermostat in place, not my new one).

So plenty of voltage headroom at the input to the buck. Peachy!
The photo shows it in place, sans cover. The white thing above it is the controller for the HRV air exchanger, which I hope to eliminate in favour of a couple of the spare yellow relays in the new thermostat below. That's the next project.

Except somehow I've managed to fry three (3!!) of my FTDI USB/serial breakout boards.. must have a wire crossed somewhere there. So I cannot actually program anything new until those get replaced -- ordered the raw chips and a supply of ChipQwik from Digikey so that I can just replace the blown chips and reuse the existing Sparkfun breakout boards afterward.


Attachments
stats.jpg



Top
#356054 - 01/11/2012 01:30 Re: 24VAC to 5VDC ? [Re: mlord]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14496
Loc: Canada
Buck regulator near top left, 3.3V PSU under it, then the Atmega328P microcontroller, and the ULN2003A relay driver chip. The ethernet board connects via SPI, and enables an embedded webserver for status and configuration. The battery-backed Real-Time Clock is on I2C off to the right. Below/between them is the white DHT22 Temperature/Humidity sensor, which uses a proprietary 1-Wire 40-bit protocol. There are five yellow coloured relays, two of which are dedicated for the furnace and fan, the other three are for future expansion. The 3.3V serial port and ethernet share a single run of Cat5e via the special 4w/4w splitter block. The 3.3V LCD display connects via a single wire (tx) serial interface, and the four coloured push-button switches all share a single GPIO using a resistor ladder.

Dagnabbit! Forgot to wire in a reset switch. Which means I'll probably need one. smile


Attachments
stat-close.jpg

Description: Buck regulator at top left.



Top
#356056 - 01/11/2012 02:28 Re: 24VAC to 5VDC ? [Re: mlord]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14496
Loc: Canada
I have not connected my scope up to the power supply to check for ripple yet, but my multi-meter claims 1VAC is present at the input to the Buck (along with 34.8VDC). If that means what I think it means, then I've got about 3% ripple at that point.

Beyond the Buck, at the 5VDC and 3.3VDC points, no AC voltage is detected. Still gotta lug the scope out there and rig a stand for it so I can have a more graphical view of it all.

Top
#356057 - 01/11/2012 02:44 Re: 24VAC to 5VDC ? [Re: mlord]
Shonky
pooh-bah

Registered: 12/01/2002
Posts: 2009
Loc: Brisbane, Australia
Yes that's probably a fair assumption at least. Note that the ripple is not a sine wave now so if your meter is doing the "rectify/filter/measure DC" and working backwards to AC it could be a bit off but it shouldn't be off by heaps. Best to look at with a scope if you've got one. If you've got a fast min/max function (which you probably don't if it's not True RMS) it might even catch it.

If you wanted to get *real* fancy/geeky you could rig a voltage divider to an ADC input and sample it with your CPU smile. You don't have to sample it particularly fast even.

At 5VDC and 3.3VDC you definitely don't want and shouldn't have any ripple. Still good to check on a DSO though if you have the means. There will be some switching noise at least on the 5V but should be pretty well filtered by the LDO.
_________________________
Christian
#40104192 120Gb (no longer in my E36 M3, won't fit the E46 M3)

Top
#356058 - 01/11/2012 02:48 Re: 24VAC to 5VDC ? [Re: Shonky]
Shonky
pooh-bah

Registered: 12/01/2002
Posts: 2009
Loc: Brisbane, Australia
As for the reset, is there at least a watchdog you can use? That will probably cover you for most if not all things.

I presume there is something that ensure it comes out of reset nicely on power up built in?
_________________________
Christian
#40104192 120Gb (no longer in my E36 M3, won't fit the E46 M3)

Top
#356063 - 01/11/2012 03:50 Re: 24VAC to 5VDC ? [Re: mlord]
drakino
carpal tunnel

Registered: 08/06/1999
Posts: 7868
Just have to say it's cool seeing this come together after seeing all the various parts earlier smile

Top
#356077 - 01/11/2012 15:19 Re: 24VAC to 5VDC ? [Re: Shonky]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14496
Loc: Canada
Looks like the Atmega328p has a built-in watchdog, which can be configured to a max period of 8 seconds. That's good for my purposes. But I'll have to fuss about to see if the Arduino bootloader code properly deals with it or not -- there's a fair bit of online discussion about that.

I've also got another gizmo laying around that is yet to be installed in the thermostat case: an ultrasonic rangefinder. I'm going to use this as a motion/proximity sensor, to turn the LCD backlight off when there's nobody in front of the thermostat. This will reduce light pollution, and also cut the overall power consumption by half.

The rangefinder itself consumes about 10mA, so I may power it through a spare gate of the relay driver chip, allowing it to be completely powered down when not actively sampling.

There goes three of the remaining 4 GPIO pins. frown

But I'm not touching anything in there until my FTDI boards get repaired -- parts expected here on Friday.

Cheers

Top
Page 1 of 3 1 2 3 >