* This is a multi-part post. Here are links to all parts:
Part 1: Overview and bill of materials, this post
Part 2: Assembly
Part 3: DC motor control
Part 4: RGB LED control
This month’s project uses the Arduino to control a motor and an RGB LED to create an aquarium style spinning night light.
The initial idea was to recycle empty toilet paper tubes to serve as the lampshade, but it turns out the project looks much more attractive and colorful using white paper. (I haven’t given up on the idea of finding a use for the empty tubes, though. Suggestions are welcome.)
A simple DC motor is used to spin the lamp structure, and a jar lid serves as the base. There is (a lot of) room for improvement in the design of the lamp, but I’m a computer scientist and wanna-be crafter at best.
I intend to revisit these projects in the future, and make them stand alone using smaller Arduino boards and sporting a nicer finish (something worthy of showing guests). For now the purpose of these projects is solely educational (in a microcontroller programming way, not hand crafting).
In the upcoming posts we will explore the assembly of the night light, as well as the circuit and Arduino sketch that make the project work.
Parts list:
- Arduino
- Mini breadboard
- DC motor
- RGB LED
- 1N914 diode
- 2N3904 transistor
- 100 Ohm resistor
- 150 Ohm resistor
- 82 Ohm resistor
- Soldering iron (this is an affordable one. There are also cooler looking digital ones like the Hakko)
- Solder
- Heat shrink tubing / wire wrap
- Jumper wire of assorted lengths
- White paper
- Jar lid
- Mounting tape
I have recorded a short video of the Arduino RGB LED Spinning Night Light in action.
And here is the Arduino sketch:
// www.TinkerHobby.com // Natalia Fargasch Norman // RGB LED night light using Arduino // Arduino pins used for motor and LEDs #define MOTOR 3 #define RED 9 #define GREEN 10 #define BLUE 11 // pins for motor and LEDs are outputs void setup() { pinMode(MOTOR, OUTPUT); pinMode(RED, OUTPUT); pinMode(GREEN, OUTPUT); pinMode(BLUE, OUTPUT); } void loop() { // set motor speed, between 0 and 255 analogWrite(MOTOR, 69); // fade from aqua to magenta for (int i = 0; i < 256; i++) { analogWrite(RED, 255-i); analogWrite(GREEN, i); analogWrite(BLUE, 0); delay(50); } // fade from magenta to aqua for (int i = 0; i < 256; i++) { analogWrite(RED, i); analogWrite(GREEN, 255-i); analogWrite(BLUE, 0); delay(50); } }
the great thing about LED light is that they do not generate lots of heat;`:
the soldering iron that i use is employing a ceramic heating element;-.