American International University of Bangladesh
American International University of Bangladesh
American International University of Bangladesh
Faculty of engineering
Report No 02
Experiment Implementation of a traffic control system with Tinkercad.
Name
9.
__________
Title: Familiarization with tinkercad , study of blink test using and implementation
of a traffic control system using microcontrollers.
Introduction:
The objective of this experiment is to get familiarized with ARDUINO UNO.
1.Learning to make the LED blink using Arduino and the delay functions
Equipment:
(a) 3 LED lights (RED,GREEN and YELLOW)
(b) 200 ohms (3)
(c) resisters and jumper wires
(d) one Arduino
GND : Short for „Ground‟. There are several GND pins on the Arduino, any of
which can be used to ground your circuit.
5V & 3.3V : As you might guess, the 5V pin supplies 5 volts of power, and the
3.3V pin
supplies 3.3 volts of power. Most of the simple components used with the Arduino
run
happily off of 5 or 3.3 volts.
Analog: The area of pins under the „Analog In‟ label (A0 through A5 on the UNO)
are
Analog Input pins. These pins can read the signal from an analog sensor (like a
temperature
sensor) and convert it into a digital value that we can read.
Digital : Across from the analog pins are the digital pins (0 through 13 on the
UNO). These
pins can be used for both digital input (like telling if a button is pushed) and digital
output
(like powering an LED).
PWM : You may have noticed the tilde (~) next to some of the digital pins (3, 5, 6,
9, 10, and 11 on the UNO). These pins act as normal digital pins, but can also be used
for something
called Pulse-Width Modulation (PWM, think of these pins as being able to simulate
analog
output (like fading an LED in and out).
AREF : Stands for Analog Reference. Most of the time you can leave this pin
alone. It is
sometimes used to set an external reference voltage (between 0 and 5 Volts) as the
upper limit
for the analog input pins.
3. Reset Button:
Just like the original Nintendo, the Arduino has a reset button . Pushing it will
temporarily connect the reset pin to ground and restart any code that is loaded on the
Arduino. This can be very useful if your code doesn’t repeat, but you want to test it
multiple times. Unlike the original Nintendo however, blowing on the Arduino
doesn’t usually fix any problems.
5. TX RX LEDs:
TX is short for transmit, RX is short for receive. These markings appear quite a bit in
electronics to
indicate the pins responsible for serial communication. In our case, there are two
places on the
Arduino UNO where TX and RX appear – once by digital pins 0 and 1, and a second
time next to the TX and RX indicator LEDs. These LEDs will give us some nice
visual indications whenever our Arduino is receiving or transmitting data (like when
we‟re loading a new program onto the board).
6. Main IC:
The black thing with all the metal legs is an IC, or Integrated Circuit . Think of it as
the brains of our Arduino. The main IC on the Arduino is slightly different from board
type to board type but is usually from the ATmega line of IC‟s from the ATMEL
company. This can be important, as you may need to know the IC type (along with
your board type) before loading up a new program from the Arduino
software.
7. Voltage Regulator:
The voltage regulator is not actually something you can (or should) interact with on
the Arduino. But it is potentially useful to know that it is there and what it‟s for. The
voltage regulator does exactly what it says – it controls the amount of voltage that is
let into the Arduino board. Think of it as a kind of gatekeeper; it will turn away an
extra voltage that might harm the circuit. Of course, it has its limits, so don‟t hook up
your Arduino to anything greater than 20 volts.
To build this control system we use C++ code to set command in different LED by
several pins. In setup function we use pinMode function which contain two parameter
which indicate the direction of current. The first parameter contain the number of
specific pin here we use 3 digital pins 5,6,7 and the second parameter contain the
mode of that pin with components.
Then we use loop function which continues a particular command again and again
and again. Under this function we use two function digitalWrite which control the
specific pin and set high means signal 1 and down means signal 0. For low command ,
a pin get 0 voltage and for high just opposite. And also use delay function which sets
the time laps between two command here this function set the values at milliseconds
units.
Experimental Procedure:
According to this following procedure we can easily build this traffic system.
1. Go trinkcad.com then login with google or email account. After that
we select the component which needed then connect these component just like
below.
Figure 2: circuit diagram of traffic control system.
Here, the black wires are connected with ground pin named GND and the
another leg means positive(+) connection of different LED’s are connected
with red wire including 220ohm resistance in each LED.
2. Write the code according to the system and see the outputs. We want
to traffic system. In traffic system, red light turns on after green light and
yellow light is turned off, so firstly when we need to stop the vehicles, red
light is used to turn on for 3 sec and then yellow light is on for 1 sec . Both red
and yellow lights are off to turn green light on afterwards for 3 sec. To turn on
red light again, the green light needs to blink for 0.5 secs for 3 times and then
yellow light is on for 1 sec and after turning off yellow light, we can again see
that red light is on.
3. According to the traffic system we rewrite code.
Results:
According to the code and turn on simulation button the whole system works
automatically. Though at the beginning we use a simple code but after the we try to
follow just like a real system. To learn the basic concept of arduino this experiment is
very important.
Reference(s):
1) https://www.arduino.cc/.
2) https://www.coursera.org/learn/arduino/lecture/ei4ni/1-10-first-glance-at-a-
program
3) Jeremy Blue; Exploring Arduino: Tools and Techniques for Engineering Wizardry