Arduino Programming for
Radon Measurement System By:
Mazhar Hussain
Muhammad Amir Yousaf
mazhar.hussain @miun.se
[email protected]
[email protected]
amir.yousa amir .yousaf@miun.
[email protected] se
2011-11-02 1
Outline
Background
Introduction to Arduino
What is Arduino Platform?
What can it do?
Arduino
Hardware Hardware
Development Environment
Programming Arduino
Objectives
Live Demonstration
[email protected]
[email protected]
2011-11-02 2
Background Measurement system for Radon. Ventilation
reset
Charge Sensitive Amplifier
Particle Sensor
Shaping Amplifier
Amplitude Measurement
Detector-bias 200V
U-controller
Presentation Storage of data
Temp. Moisture
Make alarm in critical situations http://apachepersonal.miun.se/~go rthu/ass/
[email protected]
[email protected]
Present on my Computer
2011-11-02 3
Programming Background
Read datasheets
Microcontroller
Do you have experience with Microcontroller programming with
C / C++ ?
DDRB = (1<
Programming at register level
[email protected]
[email protected]
2011-11-02 4
What is Arduino Platform? •
Arduino is an open-source electronics prototyping platform based o n flexible, easy-touse hardware and software. It brings simplicity to developer. –
Simplicity in Hardware, Development Environment and Language.
•
It can sense the environment by receiving input from a variety of sensors and can affect its surroundings by controlling lights, motors, and other actuators.
•
Arduino projects can be stand-alone or linked with software running on compu ters.
Arduino UNO
Arduino MEGA
Arduino NANO http://www.arduino.cc/
[email protected]
[email protected]
2011-11-02 5
What can it do?
Smell Pollutants: Arduino interfaced with gas sensors. It can smell ethanol, methane and a bunch of voilatile organic compounds. http://www.instructables.com/id/How-To-SmellPollutants /
Mini Segway Using the Arduino: A self balancing segway-like robot is build by using arduino, a couple of LEGO motors and sensors. http://hacknmod.com/hack/make-a-mini-segway-usingthe-arduino/
[email protected]
[email protected]
2011-11-02 6
Arduino NANO Hardware Specifications: •
Based on Atmega 328
•
Operating Voltage 5V
•
32 KB Flash Memory
•
2 KB SRAM
•
16 MHz clock speed
•
Dimensions 0.73" x 1.70" http://www.arduino.cc/en/Main/A rduinoBoardNano
[email protected]
[email protected]
2011-11-02 7
Arduino NANO Hardware Arduino Peripherals •
14 Digital I/O Pins
•
8 Analog Input Pins
•
External Interrupts (on D2 and D3)
•
PWM (D3, 5, 6, 9, 10, and 11)
•
Serial port & FTDI USART to USB converter.
•
SPI, I2C
•
Buttons and LEDs
http://www.arduino.cc/en/Main/A rduinoBoardNano
[email protected]
[email protected]
2011-11-02 8
Development Environment
•
Download from: http://www.arduino.cc /en/Main/software
•
Double click the file from the folder to open IDE.
[email protected]
[email protected]
2011-11-02 9
Development Environment Install USB driver System Properties Hardware Device Manager Ports
http://arduino.cc/en/Guide/Arduin oNano
Mini-B USB
Your computer
[email protected]
[email protected]
2011-11-02 10
Development Environment Steps to Program 1.
Configure
2.
Write Program
3.
1a
1 3 4
Compile Program
4. Upload and Execute
2:-
1b
Write program here.
[email protected]
[email protected]
2011-11-02 11
Programming Arduino •
Open example program: File Examples Basics Blink
• Arduino Sketch o
Setup() Initialization (run once at beginning )
o
Loop() Run repeatedly
[email protected]
[email protected]
2011-11-02 12
Programming Arduino •
No need to write Hardware Abstraction Library (HAL) for accessing microcontroller‟s peripherals. That make it extremely simpler to program in Arduino.
•
All peripherals are in access with provided libraries e.g.
•
To configure pin as output or input:
pinMode()
To set a digital pin high/low: To read a digital pin‟s state: To read an analog pin: To write an “analog” PWM value: Wait an amount of time
digitalWrite() digitalRead() analogRead() analogWrite() delay()
Complete library references: http://arduino.cc/en/Reference/HomePage http://www.arduino.cc/playground/Code/HardwareAbstraction
[email protected]
[email protected]
2011-11-02 13
Programming Arduino
• Arduino Refernce Homepage http://arduino.cc/en/Reference/Home Page has every thing you need to create a program from scratch.
http://arduino.cc/en/Reference/Ho mePage
[email protected]
[email protected]
2011-11-02 14
Programming Arduino •
Creating a program to write message on serial port. – Visit „Arduino Refernce Homepage‟. – Click over „Serial‟ link and find a list of functions as shown. – Use function to implement your requirement. – Clicking over the function name gives the details with examples.
[email protected]
[email protected]
2011-11-02 15
Programming Arduino
[email protected]
[email protected]
2011-11-02 16
Objectives Measurement system for Radon.
reset
Particle Sensor
Charge Sensitive Amplifier
Shaping Amplifier
Amplitude Measurement
Detector-bias 200V
U-controller
Presentation Storage of data
Temp. Moisture
http://apachepersonal.miun.se/~go rthu/ass/
[email protected]
[email protected]
2011-11-02 17
Objectives Reset
Measurement system for Radon.
ADC read
reset
Amplitude Measurement
[email protected]
U-controller
[email protected]
2011-11-02 18
Objectives Measurement system for Radon. DHT11 is a temperature and Humidity Sensor with single data line.
Community Contributions
U-controller
A DHT11 Class for Arduino. http://arduino.cc/playground/Main/D HT11Lib
Temp. Moisture
int chk = DHT11.read(DHT11PIN);
[email protected]
[email protected]
2011-11-02 19
Live Demonstration
[email protected]
[email protected]
2011-11-02 20
Data Storage and Presentation(1)
U-controller
Presentation Storage of data
Temp. Moisture
[email protected]
[email protected]
•
For representing data in an intuitive way, LabView provide a powerful user interface along with its Microsoft Office toolkit for Data storage.
•
Through LabView you can control Ardiuno based Radon Measurement device via serial link.
•
Post processing could be done in LabView to avoid long code inside Processor.
•
Report generation in Excel..
•
Go to HELP in LabView and have a look on “Find Examples”….
2011-11-02 21
Data Storage and Presentation(2)
[email protected]
[email protected]
2011-11-02 22
Data Storage and Presentation(3)
•
[email protected]
[email protected]
By using MS office toolkit in LabView, you can generate detail report of your measurements including tables and graphs.
2011-11-02 23