Searching for an Op-Amp

On Saturday, March 3, 2018 at 10:46:42 AM UTC-6, snipped-for-privacy@notreal.com wrote:

I am not sure what is meant by "hairball", but it sounds to me like it suggests unnecessary or unnecessarily convoluted components. Please point out even one unnecessary or incorrectly placed component.

Please name one significant cognitive error, one non-functional element, or one logic flaw.

First of all, This is a fairly trivial, simple circuit. No offense to a nyone, but no one who cannot see what this does from the schematic would li kely be able to help with its design.

When looking at any object, analyze it by breaking it down into its func tional elements. For this particular design, there are only 5 fundamental elements, and they happen to be mostly functionally independent, so it's fa irly easy to analyze.

  1. The bottom left side of the drawing is separated from the other element s by two diodes, so that is a good place to start. If Vin is greater than the reverse breakdown voltage (5.6V) of the Zener diode plus the forward br eakdown voltage of the D1 LED plus the forward breakdown voltage of the Q1 Base-Emitter junction, then the Zener, D1, and Q1 will all be carrying a sm all current. The result will be the LED will illuminate, and the collector of Q1 will fall towards zero volts. This in turn will de-assert GPIO 17, informing the attached device mains power is present, and will shut down Q2 , causing the LED D4 to be dark. If Vin falls below roughly 8V - 9V, then D1 will go dark, Q1 will turn off, GPIO 17 will no longer be held low, and provided +5V is present, Q2 will conduct and D4 will light. GPIO 17, D1, a nd D4 are therefore indicators of whether mains power is present, or not. That is the extent of the functional group.
  2. To the right of this group is a simple momentary switch tied between GP IO 26 and ground. If the switch is pushed, GPIO 26 is de-asserted. From t he schematic, there is no way to tell what this does, but it is a fully sel f-contained functional group. As it happens, this is a switch to initiate a controlled soft shutdown of the attached Raspberry Pi.
  3. Moving back to the top left of the circuit, we see a functional group c onsisting of 5 resistors (1 variable, 4 fixed), a battery, a fuse, 2 diodes , an operational amplifier, a transistor, and a Solid State Relay. The fus e, of course, protects against short circuiting the battery. Resistor R25 provides a bias current to diode D9, maintaining a steady voltage on the an ode that is between about 0.5V and 0.7V above the fuse junction, which will be essentially the same as that of the positive terminal of the battery. This junction is also tied to the inverting input of U1. In normal, stable operation, the bias voltage of the inverting and non-inverting input of an operational amplifier will be very close to equal. Thus, if the circuit i s working properly, the voltage of the collector of Q6, which is also the i nput of the load of the SSR, will also be equal to between 0.5V and 0.7V ab ove the battery's terminal voltage. If the potential at this point begins to fall, then the Op-Amp's output will also fall, pulling more current from the base of Q6, causing the Q6 collector current to rise, which raises the voltage at the non-inverting input until the bias voltage once again equal s the bias voltage of the inverting input. SSR X1 is controlled entirely b y the presence of Vin. If Vin falls low, then X1 shuts off, isolating the output and the non-inverting input of U1 from the battery, preventing damag e to U1. With no boas from Vin on D9, the diode isolates the inverting inp ut of U1 from the battery. Thus, the op-amp is isolated and suffers no dam age when Vin fails.

When Vin is present, however, X2 conducts with a resistance of 5 Ohms or less, providing, within a few millivolts, the same potential at the top of R10 as appears at the anode of D9, or once again a steady value between 0.

5 and 0.7V above the battery terminal voltage. This provides a steady curr ent through R10 and R24, charging the battery at a rate determined by the v alue set for R10. The voltage across R24 in millivolts is equal to the cha rging current in milliamps. Diode D3 prevents the main power from charging the battery at a rate greater than that provided by Q6, and terminates thi s functional group.
  1. The next functional group consists of an SSR, 3 resistors, a transistor , and an LED. Whenever GPIO 19 is asserted, current flows to the base of Q
