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
}

November 18, 2018

Arduino Traffic Lights Tutorial


ARDUINO TRAFFIC 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 traffic lights on the streets. A Traffic light usually consists of three lights red, yellow and green. They switch on and off within a certain time interval. The usual cycle of traffic light starts with red light for some time, followed by a momentary yellow light as a warning and finally green light for the remaining time before switching back to red.

COMPONENTS REQUIRED

1. Breadboard
2. Arduino UNO and USB cable
3. One 5mm LED each of three colors (Red, Yellow and Green)
4. Three 20 Ohm resistors
5. Jumpers
6. A 5V DC Power supply

CIRCUIT SCHEMATICS

Traffic Light wiring schematic

Make the appropriate connections as shown in the schematic above

CODE

This is the code for simulating Arduino Traffic 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);  //red led
  pinMode(4, OUTPUT);  //yellow led
  pinMode(7, OUTPUT);  //green led
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(2, HIGH);   // turn the red led on
  delay(5000);              // wait for some time
  digitalWrite(2, LOW);    // turn the red led off
  delay(100);              // wait for some time
  digitalWrite(4, HIGH);   // turn the yellow led on
  delay(1000);             // wait for some time
  digitalWrite(4, LOW);    // turn the yellow led off
  delay(100);              // wait for some time
  digitalWrite(7, HIGH);   // turn the green led on
  delay(5000);             // wait for some time
  digitalWrite(7, LOW);    // turn the green led off
  delay(200);              // wait for some time
}

November 11, 2018

Arduino Rail Road Lights tutorial


ARDUINO RAILROAD LIGHTS TUTORIAL


INTRODUCTION

Arduino is a microcontroller which can be programmed to do certain operations like lighting led, controlling servo, etc. This is an Arduino DIY project intended to simulate Railroad lights. A railroad lighting system usually consists of two red lights flashing alternately. The time interval between both lights must be less than one second in order to experience the Railroad scenario.

COMPONENTS REQUIRED

1. Breadboard
2. Arduino UNO and USB cable
3. Two 5mm Red LED’s
4. Two 20 Ohm resistors
5. Jumpers
6. A 5V DC Power supply

CIRCUIT SCHEMATICS

Figure1 Rail road lighting schematic

Make the appropriate connections as shown in the schematic above

CODE

This is the code for simulating Arduino Railroad 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() {
  // initialize digital pin 4 and 7 as an output.
  pinMode(4, OUTPUT);
  pinMode(7, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(4, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(300);              // wait for 300 millisecond
  digitalWrite(4, LOW);    // turn the LED off by making the voltage LOW
  delay(300);             // wait for 300 millisecond
  digitalWrite(7, HIGH);
  delay(300);
  digitalWrite(7, LOW);
  delay(300);
}

November 4, 2018

Simple pendulum on Black hole


SIMPLE PENDULUM ON A BLACK HOLE


INTRODUCTION

A Black Hole is an extremely dense object in space time. It is formed after a super nova explosion if the remnant mass is greater than 5 solar masses. With a mass greater than 5 solar masses, the object collapses under its own gravity leading to a birth of a Black Hole. Consider a simple pendulum at the event horizon of a Black Hole ready to swing. A pendulum is a weight suspended from a pivot so that it can swing freely. It has a bob [mass] suspended from a frictionless pivot via a string. The central position of the bob i.e. when the pendulum is at rest is called its Mean position. When the bob is made to swing on the application of external force, it oscillates back and forth about this mean position. The maximum distance traversed by the bob from the mean position is known as amplitude. The amplitude is measured in radians which is a unit of angle. The time taken by the pendulum to complete one full oscillation is called the Time Period. For small amplitude less than 1 radian, the time period is independent of amplitude of the pendulum. We intend to determine the time period of such a pendulum on Black Hole.

A simple pendulum

ASSUMPTIONS
1. The string has no tension or compression
2. The pendulum is indestructible in the event horizon before it approaches the singularity.
3. Cosmic dust resistance is negligible
4. Effect of Gravitational Time dilation is negligible

CALCULATION

The time period of a simple pendulum is given by,
T = 2π*√ (l/g) (Eqn. 1)

Where,
T – Time period [s]
l – Length of the pendulum [m]
g – Acceleration due to gravity on Black Hole [m/s2]
g = m/s2 (Eqn. 2)     

Let the length of pendulum be
l = 1 m (Eqn. 3)

Now substitute equations (2), (3) in equation (1)
T = 2π*√ (1/)
T = 2π*√ (0)
T = 2π*0
T = 0 s (Eqn. 4)                      

This is the time period of a simple pendulum on Black Hole. The value ‘zero’ clearly proves that time does not exist or time freezes inside a Black Hole. Assuming the pendulum is indestructible, it will not oscillate and just remain stationary about its mean position. No external force however large can oscillate the pendulum because time does not exist in the first place.

CONCLUSION

We thus determined the time period of a simple pendulum on Black Hole and concluded that the pendulum will never move since time does not exist inside a Black Hole.