Heidi Wang

Fade

Goal

Schematic

schematic for circuit with 3 LEDs and button

Each diode and switch is wired to its own pin providing power.

The 3 diodes all connect to the same ground.

The calculation below yielded the minimum resistances needed.

Calculation

Red and Green LEDs:

calculation for resistance needed for Red and Green

Blue LED:

calculation for resistance needed for Blue

Pushbutton:

Pushbuttons were rated for 50mA on the datasheets (octopart).

calculation for resistance needed for button

220 Ohm resistors were used for all 4 resistors across 3 different situations.

Circuit

circuit with 3 LEDs and button

Firmware

link to code file

Notes

  1. The voltage is assumed to be across an LED with a 1.8V drop.

    Voltage over time for analogWrite with 3 duty cycles

    Red = 64, Green = 128, Blue = 255

    voltage over time for analogWrite with 3 duty cycles
  2. With 3 LEDs that draw 20mA of current each, i.e. 60 total in parallel, a 1200mAh battery can power the circuit for 1200mAh / 60mA = 20 hours.

  3. The voltage across my 3 LEDs when all were on was: R 1.96 G 2.67 B 2.66V. The theoretical voltage drop for R and G is 1.8V, while for B is 3.3V. The actual voltage across was greater for R and G and less for B.