3, which in turn causes current to flow through the collector of Q3, as wel l as through LED D5 and the LED emitter internal to X2, causing D5 to illum inate and X2 to connect the battery (through D3) to the input of the next f unctional group. If Vin has failed, then the battery will still maintain power to the next element. If GPIO is de-asserted, then R8 will insure the re is no bias voltage on Q3, and Q3 is shut off, extinguishing D5, and isol ating the battery from the input to the next group. If GPIO 19 and Vin are both low, then X1, X2, and D9 all prevent the battery from discharging. I t is unknown from the schematic when or how GPIO 19 is asserted, but whenev er it is, power will be supplied to the rest of the circuit whether the mai n supply is active, or not. Presumably GPIO 19 will only be asserted after main power is present, and will be de-asserted at some point after it fail s to shut down the circuit entirely.

The last functional group (other than the DC-DC converter and the load) con sists of 2 transistors, a resistor, and a momentary switch. Whenever power is supplied by either the battery or the main supply to the emitter of Q5, as long as the switch contact is open, then current flows through the base to R13, causing the transistor to saturate, pulling the collector to withi n a tenth of a volt or two of the supply voltage. This in turn causes Q4 t o saturate, providing power to the DC converter less than 1V below the cath ode of D2 or D3, whichever is higher. If SW2 is pressed, the base of Q5 is shorted to the emitter, shutting it down, and causing power to the DC - DC converter to be interrupted, forcing a hard reset.

Reply to
Leslie Rhorer
Loading thread data ...

Here is the latest iteration of the project, includin g both the charger and the switching hardware, but san s the monitoring hardware:

V zener meant to go to +5V?

ipped in when I was tidying up the schematic. It's fi xed, now. The page may need to be force-reloaded in y our browser in order to update.

ht about eliminating X2 and implementing that

tionality in Q4/Q5?

ve essentially three relays here, but discarding one w on't work. X2 disconnects the battery and only the ba ttery when GPIO 19 is low. It is not possible to asse rt GPIO 19 until after the RPi is booted up, so whatev er feeds the RPi from both power feeds must be Normall y Closed, and not controlled by the RPi in any way. T hat constitutes 1 unique relay - Q4/Q5 in this case. Since it is a shutdown facility, it does need to be f ed from both 1N54504 diodes. Meanwhile, the battery s hould always remain disconnected from the power train unless the RPi actively connects it during live operat ion. That constitutes a second, unique, Normally Open relay, X2. Finally, X1 is also Normally Open, becaus e it isolates U1 from the battery whenever the mains f ail, to prevent damage to U1. Whenever the mains fail , X1 must be de-energized, but if the RPi is up and ru nning, then both X2 and Q4/Q5 must remain energized at all times. That makes three unique relays, with no w ay I can see for any one relay to take over the job of either of the other two. Here is a Boolean table:

1 0 - -
1 0

elay cannot be reconciled with any other relay, and ea ch relay has at least one non-deterministic state when the other two relays in turn have a deterministic sta te. Either of these facts would prevent one relay from doing the job of any other relay.

hypothetically replace Q4/Q5 with a relay, but the rel ays cost a bit more. Replacing X1 with a transistor p air wouldn't work as well as the relay. I suppose I c ould replace X2 with a PNP transistor.

Lift the bottom of R13 so instead of going to ground it connec ts to the collectors of two NPN transistors, each em itter grounded. Base of one is driven by GPIO-19 so that when GPIO-19 is high that transistor conducts a nd turns on Q4/5. Base of other is driven by the mains power present detector so that whenever mains power is present the Q4/5 pair is on irrespective of the state of GPIO-19.

If you prefer you can think of it as the relay Q4/5 being driven by the logical OR of GPIO-19 and mains power.

piglet

Reply to
piglet

Hmm. Yeah, it looks like that would work. Thanks for spotting it. Ins tead of 2 additional transistors from R13 to ground, I could add one transi stor with a bias resistor to R13 and then simply attach R12 to the base of Q5, adjusting its value a bit. I've already sent in this version of the pr ototype for printing, but I will consider this for the next revision, once I run out of my current stock of VO14642AT SSRs. It doesn't save much boar d real estate, if any, but it is $1 cheaper per board, give or take.

Thanks!

Reply to
Leslie Rhorer

Oh, for crying out loud! I don't need another transistor to implement Piglet's idea. There already is one! Q1 can do the job, as long as the gain of Q4 and Q5 is high enough. It's nice and symmetrical.

Reply to
Leslie Rhorer

