I would like to build a crib for putting it underneath my Christmas tree. We used to have a really nice one, that we built ourselves at my parents house and now its time to have my own one. Material for the crib: I plan to use mostly wood for the laser cutting and PLA for the 3D printed figures. But it might also be possible to mold the figures. I haven’t molded before, so I would be very happy to hear what material to use for this best.
For the water pump I was planning I looked into some ideas, how to build it. Here are two links that provide information about a little water pump:
https://www.youtube.com/watch?v=-7bkJgjcnN0
http://www.instructables.com/id/Arduino-Automatic-Watering-System-For-Plants/
I have different ideas for what to use a PCB for: I want to have a the star on top of the crib. Another idea is a water pump for water for the cow etc.. Maybe it would also be possible to have a little interface screen at the crib, on which little messages can be shown (e.g. happy first Advent).
In week seven, where we were asked to built something big, I already built the christmas crib housing using the CNC milling machine. My final housing consists of the walls built in this assignment and the roof made out of cardboard using the lasercutter. As I already documented the walls (see link above), I will describe here only the process of fabricating the roof and the decoration of the outer walls.
What I changed: E.g. the second board does not feature a water level sensor know, as I decided that water should just flow if I actively decide that I want it. The big board does include a WS2812 stripe for my crib light which is turned on/off according to the light that surrounds it. The morning star features a button now.
#include
#include
#include
#include
#include
#ifdef __AVR__
#include
#endif
#include
#include
//OLED Display
#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);
#define NUMFLAKES 10
#define XPOS 0
#define YPOS 1
#define DELTAY 2
#define LOGO16_GLCD_HEIGHT 16
#define LOGO16_GLCD_WIDTH 16
#if (SSD1306_LCDHEIGHT != 32)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif
//Crib Light
#define PIN 17
#define NUM_LEDS 38
#define BRIGHTNESS 50
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, PIN, NEO_GRBW + NEO_KHZ800);
int photoresistorPin = 16;
int sensorValuePhotoresistor = 0;
//Morning Star
int lEDStarPin = 14;
int buttonPin = 15;
int buttonState = 0;
//Bluetooth
int bluetoothRXPin = 0;
int bluetoothTXPin = 1;
void setup() {
Serial.begin(9600);
// by default, we'll generate the high voltage from the 3.3v line internally! (neat!)
display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3C (for the 128x32)
// init done
// Show image buffer on the display hardware.
// Since the buffer is intialized with an Adafruit splashscreen
// internally, this will display the splashscreen.
display.display();
delay(2000);
// Clear the buffer.
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(10,5);
display.print("Merry Christmas");
//Christmas Tree
display.drawPixel(50, 15, WHITE);
display.drawPixel(51, 16, WHITE);
display.drawPixel(49, 16, WHITE);
display.drawPixel(52, 17, WHITE);
display.drawPixel(48, 17, WHITE);
display.drawPixel(53, 18, WHITE);
display.drawPixel(47, 18, WHITE);
display.drawPixel(48, 18, WHITE);
display.drawPixel(52, 18, WHITE);
display.drawPixel(49, 18, WHITE);
display.drawPixel(51, 18, WHITE);
display.drawPixel(49, 19, WHITE);
display.drawPixel(51, 19, WHITE);
display.drawPixel(52, 20, WHITE);
display.drawPixel(48, 20, WHITE);
display.drawPixel(53, 21, WHITE);
display.drawPixel(47, 21, WHITE);
display.drawPixel(54, 22, WHITE);
display.drawPixel(46, 22, WHITE);
display.drawPixel(55, 23, WHITE);
display.drawPixel(45, 23, WHITE);
display.drawPixel(54, 23, WHITE);
display.drawPixel(46, 23, WHITE);
display.drawPixel(53, 23, WHITE);
display.drawPixel(47, 23, WHITE);
display.drawPixel(52, 23, WHITE);
display.drawPixel(48, 23, WHITE);
display.drawPixel(52, 24, WHITE);
display.drawPixel(48, 24, WHITE);
display.drawPixel(53, 25, WHITE);
display.drawPixel(47, 25, WHITE);
display.drawPixel(54, 26, WHITE);
display.drawPixel(46, 26, WHITE);
display.drawPixel(55, 27, WHITE);
display.drawPixel(45, 27, WHITE);
display.drawPixel(56, 28, WHITE);
display.drawPixel(44, 28, WHITE);
display.drawPixel(57, 29, WHITE);
display.drawPixel(43, 29, WHITE);
display.drawPixel(56, 29, WHITE);
display.drawPixel(44, 29, WHITE);
display.drawPixel(55, 29, WHITE);
display.drawPixel(45, 29, WHITE);
display.drawPixel(54, 29, WHITE);
display.drawPixel(46, 29, WHITE);
display.drawPixel(53, 29, WHITE);
display.drawPixel(47, 29, WHITE);
display.drawPixel(53, 30, WHITE);
display.drawPixel(47, 30, WHITE);
display.drawPixel(53, 31, WHITE);
display.drawPixel(47, 31, WHITE);
display.display();
//Crib Light
// This is for Trinket 5V 16MHz, you can remove these three lines if you are not using a Trinket
pinMode(photoresistorPin, INPUT);
//pinMode(LEDPin, OUTPUT);
#if defined (__AVR_ATtiny85__)
if (F_CPU == 16000000) clock_prescale_set(clock_div_1);
#endif
// End of trinket special code
strip.setBrightness(BRIGHTNESS);
strip.begin();
strip.show(); // Initialize all pixels to 'off'
//Morning Star & Bluetooth
pinMode(buttonPin, INPUT_PULLUP);
pinMode(lEDStarPin, OUTPUT);
}
void loop() {
//OLED display
display.startscrollright(0x00, 0x0F);
delay(2000);
display.stopscroll();
delay(1000);
display.startscrollleft(0x00, 0x0F);
delay(2000);
display.stopscroll();
delay(1000);
display.startscrolldiagright(0x00, 0x07);
delay(2000);
display.startscrolldiagleft(0x00, 0x07);
delay(2000);
display.stopscroll();
//Crib Light
sensorValuePhotoresistor = analogRead(photoresistorPin); // read the value from the sensor
Serial.println(sensorValuePhotoresistor);
sensorValuePhotoresistor = map(sensorValuePhotoresistor,0,1023,0,255);
Serial.println(sensorValuePhotoresistor);
if (sensorValuePhotoresistor < 125) {
Serial.println("Not enough light");
for(int i=0;i < NUM_LEDS;i++){
strip.setPixelColor(i, 255, 0, 255);
strip.show();
}
}
else{
Serial.println("Enough light");
for(int i=0;i < NUM_LEDS;i++){
strip.setPixelColor(i, 0, 0, 0);
strip.show();
}
}
// Morning Star Light
buttonState = digitalRead(buttonPin);
//Serial.println(buttonState);
if (buttonState == 0){
digitalWrite(lEDStarPin, HIGH);// turn the LED on
}
else {
digitalWrite(lEDStarPin, LOW); //turn the LED off
}
//Bluetooth
while(Serial.available()) {
int command = Serial.read();
Serial.print(command);
if (command == 49){
On();
}
else {
if(command == 48) {
Off();
}
}
}
delay(100);
}
void On(){
digitalWrite(lEDStarPin, HIGH);
}
void Off(){
digitalWrite(lEDStarPin, LOW);
// delay(15);
}