Tutoriel:Développement
sur Arduino
Augustin Cheron
The ArduinoProject
The hardware side
Software
Buildingenvironement
Demo Time
Conclusion
Tutoriel: Développement sur Arduino
Augustin Cheron
[email protected]://lse.epita.fr
July 19, 2012
Tutoriel:Développement
sur Arduino
Augustin Cheron
The ArduinoProject
The hardware side
Software
Buildingenvironement
Demo Time
Conclusion
Plan
1 The Arduino Project
Tutoriel:Développement
sur Arduino
Augustin Cheron
The ArduinoProject
The hardware side
Software
Buildingenvironement
Demo Time
Conclusion
What is Arduino ?
The Arduino Team :"Arduino is an open-source electronics prototypingplatform based on flexible, easy-to-use hardware andsoftware."
Open source hardwareOpen source softwareA huge community
Tutoriel:Développement
sur Arduino
Augustin Cheron
The ArduinoProject
The hardware side
Software
Buildingenvironement
Demo Time
Conclusion
What is Arduino ?
The Arduino Team :"Arduino is an open-source electronics prototypingplatform based on flexible, easy-to-use hardware andsoftware."
Open source hardwareOpen source softwareA huge community
Tutoriel:Développement
sur Arduino
Augustin Cheron
The ArduinoProject
The hardware side
Software
Buildingenvironement
Demo Time
Conclusion
What is Arduino ?
The Arduino Team :"Arduino is an open-source electronics prototypingplatform based on flexible, easy-to-use hardware andsoftware."
Open source hardwareOpen source softwareA huge community
Tutoriel:Développement
sur Arduino
Augustin Cheron
The ArduinoProject
The hardware side
Software
Buildingenvironement
Demo Time
Conclusion
What is Arduino ?
The Arduino Team :"Arduino is an open-source electronics prototypingplatform based on flexible, easy-to-use hardware andsoftware."
Open source hardwareOpen source softwareA huge community
Tutoriel:Développement
sur Arduino
Augustin Cheron
The ArduinoProject
The hardware sideAtmel AVR
USB <–> RS-232
Input and output
Shield
Conclusion
Software
Buildingenvironement
Demo Time
Conclusion
Plan
2 The hardware sideAtmel AVRUSB <–> RS-232Input and outputShieldConclusion
Tutoriel:Développement
sur Arduino
Augustin Cheron
The ArduinoProject
The hardware sideAtmel AVR
USB <–> RS-232
Input and output
Shield
Conclusion
Software
Buildingenvironement
Demo Time
Conclusion
Atmel AVR: Atmega
The Atmega is an 8-bit AVR RISC-based microcontrollerLow power comsumption.8 or 16 Mhz clock speed (at almost 1MIPS per Mhz)ATmega family can reach up to 20Mhz.5V operating voltage.
Tutoriel:Développement
sur Arduino
Augustin Cheron
The ArduinoProject
The hardware sideAtmel AVR
USB <–> RS-232
Input and output
Shield
Conclusion
Software
Buildingenvironement
Demo Time
Conclusion
USB <–> RS-232
An arduino board contain an RS232 to USB converter.Simplified the connection between your ATmega andyour computer.Old Version use well know ftdi chip.Recent one use ATmega16U2.Leonardo use only one chip.
Tutoriel:Développement
sur Arduino
Augustin Cheron
The ArduinoProject
The hardware sideAtmel AVR
USB <–> RS-232
Input and output
Shield
Conclusion
Software
Buildingenvironement
Demo Time
Conclusion
IO pin
The exemple of the Atmega168:14 digital pin.5 analog input.
Tutoriel:Développement
sur Arduino
Augustin Cheron
The ArduinoProject
The hardware sideAtmel AVR
USB <–> RS-232
Input and output
Shield
Conclusion
Software
Buildingenvironement
Demo Time
Conclusion
ICSP Connector
In Circuit Serial ProgrammingA common programming interface formicrocontroller.5 wire: Vpp, Vcc, Vdd, ICSPCLK, ICSPDAT.Usefull form burning a bootloader into the ATmega.
Tutoriel:Développement
sur Arduino
Augustin Cheron
The ArduinoProject
The hardware sideAtmel AVR
USB <–> RS-232
Input and output
Shield
Conclusion
Software
Buildingenvironement
Demo Time
Conclusion
Reset Button
Juste a single button directly connected to theATmega’s reset pin.Reset may also be direcly controlled over the USBcontroller
Usefull for programming purpose.But a bad news for debuging one.
Tutoriel:Développement
sur Arduino
Augustin Cheron
The ArduinoProject
The hardware sideAtmel AVR
USB <–> RS-232
Input and output
Shield
Conclusion
Software
Buildingenvironement
Demo Time
Conclusion
Lots of plugable hardware extension
More At : http://shieldlist.org : almost 300 shield
Tutoriel:Développement
sur Arduino
Augustin Cheron
The ArduinoProject
The hardware sideAtmel AVR
USB <–> RS-232
Input and output
Shield
Conclusion
Software
Buildingenvironement
Demo Time
Conclusion
Global view of the hardware
Globale view :
Tutoriel:Développement
sur Arduino
Augustin Cheron
The ArduinoProject
The hardware sideAtmel AVR
USB <–> RS-232
Input and output
Shield
Conclusion
Software
Buildingenvironement
Demo Time
Conclusion
Arduino Uno schematics
Arduino is not really about hardware but software.
Tutoriel:Développement
sur Arduino
Augustin Cheron
The ArduinoProject
The hardware side
SoftwareBoot loaders
IDE
Arduino library
Buildingenvironement
Demo Time
Conclusion
Plan
3 SoftwareBoot loadersIDEArduino library
Tutoriel:Développement
sur Arduino
Augustin Cheron
The ArduinoProject
The hardware side
SoftwareBoot loaders
IDE
Arduino library
Buildingenvironement
Demo Time
Conclusion
Boot loaders
Writen in the ATmega flash by the arduino team.Allow programming the devices without externalhardware.2KB memory.
Write incoming data from Serial in the flash memory(19200 baud).Also flash pin 13.And launch the software, if no software is found, itjust restart.
Source code available at :https://github.com/arduino/Arduino (hardware/arduino/bootloader/)
Tutoriel:Développement
sur Arduino
Augustin Cheron
The ArduinoProject
The hardware side
SoftwareBoot loaders
IDE
Arduino library
Buildingenvironement
Demo Time
Conclusion
IDE
Java Based easy to use minimaliste IDE.Select your serial port and baud rateSelect your boardWrite your codeVerify Sketch (Compile)Upload SketchMonitor SerialBurn a boot loader (need external hardware)
Tutoriel:Développement
sur Arduino
Augustin Cheron
The ArduinoProject
The hardware side
SoftwareBoot loaders
IDE
Arduino library
Buildingenvironement
Demo Time
Conclusion
Arduino langage
Not realy language just a C++ library.Math: sqrt sin ...Digital IO : mode, read, writeAnalog IO : mode, read, write (PWM)Avanced IO : genrate square wave, shiftBits and Bytes manipulationInterrupts handlingTime manipulation: delay
Documentation at:http://arduino.cc/it/Reference/HomePage
Tutoriel:Développement
sur Arduino
Augustin Cheron
The ArduinoProject
The hardware side
SoftwareBoot loaders
IDE
Arduino library
Buildingenvironement
Demo Time
Conclusion
Arduino language – Entry point
Listing 1: Hiden main in arduino core lib
# include <Arduino . h>
i n t main ( void ){
i n i t ( ) ;
# i f defined (USBCON)USBDevice . a t t a c h ( ) ;
# endif
setup ( ) ;
for ( ; ; ) {loop ( ) ;i f ( ser ialEventRun ) serialEventRun ( ) ;
}
return 0 ;}
Listing 2: Typical sketch main file
/ / # include Any l i b you want
void setup ( ){/ / i n i t IO , vars . . .
}
void loop ( ){/ / Do s t u f f
}
Tutoriel:Développement
sur Arduino
Augustin Cheron
The ArduinoProject
The hardware side
SoftwareBoot loaders
IDE
Arduino library
Buildingenvironement
Demo Time
Conclusion
Arduino library
The Arduino core library give access to some usefullinterfaces:
EEPROM: reading and writing.Ethernet: using the Arduino Ethernet Shield.Firmata: serial connection with computer.LiquidCrystal: controlling LCDs.SD: Reading and writing SD cards.Servo: Controlling servo motors.SPI: Communicating with devices using the SPI Bus.SoftwareSerial: serial communication on digital pins.Stepper: controlling stepper motorsWire: Two Wire Interface (TWI/I2C).
Documentation : http://arduino.cc/it/Reference/Libraries
Tutoriel:Développement
sur Arduino
Augustin Cheron
The ArduinoProject
The hardware side
Software
BuildingenvironementBy by IDE, hello makefile
What about debuging ?
Demo Time
Conclusion
Plan
4 Building environementBy by IDE, hello makefileWhat about debuging ?
Tutoriel:Développement
sur Arduino
Augustin Cheron
The ArduinoProject
The hardware side
Software
BuildingenvironementBy by IDE, hello makefile
What about debuging ?
Demo Time
Conclusion
The avr toolchain
We will discuss about it in more details later.Build : avr-gccStrip : avr-binutils (size, objcopy, strip, ...)Upload : Avrdude
Tutoriel:Développement
sur Arduino
Augustin Cheron
The ArduinoProject
The hardware side
Software
BuildingenvironementBy by IDE, hello makefile
What about debuging ?
Demo Time
Conclusion
What about debuging ?
Few emulation project : simulavrEmulation + gdb serverWrite on serial
Not a good idee if you need to be fast.
Tutoriel:Développement
sur Arduino
Augustin Cheron
The ArduinoProject
The hardware side
Software
BuildingenvironementBy by IDE, hello makefile
What about debuging ?
Demo Time
Conclusion
Direct Avr debuging
Need of external hardware : Avr Dragon, Jtag,Ociloscope, ...
Avr JTAG :Realy coolBut not present on common Atmega chip used by theArduino project.
One Wire debug : Present on every Atmega Yeah !
Tutoriel:Développement
sur Arduino
Augustin Cheron
The ArduinoProject
The hardware side
Software
BuildingenvironementBy by IDE, hello makefile
What about debuging ?
Demo Time
Conclusion
Debug wire
The debug wire use the reset pin.remeber the auto reset ?
Tutoriel:Développement
sur Arduino
Augustin Cheron
The ArduinoProject
The hardware side
Software
BuildingenvironementBy by IDE, hello makefile
What about debuging ?
Demo Time
Conclusion
My next project
Give one wire debug in the usb <–> serial Atmega chipInclude debug in Arduino IDE.Allow the use of GDB.
Not realy sure if it’s possible.
Tutoriel:Développement
sur Arduino
Augustin Cheron
The ArduinoProject
The hardware side
Software
Buildingenvironement
Demo TimeThe microcontroller Helloworld !
Some LSE project
And more ...
Conclusion
Plan
5 Demo TimeThe microcontroller Hello world !Some LSE projectAnd more ...
Tutoriel:Développement
sur Arduino
Augustin Cheron
The ArduinoProject
The hardware side
Software
Buildingenvironement
Demo TimeThe microcontroller Helloworld !
Some LSE project
And more ...
Conclusion
Blinking LED – Arduino style
i n t LED_PIN = 1 3 ;
void setup ( ){/ / Set the led pin as an outputpinMode (LED_PIN , OUTPUT) ;
}
void loop ( ){/ / Switch on the ledd i g i t a l w r i t e ( LED_PIN , HIGHT ) ;/ / Wait 1000msdelay ( 1 0 0 0 ) ;/ / Switch o f f the ledd i g i t a l w r i t e ( LED_PIN , LOW) ;/ / Wait 1000msdelay ( 1 0 0 0 ) ;
}
Tutoriel:Développement
sur Arduino
Augustin Cheron
The ArduinoProject
The hardware side
Software
Buildingenvironement
Demo TimeThe microcontroller Helloworld !
Some LSE project
And more ...
Conclusion
Who fast can we blink ? IO speed test
Basic digitalRightDirect register writingmore ?
Tutoriel:Développement
sur Arduino
Augustin Cheron
The ArduinoProject
The hardware side
Software
Buildingenvironement
Demo TimeThe microcontroller Helloworld !
Some LSE project
And more ...
Conclusion
Snes bot
...
Tutoriel:Développement
sur Arduino
Augustin Cheron
The ArduinoProject
The hardware side
Software
Buildingenvironement
Demo TimeThe microcontroller Helloworld !
Some LSE project
And more ...
Conclusion
Lots of compatible arduino project
Learn from IDE sampleMore samples on arduino websitehttp://arduino.cc/en/Tutorial/HomePage
Start with hardware (I2C, SPI, ...)http://www.arduino.cc/playground/Main/InterfacingWithHardware
Find more on google
Tutoriel:Développement
sur Arduino
Augustin Cheron
The ArduinoProject
The hardware side
Software
Buildingenvironement
Demo Time
Conclusion
Plan
6 Conclusion
Tutoriel:Développement
sur Arduino
Augustin Cheron
The ArduinoProject
The hardware side
Software
Buildingenvironement
Demo Time
Conclusion
Question ?
[email protected]@Yoopohttps://bitbucket.org/yoopo/snesbot
Top Related