Introduction: Color-Changeable Nightlight
Hey guys! I'd like to share my project which i've been working on for a while. This project was inspired by https://www.instructables.com/id/Interactive-Touch...Originally, the project works by measuring a difference in time between point A and point B. From the start pin it sends a signal to an endpin, the time it takes is measured with a timer. By decreasing the resistance value (moving your hand) closer to the capacitor of the sensor this time shortens, which changes the color. The original project is very interesting, however, it's kind of hard to make. Therefore, i've created my own.
So the way my project works is to spin/twist the stepper motor. By spinning it, it changes color. In total, there will be two motors (there can be a maximum of three motors, but i choose to do two) one is in charge of the color blue and another controls red.
Step 1: What Do We Need?
1. Arduino Leonardo
3. Bread board, big & small
4. Stepper motors (could be 1, 2 or 3. I personally recommend doing 2 or 3)
5. Multiple common Cathode RGB LEDs (you can have more or less depends on how much light you want)
6. 3x 330 Ohm resistors
2. Cotton or sponge (or any other transparent/translucent material)
3. Hot glue (gun)
Step 2: Step Making the Case
The came of my container is 20x12x10. It's definitely bigger than usual nightlight. I suggest that you can make it smaller. The box is made out of mainly cardboard, the strip is where you want you put your transparent material.
Details are below:
- 10x12cm for the base
- 20x12cm for the side
- 2x10cm for the transparent part (it could be as big as you want)
The cardboards are cut by sizers and a knife. And they are sticked together by hot-glue.
Step 3: Prototype and Wiring
Now we have everything and we can start wiring. But first, make a prototype to see how it works.
Here, i'm using Arduino Leonardo. But i believe the wiring also works on Arduino UNO. Follow and observe each wires and connect them on your Arduino. *avoid D3 & D11 when connecting the LED
When you finished all the wiring, download the coding on step.4. It it doesn't work, please double check your wiring or feel free to ask me questions down below.
Step 4: Coding
Now we have everything and we can start coding.
To use my code you can visit Arduino.cc or just click here.
The coding was based on the original project's coding, so you might see some places where things are added or slashed. But if you copied all of them, it should work if all your wirings are correct. But if you know a better way to code, please do so because i'm not the best at coding.
Step 5: We're Done!
If you have followed through with all off this, you should now have a working changeable light nightlight! Thanks for spending your time!