Workshops On Designing Electronic Toys #10

E6814d062e4214045659f01deb793859?s=47 Hirotaka Nakajima
June 10, 2014
100

Workshops On Designing Electronic Toys #10

E6814d062e4214045659f01deb793859?s=128

Hirotaka Nakajima

June 10, 2014
Tweet

Transcript

  1. 5IFTFTMJEFTBSFDPQZSJHIU˜)JSPUBLB/BLBKJNB3FEJTUSJCVUFBOEEJTDMPTVSFPGUIFTFTMJEFTBSFOPUQFSNJUUFEXJUIPVUQFSNJTTJPOT ,FJP6OJWFSTJUZMPHPJTMJDFOTFECZJUTDPQZSJHIUIPMEFST Workshops On Designing Electronic Toys #10 Hirotaka Nakajima

    / @nunnun http://about.me/nunnun 1
  2. 5IFTFTMJEFTBSFDPQZSJHIU˜)JSPUBLB/BLBKJNB3FEJTUSJCVUFBOEEJTDMPTVSFPGUIFTFTMJEFTBSFOPUQFSNJUUFEXJUIPVUQFSNJTTJPOT ,FJP6OJWFSTJUZJTMJDFOTFECZJUTDPQZSJHIUIPMEFST Agenda 2 • Serial Communication (LED3) • Connect

    your gadget to the PC • Final project presentations • Work time
  3. 5IFTFTMJEFTBSFDPQZSJHIU˜)JSPUBLB/BLBKJNB3FEJTUSJCVUFBOEEJTDMPTVSFPGUIFTFTMJEFTBSFOPUQFSNJUUFEXJUIPVUQFSNJTTJPOT ,FJP6OJWFSTJUZJTMJDFOTFECZJUTDPQZSJHIUIPMEFST Connect your gadget with PC 3 • Arduino

    has serial support (UART) • Arduino and PC are connected via USB
  4. 5IFTFTMJEFTBSFDPQZSJHIU˜)JSPUBLB/BLBKJNB3FEJTUSJCVUFBOEEJTDMPTVSFPGUIFTFTMJEFTBSFOPUQFSNJUUFEXJUIPVUQFSNJTTJPOT ,FJP6OJWFSTJUZJTMJDFOTFECZJUTDPQZSJHIUIPMEFST Serial communication (Windows) 4 • TeraTerm 
 http://en.sourceforge.jp/projects/ttssh2/releases/

  5. 5IFTFTMJEFTBSFDPQZSJHIU˜)JSPUBLB/BLBKJNB3FEJTUSJCVUFBOEEJTDMPTVSFPGUIFTFTMJEFTBSFOPUQFSNJUUFEXJUIPVUQFSNJTTJPOT ,FJP6OJWFSTJUZJTMJDFOTFECZJUTDPQZSJHIUIPMEFST Serial communication (Windows) 5

  6. 5IFTFTMJEFTBSFDPQZSJHIU˜)JSPUBLB/BLBKJNB3FEJTUSJCVUFBOEEJTDMPTVSFPGUIFTFTMJEFTBSFOPUQFSNJUUFEXJUIPVUQFSNJTTJPOT ,FJP6OJWFSTJUZJTMJDFOTFECZJUTDPQZSJHIUIPMEFST Serial communication (Mac & Ubuntu) 6 • Unix

    screen program handles serial connection • Install Serial driver: http://www.ftdichip.com/Drivers/ VCP.htm • Open Terminal • (install the screen by “apt-get install screen”) • type “screen /dev/tty.usbserial-A7004C6X”
 underlined character differs by each gadget • to exit screen type “Ctrl A + k”
  7. 5IFTFTMJEFTBSFDPQZSJHIU˜)JSPUBLB/BLBKJNB3FEJTUSJCVUFBOEEJTDMPTVSFPGUIFTFTMJEFTBSFOPUQFSNJUUFEXJUIPVUQFSNJTTJPOT ,FJP6OJWFSTJUZJTMJDFOTFECZJUTDPQZSJHIUIPMEFST Serial communication (Mac & Ubuntu) 7

  8. 5IFTFTMJEFTBSFDPQZSJHIU˜)JSPUBLB/BLBKJNB3FEJTUSJCVUFBOEEJTDMPTVSFPGUIFTFTMJEFTBSFOPUQFSNJUUFEXJUIPVUQFSNJTTJPOT ,FJP6OJWFSTJUZJTMJDFOTFECZJUTDPQZSJHIUIPMEFST Final Project 8 • According to Syllabus:
 It

    is mandatory to present/demonstrate your masterpiece (electronic gadget) with written reports. • Electronic Gadget • Must have some sensor • Report • Written reports • Circuit Diagram
  9. 5IFTFTMJEFTBSFDPQZSJHIU˜)JSPUBLB/BLBKJNB3FEJTUSJCVUFBOEEJTDMPTVSFPGUIFTFTMJEFTBSFOPUQFSNJUUFEXJUIPVUQFSNJTTJPOT ,FJP6OJWFSTJUZJTMJDFOTFECZJUTDPQZSJHIUIPMEFST Sensors 9 • Kind • Temperature / Humidity

    • Gyroscope / Accelerometer • Photo sensor (LED sensor) • Pressure • Way to connect • Analog • Digital • I2C
  10. 5IFTFTMJEFTBSFDPQZSJHIU˜)JSPUBLB/BLBKJNB3FEJTUSJCVUFBOEEJTDMPTVSFPGUIFTFTMJEFTBSFOPUQFSNJUUFEXJUIPVUQFSNJTTJPOT ,FJP6OJWFSTJUZJTMJDFOTFECZJUTDPQZSJHIUIPMEFST 10

  11. 5IFTFTMJEFTBSFDPQZSJHIU˜)JSPUBLB/BLBKJNB3FEJTUSJCVUFBOEEJTDMPTVSFPGUIFTFTMJEFTBSFOPUQFSNJUUFEXJUIPVUQFSNJTTJPOT ,FJP6OJWFSTJUZJTMJDFOTFECZJUTDPQZSJHIUIPMEFST LED3 11 • Send the data to PC

    through serial • http://web.sfc.keio.ac.jp/~takefuji/led3.tar • If you have done, draw diagram • AE-UM232R fritzing data
 http://www.densikit.com/home/fritzing
  12. 5IFTFTMJEFTBSFDPQZSJHIU˜)JSPUBLB/BLBKJNB3FEJTUSJCVUFBOEEJTDMPTVSFPGUIFTFTMJEFTBSFOPUQFSNJUUFEXJUIPVUQFSNJTTJPOT ,FJP6OJWFSTJUZJTMJDFOTFECZJUTDPQZSJHIUIPMEFST 12 int ledPin=8; int sensorPin = A0; int

    sensorValue = 0; void setup(){ pinMode(ledPin, OUTPUT); Serial.begin(9600); } void loop(){ sensorValue = analogRead(sensorPin); if(sensorValue>250){ digitalWrite(ledPin, 0); } else { digitalWrite(ledPin,1); } Serial.println(sensorValue,DEC); delay(1000); }
  13. 5IFTFTMJEFTBSFDPQZSJHIU˜)JSPUBLB/BLBKJNB3FEJTUSJCVUFBOEEJTDMPTVSFPGUIFTFTMJEFTBSFOPUQFSNJUUFEXJUIPVUQFSNJTTJPOT ,FJP6OJWFSTJUZJTMJDFOTFECZJUTDPQZSJHIUIPMEFST LED3’ 13 • LED is turned on if

    the sensor value is > 250 • It works with specific LED but not works mine (for example) • Threshold should be based on the environment • Sensor LED data several times • Determine the threshold • Let’s change the program!
  14. 5IFTFTMJEFTBSFDPQZSJHIU˜)JSPUBLB/BLBKJNB3FEJTUSJCVUFBOEEJTDMPTVSFPGUIFTFTMJEFTBSFOPUQFSNJUUFEXJUIPVUQFSNJTTJPOT ,FJP6OJWFSTJUZJTMJDFOTFECZJUTDPQZSJHIUIPMEFST 2VFTUJPO $PNNFOUT  IJSP!BXBTGDLFJPBDKQ IUUQBCPVUNFOVOOVO !OVOOVO 14