Arduino
Arduino
What is Arduino
What is Arduino?
“Arduino is an open-source electronics prototype platform based on flexible, easy-to-use hardware and software. It’s
intended for artists, designers, hobbyists and anyone interested in creating interactive objects or environments.”
- http://www.arduino.cc/
❑ Based on a simple i/o board and a development environment that implements the Processing/writing language.
❑ Arduino can be used to develop stand-alone interactive objects or can be connected to software on your
computer.
❑ It’s intended for students, artists, designers, hobbyists and anyone who tinker with technology.
❑ There are many versions of Arduino board. Versions differ by size, microcontroller, etc
The most commonly used Arduino board. We will be using this board in this workshop
Microprocessor – Atmega328
- 16 MHz speed
- 14 Digital I/O Pins
- 6 Analog Input Pins
- 32K program Memory
- 2K RAM
- 1K EEPROM
Contains a special program called A
“Bootloader”
- Always programming from USB port
- Requires 0.5K of Program Memory
USB Interface
- USB client device
- Allows computer to program the
Microprocessor
- Can be used to communicate with
computer
- Can draw power from computer to
run Arduino
Power Supply
- Connect 7V-12V Provides
- Required 5V to Microprocessor
Will automatically pick USB or Power
Supply to send power to The
Microprocessor
Indicator LEDs
1. L-Connected to
digital pin 13
2.TX- transmit data
to computer
3.RX- receive data
from computer
4.ON- when power
is applied
Reset Button
Allows you to reset
the Microprocessor
so program will
start from the
beginning.
External power
❑ Should be between 9V and 12V DC.
❑ The plug must be “center positive", that is, the middle pin of the plug has to be the
+ connection
❑ The language is very simple and provides many abstraction for simplicity of reading and
writing powerful applications.
❑ It provides a serial monitor to see the serial data from the USB virtual COM port.
❑ Allows one click compiling, verification and burning of code onto the Arduino.
Some Commands
• Serial.begin()
- e.g., Serial.begin(9600)
• Serial.print() or Serial.println()
- e.g., Serial.print(value)
• Serial.read()
• Serial.available()
• Serial.write()
• Serial.parseInt()
9/21/2019 IEEE Workshop by Md. Jahid Hasan, Dept of EEE, HSTU. 17
Arduino Pin
3. Trying to get more than 40mA out of the pin will destroy the Microprocessor
4. When the output pin is LOW, it provides no current. You can use a transistor
and/or a relay to provide a higher voltage or more current
pinMode(pin, mode)
Sets pin to either INPUT or OUTPUT
digitalRead(pin)
Reads HIGH or LOW from a pin
digitalWrite(pin, value)
Writes HIGH or LOW to a pin
Electronic stuff
Output pins can provide 40 mA of
current
Writing HIGH to an input pin installs a
20KΩ pullup
9/21/2019 IEEE Workshop by Md. Jahid Hasan, Dept of EEE, HSTU. 20
Arduino Analog Pin
1. The pins can be used to accept an input also. Digital pins can
read a voltage (1) or no voltage(0).
2. Analog pins can read voltage between 0V and 5V. You will read
a value of 0 and 1023.
pinMode(pin, mode)
Sets pin to either INPUT or OUTPUT
analoglRead(pin)
Reads analog value from a pin
analogWrite(pin, value)
Writes analog value to a pin
• Command:
analogWrite(pin, value)
• Examples:
analogWrite(9, 128)
for a 50% duty cycle
analogWrite(11, 64)
for a 25% duty cycle
Image from Theory and Practice of Tangible User Interfaces at UC Berkley
9/21/2019 IEEE Workshop by Md. Jahid Hasan, Dept of EEE, HSTU. 25
A rd u i n o P ro j e c t
Project Tools
Breadboard
Simple Schematic
Simple Layout
5V - 1.4V = 3.6V
I = E / R is the same as R = E / I
R = 3.6 / .02 = 180 ohms
Switches come in different forms, but all of them in some way open or
close a gap in a wire
The pushbutton switch has four legs for easier mounting, but only two
of them are needed
1. There is a solution.
2. A resistor to 5V will make the pin HIGH when
the Button is not pressed
3. Pressing it will make the pin LOW
4. The resistor makes sure we don’t connect 5V
directly To Ground.
• Multi-meter
• Wire strippers
• Wire cutter
• Vise
• 3rd hand
• www.instructables.com
• www.tindie.com
• www.makershed.com
• www.makezine.com
• www.techshopbd.com
• https://bdspeedytech.com
• https://www.aliexpress.com
• www.adafruit.com
• www.ebay.ca
• www.amazon.com
• www.dealextreme.com