Intro tot Arduino - vra.be tot arduino v2.pdf · Wat is Arduino? Volgens de website: “Arduino is...

36
Intro tot Arduino

Transcript of Intro tot Arduino - vra.be tot arduino v2.pdf · Wat is Arduino? Volgens de website: “Arduino is...

Page 1: Intro tot Arduino - vra.be tot arduino v2.pdf · Wat is Arduino? Volgens de website: “Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware

Intro tot Arduino

Page 2: Intro tot Arduino - vra.be tot arduino v2.pdf · Wat is Arduino? Volgens de website: “Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware

Wat is Arduino?

● Volgens de website:

“Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software. It's intended for artists, designers, hobbyists, and anyone interested in creating interactive objects or environments.”

Page 3: Intro tot Arduino - vra.be tot arduino v2.pdf · Wat is Arduino? Volgens de website: “Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware

Wat is Arduino?

● Arduino = microprocessor (Atmel)

+ bootloader in de processor

+ break out board (incl Xtal, USB, voltage stabalizer, ...)

+ makkelijke IDE voor programmas te maken+ hogere programmeer taal

● Arduino specs zijn open source– Verschillende fabrikanten maken hardware

● 300.000+ boards verkocht

Page 4: Intro tot Arduino - vra.be tot arduino v2.pdf · Wat is Arduino? Volgens de website: “Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware

Arduino vs Microcontroller

Arduino● Volledig bord

● Bevat opstart programma

● Kan direct op PC worden aangesloten

● Heeft USB poort voor communicatie

● Prijs: 15€

Microcontroller● Enkel de chip

● Bevat geen code

● Programmer nodig

● Geen communicatie

● Prijs: 2,60€

Page 5: Intro tot Arduino - vra.be tot arduino v2.pdf · Wat is Arduino? Volgens de website: “Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware

Verschillende Arduinos

Arduino Uno, 20€

Arduino Nano, 15€

Arduino Mega, 39€

Arduino Lilypad, 17€

Page 6: Intro tot Arduino - vra.be tot arduino v2.pdf · Wat is Arduino? Volgens de website: “Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware

Verschillende Arduinos

Model Processor Frequency Voltage Flash (kB) EEPROM (kB)

Digital I/O (pins)

Analog input (pins)

LilyPad ATmega168V or

ATmega328V

8 MHz 2.7-5.5 V 16 0.5 14 6

Mega2560 Atmega2560

16 MHz 5 V 256 4 54 16

Nano ATmega168 Or

ATmega328

16 MHz 5 V 16/32 0.5/1 14 8

Uno Atmega328P

16 MHz 5 V 32 1 14 6

Page 7: Intro tot Arduino - vra.be tot arduino v2.pdf · Wat is Arduino? Volgens de website: “Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware

Arduino YUN

● Combinatie van Linux computer met Arduino

Page 8: Intro tot Arduino - vra.be tot arduino v2.pdf · Wat is Arduino? Volgens de website: “Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware

Arduino Uno in detail

Atmel micro processor

USB connection

Power input (7-12V)

Reset button

Page 9: Intro tot Arduino - vra.be tot arduino v2.pdf · Wat is Arduino? Volgens de website: “Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware

Arduino Uno in detail

5V in/out

5V out met Vin aangesloten, interne 5V stabaliser5V in zonder Vin, externe 5V stabaliser

Page 10: Intro tot Arduino - vra.be tot arduino v2.pdf · Wat is Arduino? Volgens de website: “Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware

Arduino Uno in detail

Analog In pins0-5V, 10 bit resolution

Page 11: Intro tot Arduino - vra.be tot arduino v2.pdf · Wat is Arduino? Volgens de website: “Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware

Arduino Uno in detail

Digital I/O pins6 with Pulse Width ModulationLed on pin 13

Page 12: Intro tot Arduino - vra.be tot arduino v2.pdf · Wat is Arduino? Volgens de website: “Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware

Uitbreiden met shields● Shield = PCB bovenop standaard

Arduino pins dat functionaliteit uitbreidt

● Bvb. ethernet board, motor control, ...

Page 13: Intro tot Arduino - vra.be tot arduino v2.pdf · Wat is Arduino? Volgens de website: “Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware

Arduino programma in 3 stappen

1. Programma schrijven

2. Programma compileren

3. Programma opladen

Page 14: Intro tot Arduino - vra.be tot arduino v2.pdf · Wat is Arduino? Volgens de website: “Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware

Arduino programma in 3 stappen

1. Programma schrijven

2. Programma compileren

3. Programma opladen

Alle stappen via de IDE

Page 15: Intro tot Arduino - vra.be tot arduino v2.pdf · Wat is Arduino? Volgens de website: “Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware

1. Programma schrijven

● Programma wordt geschreven in een programmeertaal, begrijpbaar voor mensen

● Programmeren in C++● IDE helpt bij het schrijven van

