40
Get your hands dirty with Arduino Savio Dimatteo Heidelberg Web Enthusiasts Meetup - 10 Dec 2014

Get your hands dirty with Arduino

Embed Size (px)

Citation preview

Page 1: Get your hands dirty with Arduino

Get your hands dirty with ArduinoSavio Dimatteo

Heidelberg Web Enthusiasts Meetup - 10 Dec 2014

Page 2: Get your hands dirty with Arduino

Arduino

Page 3: Get your hands dirty with Arduino

Arduinofrom http://arduino.cc

“Arduino is an open-source electronics platform based on easy-to-use hardware and

software. It's intended for anyone making interactive projects.”

IDE

+Board

Page 4: Get your hands dirty with Arduino

Making a project

1. wire components on a breadboard and

connect them to arduino I/O pins

Page 5: Get your hands dirty with Arduino

2. write code into the IDE to read/write from/to

Arduino pins

Making a project

Page 6: Get your hands dirty with Arduino

Making a project

3. compile & upload code into a chip on the

board machine code

Page 7: Get your hands dirty with Arduino

Many Models

Page 8: Get your hands dirty with Arduino

Many Models

Page 9: Get your hands dirty with Arduino

Parameters

● Input voltage

● CPU Speed

● # Analog I/O pins

● # Digital I/O pins

● FLASH capacity

● EEPROM capacity

● SRAM capacity

● USB interface

● UART

Many Specs

Page 10: Get your hands dirty with Arduino

Parameters

● Input voltage

● USB interface

● UART

Many Specs

Cost: ~4€

Page 11: Get your hands dirty with Arduino

Arduino UNOCost: ~25€

Page 12: Get your hands dirty with Arduino

Arduino shields

Page 13: Get your hands dirty with Arduino

Arduino IDE

Page 14: Get your hands dirty with Arduino

● language is an implementation of Wiring

● syntax looks like a mix of Java/C/C++

● feels almost like a scripting language...

● code preprocessed into C++

● compiled and linked against Arduino libraries

● machine code into a file ready for upload

Arduino code

Page 15: Get your hands dirty with Arduino

● write code

● compile

● connect Arduino via USB

● upload

● see if it works

Typical workflow

Page 16: Get your hands dirty with Arduino

● write code using Serial.print(...)

● compile

● connect Arduino via USB

● upload

● open serial monitor

● see if it works, check serial monitor output

Debugging

Page 17: Get your hands dirty with Arduino

Get started

http://www.instructables.com/http://www.google.com

http://playground.arduino.cc

Page 18: Get your hands dirty with Arduino

● Arduino Projects Book● Arduino UNO● USB cable● Breadboard● Wooden Base● 9v battery snap● Wires● Photoresistors, potentiometers, pushbuttons,

sensors, LCD display, LEDs, Transistors, Optocouplers, Piezo, Small Motors, Diodes, Resistors...

Starter kit (~100€)

Page 19: Get your hands dirty with Arduino

Blink

Page 20: Get your hands dirty with Arduino

Uploading blink

Page 21: Get your hands dirty with Arduino

Blink uploaded

Page 22: Get your hands dirty with Arduino

Hello, World!

Page 23: Get your hands dirty with Arduino

Hello, World!

Page 24: Get your hands dirty with Arduino

● 01 GET TO KNOW YOUR TOOLS an introduction to the concepts you'll need to use this kit

● 02 SPACESHIP INTERFACE design the control panel for your starship

● 03 LOVE-O-METER measure how hot-blooded you are

● 04 COLOR MIXING LAMP produce any color with a lamp that uses light as an input

● 05 MOOD CUE clue people in to how you're doing

● 06 LIGHT THEREMIN create a musical instrument you play by waving your hands

● 07 KEYBOARD INSTRUMENT play music and make some noise with this keyboard

● 08 DIGITAL HOURGLASS a light-up hourglass that can stop you from working too much

● 09 MOTORIZED PINWHEEL a colored wheel that will make your head spin

● 10 ZOETROPE create a mechanical animation you can play forward or reverse

● 11 CRYSTAL BALL a mystical tour to answer all your tough questions

● 12 KNOCK LOCK tap out the secret code to open the door

● 13 TOUCHY-FEEL LAMP a lamp that responds to your touch

● 14 TWEAK THE ARDUINO LOGO control your personal computer from your Arduino

● 15 HACKING BUTTONS create a master control for all your devices!

Projects book

Page 25: Get your hands dirty with Arduino

What did I do with Arduino

Page 26: Get your hands dirty with Arduino

Got rid of IDE

● mkdir blink && cd blink && ino init

● vim src/sketch.ino

● … edit … save ...

● :!ino build

● :!ino upload

● :!ino serial (optional)

Page 27: Get your hands dirty with Arduino

My first project

Page 28: Get your hands dirty with Arduino

● hardest hardware part:

insert a straw at the base of a bottle

Trampolino

Page 29: Get your hands dirty with Arduino

● hardest hardware part:

insert a straw at the base of a bottle

● hardest software part:

try to be precise when pouring the same

amount of water...

Trampolino

Page 30: Get your hands dirty with Arduino

● water doesn’t flow at a constant rate!

Problem

Page 31: Get your hands dirty with Arduino

How many seconds to

pour for, to get the same

unit of water out of the

straw?

Problem

Page 32: Get your hands dirty with Arduino

I. measure flow rate

II. estimate pressure

Possible Solution

Page 33: Get your hands dirty with Arduino

Detecting watervoid setup() { pinMode(9, INPUT);}

void loop() { if (digitalRead(9) == LOW) { // water detected! }}

Page 34: Get your hands dirty with Arduino

“Time through straw”

Page 35: Get your hands dirty with Arduino

Curve fitting

Page 36: Get your hands dirty with Arduino
Page 37: Get your hands dirty with Arduino
Page 38: Get your hands dirty with Arduino

On Facebook...

Page 39: Get your hands dirty with Arduino

● very easy to get started

● time consuming

● exciting

● expensive

● generally not dangerous

Conclusions

Page 40: Get your hands dirty with Arduino

Get your hands dirty with Arduino

Thank You● My Website: http://www.savio.dimatteo.it

● GitHub: https://github.com/darksmo

● Twitter: @darksmo

● E-mail: [email protected]

● Trampolino: http://darksmo.github.io/arduino-trampolino/

● Arduino playground: http://playground.arduino.cc