From blwiki
Jump to: navigation, search

Microprocessor Controlled Dimmable Light with 18 White LEDs



We wanted a small bright light source to illuminate the bed of our MendelMax 1.5 3D Printer so we initially created a 12 LED light. It didn't work nearly as well as we had hoped. To put it simply, it didn't dim all that well. To fix the design we would have to change the Pulse-Width-Modulation (PWM) circuitry to make the pulse width go from 0%-100%. That change to the "simple" 555 circuit of the 12 LED Light was just too complicated and expensive (diodes, extra resistors, etc).

So we thought we'd try a different approach. We really wanted the brightness to be controllable either through a pot OR from a spare control line from our 3D Printer Electronics. It's really hard to do PWM much simpler than with an ATTiny (8-pin Arduino Compatible). Since the ATTiny digital output pins can't drive multiple chains of LEDs from an output pin, switching transistors were needed to drive the LEDs.


  • Atmel ATTiny85 Microprocessor based design
  • Software/Hardware Controllable functionality
    • Controllable brightness or On/Off control via analog/digital input pin
      • Potentiometer can be used to control brightness level (analog)
      • MicroProcessor can be used to control On/Off (5V signal level)
      • Can be re-configured via software download
    • Software control can allow for smoother functions like blooming on/off (digital on/off mode)
  • Power Compatibility
    • 12V operation matches available RepRap electronics power
    • 12V to 5V Regulator for ATTiny85 power
  • ISP Connector so the program could be downloaded on card (the ATTiny can be soldered in without a socket)

Multiple LED Drive Circuit

This Maxim Whitepaper explains why LEDs should not be connected in parallel. Here is the current vs forward voltage curve for some LEDs from the same batch from that paper:


This shows why it is crucial to control the current into the LEDs to maintain consistent lighting across the LEDs. One way to do this is to have controlled current to each LED. Another way is to drive LEDs in series for a consistent current.

  • LED-18 has 6 LED chains with 3 LEDs per chain
    • Forward voltage drop typically 3.6V for white LEDs
    • Curve is relatively a straight line between 3mA and 10mA
      • Slope is (3.6-3.1)V/(10-0)mA = 50V/A
    • Y intercept is about 3.1V
    • Therefore equation of the line is V = 3.1 + 50*i
    • 3 times 3.6V = 10.8V is the voltage drop across the three LEDs
    • For a power supply of 12V, 12V (power supply) - 10.8V (LED drop) = 1.2V
  • Using standard 2N3904 transistors as LED chain driver
    • Vce sat = 0.2V, so current limiting resistor will have 1.2-0.2V = 1.0V
    • Collector resistor - 1.0V / 10 mA would be 100 ohms series resistance



Connector Pinouts

P1 Power Connector

The board is powered from +12V which is brought in through a 5mm screw terminal block. Care needs to be taken to ensure that power is not reversed since the card has no power protection.

Pin No. Description
1 Ground
2 Power (+12V)

P2 - ISP Connector

The LED-18 board has a connection for an ISP download cable can be used to download the program into the ATTiny85 microprocessor. The GVSDuino board has an ISP programming cable connector on pins 1-6.


Connector Pin ATTiny85 Pin Function (Programming) Arduino Function Programmer Pin
1 6 MISO D1 D12
3 7 SCK D2 D13
4 5 MOSI D0 D11
5 1 RESET*   D10

RV1 Connector

Three pin, 0.1" Pitch, connector. These connections can go to a potentiometer where pins 1 and 3 go to the outside pins and pin 2 goes to the wiper.

Pin Description
2 Brightness


Board Layout/Mounting Hole Dimensions


Box/Board Model

The Box and board Sketchup models are here.


Board Design Files

Board Design files on GitHub

Software Files

LED-18 code Github repository

// LED-18
// This code works with the LED-18 board.
// The wiki page for the board is at:
//   http://land-boards.com/blwiki/index.php?title=LED-18
// This code reads an external variable resistor, scales the resistor 
// and writes out the value of the resistor to a PWM pin.
// This code runs on an ATTiny85.

int led = 0;           // LED pin
int potPin = 1;        // Pot pin

// setup() - Configures the LED line to be an output
//  setup is run once at the start.

void setup()  
  pinMode(led, OUTPUT);

// loop() - reads the pot and returns 10-bits (0-1023). 
// It then scales that from 10-bits to 8-bits (0-255).
// The value is then fed to the PWM output which goes to the LED drivers.

void loop()  
  int brightness = 0;    // Variable which contains how bright the LED is
  brightness = analogRead(potPin);  // read the pot
  analogWrite(led, brightness>>2);  // scale and write out to LED driver pin
  // wait for 30 milliseconds to see the dimming effect