Chapter Three Technology Used: 3.1 Arduino
Chapter Three Technology Used: 3.1 Arduino
TECHNOLOGY USED
In this chapter, all the components used to design the system are explained, giving details of all
the specifications, technologies and particulars about each of them.
3.1 ARDUINO
Arduino is a small microcontroller board with a USB plug to connect to computer. It has number
of connection sockets that can be wired up to external electronics, such as motors, relays, light
sensors etc. They can either be powered through the USB connection from the computer or from
a 12V battery. They can be controlled from the computer or programmed by the computer and then
disconnected and allowed to work independently.
Fig. 3.1
Arduino
Mega
FEATURES DESCRIPTION
Microcontroller ATmega2560
Operating Voltage 5V
Input Voltage (recommended) 7-12V
Input Voltage (limits) 6-20V
Digital I/O Pins 54 (of which 15 provide PWM output)
Analog Input Pins 16
DC Current per I/O Pin 40 mA
DC Current for 3.3V Pin 50 mA
Flash Memory 256 KB of which 8 KB used by boot loader
SRAM 8 KB
EEPROM 4 KB
Clock Speed 16 MHz
3.1.2.1 Pin Description
Arduino Mega has 54 digital input/output pins 16 analog pins. Different pins classified according
to their function are shown in Fig. 3.2.
ATmega
2560
3.1.2.2 Power
The Arduino Mega can be powered via USB connection or with an external power supply. The
power source is selected automatically. External (non-USB) power can be given either from an
AC-to-DC adapter or battery. The adapter can be connected by plugging a 2.1 mm centre-positive
plug into the board's power jack. Leads from a battery can be inserted in the GND and Vin pin
headers of the POWER connector. The board can operate on an external supply of 6 to 20 volts. If
supplied with less than 7V, however, the 5V pin may supply less than five volts and the board may
be unstable. If using more than 12V, the voltage regulator may overheat and damage the board.
The recommended range is 7-12 volts.
3.1.2.3 Memory
The ATmega2560 has 256 KB of flash memory for storing code (of which 8 KB is used for the
boot loader), 8 KB of SRAM and 4 KB of EEPROM (which can be read and written with the
EEPROM library).
3.1.2.5 Communication
The Arduino Mega2560 has a number of facilities for communicating with a computer, another
Arduino or other microcontrollers. The ATmega2560 provides four hardware UARTs for TTL
(5V) serial communication. The Arduino software includes a serial monitor which allows simple
textual data to be sent to and from the board. The RX and TX LEDs on the board will flash when
data is being transmitted via the ATmega8U2/ATmega16U2 chip and USB connection to the
computer (but not for serial communication on pins 0 and 1). A software serial library allows for
serial communication on any of the Mega 2560 digital pins. The ATmega2560 also supports TWI
and SPI communication. The Arduino software includes a Wire library to simplify use of the TWI
bus.
3.1.2.6 Programming
The Arduino Mega can be programmed with the Arduino software. The ATmega2560 on the
Arduino Mega comes pre burned with a boot loader that allows to upload new code to it without
the use of an external hardware programmer. It communicates using the original STK500 protocol.
One can also bypass the boot loader and program the microcontroller through the ICSP (In-Circuit
Serial Programming) header using Arduino ISP.
TRANSMITTER RECEIVER
(a)
(b)
Fig. 3.8
HC-
SR04 Ultrasonic Sensor (a) Top View (b) Bottom View
The main features of HC-SR04 are listed as follows:
Power Supply : +5V DC
Quiescent Current : <2mA
Working Current: 15mA
Effectual Angle: <15°
Ranging Distance : 2cm – 400 cm/1" - 13ft
Resolution : 0.3 cm
Measuring Angle: 30 degree
Trigger Input Pulse width: 10uS
Dimension: 45mm x 20mm x 15mm
This system typically uses a transducer which generates sound waves in the ultrasonic range, above
18 kHz, by converting electrical energy into sound known as a chirp. Then upon receiving the
echo, converts the sound waves into electrical energy which can be measured and displayed as
shown in Fig. 3.9.
Fig. 3.9 Working of Ultrasonic Sensor
The Arduino developers provide the Arduino integrated development environment (IDE), which
is a cross-platform application written in the programming language Java. It originated from the
IDE for the languages processing and Wiring. It is designed to introduce programming to artists
and other newcomers unfamiliar with software development. It includes a code editor with features
such as syntax highlighting, brace matching, and automatic indentation, and provides simple one-
click mechanism to compile and load programs to an Arduino board. A program written with the
IDE for Arduino is called a "sketch".
The Arduino IDE supports the languages C and C++ using special rules to organize code. The
Arduino IDE supplies a software library called Wiring from the Wiring project, which provides
many common input and output procedures. A typical Arduino C/C++ sketch consists of two
functions that are compiled and linked with a program. Arduino IDE employs the
program avrdude to convert the executable code into a text file in hexadecimal coding that is
loaded into the Arduino board by a loader program in the board's firmware.
After making deep study about the controller, components, sensors and modules the
hardware and software implementation part is designed which are needed for the proposed system.
The detailed step by step procedure for development of hardware and software with Arduino mega
2560 microcontroller board, sensor modules and circuitry will be explained in the next chapter.