Arduino Programming
for
Radon Measurement System
By:
Mazhar Hussain
mazhar.hussain @miun.se
Muhammad Amir Yousaf
[email protected][email protected]
[email protected]
2011-11-02 1
Outline
Background
Introduction to Arduino
What is Arduino Platform? What can it do?
Arduino Hardware Development Environment Programming Arduino Objectives
Live Demonstration
[email protected]
[email protected]
2011-11-02 2
Background
Measurement system for Radon.
Ventilation reset
Particle Sensor
Charge Sensitive Amplifier
Shaping Amplifier
Amplitude Measurement
U-controller
Presentation Storage of data
Detector-bias 200V
Temp. Moisture
Make alarm in critical situations
http://apachepersonal.miun.se/~go rthu/ass/
Present on my Computer
[email protected]
[email protected]
2011-11-02 3
Programming Background
Read datasheets
Microcontroller Do you have experience with Microcontroller
programming with C
DDRB = (1<<DDB3)|(1<<DDB2)|(1<<DDB1)|(1<<DDB0);
/ C++ ?
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 on 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 computers.
Arduino UNO
Arduino NANO
http://www.arduino.cc/
Arduino MEGA
[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
1 3 4
1a
2. Write Program
3. Compile Program
4. Upload and Execute
2:Write program here.
1b
[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 microcontrollers 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: digitalWrite() To read a digital pins state: digitalRead() To read an analog pin: analogRead() To write an analog PWM value: analogWrite() Wait an amount of time 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.
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
U-controller
Presentation Storage of data
Detector-bias 200V
Temp. Moisture
http://apachepersonal.miun.se/~go rthu/ass/
[email protected]
[email protected]
2011-11-02 17
Objectives
Measurement system for Radon.
Reset
ADC read
reset
Amplitude Measurement
U-controller
[email protected]
[email protected]
2011-11-02 18
Objectives
Measurement system for Radon.
DHT11 is a temperature and Humidity Sensor with single data line.
U-controller
Community Contributions
Temp. Moisture
A DHT11 Class for Arduino. http://arduino.cc/playground/Main/D HT11Lib
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
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.
[email protected]
[email protected]
2011-11-02 21
Data Storage and Presentation(2)
[email protected]
[email protected]
2011-11-02 22
Data Storage and Presentation(3)
By using MS office toolkit in LabView, you can generate detail report of your measurements including tables and graphs.
[email protected]
[email protected]
2011-11-02 23