programmas● Een Arduino programma noemt men

ook een sketch

Page 16: Intro tot Arduino - vra.be tot arduino v2.pdf · Wat is Arduino? Volgens de website: “Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware

Tips voor het programmeren

● Voeg commentaar toe aan je code● Gebruik goede namen voor je

variabelen● Bouw logische blokken in je code

-> Zorg dat je er binnen een jaar nog aan uit geraakt

Page 17: Intro tot Arduino - vra.be tot arduino v2.pdf · Wat is Arduino? Volgens de website: “Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware

Basisstructuur van een sketch

Page 18: Intro tot Arduino - vra.be tot arduino v2.pdf · Wat is Arduino? Volgens de website: “Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware

Functies voor uitlezen pins

● Digitale pins– digitalWrite()

– digitalRead()

– analogWrite()

● Analoge pins– analogRead()

Page 19: Intro tot Arduino - vra.be tot arduino v2.pdf · Wat is Arduino? Volgens de website: “Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware

Libraries

“If I have seen further it is by standing on the

shoulders of giants”- Isaac Newton -

Page 20: Intro tot Arduino - vra.be tot arduino v2.pdf · Wat is Arduino? Volgens de website: “Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware

Libraries

● Library is een bibliotheek met functies● Libraries beschikbaar voor veel

electronica componenten, bvb rotary encoder, LCD display, …

● Libraries beschikbaar voor interface protocollen, bvb I2C

Page 21: Intro tot Arduino - vra.be tot arduino v2.pdf · Wat is Arduino? Volgens de website: “Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware

2. Programma compileren

● Compileren = programma omzetten naar code die de Arduino begrijpt

● Tijdens compileren wordt het programma nagekeken op syntax fouten (geen logische fouten!)

Page 22: Intro tot Arduino - vra.be tot arduino v2.pdf · Wat is Arduino? Volgens de website: “Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware

3. Programma opladen

● Gecompileerd programma moet worden opgeladen naar de Arduino via USB kabel

● Juiste bord en USB poort kiezen

Page 23: Intro tot Arduino - vra.be tot arduino v2.pdf · Wat is Arduino? Volgens de website: “Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware

Communicatie met de PC

● USB poort voor communicatie met PC– Herprogrammeren van Arduino in het

circuit

– Gegevens doorsturen naar de PC tijdens uitvoeren sketch (incl. debug)

– Via PC instructies geven aan de Arduino

Page 24: Intro tot Arduino - vra.be tot arduino v2.pdf · Wat is Arduino? Volgens de website: “Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware

1: pinkende led

Page 25: Intro tot Arduino - vra.be tot arduino v2.pdf · Wat is Arduino? Volgens de website: “Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware

2: Uitlezen schakelaar

Page 26: Intro tot Arduino - vra.be tot arduino v2.pdf · Wat is Arduino? Volgens de website: “Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware

3: uitlezen analoge waarde

Page 27: Intro tot Arduino - vra.be tot arduino v2.pdf · Wat is Arduino? Volgens de website: “Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware

4: Led, ldr en pot

Page 28: Intro tot Arduino - vra.be tot arduino v2.pdf · Wat is Arduino? Volgens de website: “Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware

5. Faden van led met PWM

Page 29: Intro tot Arduino - vra.be tot arduino v2.pdf · Wat is Arduino? Volgens de website: “Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware

6. Rotary encoder

Page 30: Intro tot Arduino - vra.be tot arduino v2.pdf · Wat is Arduino? Volgens de website: “Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware

Grotere Arduino projecten

Page 31: Intro tot Arduino - vra.be tot arduino v2.pdf · Wat is Arduino? Volgens de website: “Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware

DDS module

● Direct Digital Synthesizer● Kan sinusgolven maken tussen 0

en 30 MHz● Vanaf 5€ op ebay

Page 32: Intro tot Arduino - vra.be tot arduino v2.pdf · Wat is Arduino? Volgens de website: “Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware

Hoge snelheidsfotografie

● Arduino project voor het nemen van fotos van events die slechts enkele milliseconden duren

Page 33: Intro tot Arduino - vra.be tot arduino v2.pdf · Wat is Arduino? Volgens de website: “Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware

Nano keyer

● CW keyer gebaseerd op Arduino● Stand alone of met PC

Page 34: Intro tot Arduino - vra.be tot arduino v2.pdf · Wat is Arduino? Volgens de website: “Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware

Arduino Bom

● Ontkoppel de draadjes in de juiste volgorde of de bom ontploft

Page 35: Intro tot Arduino - vra.be tot arduino v2.pdf · Wat is Arduino? Volgens de website: “Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware

Arduino en Radio

Page 36: Intro tot Arduino - vra.be tot arduino v2.pdf · Wat is Arduino? Volgens de website: “Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware

Voor meer info

www.arduino.cc