Making things sense-Day 2 (May 2011)

1,092
-1

Published on

Slides for the Edge Workshop

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,092
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
48
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Making things sense-Day 2 (May 2011)

  1. 1. Making things senseUrban sensing and physical computing Day 2 (7-8 May 2011) Markus Rittenbruch QUT Urban Informatics / FAST & NICTA
  2. 2. Schedule - Day 2• 12:00 - 12:10 Introduction• 12:10 - 12:30 Analogue sensors• 12:30 - 13:00 Activity• 13:00 - 14:00 Sharing sensor data• 14:00 - 14:10 Short break• 14:10 - 16:10 Project activity• 16:10 - 16:50 Project presentations• 16:50 - 17:00 Wrap up
  3. 3. Making things sense - Day 2
  4. 4. Programming
  5. 5. ProgrammingData types When variables are made to exceed their maximum capacity they "roll over" back to their minimum capacity, note that this happens in both directions. int x x = -32,768; x = x - 1; // x now contains 32,767 - rolls over in neg. direction x = 32,767; x = x + 1; // x now contains -32,768 - rolls overFloat & casting:
  6. 6. ProgrammingFloat & casting: int x; int y; float z; x = 1; y = x / 2; // y now contains 0, ints cant hold fractions z = (float)x / 2.0; // z now contains .5 (you have to use 2.0, not 2)
  7. 7. Resources• Language reference: • http://www.arduino.cc/en/Reference/HomePage • http://arduino.cc/en/Reference/Extended • General code library: • http://arduino.cc/en/Reference/Libraries• Interfacing with hardware: • http://www.arduino.cc/playground/Main/InterfacingWithHardware• Examples • http://arduino.cc/en/Tutorial/HomePage
  8. 8. Analogue sensors
  9. 9. Analogue sensor pins• Use analogue in pins 0-5 for analogRead()• Address as 14-19 when used as digital pins • digitalWrite(), digitalRead()• No pinMode required for analogRead();
  10. 10. Analogue sensor input• File/Examples/Analog/AnalogInput
  11. 11. Analogue sensor input
  12. 12. Programming Conditionals http://www.ladyada.net/learn/arduino/lesson5.html
  13. 13. AnalogInput
  14. 14. Calibration - part 1
  15. 15. Calibration - part 2• map(): remap a number from one range to another • val = map(val, 0, 1023, 0, 255);• constrain(): constrain to a number range
  16. 16. Project activity 1 - Calibration
  17. 17. Components • RGB LED:
  18. 18. Components• LED matrix http://www.sparkfun.com/datasheets/Components/LED/YSM-1288CR3G2C.pdf
  19. 19. Components • MAX7219 LED driverhttp://arduino.cc/playground/Main/MAX72XXHardwarehttp://www.arduino.cc/playground/Main/LEDMatrix
  20. 20. Project activity II - Projects
  21. 21. So, you’ve got an Arduinoand now you want tomake it talk
  22. 22. Or, maybe you want totalk to it...
  23. 23. ...from the other side of the world
  24. 24. This session of the workshop willshow you some ways of doing that.
  25. 25. Arduino to the world• Arduino direct to Pachube via ethernet/wifi shield• Or Arduino to PC via serial, then to Pachube/Twitter• We’re taking the second approach in this workshop, since the kits we provided don’t include ethernet/wifi shields
  26. 26. Step 1: Register a feed on Pachube
  27. 27. Step 2: Write some code
  28. 28. Arduino Sketch
  29. 29. Ruby “Bridge”: setup
  30. 30. Ruby “Bridge”: the loop
  31. 31. Step 3: See your data on Pachube
  32. 32. Advanced topics• PCB design• Wireless communication • Xbee • Bluetooth • Wifi • Infrared • Radio• Real-time communication• Multi-tasking
  33. 33. Resources• http://apiwiki.twitter.com/• http://community.pachube.com/api• http://community.pachube.com/tutorials• http://community.pachube.com/triggers/ twitter
  34. 34. What next?• Hackerspace Brisbane • http://hackerspaces.org/wiki/Hackerspace_Brisbane• Living Dolls (The Edge) • http://edgeqld.org.au/blog/2011/04/07/living-dolls/

×