6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat Sep 21, 2024 3:29 pm

All times are UTC




Post new topic Reply to topic  [ 29 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: Power Circuit
PostPosted: Wed May 19, 2021 9:11 pm 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
Firefox6502, the circuit Enso posted is interesting, but you indicated you already have a 7805 and a heatsink. Not that you'll need much of a heatsink, but anyway... :)

I've edited your circuit, partly to correct the issues floobydust noted. It's helpful to clearly show *both* connections to the battery and likewise both connections to the exteral supply.

I don't think the polyfuses are necessary. Also I added an extra pole on the switch. Otherwise the battery would remain connected to the 7805 even when in Mains mode, and that creates a small problem. The 7805 itself will draw a small current even with its output disconnected, and that would eventually flatten the battery.

-- Jeff


Attachments:
power circuit.png
power circuit.png [ 1.25 MiB | Viewed 564 times ]

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html
Top
 Profile  
Reply with quote  
 Post subject: Re: Power Circuit
PostPosted: Wed May 19, 2021 11:05 pm 
Offline
User avatar

Joined: Sat Sep 29, 2012 10:15 pm
Posts: 899
Just out of curiosity, what is a 'raspberry pi 5.1V power supply'? I noticed at the raspi website a mention that one is required, but every device I've seen is powered by a usual 5V USB wallwart. I have a box of ones that claimed 2+ amps but were not providing that (as USB spec requires 500mA and the connectors are wimpy), and l 've never seen a 5.1v supply .

I would imagine, since you are doing your own regulation, that you would want to start with a higher initial voltage, or a tiny ripple will bring you below 5v. Oh, I see it's for battery only...

l've seen many USB power supplies provide a lot less than 5v under load.

P.S. MY tablet is messing up caps, stuck In handwr't ng mode. Crap.

_________________
In theory, there is no difference between theory and practice. In practice, there is. ...Jan van de Snepscheut


Top
 Profile  
Reply with quote  
 Post subject: Re: Power Circuit
PostPosted: Wed May 19, 2021 11:38 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8510
Location: Southern California
enso wrote:
l've seen many USB power supplies provide a lot less than 5v under load.

Is that measured before going though cable, or after cable and connectors? (I imagine the power supply regulation is relatively good, but the resistance of cheap, thin wire and the connectors brings the voltage down, by the amount of the current times the resistance.)

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
 Post subject: Re: Power Circuit
PostPosted: Wed May 19, 2021 11:49 pm 
Offline
User avatar

Joined: Sat Sep 29, 2012 10:15 pm
Posts: 899
As measured on the target device power bus. I've seen 4.5V.

_________________
In theory, there is no difference between theory and practice. In practice, there is. ...Jan van de Snepscheut


Top
 Profile  
Reply with quote  
 Post subject: Re: Power Circuit
PostPosted: Thu May 20, 2021 1:25 am 
Offline
User avatar

Joined: Mon Feb 01, 2021 1:07 am
Posts: 44
Location: Sydney, Australia
floobydust wrote:
Unless I'm missing something, you have the battery and the Pi +5V supply coming in and going thru a pair of caps in parallel. Caps won't pass DC, so neither position of the switch will result in having +5V to power your circuit.

You are totally correct! Dumb mistake by me. I should have these caps in parallel from power to ground (not in series in the cct).

_________________
Greetings Professor Falken.


Top
 Profile  
Reply with quote  
 Post subject: Re: Power Circuit
PostPosted: Thu May 20, 2021 1:35 am 
Offline
User avatar

Joined: Mon Feb 01, 2021 1:07 am
Posts: 44
Location: Sydney, Australia
enso wrote:
Just out of curiosity, what is a 'raspberry pi 5.1V power supply'? I noticed at the raspi website a mention that one is required, but every device I've seen is powered by a usual 5V USB wallwart. I have a box of ones that claimed 2+ amps but were not providing that (as USB spec requires 500mA and the connectors are wimpy), and l 've never seen a 5.1v supply.

Attached is a pic of the power supply...


Attachments:
rasppi3bpwr.jpg
rasppi3bpwr.jpg [ 2.63 MiB | Viewed 540 times ]

_________________
Greetings Professor Falken.
Top
 Profile  
Reply with quote  
 Post subject: Re: Power Circuit
PostPosted: Thu May 20, 2021 1:46 am 
Offline
User avatar

Joined: Mon Feb 01, 2021 1:07 am
Posts: 44
Location: Sydney, Australia
Dr Jefyll wrote:
Firefox6502, the circuit Enso posted is interesting, but you indicated you already have a 7805 and a heatsink. Not that you'll need much of a heatsink, but anyway... :)

I've edited your circuit, partly to correct the issues floobydust noted. It's helpful to clearly show *both* connections to the battery and likewise both connections to the exteral supply.

I don't think the polyfuses are necessary. Also I added an extra pole on the switch. Otherwise the battery would remain connected to the 7805 even when in Mains mode, and that creates a small problem. The 7805 itself will draw a small current even with its output disconnected, and that would eventually flatten the battery.

-- Jeff

Jeff, thank you so much for the new and improved cct!!! Design fixes and improvements such as this helps me to learn.
The switch you used must be a DPDT (where I was using a SPDT).
Also I may replace the SB230TA with a 1N4001 if it's cheaper as the diode is only for the battery, i.e. low current.

Enso's circuit does look very cool (thanks Enso)... given I have most of the parts already I'll go with my circuit.
But I will read up on the LM1117-5.0 and understand it's pros and cons. Potentially use it in a future circuit.

_________________
Greetings Professor Falken.


Top
 Profile  
Reply with quote  
 Post subject: Re: Power Circuit
PostPosted: Thu May 20, 2021 1:51 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8510
Location: Southern California
Firefox6502 wrote:
The switch you used must be a DPDT (where I was using a SPDT).

It was DP3T, the third position being OFF.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
 Post subject: Re: Power Circuit
PostPosted: Thu May 27, 2021 12:14 pm 
Offline
User avatar

Joined: Tue Aug 11, 2020 3:45 am
Posts: 311
Location: A magnetic field
GARTHWILSON on Thu 11 Mar 2021 wrote:
If you have 9V or 12V to bring down to 5V, I would just say the easiest for the beginner is something like a 7805 with adequate heatsinking.


I strongly agree. When I used a 7805, it worked first time. When I moved to LM317, I thought "[Expletive deleted] this! Next time, I'm buying 7805s!" This is a reason why 7805 is found in so many 8 bit computers. It just works. Admittedly, LM317 will be an exercise in frustration if you have a very small choice of resistor values, questionable numeracy and terrible soldering. Regardless, the general principle is true. Every other option will be surprisingly more difficult and tangential when powering 5V digital logic. Any design without 7805 should be regarded as intermediate or advanced and may be an unnecessary complication. If your design benefits from intermediate or advanced circuitry, it can be revised when you have more experience.

Despite such warning, I've devised a power regulation circuit to meet many of the requirements mentioned on the 6502 Forum:-


After previous empirical experiments with LM317 variable voltage regulation (apparently, not an oxymoron), I was able to combine the numerous examples typically found in a datasheet and devise a diode protected, surge protected, 5.0V, 4.6V, 3.3V supply where all power rails come up together. This can be easily adapted or extended to cover other cases; possibly beyond 30V.

LM317 is an odd device which is less encapsulated than the popular 7805 design. Both devices are able to limit current or voltage but not both functions at the same time. LM317 is typically "programmed" with a potential divider circuit to provide a relative voltage drop. (7805 is effectively a pre-programmed LM317.) In the typical LM317 voltage regulation arrangement, LM317 is not grounded and may be used to provide one or more large voltage drops. To achieve this, 100 microamps traverses the Adjust pin and this current sense is used as negative feedback. Configuration is relative to an internal 1.25V zener diode which, unfortunately, also sets the minimum voltage drop.

Given the very small current sense, it is possible to create a multi-Y arrangement where the bottom half of the potential dividers is shared and the top half allows multiple LM317 devices to work at different ratios. Ordinarily, when voltage is fixed and current is variable, this would not work. However, it works in a restricted range when current is fixed and voltage is variable. The remainder of the circuit concerns PNP 2N2905, 2N2907 or similar with capacitor at base. When the capacitor is empty, this arrangement initially bypasses the common element of the potential dividers and sets each LM317 to the minimum possible voltage. As the capacitor fills, the PNP transistor switches off and the 2.7k resistor is not bypassed. This sets the maximum voltage for each section.

5.0V is configured with 1k resistor. 4.6-5.0V may be set with 1k resistor in series with 100 ohm potentiometer. (Screw type is strongly recommended.) 3.3-3.4V may similarly configured with 1.8k in series with a separate 100 ohm potentiometer. Do not use the 3.3V section heavily because it is a convenience feature with the least efficiency.

For dubious power sources, such as power jacks and USB, use full bridge rectifier and then Buck, Boost or Buck/Boost to 7V. Well, ideally, you should use fully galvanically isolated, full opto-isolated Ćuk conversion is saturated mode. However, if you're buying cheap components, you are more likely to find Buck/Boost modules available in packs of 10. Set them to 7V with a screwdriver and check that the output does not exceed 7V when the input is 9V. Such units convert excess voltage at 85% efficiency but the output has significant noise. LM317 burns the last 2V (1.25V minimum drop plus 0.75 margin) to make a smooth supply. Obviously, there are more efficient methods to regulate power. However, many of them involve reading 500 pages about snubber circuits and more obscure topics. 7805 is "get 'er done" and LM317 is only the next step in a possible long journey.

Firefox6502 seeks a circuit where it is possible to select source of power input. Place a full bridge rectifier and Buck/Boost circuit behind a single poll switch. This should be suitable for input with either polarity, 4-20V. Indeed, it should be suitable for solar power.


Attachments:
lm317-configuration0-0-0.csv [1.25 KiB]
Downloaded 40 times
volt-reg-diode0-0-2.pdf [124.33 KiB]
Downloaded 39 times
volt-reg-diode0-0-1.odg [7.92 KiB]
Downloaded 36 times

_________________
Modules | Processors | Boards | Boxes | Beep, Beep! I'm a sheep!
Top
 Profile  
Reply with quote  
 Post subject: Re: Power Circuit
PostPosted: Thu May 27, 2021 1:09 pm 
Offline

Joined: Tue Sep 03, 2002 12:58 pm
Posts: 325
... that's not how the LM317 works. Did you try building that circuit? Put 12V on the input, and see what you get on the '5' volt output.

The 100uA is not a 'sense current'. It's the power that the internal reference requires to work, and they've kept it as small as they could to reduce error. You're neglecting the current through the programming resistors: 1.25V across 1K, 1K, and 1.8K will give you 3.2mA through the 2.7K resistor, taking all three outputs to nearly 10V.


Top
 Profile  
Reply with quote  
 Post subject: Re: Power Circuit
PostPosted: Thu May 27, 2021 1:36 pm 
Offline
User avatar

Joined: Tue Aug 11, 2020 3:45 am
Posts: 311
Location: A magnetic field
If the 2.7k resistor is tripled to 8.1k, does that fix it?

_________________
Modules | Processors | Boards | Boxes | Beep, Beep! I'm a sheep!


Top
 Profile  
Reply with quote  
 Post subject: Re: Power Circuit
PostPosted: Thu May 27, 2021 2:46 pm 
Offline

Joined: Tue Sep 03, 2002 12:58 pm
Posts: 325
Sheep64 wrote:
If the 2.7k resistor is tripled to 8.1k, does that fix it?

No. The LM317's job is to keep the output 1.25V above the adjust pin. With them all tied together, all three outputs will be at the same level whatever resistors you use. You need an entirely separate divider for each output.


Top
 Profile  
Reply with quote  
 Post subject: Re: Power Circuit
PostPosted: Thu May 27, 2021 5:25 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8390
Location: Midwestern USA
Sheep64 wrote:
Admittedly, LM317 will be an exercise in frustration if you have a very small choice of resistor values, questionable numeracy and terrible soldering.

Huh? The 317 is a no-brainer to use. A couple of resistors—one could be a pot—and a few caps is all it takes. In fact, the LM78xx series can be made work in a similar fashion by lifting pin 2 above ground.

Quote:
Every other option will be surprisingly more difficult and tangential when powering 5V digital logic. Any design without 7805 should be regarded as intermediate or advanced and may be an unnecessary complication.

I power my POC units with an old PC-ATX power supply and thus avoid any complication. Whomever designed the power supply did all the work for me. :D I get a rock-stable 5 volts with virtually no crud on it and instant short-circuit protection should I do something stupid, such as drop a small screwdriver on exposed pins that are powered. :oops:

Just my opinion, but you are overthinking this.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Last edited by BigDumbDinosaur on Fri May 28, 2021 2:40 am, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Power Circuit
PostPosted: Thu May 27, 2021 8:29 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8510
Location: Southern California
The LM317 needs a few mA minimum load in order to regulate. The NSC data sheet for it says 3.5mA typ and 10mA max for a 40V input-output difference (which probably none of us will be doing for our computer circuits), but the graph shows it drops to about 1.4mA typ at a 5V input-output difference. They recommend 240Ω for the resistor going from the output to the adjustment pin, which gives a 5.21mA load. It seems a bit heavy, but when I've used the 317 in our aircraft stuff, I had power to burn, so it wasn't a concern. It does tighten up the output voltage a bit more than a lower current there would, since there's a tolerance in the adjustment pin current which is typically 50µA but could be as high as 100µA, and the 240Ω's current will have an effect of swamping out that tolerance. If you're not using 1% resistors it may not matter.

So here's how I would go about figuring the resistors. Per the data sheet, I'm calling the output-to-adjustment-pin resistor R1, and the adjustment-pin-to-ground resistor R2.
  • Per the recommendation, R1 is 240Ω. This in a sense wastes 5.21mA, but keeps the output voltage from rising in the absence of a load.
  • Then you need another 50µA for the adjustment pin. 5.21mA+50µA=5.26mA.
  • The adjustment pin will be 1.25V below the output voltage which we desire at 5V. 5V-1.25V=3.75V.
  • 3.75V/5.26mA=713Ω for R2. Uh-oh, that's not a standard value. You could put a 33Ω in series with a 680Ω. I tried 220Ω, 270Ω, and 300Ω for R1, but they still don't land on standard values for R2; so the 680Ω+33Ω for R2 might be best, or use a trimmer. The trimmer would be the only way to fine-adjust the output to exactly 5.00V, if that's important to you for any reason. (On my workbench computer, the Vcc is also the reference for the fast A/D converter. I have 5.08V from the 7805, which I just crank into correction factors when it matters.)

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 29 posts ]  Go to page Previous  1, 2

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: