Projects/CorridorLight: Difference between revisions

Line 89:
When initially applying 5VDC the capacitor C1 starts charging through R4 and almost no current will flow through R2. The initial voltage on the positive terminal of the capacitor would be zero and it starts increasing at a rate that depends on the values of R4 and C1. As the voltage in the common node increases also does the voltage on the gate of the transistor Q1 (very small current through R2 means very small voltage drop across). Some of the current also flows through R2 and R3 operating as a voltage divider. As the capacitor charges the current through R4 goes down and so does the voltage drop, increasing the voltage on R2 which in turn will increase the voltage on the gate for Q1. When the voltage is sufficient Q1 will allow current to flow from the collector to the emitter and the LED will illuminate through the current limiting resistor R1. As the capacitor charges, the voltage on the base will be higher, the current from base to emitter will increase and the LED will shine brighter.
For switching off, after removing power the capacitor will discharge through R2 and R3 but it will still provide current to discharge through R4, R1 and D1 until the current in the gate of Q1 turns the LED off.
By chosing the values of all these components it's possible to simulate what the response time would be for the soft start/soft stop of the LED. In my case I had access to Proteus PCB Designer which includes a simulator so I could both build the schematic and test it's behaviour.
 
<br clear=all>
* Op-amp as a comparator
[[File:Opamp as comparator.png|thumb|150px|left|Op-amp as comparator]]
One of the multiple applications of an operational amplifier is working as a voltage comparator. In this configuration the op-amp works in saturated mode so it's output will change quickly from the positive supply rail voltage to the negative or ground voltage depending on whether the inverting input's voltage is higher or lower than the non-inverting input's voltage. In other words, looking at the schematic, if the voltage in terminal 3 is higher than the voltage in terminal 2, the voltage in terminal 6 will be the same voltage of terminal 7, but if the opposite happens then terminal 6's voltage will be that of terminal 4. In this case I'm using a rail-to-rail op-amp which makes this statement correct but other op-amps will have a small voltage drop and might not necessarily reach the rail voltages, either one or none of them. Connector J2 is the externally connected photodiode in photovoltaic mode with R11 as loading resistor. By adjusting the values of R9 and R10 I was able to simulate the different voltages at which I could make the op-amp trigger its output depending on the amount of light and the voltage created by the photodiode.
<br clear=all>
* AND gate with two NPN transistors