1 / 108

#10

#10. Anne Roudaut hci2: building interactive devices hasso-plattner institute. tangible & electronic. assignment. design, prototype, and laser cut a robotic vehicle that you can control by projecting on it upload sketches, drawings, & photos to the wiki.

noma
Download Presentation

#10

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. #10 Anne Roudaut hci2: building interactive devices hasso-plattner institute tangible & electronic

  2. assignment • design, prototype, and laser cut a robotic vehicle that you can control by projecting on it • upload sketches, drawings, & photos to the wiki

  3. shape allows users to pick up and move light sensors, to allow sending commands to the tangible (onmi) wheels and motor, so it can move itself your task: design & built a motorized tangible object

  4. electronic part with an arduino board

  5. and a set of components (battery / motors / photoresistors / chips / resistors …)

  6. arduino

  7. board

  8. program on PC (simplified C++) • upload to the board • separate and run independently main advantage of Arduino!

  9. when programming and testing pins some LEDs usb plug (5V) processor reset button to run independently external power (max 12v) pins

  10. pins some LEDs usb plug (5V) reset button processor external power (max 12v) pins: to plug in components such as… pins

  11. + - long leg is the + LEDs

  12. the LED blinks continuously (we will see later why we need the resistor) pin “gnd” (ground) pin “12” what’s happening?

  13. step by step

  14. 0 configure

  15. 1 pin “gnd” (ground) pin “12” pluging in

  16. e.g. all these pins are connected It is the same here etc. test board

  17. 2 compiling

  18. 3 uploading

  19. it isblinking: the board is uploading the binary code (1 = light on / 0 = light off) 3 uploading

  20. 4 1st loop executing

  21. 5 executes setup () reseting

  22. test 1 (5 mn) blinking LED • plug in a resistor and an LED in pin 12 • launch the File/Examples/Basic/Blink arduino files • modify the code to make the LED says “SOS” in Morse (3 shorts, 3 longs, 3 shorts) 82 ohm - + pin gnd Blue LED pin 12 (5 V)

  23. don’t forget your programming skills! write functions

  24. test 2 (5 mn) more blinking (with the same circuit) • upload File/Examples/Basic/Blink to the board • change the first delay value to 1 and the second to 1. upload the code to the board • change the first delay value to 1 and the second to 10. upload the code to the board • compare the three cases and tell me more!

  25. delay(1000) … delay(1000) HIGH blink bright LOW 1 2 3 delay(1) … delay(1) less bright blink delay(1) … delay(10) even less bright blink

  26. delay(1000) … delay(1000) HIGH voltage is either 0 or 5v LOW 1 2 3 delay(1) … delay(1) voltage is ½ of 5V delay(1) … delay(10) voltage is a 1/11 of 5 V

  27. pulse width modulation :: technique using a rectangular pulse wave whose pulse width is modulated resulting in the variation of the average value of the waveform it serves to create an analog signal from a digital one

  28. digitalWrite("pin number", HIGH or LOW) or analogWrite("pin number", "value in [0;255]") (% of voltage) there are special pins that produce PWM signals • (in addition to digital signals)

  29. test 3 (5 mn) smooth blinking • change your circuit to use a PMW pin • write code with analogWrite() to make the led smoothly blink (the brightness progressively increases)

  30. pins are input and output

  31. digitalWrite("pinnumber”,”HIGH or LOW”) digitalRead("pin number”) -> 1 or 0 (0 if voltage < 3v) digital pins are for input and output

  32. analogWrite("pin number”,[0;255]) PWM pins are analog output

  33. analogRead("pin number”) -> [0;1023] (1023 being the maximum voltage in the board) analog pins are for analog input

  34. both digital and analog pins deal with voltages reading input works with every components that generate voltages

  35. battery

  36. by the way, components that generate high voltage will damage the board, be careful! pin “A0” pin “gnd” 1.5V battery on A0 pin to read it voltage

  37. digitalWrite(A0,HIGH)

  38. Monitor display Serial.print() Serial,println() 305 305 305 305 305 305 305 305 305 305 305 305 305 of [0;1023] so 305x5/1023 = 1,49V

  39. so it works with components that generate voltages such as…

  40. voltage increases when the intensity of light increases photodiode

  41. voltage increases when pressure increases piezoelectric cells

  42. but also with components that generate resistance • (and we will see the trick later)

  43. material in what components are plug in it removes electrostatic charges conductive foam

  44. it lets the charge passing thought: it conduces charges the more you squeeze it, the less it resists to the travel of the charges conductive foam

  45. pin “A0” pin “gnd” let’s play with a piece of conductive foam

  46. test 4 (5 mn) read pins • plug in two wires and a piece of foam between pin A0 and GND • write code to display the change of voltage on pin A0 • write code to make an LED more or less bright when you squeeze the foam

More Related