Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Node.js + Raspberry Piで お手軽IoT
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Masaki Koyanagi
June 05, 2017
Programming
2k
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Node.js + Raspberry Piで お手軽IoT
Masaki Koyanagi
June 05, 2017
Transcript
16 slides
Node.js + Raspberry Piで お手軽IoT We Are JavaScripters! @8th 1st
Day Name: Koyanagi Twitter: @mascii_k
自己紹介 小柳 昌生 (こやなぎ まさき) Twitter: @mascii_k 2015/07~2017/03 Web系エンジニアインターン 2017/03
東京理科大学大学院 修了 2017/04〜 SIerシステムエンジニア
でJSも喜ぶ IoTデバイスを作った話 1
学生(インターン)時代に作ったもの 学習塾向け入退室管理機器(Raspberry Piベース) ▸ NFCカードが持つIDを活用 ▸ 開発言語はJS(Node.js) + Python 2.x
▸ JSが塾に来てカードをタッチすると親にプッシュ通知 が届く仕組み
Pythonが必要な理由 ▸ ソニーPasoriの最新型 “RC-S380”を扱えるライブラ リが”nfcpy”しかない ▹ 最新といっても 2012/10 発売 ▹
libnfc が RC-S380 に対応していない ▸ 前回IoTLTの登壇者の方もPasori利用時 は Go + Python(nfcpy) だそそうです
どんなnpmパッケージを使ったか ▸ request ▹ http / https通信を行うためのクライアント ▸ onoff ▹
GPIO上のLEDをON/OFFする ▸ python-shell (+ nfcpy) ▹ 標準入出力でJSONを受け取る {"id":"01010456789ABCDE"}
IoT≠電子工作 2
Raspberry PiとテレビをHDMI接続してテレビの ON/OFFを確認する : node-cec http://qiita.com/mascii/items/132c064c30e321dea911
IoT≠電子工作 ▸ Raspberry Pi に4Gモデム(USBデバイス)とテレビ (HDMIケーブル)を繋げるだけでもIoTできる ▹ 「電子工作をしないIoT」もある
npmパッケージを作った話 3
Node.jsでもNFCを使ってほしい! ▸ HDMIのように、配線してnpmパッケージ入れるだけ でPasoriが使えたらいいのに... ▹ JSだけ書きたい... ▹ Python 書きたくない... ▹
JSなら非同期な処理が書きやすい ▸ npmパッケージを作ってみた!
node-nfcpy-id
デモ ▸ 私のPASMOをタッチすると LEDが青色に光り、それ以外 のカードをタッチするとLEDが 赤色に光る ▸ npmパッケージ ▹ node-nfcpy-id
▹ onoff
まとめ 4
まとめ ▸ request, Express, socket.ioなどRaspberry Pi 専用でないnpmパッケージも活用できる ▸ node-nfcpy-id というnpmパッケージ作った
▹ 近日中にQiitaに記事アップします ▸ 電子工作しないIoTもできる。そう、JSならね。
THANKS! Node.js + Raspberry Piでお手軽IoTしてみてください
More Decks by Masaki Koyanagi
See All by Masaki Koyanagi
Vitestを使った型テストの始め方
mascii
6
3.4k
WebHID API でリングコン のセンサー値を取得してみた
mascii
1
1.2k
Pros and Cons で考える Vue 2 Composition API
mascii
4
1.2k
Joy-ConをJavaScriptでプレゼンリモコンにした話
mascii
0
650
TypeScript で Optional Chaining を使ってみた
mascii
1
810
Vue.jsでCSS Modulesを使ってみた
mascii
0
190
不変量
mascii
1
260
Nuxt.js+Firebaseで個人サービスを作るまで
mascii
1
2.6k
JavaScriptのバージョンの話
mascii
1
2.5k
Other Decks in Programming
See All in Programming
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
310
Kawaiicon: Kubernetes, it's no longer cool, but let's secure it anyway!
barnbarn
0
130
Python Lambdaにおけるテストしやすい設計とAI支援の活用 / Designing Testable Python Lambda Functions with AI
kitano_yuichi
1
330
社内AIエージェント「Askワンバン」における コストチューニングの取り組み
t0yohei
0
170
Snowflake Openflow Connector利用の勘所 / 20261024developersio2026tokyo-snowflake-openflow
kasacchiful
PRO
0
340
조합이폭발하는디자인시스템이걸눈으로도테스트하라고요
giljongyu
0
750
Apple Intelligenceとオンデバイス時代の到来
yahir0
0
240
SFCで実現する病院・医療システムの動的組み立て式UI
koukimiura
1
180
3回つくってわかった、 定期実行ジョブ基盤の本質情報
takai
4
3.9k
baseline으로 마이그레이션, 리팩토링 안전하게 맡기기
fornewid
1
980
Secure Your Coding Agent Like It’s Malware (v1.5) 🇬🇧 @Code.talks 2026
richargh
0
150
Vue.jsで作る空間解析アプリとCapacitorプラグインのData Bridge
hal_spidernight
1
170
Featured
See All Featured
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
31k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
6
1.3k
How to Ace a Technical Interview
jacobian
280
24k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
560
Statistics for Hackers
jakevdp
799
230k
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
640
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
230
23k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
640
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.7k
Code Reviewing Like a Champion
maltzj
529
40k
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.7k
Accessibility Awareness
sabderemane
1
300