Arduinukyah - a Hanukkah Menorah

by rubenzilzer in Circuits > Arduino

552 Views, 0 Favorites, 0 Comments

Arduinukyah - a Hanukkah Menorah

chanukiah.png
20191222_185601.jpg
arduinukyah.jpg

A very simple Chanukya (the 8 lights nemorah ) to light one each day of Hanukkah

Made with arduino nano, leds, some resistors and a thermistor to sense the fire and light a led each time you put a flame near

Supplies

Arduino nano

8 yellow leds

one rgb led for the 'shamas'

one thermistor

8 500 ohms resistors for the LEDS

one 10K resistor for the thermistor

The Code

chanukiah.png

The code for the arduino ide:

int candles[] = {2, 3, 4, 5, 6, 7, 8, 12};

//input for the thermistor(temperature sensor) int yom = 0;

void setup() {

Serial.begin(9600);

// Set up pin modes

pinMode(inPin, INPUT);

pinMode(candles[0], OUTPUT);

pinMode(candles[1], OUTPUT);

pinMode(candles[2], OUTPUT);

pinMode(candles[3], OUTPUT);

pinMode(candles[4], OUTPUT);

pinMode(candles[5], OUTPUT);

pinMode(candles[6], OUTPUT);

pinMode(candles[7], OUTPUT);

pinMode(candles[8], OUTPUT);

pinMode(candles[9], OUTPUT);//is pin 12 (we need 9,10 ,11 for analog)

//rgb "shamas" led

pinMode(9, OUTPUT);

pinMode(10, OUTPUT);

pinMode(11, OUTPUT); \ }

void loop() { i

nt sensorValue = analogRead(A0);

//heat sensing lLED in pin A0

Serial.println(sensorValue);

//change sensor value to adjust sensitivity

if (sensorValue>50){ yom +=1;

delay(1500 );

}

if(yom>0){

analogWrite(9, random(100,255));

analogWrite(10, random(100,255));

analogWrite(11, random(100,255));

delay(100 ); }

else{

analogWrite(9, 255);

analogWrite(10, 255);

analogWrite(11, 255);

}

val = digitalRead(inPin);

// read input value for pushbutton

if (val == HIGH) { yom +=1 ; delay(500 );

if(yom > 8){yom=0;}

} i

f(yom>0){

digitalWrite(2, HIGH);

}

if(yom>1){

digitalWrite(3, HIGH);

}

if(yom>2){

digitalWrite(4, HIGH);

} i

f(yom>3){

digitalWrite(5, HIGH);

}

if(yom>4){

digitalWrite(6, HIGH);

}

if(yom>5){digitalWrite(7, HIGH);

}

if(yom>6){digitalWrite(8, HIGH);

}

if(yom>7){

digitalWrite(12, HIGH);

}

if(yom==0){

digitalWrite(2, LOW);

digitalWrite(3, LOW);

digitalWrite(4, LOW);

digitalWrite(5, LOW);

digitalWrite(6, LOW);

digitalWrite(7, LOW);

digitalWrite(8, LOW);

digitalWrite(12, LOW);

}

}