## Saturday, March 7, 2015

### Blinking a LED with a Timer 555

This is my first study to build a useless USB powered LED blinking gadget.

I use the classical Timer 555 to blink one LED.
I used 2 22K Ohm resistors for Ra and Rb and a 47uF capacitor (A 100uF would have been easier for computation). this give me an output frequency of 0.46/s and a duty cyle of 0.66.

To make it more prettier I am adding a 470uF capacitor and a 10k Ohm resistor to make the LED fade in and out. Though the fade out does not really work.

```/*

timer

Timer 555, 1 LEDs Blinking Schematic:
=====================================

1. Pin1 to ground
2. Connect a 0.01uF capacitor between pins 5 and 1.
3. Connect a 0.47uF capacitor between pins 1 and 6.
Negative lead of the capacitor to pin 1.
4. Connect a 22k Ohm resistor between pin 6 and 7.
5. Connect a 22kOhm pins 7 and 8.
6. Connect a pins 4 and 8 to each other (red) and pins
7. Connect a 2 and 6 to each other (yellow).
8. Connect an LED+ to pin3 LED- to ground
8. Connect Pin8(Vcc) to Power

1. Initial State
C has no changer vC == 0
vC = THRESHOLD + TRIGGER == LOW (Connected)
=> v OUTPUT HIGH == Vcc

2. Since TRIGGER == LOW -> C is charging and vC is increasing
vC = (Vcc - V0) * (1- e-t / [(RA+RB)*C])

3. vC == 2/3 Vcc
=> THRESHOLD = HIGH => OUTPUT = LOW
timeToAccumlate = 1.1*(RA+RB)*C seconds

4. C is discharging via Rb into DISCHARGE.

vC = 2/3*Vcc* ( e-t /(RB*C))
timeToDischarge = 0.7*RB*C seconds

5. When vC == TRIGGER ==1/3Vcc => TRIGGER = LOW => OUTPUT = HIGH
Goto step 2
*/

function print(s) {
console.log(s)
}

var capacitor = 47/1000/1000/1000 // 0.47uF
var capacitor = 47/1000/1000/1000*10 // 4.7uF
var capacitor = 47/1000/1000/1000*100 // 47uF
//var capacitor = 47/1000/1000/1000*1000 // 470uF
//var capacitor = 10/1000/1000/1000*100 // 10uF

var vcc = 5
var vcc13 = 1/3 * vcc
var vcc23 = 2/3 * vcc
var Ra = 8.2 * 1000 // kOmh
var Rb = 68  * 1000 // kOmh
var Ra = 22 * 1000 // kOmh
var Rb = 22  * 1000 // kOmh

var frequencyOfOutput  = (1 / ( 0.7 * ( Ra + 2 * Rb) * capacitor)) / 10
var dutyCycle    = (0.7 * (Ra + Rb) * capacitor) / (0.7 * ( Ra + 2*Rb ) * capacitor)
var dutyCycleSimplified = (Ra+ Rb) / (Ra + 2*Rb)

print("frequencyOfOutput:"+frequencyOfOutput+" per seconds")
print("dutyCycle:"+dutyCycle)
print("dutyCycleSimplified:"+dutyCycleSimplified)

```