Upgrade to Pro — share decks privately, control downloads, hide ads and more …

iotlt-sap-20180830.pdf

 iotlt-sap-20180830.pdf

IoTLT札幌 Vol.4での発表資料です。

F82dff1a913e41652f060122fd921822?s=128

MinoruInachi

August 31, 2018
Tweet

Transcript

  1. ͖Έ͸$)*3*.&/Λ
 ஌͍ͬͯΔ͔ʁ

  2. ීஈ͸ΤϯλʔϓϥΠζܥͷιϑτ΢ΣΞΤϯδχΞ ಀආ׆ಈͱͯ͠ϚΠίϯϘʔυ .JDSP1ZUIPO޷͖ ࣗݾ঺հ

  3. ݄̔͸͡Ίͷ͋Δ೔ ݄ʹ։࠵͢ΔϋοΧιϯͰ ߨࢣਞͷ໨ॲ͕͍ͭͯͳ͍Α͏Ͱ͢ɻ ʻதུʼ ؀ڥ͸ϥζϕϦʔύΠʴ$IJSJNFO ʢ*P5ϓϩάϥϛϯά؀ڥʣ ͱ͋Δ஌ਓ $IJSJNFO

  4. CHIRIMEN OPEN HARDWARE https://chirimen.org/

  5. $)*3*.&/ͱ͸ʁ ΢Σϒϒϥ΢β͸ώτ͕ίϯϐϡʔλωοτϫʔΫΛར༻͢ΔͨΊͷॏཁͳ໾ׂ ΛՌ͖ͨͯ͠·ͨ͠ɻ͞Βʹ༷ʑͳΞϓϦέʔγϣϯΛಈ࡞ͤ͞ΔίϯϐϡʔςΟ ϯάϓϥοτϑΥʔϜͱͯ͠ͷ໾ׂ΋૿͍ͯ͠·͢ɻ *P5΍8P5ͱ͍ͬͨίϯηϓτ͕ࣔ͢ɺ͞·͟·ͳϞϊ͕ίϯϐϡʔλωοτ ϫʔΫͰܨ͕Δະདྷͷࣾձʹ͓͍ͯ΋ɺࢲͨͪώτ͸ॏཁͳଘࡏͰ͢ɻ͕ͨͬ͠ ͯɺώτͱϞϊ͕΢ΣϒΛհͯ͠ޓ͍ʹڠௐ͋͑͠Δ؀ڥ͕ඞཁͰ͢ɻͦͯ͠ɺ ͦΕ͸΢Σϒϒϥ΢β֩ʹ࡞ΒΕ͍ͯ͘ͷ͸ͳ͍͔ͱߟ͑·͢ɻ ຊϓϩδΣΫτ͸ɺ͜ͷΑ͏ͳ؀ڥʢϓϥοτϗʔϜʣΛࢀՃऀͷօ͞ΜͱΦʔ ϓϯʹσβΠϯ͠ɺͭ͘Γ͍͋͛ͯ͘͜ͱΛΊ͟͠·͢ɻ·ͨ͜ͷΑ͏ͳࠓޙͷ

    ৽ͨͳࣾձͰͷl΢ΣϒΒ͠͞zͱ͸Կ͔ɺ΢ΣϒΛհͨ͠ΑΓΑ͍ώτɾϞϊͷ ؔ܎ͱ͸Կ͔ΛɺσΟεΧογϣϯɺϓϩτλΠϓ੍࡞ɺར༻ɺվྑΛ௨ͯ͠ߟ ͑ɺఏҊ͍͖ͯ͠·͢ɻ 〜from 「ABOUT」
  6. ݯྲྀ͸ɺ͋ͷ'JSFGPY04

  7. $)*3*.&/Ϙʔυɿ&DIJHP3FW ೥݄̕ɺεΠοναΠΤϯε͔Βൢച։࢝ 'JSFGPY04ͷ044൛ɺ#( #PPUUP(FDLP 04͕ಈ࡞ 8FC(1*0"1* 8FC*$"1*ͰηϯαʔΞΫνϡΤʔλʹΞΫηε ։ൃʹ͸1$Λܨ͍Ͱɺ'JSFGPY্ͷ8FC*%&Λ࢖͏ ೥݄̍ɺ׬ച ೖՙͳ͍ঢ়ଶ͕ଓ͖ɺೖखࠔ೉

  8. $)*3*.&/GPS3BTQCFSSZ1J ೥݄ϦϦʔε ΋͸΍#(04Ͱ΋ͳ͍ɺ'JSFGPY΋࢖Θͳ͍ 3BTQCJBOͷ্ʹ8FC(1*0"1* 8FC*$"1*Λ࣮૷ ։ൃʹ͸ΦϯϥΠϯ8FCΤσΟλ+4#JO·ͨ͸+4'JEEMFͷར༻Λ૝ఆ

  9. ͘͠Έ +4#JO +4'JEEMF ΦϯϥΠϯWebΤσΟλ Web GPUO/I2C API QPMZpMMKT I2C σόΠεAPI

    JD"%5KT JD"%5KT JD"%5KT Raspberry Pi 3 / Raspbian Chromium HTML wss://localhost:33330/ WebSocket node srv.js /sys/class/gpio/gpioXX /dev/i2c-1 Raspberry Pi 3 Hardware GPIO I2C
  10. ඪ४αϙʔτ*$σόΠε JD"%4KT "%ίϯόʔλ JD"%5KT Թ౓ηϯαʔ JD(1:&KT ੺֎ઢڑ཭ηϯαʔ JD1$"KT 18.αʔϘϞʔλʔυϥΠόʔ JD4KT

    Χϥʔηϯαʔ JD7&.-KT 67ηϯαʔ JDDBO[BJCMJOLKT *̎$4MBWFσόΠε։ൃϘʔυ JDHSPWFBDDFMFSPNFUFSKT (SPWFՃ଎౓ηϯαʔ JDHSPWFHFTUVSFKT (SPWFδΣενϟʔηϯαʔ JDHSPWFMJHIUKT (SPWF*$ޫηϯαʔ JDHSPWFPMFE%JTQMBZKT (SPWF0-&%σΟεϓϨΠ JDHSPWFUPVDIKT (SPWFλονηϯαʔ
  11. νϡʔτϦΞϧ͸ׂͱॆ࣮ https://github.com/chirimen-oh/chirimen-raspi3/wiki/Tutorial

  12. ݸਓతʹ͸࣋ͬͯͳ͍σόΠε͹͔ΓͰ೉ّ

  13. ख࣋ͪͷ୅ସ඼ͰؤுͬͯΈͨ #.&
 Թ౓ɾ࣪౓ɾؾѹηϯαʔ -
 ϞʔλʔυϥΠόʔ %"*40ͷ64#ઔ෩ػ

  14. ͜͏ͳΔͱɺσʔλγʔτௐ΂Δͷ͸ඞਢ #.&
 Թ౓ɾ࣪౓ɾؾѹηϯαʔ -
 ϞʔλʔυϥΠόʔ

  15. var BME280 = function(i2cPort,slaveAddress){ this.i2cPort = i2cPort; this.i2cSlave = null;

    this.slaveAddress = slaveAddress; }; BME280.prototype = { init: function(){ return new Promise((resolve, reject)=>{ this.i2cPort.open(this.slaveAddress).then((i2cSlave)=>{ this.i2cSlave = i2cSlave; //console.log("init ok:"+this.i2cSlave); this.digT = []; this.digP = []; this.digH = []; this.temp = 0.0; this.pres = 0.0; this.hum = 0.0; this.t_fine = 0.0; var osrs_t = 1; // Temperature oversampling x 1 var osrs_p = 1; // Pressure oversampling x 1 var osrs_h = 1; // Humidity oversampling x 1 var mode = 3; // Normal mode var t_sb = 5; // Tstandby 1000ms var filter = 0; // Filter off var spi3w_en = 0; // 3-wire SPI Disable var ctrl_meas_reg = (osrs_t << 5) | (osrs_p << 2) | mode; var config_reg = (t_sb << 5) | (filter << 2) | spi3w_en; var ctrl_hum_reg = osrs_h; this.writeReg(0xF2,ctrl_hum_reg) this.writeReg(0xF4,ctrl_meas_reg) this.writeReg(0xF5,config_reg) resolve(); },(err)=>{ reject(err); }); }); }, writeReg: function(reg_address, data){ return new Promise(async (resolve, reject)=>{ if(this.i2cSlave == null){ reject("i2cSlave Address does'nt yet open!"); } else { await this.i2cSlave.write8(reg_address,data); resolve(); } }); }, callibParam: function(){ return new Promise(async (resolve, reject)=>{ if(this.i2cSlave == null){ reject("i2cSlave Address does'nt yet open!"); }else{ var calib = []; for(var i=0x88; i<0x88+24; i++){ calib.push(await this.i2cSlave.read8(i)); } calib.push(await this.i2cSlave.read8(0xA1)); for(i=0xE1; i<0xE1+7; i++){ calib.push(await this.i2cSlave.read8(i)); } this.digT.push((calib[1] << 8) | calib[0]); this.digT.push((calib[3] << 8) | calib[2]); this.digT.push((calib[5] << 8) | calib[4]); this.digP.push((calib[7] << 8) | calib[6]); this.digP.push((calib[9] << 8) | calib[8]); this.digP.push((calib[11]<< 8) | calib[10]); this.digP.push((calib[13]<< 8) | calib[12]); this.digP.push((calib[15]<< 8) | calib[14]); this.digP.push((calib[17]<< 8) | calib[16]); this.digP.push((calib[19]<< 8) | calib[18]); this.digP.push((calib[21]<< 8) | calib[20]); this.digP.push((calib[23]<< 8) | calib[22]); this.digH.push(calib[24]); this.digH.push((calib[26]<< 8) | calib[25]); this.digH.push(calib[27]); this.digH.push((calib[28]<< 4) | (0x0F & calib[29])); this.digH.push((calib[30]<< 4) | ((calib[29] >> 4) & 0x0F)); #.&໘౗͘͞ա͗
  16. ͱ͜ΖͰʜ

  17. ͏͢͏͢ɺ
 ײ͍ͮͯΔ͔΋͠Ε·ͤΜ͕ʜ

  18. +4#JO +4'JEEMF ΦϯϥΠϯWebΤσΟλ Web GPUO/I2C API QPMZpMMKT I2C σόΠεAPI JD"%5KT

    JD"%5KT JD"%5KT Raspberry Pi 3 / Raspbian Chromium HTML wss://localhost:33330/ WebSocket node srv.js /sys/class/gpio/gpioXX /dev/i2c-1 Raspberry Pi 3 Hardware GPIO I2C Πϯλʔωοτ͚͔ͩ͜͜Αʂ
  19. "NCJFOUʹଌఆσʔλΛ͋͛ͯΈΑ͏ͱࢥͬͨʜ https://ambidata.io/

  20. "NCJFOUʹσʔλΛ͋͛Δํ๏ ௚઀࢖͑Δ"1*͸ແ͔͕ͬͨɺதͰ΍͍ͬͯΔ͜ͱ ͸ׂͱ؆୯ 3&45GVM"1*ͰσʔλΛ1045͢Ε͹Α͍ 63-͸IUUQBNCJEBUBJPBQJWDIBOOFMTνϟϯωϧ*%EBUB σʔλ CPEZ ͸+40/ܗࣜͰ༩͑Δ \XSJUF,FZϥΠτΩʔ Eσʔλ

    Eσʔλ ʜ^ ͳͷͰɺ+BWB4DSJQUͷGFUDIͰ΋࢖͑͹Α͍ͷ͔ͱ ҆қʹߟ͑ͨ
  21. ͕ͩɺͦΜͳʹ؁͘ͳ͔ͬͨʂ .JYFE$POUFOU໰୊ +4#JO΍+4'JEEMF͸IUUQT͕ͩ"NCJFOUͷ3&45GVM"1*͸IUUQͳͷͰ
 ϦΫΤετ͕ϒϩοΫ͞ΕΔ )5.-ΛϩʔΧϧʹμ΢ϯϩʔυͯ͠ಈ͔ͯ͠ճආ ΫϩευϝΠϯ੍໿໰୊ $034 $SPTT0SJHJO3FTPVSDF4IBSJOH Λ࢖͏ʹ͸αʔόଆͷରԠ͕ඞཁ IUUQϔομͷNPEFΛOPDPSTʹͯͯ͠͠Έͨ

    $POUFOU5ZQF໰୊ BQQMJDBUJPOKTPOΛࢦఆͯ͠΋UFYUQMBJOͰ1045͞Εͯ͠·͏ OPDPSTͰ͸ͦ͏͍͏΋ͷΒ͍͠ μʔςΟͳखஈͰ͋Δ͕ɺɺɺ ϔομΛॻ͖׵͑Δ$ISPNFϓϥάΠϯΛ࢖ͬͯ$POUFOU5ZQFΛڧҾʹ
 BQQMJDBUJPOKTPOʹॻ͖׵͑ͨ Α͍ࢠ͸·Ͷͪ͠Όμϝ
  22. None
  23. 8FCϒϥ΢βͰ+BWB4DSJQU࢖ͬͯ *P5͍ͨ͠ͳΒଞʹ΋બ୒ࢶ͋Δ

  24. Mongoose OS https://mongoose-os.com/

  25. obniz https://obniz.io/

  26. ·ͱΊ $)*3*.&/͸'JSFGPY04༝དྷͷٕज़Λ*P5ʹద༻ ͢ΔࢼΈ 8FCϑϩϯτΤϯυ্Ͱ8FC(1*0*$"1*Λ࢖ͬ ͯηϯαʔʗΞΫνϡΤʔλʹΞΫηε ઐ༻Ϙʔυ͸ೖखࠔ೉ͳঢ়گ ୅ΘΓʹ3BTQCFSSZ1Jͷ3BTQCJBO্Ͱಈ͘΋ ͷ͕ग़͍ͯΔ 8FCٕज़ͰϓϩάϥϛϯάͰ͖Δͱݴͬͯ΋)8 ஌ࣝ͸ඞཁ

    8P5Λ͏͍ͨͬͯΔׂʹ͸֎ͱͷ࿈ܞ͕໘౗ͳͷ ͰɺԿΒ͔ͷվળ͸ඞཁͩΖ͏ ͍Ζ͍ΖͱϥΠόϧͬΆ͍ͷ΋ग़͖͍ͯͯΔ