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
58
W3Cについて - インターネット標準勉強会 - 若者編
nunnun
0
610
プロフェッショナルSSL/TLS勉強会 PKIに対する攻撃 (第4章)
nunnun
0
1.3k
Paper Summary Encore: Lightweight Measurement of Web Censorship with Cross- Origin Requests
nunnun
0
120
インターネット -第10回- Firefox OSアプリ開発 応用編
nunnun
0
890
Introduction to Server Operations and Automations
nunnun
1
250
Exploring the knowledge on Web
nunnun
2
84
インフラエンジニアのための次世代プロトコル入門 - July TechFesta 2014
nunnun
36
12k
Workshops On Designing Electronic Toys #10
nunnun
0
150
Featured
See All Featured
Clear Off the Table
cherdarchuk
91
320k
Code Reviewing Like a Champion
maltzj
519
39k
The Brand Is Dead. Long Live the Brand.
mthomps
53
38k
Web Components: a chance to create the future
zenorocha
310
42k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
4
110
Documentation Writing (for coders)
carmenintech
65
4.3k
The Invisible Customer
myddelton
119
13k
A Tale of Four Properties
chriscoyier
156
22k
ParisWeb 2013: Learning to Love: Crash Course in Emotional UX Design
dotmariusz
110
6.9k
A better future with KSS
kneath
236
17k
For a Future-Friendly Web
brad_frost
174
9.3k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
327
21k
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