Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Workshops On Designing Electronic Toys #11
Search
Hirotaka Nakajima
June 17, 2014
0
120
Workshops On Designing Electronic Toys #11
Hirotaka Nakajima
June 17, 2014
Tweet
Share
More Decks by Hirotaka Nakajima
See All by Hirotaka Nakajima
暗号資産カストディアンとセキュリティ
nunnun
0
60
W3Cについて - インターネット標準勉強会 - 若者編
nunnun
0
620
プロフェッショナルSSL/TLS勉強会 PKIに対する攻撃 (第4章)
nunnun
0
1.4k
Paper Summary Encore: Lightweight Measurement of Web Censorship with Cross- Origin Requests
nunnun
0
130
インターネット -第10回- Firefox OSアプリ開発 応用編
nunnun
0
890
Introduction to Server Operations and Automations
nunnun
1
250
Exploring the knowledge on Web
nunnun
2
86
インフラエンジニアのための次世代プロトコル入門 - July TechFesta 2014
nunnun
36
12k
Workshops On Designing Electronic Toys #10
nunnun
0
150
Featured
See All Featured
Mobile First: as difficult as doing things right
swwweet
222
8.9k
Teambox: Starting and Learning
jrom
133
8.8k
Building Better People: How to give real-time feedback that sticks.
wjessup
364
19k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
231
17k
Fireside Chat
paigeccino
33
3k
GitHub's CSS Performance
jonrohan
1030
460k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Automating Front-end Workflow
addyosmani
1366
200k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.2k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
46
2.1k
Writing Fast Ruby
sferik
627
61k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Transcript
5IFTFTMJEFTBSFDPQZSJHIU)JSPUBLB/BLBKJNB3FEJTUSJCVUFBOEEJTDMPTVSFPGUIFTFTMJEFTBSFOPUQFSNJUUFEXJUIPVUQFSNJTTJPOT ,FJP6OJWFSTJUZMPHPJTMJDFOTFECZJUTDPQZSJHIUIPMEFST Workshops On Designing Electronic Toys #11 Hirotaka Nakajima
/ @nunnun http://about.me/nunnun 1
5IFTFTMJEFTBSFDPQZSJHIU)JSPUBLB/BLBKJNB3FEJTUSJCVUFBOEEJTDMPTVSFPGUIFTFTMJEFTBSFOPUQFSNJUUFEXJUIPVUQFSNJTTJPOT ,FJP6OJWFSTJUZJTMJDFOTFECZJUTDPQZSJHIUIPMEFST Agenda 2 • Using I2C Sensor • Work
time
5IFTFTMJEFTBSFDPQZSJHIU)JSPUBLB/BLBKJNB3FEJTUSJCVUFBOEEJTDMPTVSFPGUIFTFTMJEFTBSFOPUQFSNJUUFEXJUIPVUQFSNJTTJPOT ,FJP6OJWFSTJUZJTMJDFOTFECZJUTDPQZSJHIUIPMEFST Sensors 3 • Kind • Temperature / Humidity
• Gyroscope / Accelerometer • Photo sensor (LED sensor) • Pressure • Way to connect • Analog • Digital • I2C
5IFTFTMJEFTBSFDPQZSJHIU)JSPUBLB/BLBKJNB3FEJTUSJCVUFBOEEJTDMPTVSFPGUIFTFTMJEFTBSFOPUQFSNJUUFEXJUIPVUQFSNJTTJPOT ,FJP6OJWFSTJUZJTMJDFOTFECZJUTDPQZSJHIUIPMEFST I2C 4 • Inter-Integrated Circuit • Bus spec
for internal device communication • Bus speed: 100kbps, 400kbps ~ 3.4Mbps • Shared 2 physical pins for I/O • Clock signal (SCL) • Data transfer (SDA) • 10k pull-up resistor • Master-Slave model • Binary protocol
5IFTFTMJEFTBSFDPQZSJHIU)JSPUBLB/BLBKJNB3FEJTUSJCVUFBOEEJTDMPTVSFPGUIFTFTMJEFTBSFOPUQFSNJUUFEXJUIPVUQFSNJTTJPOT ,FJP6OJWFSTJUZJTMJDFOTFECZJUTDPQZSJHIUIPMEFST I2C 5 • 1. Start bit (1 bit)
• 2. Slave Address (7 bits) • 3. Read / Write flag • 4. Acknowledgement (1 bit) from slave • 5. Data (8 bits) • 6. Data-Acknowledgement (1 bit) from slave • 7. Stop bit (1 bit) Chart: http://nora66.com/avr/prog2.html
5IFTFTMJEFTBSFDPQZSJHIU)JSPUBLB/BLBKJNB3FEJTUSJCVUFBOEEJTDMPTVSFPGUIFTFTMJEFTBSFOPUQFSNJUUFEXJUIPVUQFSNJTTJPOT ,FJP6OJWFSTJUZJTMJDFOTFECZJUTDPQZSJHIUIPMEFST I2C 6 • 1. Start bit (1 bit)
• 2. Slave Address (7 bits) • 3. Read / Write flag • 4. Acknowledgement (1 bit) from slave • 5. Data (8 bits) from slave • 6. Data-Acknowledgement (1 bit) • 7. Stop bit (1 bit) Chart: http://nora66.com/avr/prog2.html
5IFTFTMJEFTBSFDPQZSJHIU)JSPUBLB/BLBKJNB3FEJTUSJCVUFBOEEJTDMPTVSFPGUIFTFTMJEFTBSFOPUQFSNJUUFEXJUIPVUQFSNJTTJPOT ,FJP6OJWFSTJUZJTMJDFOTFECZJUTDPQZSJHIUIPMEFST I2C with Arduino 7 • Arduino I2C support:
Wire http://www.arduino.cc/en/Reference/Wire • Lots of libraries for sensors • Today we will use GY-80 • L3G4200D (3 axis gyro) • ADXL345 (3 axis accelerometer) • HMC5883L (compass) • BMP085 (temperature & pressure sensor)
5IFTFTMJEFTBSFDPQZSJHIU)JSPUBLB/BLBKJNB3FEJTUSJCVUFBOEEJTDMPTVSFPGUIFTFTMJEFTBSFOPUQFSNJUUFEXJUIPVUQFSNJTTJPOT ,FJP6OJWFSTJUZJTMJDFOTFECZJUTDPQZSJHIUIPMEFST I2C with Arduino 8 • http://web.sfc.keio.ac.jp/~takefuji/gy80.tar • pin
• Arduino: A4 (SDA), A5 (SCL) • GY-80: SCL, SDA
5IFTFTMJEFTBSFDPQZSJHIU)JSPUBLB/BLBKJNB3FEJTUSJCVUFBOEEJTDMPTVSFPGUIFTFTMJEFTBSFOPUQFSNJUUFEXJUIPVUQFSNJTTJPOT ,FJP6OJWFSTJUZJTMJDFOTFECZJUTDPQZSJHIUIPMEFST 9
5IFTFTMJEFTBSFDPQZSJHIU)JSPUBLB/BLBKJNB3FEJTUSJCVUFBOEEJTDMPTVSFPGUIFTFTMJEFTBSFOPUQFSNJUUFEXJUIPVUQFSNJTTJPOT ,FJP6OJWFSTJUZJTMJDFOTFECZJUTDPQZSJHIUIPMEFST 2VFTUJPO $PNNFOUT IJSP!BXBTGDLFJPBDKQ IUUQBCPVUNFOVOOVO !OVOOVO 10