Here is how the next production run will likely look:

formatting link

Reply to
Leslie Rhorer

RPi won't work with less than 4.95V. Your layout only delivers 4.3 - 4.5V from the mains supply, and as the battery discharges, it also may deliver less than 4.95V.

Really? So the RPi has a 1% tolerance on its power supply, that's a new one . And what kind of newbie commits to a circuit based on what "may" be the c ase, except for one who doesn't know how to do his homework.

nverter.

an option, or at least not a good one. Much of the battery capacity will remain unused. Not only that, but 6V batteries are only "cheaper" in the s ense they result in a lower gross capital outlay per ampere-hour. They are more expensive per watt-hour, which is the important figure.

The voltage of NiMH is essentially flat throughout the discharge cycle maki ng watt-hour and ampere-hour equivalent. And from what I can see, the 5-pac k 6V NiMH is quite popular in the RC world.

t 6V. That is only 12 watt-hours of capacity, of which perhaps half could be used. He might not even get an hour of backup. Using 9.6V at 3800mAH x 2, I will be getting around 73 watt-hours, of which close to 90% could be used. The user may choose even larger batteries. The prototype should get easily a day of backup.

You do understand the 2000 mAh is for AA cells. If you go to D-cells, that becomes 10,000 mAh. And it sounds like you're confused about capacity of co mposite cell battery configurations. The capacity of a series of cells is t he capacity of single cell, it is not multiplied by the number of cells. An d as far a extracting over 90% of the stored cell energy, it is a no braine r with NiMH because the terminal voltage is essentially unchanged throughou t the discharge cycle.

Looks like your understanding of battery technology is lacking. And, as har d as it is to believe, you know even less about the power supply requiremen ts of digital logic. You have no idea about such things as "recommended ope rating voltages" and tolerances like +/- 5% and so forth.

Reply to
bloggs.fredbloggs.fred

X1 is strange, better replaced with non-isolated BJTs.

--
 Thanks, 
    - Win
Reply to
Winfield Hill

Blow up green LEDs?

Apparently it is supposed to be a UPS for a Raspberry Pi. Since I have one lying around and load of ex laptop power bricks with outputs that are mostly 17+/-2v and >=3A capacity it strikes me that they represent an ideal free power source that the device should be designed to use.

This input specification is different to the OPs 12v requirement and leaves enough headroom for charging nominal 12v SLAs.

I'll have a go at a specification I would use if I were to make one. I'm not sure I'll bother since mine spends most of its time off.

Input: 15-20v @ 3A Output: 5v regulated @ 1-2A max (usually under 700mA for RPi)

Capable of charging NiMH or SLA batteries at C/5 or C/2 until close to full charge and then float charge at

Reply to
Martin Brown

On Monday, March 5, 2018 at 8:53:21 PM UTC-6, snipped-for-privacy@gmail.com wrot e:

he RPi won't work with less than 4.95V. Your layout only delivers 4.3 - 4.

5V from the mains supply, and as the battery discharges, it also may delive r less than 4.95V.

ne.

Officially it is 5%, but I can tell you from direct personal experience the Pi3 will not boot reliably on less than 4.95 volts. Nevertheless, 6V d efinitely exceeds the published maximum of 5.25V, and 5 NiMH or NiCd cells under charge will exceed 6V. I don't have any NiCd cells handy, but the 8 cell NiMH pack I hold in my hand is currently sitting at 10.2V under charge . Interpolating to 5 cells comes up with 6.375V.

se, except for one who doesn't know how to do his homework.

I wouldn't know. I have been doing this for over 40 years. I think tha t qualifies me as something other than "newbie". To answer the question, h owever, any engineer who does not consider what a user might reasonably do or under what conditions the proposed device might reasonably hve to perfor m is not doing his job.

converter.

ot an option, or at least not a good one. Much of the battery capacity wil l remain unused. Not only that, but 6V batteries are only "cheaper" in the sense they result in a lower gross capital outlay per ampere-hour. They a re more expensive per watt-hour, which is the important figure.

king watt-hour and ampere-hour equivalent. Only if the number of cells and the size of the cells is constant. Allowing the user to choose a variety of chemistries, number of cells, and battery capacities is one of the corne rstones of this design. If you do not understand how this is of value to c onsumers or how this will broaden the number of potential consumers of the product, then you understand neither consumers nor economics.

