Getting Started With Arduino How To Build A Twitter Monitoring Alertuino


Published on

The slides from my talk about Arduino at Barcamp Liverpool. Shows the basics about Arduino and how I hacked a toy gun to fire whenever someone mentioned #bcliverpool on twitter

Published in: Technology
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Getting Started With Arduino How To Build A Twitter Monitoring Alertuino

  1. 1. Getting Started With Arduino: How to build a Twitter-monitoring Alertuino Adrian McEwen -
  2. 2. What is Arduino? <ul><li>Embedded computing platform </li></ul><ul><li>Open Source Hardware </li></ul><ul><li>Open Source Software </li></ul><ul><li>Easy-to-use </li></ul><ul><li>A way to build the “Internet of Things” </li></ul>Adrian McEwen -
  3. 3. Common Features <ul><li>Assortment of Arduinos, but most share the same common features: </li></ul><ul><li>16KB flash </li></ul><ul><li>1KB RAM </li></ul><ul><li>14 digital I/O pins </li></ul><ul><li>6 analogue I/O pins </li></ul>Adrian McEwen -
  4. 4. Easy to Learn <ul><li>Integrated IDE </li></ul><ul><li>Upload code via USB with a single click </li></ul><ul><li>Lots of examples to learn from </li></ul><ul><li>Active community sharing how they made their projects </li></ul>Adrian McEwen -
  5. 5. Easy to Extend Adrian McEwen -
  6. 6. The Anatomy of a Sketch <ul><li>The code that runs on the Arduino is called a sketch. </li></ul><ul><li>Two main parts: </li></ul><ul><ul><li>setup() </li></ul></ul><ul><ul><li>loop() </li></ul></ul><ul><li>This is the Arduino “Hello World” - Blink </li></ul>Adrian McEwen -
  7. 7. The Anatomy of a Sketch: setup() <ul><li>Runs once, on startup. </li></ul>Adrian McEwen -
  8. 8. The Anatomy of a Sketch: loop() <ul><li>Runs continually, after startup. </li></ul>Adrian McEwen -
  9. 9. Seeing Blink in Action <ul><li>Load Blink example in the IDE: File -> Sketchbook -> Examples -> Digital -> Blink </li></ul><ul><li>Click the upload button: </li></ul><ul><li>Watch the LED blink* </li></ul><ul><li>*on boards other than the Diecimila and Duemilanove you might need to connect an LED between digital pin 13 and GND </li></ul>Adrian McEwen -
  10. 10. Now the real fun starts… Adrian McEwen -
  11. 11. Some (Very) Basic Electronic Concepts <ul><li>You can think of electronics in a similar way to how you’d think of plumbing </li></ul><ul><li>Voltage [V]: a bit like water pressure </li></ul><ul><li>Current [I]: a bit like the amount of water flowing through something </li></ul><ul><li>Resistance [R]: a bit like the (inverse of the) diameter of a water pipe </li></ul>Adrian McEwen -
  12. 12. Ohm’s Law <ul><li>The only equation you’ll need to begin tinkering </li></ul><ul><li>Voltage = Current x Resistance </li></ul><ul><li>Current = Voltage / Resistance </li></ul><ul><li>Resistance = Voltage / Current </li></ul><ul><li>Learn more as you want to do more… </li></ul>Adrian McEwen -
  13. 13. Tinkering With Toys <ul><li>Hacking a toy ray gun to notify me when someone twitters about #barcampliverpool </li></ul>Adrian McEwen -
  14. 14. Take 1 Cheap Toy Ray Gun <ul><li>Battery-operated electronic toys are ideal </li></ul><ul><li>Takes 3 AAA batteries, so near enough to the Arduino’s 5V </li></ul>Adrian McEwen -
  15. 15. Open It Up <ul><li>Find the connections to bypass the switch and turn the toy on </li></ul><ul><li>Use 5V and GND connections on Arduino with some wires to test where the connections should go </li></ul>Adrian McEwen -
  16. 16. Make New Connections <ul><li>Solder the connections ideally </li></ul><ul><li>But you could cut the wires and connect new ones with connecting block </li></ul>Adrian McEwen -
  17. 17. Parts We’ll Use <ul><li>Resistor – 1K ohm (brown-black-red) </li></ul>Adrian McEwen -
  18. 18. Parts We’ll Use <ul><li>Transistor – basically an electronically operated switch </li></ul><ul><li>(we’re using a 2N2222) </li></ul>Adrian McEwen -
  19. 19. Parts We’ll Use <ul><li>Breadboard – easy, solderless prototyping board </li></ul>Adrian McEwen -
  20. 20. Transistors in (a Bit) More Detail <ul><li>Wire emitter to –ve/GND side of circuit </li></ul><ul><li>Wire collector to +ve side of circuit </li></ul><ul><li>Current will flow from collector to emitter when a voltage is applied to base </li></ul>Adrian McEwen -
  21. 21. Our Circuit Adrian McEwen -
  22. 22. Software <ul><li>Computer will fetch the data from Twitter for us </li></ul><ul><li>Then send the number of alerts over serial to the Arduino </li></ul><ul><li>The Arduino will listen for the number of alerts over serial </li></ul><ul><li>Then turn on the toy for 2 seconds for each alert </li></ul>Adrian McEwen -
  23. 23. Alertuino Software: setup() <ul><li>Runs once, on startup. </li></ul>Adrian McEwen -
  24. 24. Alertuino Software: loop() Adrian McEwen -
  25. 25. Lets Try It <ul><li>Upload the Alertuino sketch </li></ul><ul><li>Start the serial monitor </li></ul><ul><li>Send it a command </li></ul><ul><li>Enjoy* </li></ul><ul><li>*fingers crossed ;-) </li></ul>Adrian McEwen -
  26. 26. Find out more <ul><li>My Blog: </li></ul><ul><ul><li> </li></ul></ul><ul><li>Or email </li></ul><ul><li>Buy a beginners kit: </li></ul><ul><ul><li> </li></ul></ul><ul><li>Download the software: </li></ul><ul><ul><li> </li></ul></ul><ul><li>Learn more: </li></ul><ul><ul><li> </li></ul></ul>Adrian McEwen -