ARDUINO
FOR BIOMED STUDENT
DR . EMAD TALEB
What is an Arduino ?
Open Source electronic prototyping platform based on flexible
easy to use hardware and software.
Basically Arduino is Microcontroller.
Microcontroller is microprocessor with memory, RAM and
some other peripheral connected with it.
TYPES OF ARDUINO
Boarduino Kit
Arduino DIY Arduino
LilyPad
Arduino Uno
Arduino Mega
2560
TYPES OF ARDUINO
USB (to Computer)
PWR IN
RESET
SCL\SDA
(I2C Bus)
POWER
5V / 3.3V /
GND
Digital I\O
PWM(3, 5, 6, 9, 10,
Analog 11)
INPUTS
Arduino component
Arduino work steps
•Check out: http://arduino.cc/en/Guide/HomePage
1. Download & install the Arduino environment (IDE)
2. Connect the board to your computer via the UBS
cable
3. If needed, install the drivers (not needed in lab)
4. Launch the Arduino IDE
5. Select your board
6. Select your serial port
7. Open the blink example
8. Upload the program
1- Download Arduino IDE
(Integrated Development Environment)
Download & install the
Arduino
environment (IDE)
arduino.cc/en/main/
software
http://arduino.cc/en/
Guide/HomePage
2- Connect Redboard to your Computer
3- Install Arduino Drivers
Open Arduino IDE
4- Select Your Board
Select Serial Device (Windows)
Select Serial Device (Mac)
Download Code
Know The Arduino GUI
Verify:
Compiles and
approves your
code. Will
catch errors in
syntax.
Know The Arduino GUI
Upload: Sends
your code to
the RedBoard.
When you click
it you should
see lights on
your board
blink rapidly.
Know The Arduino GUI
New:
Opens up
a new
code
window
tab.
Know The Arduino GUI
Open: Open an
existing sketch,
which is where
you write your
code.
Know The Arduino GUI
Save: Saves
the currently
open sketch.
Know The Arduino GUI
Serial Monitor:
Opens a window
that displays any
serial info the
RedBoard is
transmitting.
Very useful for
debugging.
What is Serial?
Process of
sending data one
bit (0 or 1) at a
time.
Know The Arduino GUI
Sketch Name:
Name of the
sketch you
are currently
working on.
Know The Arduino GUI
Code Area:
Area where
you compose
the code for
your sketch.
Know The Arduino GUI
Message Area:
Where the IDE
tells you if
there were
any errors in
your code.
Arduino Programming
Terminology
Arduino Programming
Bare minimum code:
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
Arduino Programming
Bare minimum code:
setup : It is called only when the Arduino is powered on or
reset. It is used to initialize variables and pin modes
loop : The loop functions runs continuously till the device is
powered off. The main logic of the code goes here. Similar
to while (1) for micro-controller programming.
Arduino Programming
PinMode:
A pin on arduino can be set as input or output by using
pinMode function.
pinMode(13, OUTPUT); // sets pin 13 as output pin
pinMode(13, INPUT); // sets pin 13 as input pin
Arduino Programming
Reading/writing digital values:
digitalWrite(13, LOW); // Makes the output voltage on pin 13 ,
0V
digitalWrite(13, HIGH); // Makes the output voltage on pin 13 ,
5V
int buttonState = digitalRead(2); // reads the value of pin 2 in
buttonState
Arduino Programming
Reading/Writing Analog Values:
analogRead(A0); // used to read the analog value from the pin
A0
analogWrite(2,128);
BREADBOARD
How it How it’s
looks connected Connect power
to the + vertical
columns
Connect ground
down the -
vertical
columns
Components
placed along
horizontal rows will
be connected
This line divides the board in
when power is
half running.
JUMPER WIRE
RESISTOR
POTENTIOMETER
LIGHT EMITTING DIODE (LED)
PHOTO RESISTOR
TEMPERATURE SENSOR
Compatible Biometric Sensors with Arduino
1. Optical fingerprint reader
Compatible Biometric Sensors with Arduino
2- Pulse sensor
This sensor measures heart beat. It
is very easy to use with your Arduino,
as it only requires one analog data pin,
VCC and GND. The sensor can be
easily powered up using the Arduino
5V pin.
This sensor has an optical heart rate
sensor with amplification and circuit
for noise reduction, giving fast and
reliable pulse readings.
Compatible Biometric Sensors with Arduino
3- Galvanic skin response grove module
This module allows you to measure
galvanic skin response by measuring
the electrical conductance of the skin.
The skin conductance changes
accordingly to the amount of sweat
on the skin.
As the skin electric properties
change with emotions, this kind of
sensor is used in lie detectors
(polygraphs) to detect changes in the
person’s physiological state .
Compatible Biometric Sensors with Arduino
4. Myoware muscle sensor
The myoware muscle sensor
measures the electrical activity
of a muscle, giving an output
voltage between 0 and 5V (in
case you’re powering up the
sensor with 5V) depending on the
amount of activity in a muscle
Compatible Biometric Sensors with Arduino
5- e-Health shield
The e-Health shield can be used
to gather real time biometric
information from a patient. This
shield allows you to monitor a
wide variety of biometric
information. The shield can use
10 different sensors: pulse,
oxygen in blood, airflow, body
temperature, ECG, glucometer,
galvanic skin response, blood
pressure, position and
electromyography (muscle)
sensor.
Example: Circuit With Temperature Sensor
Temperature sensors are used to
measure ambient temperature.
Sensor we’re using has three pins –
positive, ground, and a signal. For every
centigrade degree it reads, it outputs 10
millivolts.
We’ll integrate the temperature sensor
with Arduino and use the serial monitor
to display the temperature.
CIRCUIT SCHEMATIC
Circuit Design and Implement
Create The Sketch
const int temperaturePin = 0; Serial.print("voltage: ");
Serial.print(voltage);
void setup() { Serial.print(" deg C: ");
Serial.begin(9600); Serial.print(degreesC);
Serial.print(" deg F: ");
} Serial.println(degreesF);
void loop() { delay(1000);
}
float voltage, degreesC, degreesF;
voltage = getVoltage(temperaturePin); float getVoltage(int pin)
degreesC = (voltage - 0.5) * 100.0;
{
degreesF = degreesC * (9.0/5.0) + 32.0;
return(analogRead(pin) *
0.004882814);
}
Learning Resources
www.arduino.cc
www.ladyada.net/learn/arduino
www.EarthshineElectronics.com