November 25, 2018

Arduino Street lights tutorial


ARDUINO STREET LIGHTS TUTORIAL


INTRODUCTION

Arduino is a microcontroller which can be programmed to do certain operations like lighting led, controlling servo, etc. This is a DIY Arduino project intended to simulate street lights. Currently due to advancements in technology, LED’s are replacing incandescent, fluorescent and halogen lamps. LED’s are inexpensive, robust and most importantly efficient. LED’s are already powering many parks, homes, streets in cities and villages. They themselves are recharged by solar power thus they represent a completely green source of energy.

COMPONENTS REQUIRED

1. Breadboard
2. Arduino UNO and USB cable
3. 5mm White LED’s (10 numbers)
4. 20 Ohm resistors (10 numbers)
5. Jumpers
6. A 5V DC Power supply

CIRCUIT SCHEMATICS

Figure.1 Arduino Street lights schematic

Make the appropriate connections as shown in the schematic above

CODE
This is the code for simulating Arduino Street lights. Note that this code is valid only for the particular schematic represented in figure1. The values and choice of ports can always be changed. 

Copy and paste the code in Arduino IDE sketch area.

void setup() {

  pinMode(2, OUTPUT);  //white led1
  pinMode(3, OUTPUT);  //white led2
  pinMode(4, OUTPUT);  //white led3
  pinMode(5, OUTPUT);  //white led4
  pinMode(6, OUTPUT);  //white led5
  pinMode(7, OUTPUT);  //white led6
  pinMode(8, OUTPUT);  //white led7
  pinMode(9, OUTPUT);  //white led8
  pinMode(10, OUTPUT);  //white led9
  pinMode(11, OUTPUT);  //white led10
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(2, HIGH);   // turn the white led1 on
  digitalWrite(3, HIGH);    // turn the white led2 on
  digitalWrite(4, HIGH);   // turn the white led3 on
  digitalWrite(5, HIGH);    // turn the white led4 on
  digitalWrite(6, HIGH);   // turn the white led5 on
  digitalWrite(7, HIGH);    // turn the white led6 on
  digitalWrite(8, HIGH);   // turn the white led7 on
  digitalWrite(9, HIGH);    // turn the white led8 on
  digitalWrite(10, HIGH);   // turn the white led9 on
  digitalWrite(11, HIGH);    // turn the white led10 on
}

No comments:

Post a Comment