Get your hands dirty with Arduino

Preview:

Citation preview

Get your hands dirty with ArduinoSavio Dimatteo

Heidelberg Web Enthusiasts Meetup - 10 Dec 2014

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

Making a project

1. wire components on a breadboard and

connect them to arduino I/O pins

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

Arduino pins

Making a project

Making a project

3. compile & upload code into a chip on the

board machine code

Many Models

Many Models

Parameters

● Input voltage

● CPU Speed

● # Analog I/O pins

● # Digital I/O pins

● FLASH capacity

● EEPROM capacity

● SRAM capacity

● USB interface

● UART

Many Specs

Parameters

● Input voltage

● USB interface

● UART

Many Specs

Cost: ~4€

Arduino UNOCost: ~25€

Arduino shields

Arduino IDE

● 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

● write code

● compile

● connect Arduino via USB

● upload

● see if it works

Typical workflow

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

● compile

● connect Arduino via USB

● upload

● open serial monitor

● see if it works, check serial monitor output

Debugging

Get started

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

http://playground.arduino.cc

● 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€)

Blink

Uploading blink

Blink uploaded

Hello, World!

Hello, World!

● 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

What did I do 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)

My first project

● hardest hardware part:

insert a straw at the base of a bottle

Trampolino

● 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

● water doesn’t flow at a constant rate!

Problem

How many seconds to

pour for, to get the same

unit of water out of the

straw?

Problem

I. measure flow rate

II. estimate pressure

Possible Solution

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

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

“Time through straw”

Curve fitting

On Facebook...

● very easy to get started

● time consuming

● exciting

● expensive

● generally not dangerous

Conclusions

Get your hands dirty with Arduino

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

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

● Twitter: @darksmo

● E-mail: darksmo@gmail.com

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

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

Recommended