Bacis Arduino Workshop
Bacis Arduino Workshop
By
Automation Club
MECHANICAL & AUTOMOBILE DIPLOMA STUDIES
MARWADI UNIVERSITY
RAJKOT
What is Automation
In the industrial automation, sensors play a vital part to make the products
intellectual and exceptionally automatic.
Power USB
Arduino board can be powered by using the USB cable from your
computer. All you need to do is connect the USB cable to the USB
connection
Arduino Reset
You can reset your Arduino board, i.e., start your program from the
beginning. You can reset the UNO board in two ways. First, by using
the reset button on the board. Second, you can connect an
external reset button to the Arduino pin labelled RESET .
Pins (3.3, 5, GND, Vin)
3.3V − Supply 3.3 output volt
5V − Supply 5 output volt
Most of the components used with Arduino board works fine with 3.3 volt and 5
volt.
GND (Ground) − There are several GND pins on the Arduino, any of which can be
used to ground your circuit.
Vin − This pin also can be used to power the Arduino board from an external
power source, like AC mains power supply.
Digital I/O
The Arduino neno board has 14 digital I/O pins (of which 6 provide PWM (Pulse
Width Modulation) output. These pins can be configured to work as input digital
pins to read logic values (0 or 1) or as digital output pins to drive different modules
like LEDs, relays, etc. The pins labeled “~” can be used to generate PWM.
Analog pins
The Arduino nano board has five analog input pins A0 through A7.
These pins can read the signal from an analog sensor like the
humidity sensor or temperature sensor and convert it into a digital
value that can be read by the microprocessor.
TX and RX LEDs
On your board, you will find two labels: TX (transmit) and RX
(receive). They appear in two places on the Arduino UNO board.
First, at the digital pins 0 and 1, to indicate the pins responsible for
serial communication. Second, the TX and RX led (13). The TX led
flashes with different speed while sending the serial data. The speed
of flashing depends on the baud rate used by the board. RX flashes
during the receiving process.
Arduino IED software
The Arduino IDE (Integrated Development Environment) is the program used to write code, and
comes in the form of a downloadable file on the Arduino website.
The Arduino board is the physical board that stores and performs the code uploaded to it. Both
the software package and the board are referred to as "Arduino."
Setp-1
Step-2
Setp-3
Arduino coding syntax
digitalWrite() The code makes the digital pin an OUTPUT and toggles it by alternating digitalWrite(pin, value)
between HIGH and LOW
pinMode() The specified pin to behave either as an input or an output. pinMode(pin, mode)
Defined the digital pin as input or output in void setup() function section.
delay() Pauses the program for the amount of time (in milliseconds) specified as delay(1000)
parameter. (There are 1000 milliseconds in a second.)
void Functions are declarer in “setup” void setup()
actions are performed in the functions “loop" void loop()
#define #define is a useful component that allows the programmer to give a name #define constantName
to a constant value. value
#include #include is used to include outside libraries in your sketch. #include <Libraries>
Arduino coding syntax
Functions Description Syntax
Serial.begin() Sets the data rate in bits per second (baud) for serial data Serial.begin(speed, config)
transmission. For communicating with the computer, use one of Serial.begin(speed)
these rates: 300, 600, 1200, 2400, 4800, 9600, 14400, 19200,
28800, 38400, 57600, or 115200.
Serial.end() Disables serial communication, allowing the RX and TX pins to be Serial.end()
used for general input and output.
Serial.write() Writes binary data to the serial port. Serial.write(value)
buf: an array to send as a series of bytes Serial.write(string)
Serial.write(buf, len)
Serial.print() This command can take many forms. Numbers are printed using an Serial.print(value, format)
ASCII character for each digit. permitted values are BIN(binary, or
base 2), OCT(octal, or base 8), DEC(decimal, or base
10), HEX(hexadecimal, or base 16).
Serial.println() Prints data to the serial port to get output in serial port. Serial.println(value, format)
Serial.read() Reads incoming serial data. Serial.read()
Arduino coding syntax
Functions Description Syntax
pulseIn() Reads a pulse (either HIGH or LOW) on a pin. For pulseIn(pin, value)
example, if value is HIGH, pulseIn() waits for the pin pulseIn(pin, value,
to go from LOW to HIGH, starts timing, then waits for timeout)
the pin to go LOW and stops timing.
delayMicrosecon Pauses the program for the amount of time (in delayMicroseconds(us)
ds() microseconds) specified as parameter. There are a
thousand microseconds in a millisecond, and a
million microseconds in a second.
// Comments are lines in the program that are used to
inform yourself or others.
LiquidCrystal Libr Creates a variable of type LiquidCrystal LiquidCrystal()
ary
Basic component for Arduino
Breadboard
A breadboard is used to build and test circuits quickly before finalizing any
circuit design. The breadboard has many holes into which circuit components
like jumpers, ICs and resistors can be inserted. ... A node is a point in a circuit
where two components are connected.
Breadboard
Jumper wires
Component:-
Arduino
Resistor
LED
• CONNECTION:-
• D13 to Resistor
• Resistor to LED
• LED to GND
Fade
Component:-
Arduino
Resistor
LED
• CONNECTION:-
• D9 to Resistor
• Resistor to LED
• LED to GND
Button
Component:-
Arduino
Resistor
Button
• CONNECTION:-
• 5v to lag 1
• GND to Resistor
• Resistor to leg 2
• Leg 3 to D2
Debounce
Component:-
Arduino
Resistor
Button
LIGHT DEPENDEDENT RESISTOR
(LDR)
In IR sensor IR transmitter
flow infrared radiation.
Radiation is strike and
change direction on
sensor side IR receiver
receive this radiation and
change in signal.
Ultrasonic sensor
Ultrasonic Sensors measure the distance
of target objects or materials through the
air using “non-contact” technology.
They measure distance without damage
and are easy to use and reliable.
Working principal
Trigger to D10
Echo to D9
Servo motor