Chromotherapy Christmas House by STEMaker 3d model
3dmdb logo
Thingiverse
Chromotherapy Christmas House by STEMaker

Chromotherapy Christmas House by STEMaker

by Thingiverse
Last crawled date: 3 years, 4 months ago
This project is fun because it combines arduino circuits and code with laser cutting and 3d printing. It uses an RGB LED and PWM to make a delightful chromotherapeutic holiday effect.
What you need:
Arduino Uno
Laser Cutter
3d Printer
6mm Birch wood
Plastic house or toy
3 220 Ohm resistors
jumper cables and wires
Step 1: Cut out the wood backing with a laser cutter (file included).
2: Attach the feet to the backing with glue.
3: Fasten the Arduino to backing with 3mm screws.
4: Attach mini breadboard to backing with double sided tape.
5: 3D print the clips.
6: Hook up Arduino circuit like that shown in the diagram.
7: Upload the RBG fade sketch to the Arduino.
8: Find a plastic toy to put on top.
Credits:
For the PWM code for LED:
https://create.arduino.cc/projecthub/Shahirnasar/simple-rgb-led-light-with-fade-635bc2
Code:
// variables to hold the LED color
int rVal = 254;
int gVal = 1;
int bVal = 127;
int rDir = -1;
int gDir = 1;
int bDir = -1;
// constants to name the pins
const int rPin = 11;
const int gPin = 10;
const int bPin = 9;
void setup() {
// declare the pinModes
pinMode(rPin, OUTPUT);
pinMode(gPin, OUTPUT);
pinMode(bPin, OUTPUT);
pinMode(A0, INPUT);
Serial.begin(9600);
}
void loop() {
// PWM the LED
// when using a common anode RGB LED like the ones in
// your kits, you create a voltage difference across
// each diode to light up the LED, that is, a PWM value
// of 255 will turn that light off, while a PWM value of 0
// will turn that light on fully.
Serial.println(analogRead(A0));
if (analogRead(A0) < 400) {
analogWrite(rPin, rVal);
analogWrite(gPin, gVal);
analogWrite(bPin, bVal);
// change the values of the LEDs
rVal = rVal + rDir;
gVal = gVal + gDir;
bVal = bVal + bDir;
// for each color, change direction if
// you reached 0 or 255
if (rVal >= 255 || rVal <= 0) {
rDir = rDir * -1;
}
if (gVal >= 255 || gVal <= 0) {
gDir = gDir * -1;
}
if (bVal >= 255 || bVal <= 0) {
bDir = bDir * -1;
}
} else {
digitalWrite(9, LOW);
digitalWrite(10, LOW);
digitalWrite(11, LOW);
}
// slight delay so it doesn't rotate color too quicky
delay(33);
}

Tags