Rainbow Spark in Mini House using Maker Uno.

Rainbow Spark in Mini House using Maker Uno.

Introduction

Want to know how your house keeps brightening using a switch? Let us explore this project now by using Maker Uno !

 

Components needed :

components p1

  1. Maker Uno
  2. House DIY Kit
  3. Mini Breadboard ( 8.5 x 5.5 cm, 400 holes)
  4. Rocker Switch Small 2 pins
  5. Male-to-Male Wire
  6. White LED
  7. Resistor (1 x 220 ohms)
  8. Resistor (1 x 10k ohms)

 

Steps 

1. Anode(positive) of LED connected to the red wire. While the cathode(negative) of the LED is connected to the black wire.

Note: To understand more about LED, click here.

p1 1

2. Put the LED into the slot of the house DIY kit.

p1 2

3. Stick the wire LED with Male-to-Male wire using sellotape (like in the red circle).

p1 3

4. Connect the center and right side of the switch using different wires. 

p1 4

5. Stick the wire of the Rocker Switch with Male-to-Male wire using sellotape (like in the red circle).

p1 5

6. Pin 3.3 V is connected to positive power rails(red side of breadboard) while pin GND is connected to negative power rails(blue side of breadboard).
Put resistor 220 Ohms in terminal strips at different rows on each leg. 

Note: To understand more about Breadboard, click here. 

p1 6

7. The Anode of the LED is connected at the same row of one leg resistor. The cathode of the LED is connected to negative power rails(blue side of the breadboard).

p1 7

8. Connect the resistor to pin 4 of Maker Uno by putting the wire in the same row on the terminal strips. 

Note: To understand the Maker Uno Board, click here. 

p1 8

9. Resistor 10k Ohms was put on the breadboard. One leg of the resistor at terminal strips rows while another leg of the resistor is at negative power rails.

p1 9

10. Wire from the right side of the switch is connected to the same rows of resistors while the wire from the center of the switch is connected to positive power rails.

p1 10

11. Connect a wire from the same rows of resistors to pin 2 of Maker Uno.

Note: To understand the Maker Uno Board, click here.

p1 11

12. Connect Maker Uno and laptop/pc using USB (like in red circles).

p1 12 

13. Before proceeding to this step, Arduino IDE has been installed and some setting is needed.

Note: Follow the step of installation and setup from this website.

 

After done the installation, copy the code from the sample code section and paste it into Arduino IDE.

To select the board model, go to Tools > Board > Arduino/Genuino Uno.

Click the “Upload” upload button to upload the sample code to your Maker UNO.

code 1

13. Switch (white circle) is turned OFF, LED is not lit up.

p1 13

14. Switch (white circle) is turned ON, LED will light up.

p1 14

 

Schematic Diagram

sp1

 

Video

 

Sample Code 

int LED = 4;                              // LED at pin 4
int Button = 2;                           // Button at pin 2

void setup()
{
  pinMode(LED, OUTPUT);                   // LED as output
  pinMode(Button, INPUT_PULLUP);          // Button as input
}
void loop()
{
  if(digitalRead(Button) == HIGH)         // If Button is turned ON
     digitalWrite(LED, HIGH);             // LED will light up
  else if (digitalRead(Button) == LOW)    // If Button is turned OFF
     digitalWrite(LED, LOW);              // LED will not light up
}