RPi-and-restroom

Ffdf2b0baba2980a90923978cf32a6ca?s=47 fukayatsu
January 15, 2014

 RPi-and-restroom

Check restroom is occupied/vacant using Raspberry Pi

Ffdf2b0baba2980a90923978cf32a6ca?s=128

fukayatsu

January 15, 2014
Tweet

Transcript

  1. PRi on Toilet @fukayatsu

  2. ઌि຤ʹΑ͏΍͘ RPiΛ࢝Ί·ͨ͠ RPi = Raspberry Pi

  3. ͱ͜ΖͰɺ

  4. ฐࣾΦϑΟεͷ ໰୊఺

  5. τΠϨ͕ࠞΜͰΔ • ϑϩΞͷஉੑ໿10ਓʹରͯ͠τΠϨ͸1͚ͭͩɻ • ͦΕҎ֎ͩͱ֎ͷίϯϏχͷτΠϨΛआΓΔ͙ Β͍͔͠ͳ͍ɻ • Կճ΋τΠϨΛ֬ೝ͠ʹߦ͘ͷ͕໘౗͍͘͞ɻ

  6. ͦ͜Ͱɺ

  7. None
  8. None
  9. ͜Ε͸Կʁ • RPi + ੺֎ઢηϯα + Wifiυϯάϧ • τΠϨ͕࢖༻த͔Ͳ͏͔Λఆظతʹαʔό΁ૹ৴

  10. None
  11. ࡢ೔͔ΒՔಇத http://ucchusma.herokuapp.com/api/v1/rooms/1

  12. γεςϜશମ૾

  13. RPi্ͷεΫϦϓτ • cat /sys/class/gpio/gpio4/value • => 1 (͍Δ) or 0

    (͍ͳ͍) • ্هͷ݁ՌΛఆظతʹAPIαʔόʹૹ৴(Ruby) • ࣮ࡍʹ͸௚ۙ30ඵؒͰ5ඵҎ্൓Ԡͨ͠৔߹ ʹ”࢖༻த”ͱ൑அ
  14. APIαʔό • on Heroku • Sinatra + Grape + Redis

    • /api/v1/rooms/1ʹରͯ͠GETɾPUTΛڐՄ • PUT࣌͸token͕ඞཁ
  15. Chrome ֦ு • ఆظతʹAPIΛνΣοΫͯ͠ΞΠίϯΛม͑Δ

  16. before & after • ಋೖલ • ʮ͏ʔτΠϨτΠϨʯ=>ʮ͋ɺ࢖༻த͔…ʯ => ʮ·ͨޙͰདྷΑ͏ʯ=> ਺෼ޙ࠷ॳʹ໭Δ

    • ಋೖޙ • ʮ͓ɺτΠϨۭ͍ͨͳɻʯ=> ʮ;͎…ʯ
  17. RPiΛ͍͡Δ࣌ͷTips • δϟϯύϫΠϠ(Φε-ϝε)͕͋Δͱศར • GPIOͷinput͸5VͰͳ͘3.3V • ৄ͘͠͸blogͰʂ • blog.fukayatsu.com/2014/01/12/rest-room-api/

  18. ࣍ճ࡞ • ΦϑΟεͷΠϯλʔϗϯతͳ΍ͭ • ϘλϯΛԡͨ͠Βࣸਅ෇͖Ͱhipchatʹ௨஌ • ͍ͭͰʹTweet͢ΔϘλϯ͕͋ͬͯ΋͍͍ • ిݯͷऔΓճ͕͠ωοΫ

  19. ײ૝ • ϋϯμ෇ָ͚͍͠ • Rubyָ͍͠ • ࣗ෼ͷੜ׆Λศརʹ͢Δ΋ͷΛ࡞Δͷ͸࠷ߴʹ ָ͍͠ = RPi͓͢͢Ί

  20. ؔ࿈ϓϩδΣΫτ • ϔϒϯζŋυΞɹʙࢲ͕ߦͬͨΒۭ͍ͯΔτΠϨʢ by νʔ ϜϥϘMAKE෦ ʣ • http://heavens-door.info/ •

    ͪ͜Β͸mbed੡ɻηϯαʔ͸ಉͬ͡Ά͍ • Peeping Tom in the toilet with Raspberry Pi • http://www.raspberrypi.org/archives/4509 • RPi + webcam੡ɻτΠϨʹwebcamͬͯ…