rld.

This isn't for RC.

t becomes 10,000 mAh.

There are a lot more than AA or D cells out there, or didn't you know? I'l l ignore AAA, for the time being, but cells range from C to N, to all other manner of individual cells. There are plenty of different capacity batter y packs using various individual cell sizes, as well.

y configurations. The capacity of a series of cells is the capacity of sing le cell, it is not multiplied by the number of cells.

I am not confused about any such thing, and you are quite wrong. If it "so unds" to you like I am confused, then you aren't listening. I have not bee n confused about the difference between series connections and parallel con nections since 1972. For a given cell size, the energy capacity of 2 cells is twice that of 1 cell, regardless of whether the connection is series or parallel. Assuming for the moment the efficiency of the voltage down-conv ersion is the same at any input voltage, then a 6V, 1AH battery pack has pr ecisely the same capacity as a 3V, 2AH battery pack. The difference is for a given load the converter will draw twice the current with the 3V pack. Again, assuming essentially the same conversion efficiency, the capacity of the battery pack is equal to the total amount of stored energy, not its ch arge storage capacity. Multiply its rated AH capacity by its terminal volt age.

iner with NiMH because the terminal voltage is essentially unchanged throug hout the discharge cycle.

Don't tell that to the people who make the battery charge meters for device s. Yes, it is flatter than Alkaline, or even NiCd, but calling it "unchang ed" is a stretch. It is not relevant to my point, however. The cell conta ins a certain amount of charge, one may extract various fractions of the ch arge during use, but deep-cycling a cell beyond a certain point is not reco mmended, even for batteries that are specifically designed for deep-cycle u se.

ard as it is to believe, you know even less about the power supply requirem ents of digital logic. You have no idea about such things as "recommended o perating voltages" and tolerances like +/- 5% and so forth.

I have multiple decades of experience with designing and troubleshooting po wer systems supplying RTL, DTL, TTL, I^2L, and ECL logic, not to mention de signing systems using those logic families. Your assumptions are showing, and they are not good.

None of which has to do with the design at hand, which is working well.

Reply to
Leslie Rhorer

How is it strange? It doesn't drop a significant amount of voltage duri ng operation, which is critical, and it is largely agnostic of the input po tential, which is also close to critical. I can certainly think of a BJT s olution, but not one that isn't much more complex and not which does not us e more space and probably more money.

Reply to
Leslie Rhorer

You may find need to add a resistor across Q6 E-B to form a divider with R26 as the output swing of U1 is unlikley to go high enough to be able to reliably turn off Q6. TL071 is a good general purpose part but does not have rail to rail output stage. As drawn it is vulnerable to reverse connected supply.

piglet

Reply to
piglet

I concur. Allowing the user to employ what he has laying around is part fo the idea. I selected 12V as a minimum because it is extremely common, and allowing an input smaller than 12V produces no end of problems. It is also what I will be using on a number of systems, although in most cases the su pply will be servicing a great deal more than just the RPi, so their capaci ties in some cases will exceed 1000 watts / 80 Amperes.

Not at all. I specified 12V as a minimum, not an absolute. Note 12V suppl ies are very common and inexpensive in a wide range of capacities.

Yes, but the ADDS1115 from Texas Instruments is fairly inexpensive and v ery easy to deploy. I am using it (see TP 1-4 in the drawing) to monitor V in, Vout, Vbatt, and the voltage across R24, which gives us the charging cu rrent to the battery.

Hear, hear.

While the point is certainly valid, adding another rectifier also adds an other voltage drop, and with Vin already being very close to Vbatt, another voltage drop, even a small one, will really make things difficult. I coul d add a BJT with a reasonably high BC reverse voltage, I guess, but even t hat make things awfully tight with a 9.6V battery and a 12V supply. I supp ose I could add a DAC for the battery charge function. That would help all eviate the small Delta-V, and allow for very sophisticated charging. I cou ld even allow for LiPo and Li-ion chemistry.

I'm afraid I am not following. I know what a golden ratio is, but aprop os to what in this context?

Reply to
Leslie Rhorer

