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.
- 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.
- 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.
- 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.- 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
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.