Séminaire AgroTIC : Arduino et ses applications en agriculture
Seminario per l'introduzione della tecnologia arduino in agricoltura
Riferimento alessandro matese a.matese@ibimet.cnr.it IBIMET CNR
6. Introduction
• “Arduino is an open-source physical computing
platform based on a simple i/o board and a
development environment that implements the
Processing / Wiring language. Arduino can be
used to develop stand-alone interactive objects
or can be connected to software on your
computer.“ ( www.arduino.cc, 2006 )
7. Introduction
• A physical Input / Output board
(I/O) with a programmable
Integrated Circuit (IC).
• Also including an Integrated
Development Environment
(IDE) for programming.
• The language itself is based in
C but is largely modeled upon
the www.processing.org
language.
8. Introduction
What is it used for?
• Physical Computing
projects / research
• Interactive Installations
• Rapid prototyping
What can it do?
• Sensors ( to sense stuff )
– Push buttons, touch pads, tilt switches.
– Variable resistors (eg. volume knob / sliders)
– Photoresistors (sensing light levels)
– Thermistors (temperature)
– Ultrasound (proximity range finder)
• Actuators ( to do stuff )
– Lights, LED’s
– Motors
– Speakers
– Displays (LCD)
– Relays
9. Introduction
Why Arduino?
• It is Open Source, both in terms of Hardware and Software.
• It is cheap, the hardware can be built from components or a prefab board
can be purchased for approx 25 Euro
• It can communicate with a computer via serial connection over USB
• It can be powered from USB or standalone DC power.
• It can run standalone from a computer (chip is programmable) and it has
memory (a small amount).
• It can work with both Digital and Analogue electronic signals. Sensors
and Actuators.
• You can make cool stuff! Some people are even making simple robots,
and we all know robots are just cool.
19. Applications
INDOOR CO2 , Temperature and Humidity of indoor ambient
Pachube -> Cosm -> Xively “ Internet of Things”
Bike for mobile monitoring (GPS)
Sap flow
Any idea ????????
20. Applications
Seeeduino
45 Euro
LilyPad
22 Euro
Ethernet
49 Euro
32 bit ARM core processor, the Atmel SAM3X8E ARM
Cortex-M3 MCU,
54 digital input/output pins (of which 16 can be used
as PWM outputs, with selectable resolution),
12 analog inputs with 12 bit of resolution,
4 UARTs (hardware serial ports), and two DAC
outputs (digital to analog converter)
Arduino Uno 25 Euro Arduino Due 46 Euro
22. Programming
1. Installation arduino 1.x
2. Tools
3. Examples and library
4. Plug the device
5. Com port
6. Platforms
7. Sketch
8. Compile
9. Upload
10.Internet and GitHub
23. Programming
Command
// Comments
1) int Global Variables declaration: i.e. integer
2) setup() Setup of devices, pins and sensors
3) loop() Programme routine
void Function declaration
pinMode(pin,mode)
funzione di configurazione di un piedino
Arduino, in modo che sia utilizzabile come
INPUT o come OUTPUT
digitalWrite(pin,level)
invia un comando di output sul piedino
selezionato (pin) di tipo digitale, pe cui 0 o 1;
in sostituzione dello 0 e dell’1 si possono
utilizzare le costanti LOW (0) e HIGH (1)
delay(second)
funzione utile per introdurre un dalay (attesa)
tra una istruzione e la successiva, il
paramero second è esperesso in millesimi di
secondo.
24. Programming
Analog and Digital
Temperature sensor that convert in a voltage signal, and Arduino can acquire voltage
value between 0 and 5 volts.
This values are different from the HIGH and LOW that characterize digital signals,
because they can take any value between 0 and 5 volts. 0.3 volts, 3.27 volts, 4.99 volts
are possible values.
One small hardware part inside the microprocessor that comes with the Arduino I/O
board is dedicated to translate analog voltages into these values, it is the Analog to
Digital Converter also called ADC.
25. Programming
#define DHTPIN 4 // digital pin
Serial.begin(9600); // serial communication ON at 9600 Baud Rate (bits/sec)
dht.begin(); // external library
pinMode(O0, OUTPUT); // declare digital sensor as output (relay)
pinMode(I0, INPUT); // declare digital sensor as input (button)
digitalWrite(O0, LOW); // change the state of digital channel
int val = digitalRead(I0); // read the digital channel
rada = analogRead(1); counts 0-1024 // read the digital channel
rad1=(rada*5)/1.024; millivolts 0 - 5000
Serial.println("PUSH"); // print a string in Serial Monitor
delay(1000); // delay for the loop
26. TUTORIAL
Device nr.2 : Temp/RH
D2_T_rh_final.h
Device nr.1 : soil moisture and water sensor
D1_soilpluswater_final.h
Device nr.4 : Luminosity
D4_Relays_finale.h
Device nr.3 : Button and relay
D3_Luminosity_final.h