I believe it will. That is to say it should never have to cut off Q6 en tirely. It is expected to float somewhere around Vin - 2V or so in order t o be able to deliver a steady 10 - 100mA on the emitter of Q6. The TL071 s hould be able to deliver within a volt or so of Vin, which should be suffic ient to this purpose. That, and its low cost and high availability is why I chose it.

True, but then so is the rest of the circuit. Yes, I know it is not goo d and I know it would be a good idea to make it reverse polarity immune. I may look into this further before production. For the prototypes, it is f ine. That, and this is certainly not the only device out there to be vulne rable to a reversed supply. I personally have let the magic smoke out of m ore than a few components in my day by accidentally hoking them up backward s.

Reply to
Leslie Rhorer

I think that you've defined the key issue here. There are many UPS solutions for the Raspberry Pi and all seem to use a single cell Li-Ion battery and a the normal 5V 1A charger. The inflexibility is not a bad thing in this case.

To automatically detect the type of battery connected, and the proper charging protocol (voltage, current, temperature, EOC) is not impossible, but is non-trivial.

Reply to
sms

ood and I know it would be a good idea to make it reverse polarity immune. I may look into this further before production. For the prototypes, it is fine. That, and this is certainly not the only device out there to be vul nerable to a reversed supply. I personally have let the magic smoke out of more than a few components in my day by accidentally hoking them up backwa rds.

Trouble is it'll make you liable & get the product a bad rep. Users will ju st deny it.

NT

Reply to
tabbypurr

Using 12v as a minimum makes life more difficult than it needs to be.

12v represents one of the few PSUs I have been obliged to actually buy.

I have a drawer full of ex scrapped laptop PSUs bricks accumulated over the years that I can give to people who need them. Setting 15v as the working minimum makes it possible to use SLA nominally 12v.

Two resistors and links to get four values in a geometric progression.

1/phi, 1, phi, 1+phi

__o 1 o_________ | __|A|__|_o 2 o_ | _________o 3 o_|_|B|___

Link 1 = A Link 2 = A+B Link 3 = B Link 1&2 = A||B Link 1&2&3 = 0

Select B = phi*A

It will be OK in E12 with phi taken as 1.5. It is close to perfect in E24 eg. 10R & 16R

Even if you set A=B you still get

A/2 A 2A & 0

Breaking the degenerate case carefully gets an extra value for free.

--
Regards, 
Martin Brown
Reply to
Martin Brown

BTW: Do you have something against Schottky diodes?

1N5821 is half the price, would only drop about half the voltage that an 1N5404 does and isn't flagged as legacy not recommended for new designs.
--
Regards, 
Martin Brown
Reply to
Martin Brown

No, it doesn't. First of all, it is what I, myself, require. The first four of these will be for me. All of the deployments have 12V supplies in place, with capacities from 850 to 1200 watts. It is nice you have some 1

7V bricks sitting around, but I don't, and neither does my preliminary mark et. Furthermore, adding an additional power supply to the existing enclosu res presents a very significant set of issues, includng the fact there is n ot enough additional room in the enclosures to add another supply, and the fact the AC power does not penetrate the enclosures. Adding another AC fee d would not be pretty.

My preliminary market for these devices will be the DIY holiday lighting enthusiasts, the vast majority of whom are using 12V equipment. Some of th e newest equipment does support 16V, and there is some 24V equipment out th ere, but by far the largest sector of the users employ ATX computer power s upplies with 12V waterproof supplies coming in second. I use both, but the Raspberry Pi enclosures all have ATX supplies.

I am very painfully aware of how much extra trouble making 12V a lower li mit for this build engenders, but I am quite adamant it is the correct desi gn target. If it had not been, then I would never have needed to query her e for what I feared in the first place might have been being a unicorn part . Indeed, even 12V is pretty easy if one limits the batteries to no more t han 8V.

That is very nice for you, and I do not want to exclude people such as yo u from the demographic if possible. Indeed, allowing the flexibility to em ploy up to 18V adds very little in the way of difficulty to the project, an d as such is more than reasonable, IMO. Excluding 12V, however, will kill off much of my primary market, including me.

Reply to
Leslie Rhorer

formatting link
ATX dc-dc supplies 12v-24v etc.

Reply to
Sjouke Burry

No. I looked at several, and none seemed to have the needed specs. This one looks pretty good, however.

Reply to
Leslie Rhorer

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.