General
Here is a prototype of my new USB powered high power LED lamp. This design is based on an Arduino Nano and one 1W Olson LED from Osram (LCW_CQ7P.EC). Next to that it has some cool features:
-a 3D printed case
-laser-cutted front glas
-touch sensor
I designed a new nano shield for the Arduino with a touch sensor and a led driver (NUD4001). The brightness of the LED can be adjusted by touching the touch sensor, the Arduino changes then the LED drivers PWM signal.
The yellow ABS case was printed with a printrbot.
Demonstration
By touching the touch pad the folling states are activated:
(compare software code below)
==>[transistion: touch pad activated]
state 1:
LED on (fading down)
==>[transistion: touch pad activated]
state 2:
LED on (fading stop)
==>[transistion: touch pad activated]
state 3:
LED on (fading up)
==>[transistion: touch pad activated]
state 4:
LED on (fading stop)
Block diagramm
3D CAD model
The original models dimensions are 50x50x50mm. This model has modified dimensions, since my Printrbot is not properly calibrated. The model is also rotated about 90° with the front side looking down.
The case can be mounted on a ordinary tripod by using a 1/4″ hex nut in the case. The Arduino has its own slot on top of the case, the slot exposes the touch pad of the touch shield.
The LED is mounted on the back with the heatsink facing to the outside.
In the video you see an older version of the case.
This is the current version:
Schematic
Here you see the schematic for the Nano Shield. You’ll find the Eagle-Files (.sch and .brd below in the Download section). The
Functions:
– the Nano Shield fits exactly on a Arduino Nano
– dimming the power LED (350mA) via PWM with a NUD4001 LED driver [Datasheet]
– a touch switch on the back of the board to turn the LED on and off (uses CapSense Lib from Arduino.cc, Link)
Arduino Software
[cpp]
/*
LED USB Lamp
This program controls a high power LED via PWM and reads in a touch pad.
The circuit:
* LED attached from digital pin 3 to ground.
* touch pad connected to pin 6 and 5
Created 18 Aug 2012
By Sebastian Schuster
*/
#include <CapSense.h>
CapSense cs_6_5 = CapSense(6,5); // 10M resistor between pins 4 & 2, pin 2 is sensor pin, add a wire and or foil if desired
int ledPin = 3; // LED connected to digital pin 9
int actualState = 0;
int nextState = 0;
void setup() {
cs_6_5.set_CS_AutocaL_Millis(0xFFFFFFFF); // turn off autocalibrate on channel 1 – just as an example
Serial.begin(9600);
actualState = 0;
}
boolean readTouchpad(){
long start = millis();
long touchpad = cs_6_5.capSense(30);
boolean onOff=0;
Serial.print(millis() – start); // check on performance in milliseconds
Serial.print("\t"); // tab character for debug windown spacing
Serial.println(touchpad); // print sensor output 1
if (touchpad > 100)
onOff=1;
return onOff;
}
/*
state 0:
LED on (100%)
(transistion: touch pad activated)
state 1:
LED on (fading down)
(transistion: touch pad activated)
state 2:
LED on (fading stop)
(transistion: touch pad activated)
state 3:
LED on (fading up)
(transistion: touch pad activated)
state 4:
LED on (fading stop)
*/
int fadeValue= 255;
long timer_125ms=0;
long timer_125ms_old=0;
boolean touchpadPressed_old=0;
void loop() {
timer_125ms = millis();
long timer_diff_125ms = timer_125ms – timer_125ms_old;
//abfrage alle 500ms
if(timer_diff_125ms>125)
{
boolean touchpadPressed = readTouchpad();
switch (actualState) {
case 0:
Serial.println("State: 0");
if((touchpadPressed==1)&&(touchpadPressed_old==0))
nextState = 1;
break;
case 1:
Serial.println("State: 1");
if((touchpadPressed==1)&&(touchpadPressed_old==0))
nextState = 2;
break;
case 2:
Serial.println("State: 2");
if((touchpadPressed==1)&&(touchpadPressed_old==0))
nextState = 3;
break;
case 3:
Serial.println("State: 3");
if((touchpadPressed==1)&&(touchpadPressed_old==0))
nextState = 4;
break;
case 4:
Serial.println("State: 4");
if((touchpadPressed==1)&&(touchpadPressed_old==0))
nextState = 0;
break;
}
touchpadPressed_old=touchpadPressed;
timer_125ms_old = millis();
}
//##################################################
if(actualState==0)
{
fadeValue = 255;
analogWrite(ledPin, fadeValue);
}
else if(actualState==1)
{
fadeValue -=3;
analogWrite(ledPin, fadeValue);
}
else if(actualState==3)
{
fadeValue +=3;
analogWrite(ledPin, fadeValue);
}
//##################################################
actualState=nextState;
delay(50);
}
[/cpp]
Download
Arduino Software: http://www.zipfelmaus.com/wp-content/uploads/sites/7/2012/09/led_usb_lamp.zip
Arduino CapSense Lib: http://arduino.cc/playground/Main/CapacitiveSensor?from=Main.CapSense
Arduino Nano LED+Touch Shield: http://www.zipfelmaus.com/wp-content/uploads/sites/7/2012/09/LED_Touch_shield.zip
Nice project, especially THANKS for pointing out the NUD4001. Great little chip. One question about the schematic: Why R2?