Cov txheej txheem:

IoT Enabled Kas Fes Tshuab: 9 Kauj Ruam (nrog Duab)
IoT Enabled Kas Fes Tshuab: 9 Kauj Ruam (nrog Duab)

Video: IoT Enabled Kas Fes Tshuab: 9 Kauj Ruam (nrog Duab)

Video: IoT Enabled Kas Fes Tshuab: 9 Kauj Ruam (nrog Duab)
Video: Sib Hawm Dhau (Time Passed) Music Video by: Deeda/Dib Xwb 2024, Hlis ntuj nqeg
Anonim
Image
Image
Yuav tsum muaj khoom siv
Yuav tsum muaj khoom siv

Cov lus qhia no tau nkag mus rau hauv IoT kev sib tw - Yog tias koj nyiam nws, thov pov npav rau nws

Hloov kho tshiab: Tam sim no txhawb 2 txoj kev sib tham thiab OTA hloov tshiab

Rau qee lub sijhawm tam sim no kuv tau muaj lub tshuab kas fes Jura thiab kuv ib txwm xav siv nws li cas.

Kuv tau ua haujlwm hauv tsev yooj yim siv tshuab rau qee xyoo tab sis lub tshuab kas fes tsis yog ib yam uas yooj yim rau kev hloov pauv (lossis yog li kuv xav). Jura kas fes tshuab feem ntau muaj 'Diagnostic chaw nres nkoj' thiab/lossis chaw nres nkoj siv rau ntxiv kev them nyiaj rau lub tshuab, txawm li cas los xij kuv tsis tuaj yeem pom cov ntaub ntawv qhia txog yuav siv nws li cas. Tsis ntev los no, cov txheej txheem tau thim rov qab-tsim los ntawm qee tus tib neeg thiab tshaj tawm rau pej xeem. Qhov teeb meem yog, feem ntau ntawm cov ntawv xa mus rau lub luag haujlwm muaj rau cov tshuab loj dua li kuv li (Ena 7).

Nyob rau sab saum toj ntawm qhov ntawd, kuv lub tshuab tsis muaj lub hwj chim nyob ruaj khov zoo li cov tshuab loj dua, hloov nws muaj HV hloov uas ua rau lub zog muab khoom 'xauv rau'. Lub cev lub cev ntawm lub tshuab ua haujlwm qhib 2 qhov hloov pauv - Ib qho qis qis (logic sab, tua tawm) thiab ib qho High Volt (Fais fab rau). Ob lub keyboards yog ib ntus.

Kuv kuj xav tau kom ntseeg tau tias lub tshuab tseem ua haujlwm 100% ywj pheej ntawm ib qho kev tswj hwm, piv txwv li lub tshuab tseem ua haujlwm zoo li qub yog tias nws tsis yog IoT qhib.

Txhawm rau siv lub tshuab kom zoo yuav tsum muaj ob yam: 1) Muaj peev xwm tswj tau lub zog rau lub tshuab 2) Txhawm rau tuaj yeem sib txuas lus nrog lub tshuab kom qhib lub zog rau ua kas fes, yaug thiab lwm yam.

Kauj Ruam 1: Peb Yuav Ua Li Cas

Peb yuav siv ESP8266 'ESP-01' module txuas rau lub wifi hauv tsev thiab sau npe mus rau MQTT server/ncauj lus mloog rau cov lus txib. Qhov 'Front End' Kuv siv yog OpenHAB2 tab sis tsis muaj laj thawj koj tsis tuaj yeem ntxiv rau lub vev xaib interface ntawm lub cuab yeej thiab tswj ncaj qha yog tias koj xav tau lossis ntawm HTTP Tau txais cov lus txib.

ESP8266 yuav tswj kev tswj hwm 2 qhov cuam tshuam nrog lub zog khawm thiab tseem ua cov lus txib txuas mus rau/los ntawm lub tshuab kas fes.

CEEB TOOM - Cov lus qhia no qhia txog cov txheej txheem uas kuv tau siv los hloov kho kuv lub Jura Ena7 kas fes tshuab kom tswj tau los ntawm kev siv tshuab hauv tsev. Nws cuam tshuam nrog kev hloov kho cov cuab yeej hluav taws xob uas tuaj yeem ua rau muaj kev phom sij yog tias ua tsis raug. Cov ntaub ntawv ntawm no yuav tsis tiav, tsis raug thiab tsis nyab xeeb. Ua nrog ceev faj. Tsis lees paub lub luag haujlwm.

Kauj Ruam 2: Yuav tsum muaj Cov Khoom Siv

Yuav tsum muaj khoom siv
Yuav tsum muaj khoom siv
Yuav tsum muaj khoom siv
Yuav tsum muaj khoom siv
Yuav tsum muaj khoom siv
Yuav tsum muaj khoom siv

Qhov

  • ESP-01 module thiab ib txoj hauv kev rau nws (Arduino IDE thiab lub cev hloov pauv rau lub cajmeem)
  • 2 txoj kev xa xov module EBAY
  • 5v -> 3.3v Regulator EBAY
  • Me me 5v mains powered xov tooj charger
  • Logic qib hloov pauv* Freetronics
  • Misc hlau, tus pin headers, cua sov ntsws thiab lwm yam rau txuas nws tag nrho.

Cov cuab yeej

  • Zoo tipped soldering hlau
  • Solder
  • Cov hlua hlau siv tau yooj yim
  • Torx T15 tsav tsheb
  • Oval kev ruaj ntseg cuab yeej (lossis ua ib qho, tsuas yog siv ob peb feeb)

*Kuv pib siv arduino UNO hauv kuv qhov kev sim ntawm txhua qhov kev hais kom ua rau lub tshuab thiab nws ua haujlwm tau zoo, txawm li cas los xij ESP module tsis kam ua haujlwm. Kuv triple tshuaj xyuas cov cai thiab kuv paub tseeb tias cov lus txib tawm ntawm ESP module zoo ib yam li arduino txawm li cas los xij nws tsis mus. Kuv muab qhov no tso rau ESP module tsuas yog ua haujlwm ntawm 3.3v logic thiab tsis yog 5V. Thaum kuv muab tso rau hauv Logic converter, nws ua haujlwm tau zoo. Qhov no yuav lossis tsis xav tau hauv lwm lub tshuab.

Qhov zoo tshaj, koj yuav muaj lub tshuab siv hluav taws xob hauv tsev uas twb muaj lawm uas txhawb nqa MQTT raws tu qauv (xws li openhab) vim qhov no yog qhov phiaj xwm phiaj xwm. Yog tias koj tsuas yog xav tswj nws ntawm cov nyees khawm ntawm nplooj ntawv web tsis muaj kev txhawb nqa, koj yuav tsum tau hloov qee qhov hloov pauv mus rau nplooj ntawv web nplooj ntawv. Nws tsis yog qhov nyuaj dhau kom ua tiav (tej zaum rev2..)

Kauj Ruam 3: Txoj Cai Jura

Txoj Cai Jura
Txoj Cai Jura

Cov ntaub ntawv rau/los ntawm lub tshuab tsuas yog ntu @ 9600 tab sis Jura muaj qee qhov dag txog lawv lub tes tsho ib yam nkaus. Cov txheej txheem ib txwm siv qhov no ntxiv rau ECC thiab/lossis kom ua rau muaj kev sib txuas lus tsis zoo. Yooj yim muab, txhua byte ntawm cov ntaub ntawv (tus yam ntxwv) tau faib ua ob ntu 2 thiab 5 ntawm 4 tus qauv txheej txheem bytes taug qab los ntawm 8ms ncua. Yog tias koj mob siab kawm paub qhov no ua haujlwm li cas, muaj ntau cov ntaub ntawv hauv qhov txuas ntawm no.

Cov Ntaub Ntawv Txheej Txheem muab los ntawm:

Txoj cai arduino ua kom yooj yim rau qhov no, ua rau koj xa tus qauv, tib neeg nyeem cov lus txib uas nws tom qab ntawd hloov mus rau hauv Jura raws tu qauv.

Kuv tus lej yog ua ke ntawm cov lej los ntawm:

Cov lus txib hais txog ntawm cov vev xaib saum toj no tsis raug rau kuv lub tshuab tab sis dhau los ntawm txoj hauv kev sim thiab ua yuam kev, kuv muaj peev xwm los nrog cov hauv qab no:

FA: 01 - Tua tawm (tab sis tsis zoo li yaug, txawm tias xav tau) FA: 02 - Teb tias 'ok' tab sis tsis paub meej tias nws ua dab tsi. FA: 03 - Yaug Cov Lus (Ua kom 'yaug tawm' cov lus ntawm lub vijtsam, nias lub tshuab rhaub) FA: 04 - Yaug Kev Ua - Yaug thaum 'Nias lub pob teb' cov lus tshwm, tsis li ntawd tsis muaj dab tsi FA: 05 - Muaj zog ntawm lub vijtsam (Tej zaum ua ke ua qhov no nrog ua kas fes kom muaj zog) FA: 06 - Muaj zog ntawm lub vijtsam (Tej zaum muab qhov no nrog ua kas fes kom muaj zog) FA: 07 - 'Tshwj xeeb' ntawm lub vijtsam tab sis tsis tau ua dab tsi, tsis paub tseeb tias qhov no yog rau FA: 08 - Chav FA: 09 - Kas fes me FA: 0A - Kas fes loj

Muaj lwm cov lus txib tab sis qhov no txaus rau kuv …

Ceev faj thaum tshaj tawm cov lus tsis paub, piv txwv li, pom tias AN: 0A yuav so EEPROM ntawm lub tshuab …

Kauj ruam 4: Disassembly

Tau txais lub tshuab nws tus kheej qhib tsis yog qhov yooj yim dhau raws li koj xav tau qee qhov cuab yeej tshwj xeeb me ntsis tab sis tus neeg mob siab rau yuav nrhiav txoj hauv kev - Koj xav tau T15 Torx ntsis thiab 'qhov tseem ceeb oval' rau 2 tus ntsia hlau. Torx Kuv twb muaj lawm, cov cuab yeej oval Kuv tau ua los ntawm 4mm lub qhov (socket) lub taub hau ntsia liaj qhov rooj tawm thiab ntswj me ntsis nrog rauj.

Cov lus qhia ntawm no tau nthuav qhia zoo-https://marius.me.uk/blog/2015/03/open-jura-ena-5/

Kauj ruam 5: Voiding lub Warranty

Voiding qhov Warranty
Voiding qhov Warranty
Voiding qhov Warranty
Voiding qhov Warranty
Voiding qhov Warranty
Voiding qhov Warranty
Voiding qhov Warranty
Voiding qhov Warranty

Thaum nkag mus rau hauv lub tshuab, koj yuav pom cov khoom tseem ceeb. Lub hwj chim tseem ceeb nkag tau zoo nyob hauv qab nws rau ntxiv 5v lub charger.

Kuv ntxiv (cov ntsuas hluav taws xob) cov xov hlau mus rau lub davhlau ya nyob twg thaiv ntawm kev nkag mus ntawm lub tshuab thiab cov laug/heatshrinked cov no mus rau lub hauv paus pins ntawm 5v lub charger. Kuv tus qauv tshwj xeeb tsis yog hom USB chaw nres nkoj tab sis ib qho uas muaj cov hlau lead txuas mus tas li. Koj yuav tsis muaj chav txaus rau lub chaw nres nkoj usb hom ib tus tuaj yeem siv lub USB cable tiag tiag tab sis yog tias koj qhib lub charger, koj tuaj yeem tshem qhov chaw nres nkoj USB thiab hloov nrog cov qauv txheem rau 5v thiab Gnd cov ntsiab lus.

Koj tuaj yeem hloov lwm qhov tseem ceeb ntsuas 5v fais fab mov yog tias koj nyiam. 500ma yuav tsum txaus.

Muaj ntau chav rau tus qauv xa tawm tuaj ze ntawm lub tshuab zom. Peb yuav tsum xaim ob qhov txuas txuas kom ua haujlwm sib luag nrog lub zog hloov pauv tseem ceeb. Kuv yooj yim txiav cov xov hlau uas twb muaj lawm, hle, tinned, ntxiv cov xaim ntxiv rau hauv thiab rov qab ua ke (tsis txhob hnov qab heatshrink). Muaj qhov xoob txaus hauv cov xov hlau los ua qhov no.

Cov qauv xa tawm tau muaj nyob rau hauv qhov chaw nrog qhov ua tau zoo zoo ob tog. Nrog cov xov hlau txuas nrog thiab tsuas muaj chaw txwv rau kev txav chaw, txawm tias daim kab xev tsis tuav, tus qauv yuav tsis mus deb thiab tsis tuaj yeem tiv nrog cov khoom hlau.

Kuv kuj tau rov txhim kho qhov chaw kuaj mob ntawm kuv lub tshuab los txiav txim qhov chaw ntawm kev sib txuas sab hauv yog li kuv tuaj yeem ua tiav qhov kev koom ua ke zais. Tsuas yog tx, rx thiab Gnd xov hlau siv.

Yog tias koj muaj lub tshuab ua lag luam ntau dua uas txhawb nqa qhov hluav taws xob nyob tos thiab/lossis koj tsis xav kom tsis muaj kev lees paub ntawm koj lub tshuab, koj tuaj yeem txuas ncaj qha mus rau qhov chaw kuaj mob hloov chaw tab sis yuav tsis muaj peev xwm siv lub tshuab siv cov cuab yeej no.

Kuv lub tshuab siv 7 tus pin txuas. Los ntawm sab laug mus rau sab xis nws yog:

NC Tx G Rx NC 5v NC

Cov pins sib xws ntawm lub ntsiab: Liab = Gnd Txiv kab ntxwv = Rx Dub = Tx

Xav paub ntau ntxiv tuaj yeem pom ntawm pinouts ntawm no:

Kauj Ruam 6: Txuas Lub Logic Sab

Txuas lub Logic Sab
Txuas lub Logic Sab
Txuas lub Logic Sab
Txuas lub Logic Sab
Txuas lub Logic Sab
Txuas lub Logic Sab

Txheeb xyuas daim duab - Nws zoo li nyuaj dhau tab sis nws tsis yog.

Kuv tau teeb tsa qib hloov pauv mus rau sab nraub qaum ntawm qhov (piav qhia) qhov ntsuas hluav taws xob nrog qee daim kab xev ob tog. Tom qab ntawd kuv tau siv qee qhov kev tiv thaiv ob txhais ceg txhawm rau txhawm rau lub zog thiab cov pins hauv av ntawm ob sab ntawm qib hloov pauv mus rau lub hwj huam sib luag module. Tag nrho cov qauv no ua haujlwm zoo li 'passthrough' rau txhua qhov kev xav thiab lub zog rau ESP-01.

Kuv siv ob lub nruab nrab hloov pauv rau cov ntaub ntawv xov xwm thiab sab nraud ob qho rau kev xa xov txuas ntxiv tab sis nws tsis muaj teeb meem uas koj siv.

Nws tsis yog qhov tsim nyog nrog cov qauv sib txuas no kom ua haujlwm 5v cov laj thawj vim tias lawv tau ua haujlwm qis tab sis nws tsuas yog ua haujlwm zoo yog li kuv tau ua nws lawm.

Kuv siv 4x2 tus poj niam lub taub hau rau txuas rau ESP tus qauv. Qhov no tso cai rau yooj yim rub tawm cov cai lossis hloov tus qauv.

Tsis yog daim duab hauv daim duab yog 5V cov tswv yim - Kuv txuas kuv lub xov tooj ncaj qha mus rau qhov txuas txuas (saib daim duab thib ob). Cov xaim dub rau hauv qab sab laug ntawm daim duab yog cov ntaub ntawv xov xwm tawm mus rau lub rooj tsavxwm tseem ceeb. Kuv siv ib feem ntawm daim npog 3.5 hli lub mloog pob ntseg txuas txuas tsuas yog pab txo qhov muaj feem cuam tshuam hauv kab ntawv.

12f txoj cai siv SoftwareSerial hloov kho cov ntawv kho vajtse - Qhov no tso cai rau tus qauv qhia qhov xwm txheej rau kev debugging rov qab los ntawm cov lej ib txwm muaj. Kev sib txuas yog ntawm pins 4 thiab 5 hloov chaw. Kuv yoog tib lub taub hau kom ESP12F ntsaws rau hauv kev sib pauv rau ESP-01, tsuas yog sib pauv cov koob ntawd

Kauj Ruam 7: Programming Module

Programming lub Module
Programming lub Module

Txoj cai tau suav sau tawm tsam Arduino 1.8.1 nrog ESP8266 board addon thiab PubSubClient 2.6.0 (uas yog MQTT Library)

Hloov kho cov cai raws li qhov koj xav tau thiab xa cov cai rau ESP-01 module thiab txuas rau lub tshuab. Ceev faj nrog kev taw qhia ntawm tus pin!

Kev teeb tsa

Kev xaiv 1)

Tsuas yog nyob ntawm tus lej lej hauv zip. Thaum ESP module thawj khau raj, nws mus rau hauv AP hom thiab teeb nws tus IP rau 192.168.4.1. Tom qab ntawd koj tuaj yeem txuas mus rau tus qauv thiab hloov tus IP thiab txuas rau koj tus kheej qhov chaw nkag. Koj kuj tseem yuav tsum teeb tus IP rau koj lub tshuab hauv qhov ntawd vim tias tsis muaj DHCP ntawm tus qauv.

Default AP SSID yog 'ESPSwitch' thiab tus password yog '12345678'

Nws nyob hauv AP hom rau 2 feeb los ntawm lub neej ntawd. Koj tuaj yeem hloov qhov kev teeb tsa no hauv 'global.h' - Nws yog hu ua 'adminTimeout' thiab nyob hauv vib nas this. Kuv pom zoo hloov qhov no mus rau qee yam qis thaum koj muaj lub khoos phis tawj siv tau hauv EEPROM vim nws tsuas yog ua rau qeeb qeeb uas tsis tsim nyog hauv kev khau raj ntawm lub cuab yeej.

Kev Xaiv 2)

Nov yog lub hauv paus pib rau tus lej tshiab uas txhawb nqa 2 txoj kev sib tham, xaiv 1 tsis muaj. Koj tseem tuaj yeem hloov pauv qhov pib SSID/Lo lus zais teeb tsa hauv cov ntaub ntawv tseem ceeb ino (saib rau '// DEFAULT CONFIG') yog li nws yuav thauj khoom cov teeb tsa ntawd mus rau hauv EEPROM ntawm thawj lub khau raj thiab hloov pauv hom kev ncua mus rau qee yam qis hauv 'global.h'. Qhov no zam kom tsis txhob cuam tshuam ib puag ncig txuas rau AP ib ntus.

Cov cuab yeej yuav txiav nws tus kheej MQTT id (thiab txoj hauv kev rau npe) mus rau 4 tus lej kawg ntawm tus lej xov tooj. Txoj hauv kev los ntawm lub neej ntawd yog ha/mod //#, hloov pauv raws li koj pom zoo tab sis nyeem cov lus hauv kab lus kom paub tseeb tias cov khoom tsim nyog muaj qhov ntev raug.

Kuv ua qhov no vim nws txhais tau tias kuv tsis tas yuav tsim tus lej tshwj xeeb rau txhua tus qauv ntawm kuv lub network.

Cov cuab yeej ID pom thiab MQTT server tuaj yeem teeb tsa ntawm MQTT server nplooj ntawv ntawm sab hauv web server

Kauj Ruam 8: Ua Nws Ua Cov Khoom …

MQTT cov lus txib yog

ha/mod/xxxx/0 lossis 1 = Toggle zog

Lwm txoj hlua yuav raug kho raws li cov lus txib thiab xa los ntawm chaw nres nkoj txuas. Cov xwm txheej tau tshaj tawm rau /ha /kas fes hauv HEX

Nrog OpenHAB

coffeemachine.items

Number Coffee_Machine_Power "Power" {mqtt = "> [tswj: ha/mod/8002/: command:*: default]"} String Coffee_Machine_Status {mqtt = "<[control: ha/coffee: state: default]"}

Sitemap

Pawg khoom = "Lub Tshuab Kas Fes" {Hloov cov khoom = Coffee_Machine_Power daim ntawv lo = "Lub zog" mappings = [1 = "Toggle"] Hloov cov khoom = Coffee_Machine_Cmd daim ntawv lo = "" mappings = ["FA: 09" = "Me me"] Hloov cov khoom = Coffee_Machine_Cmd daim ntawv lo = "" mappings = ["FA: 0A" = "Loj"] Hloov cov khoom = Coffee_Machine_Cmd daim ntawv lo = "" mappings = ["FA: 04" = "Yaug"] Cov ntawv nyeem = Coffee_Status label = "Status [%s] "}

voicecontrol.rules

ntshuam org.openhab.model.script.actions.* ntshuam org.openhab.core.library.types.* ntshuam java.util.*

txoj cai "Lub suab hais kom ua txoj cai"

thaum Yam Khoom VoiceCommand tau txais cov lus txib tom qab ntawd hloov txoj hlua hais kom ua = VoiceCommand.state.toString.toLowerCase logInfo ("Voice. Rec", "VoiceCommand tau txais"+hais kom ua)

yog (command.contains ("qhib lub tshuab kas fes") || command.contains ("tua lub tshuab kas fes")) {

sendCommand (Coffee_Machine_Power, 1)} yog (command.contains ("ua rau kuv kas fes me me")) {sendCommand (Coffee_Machine_Cmd, "FA: 09")} yog (command.contains ("ua rau kuv kas fes loj")) { sendCommand (Coffee_Machine_Cmd, "FA: 0A")} yog (command.contains ("yaug lub tshuab kas fes")) {sendCommand (Coffee_Machine_Cmd, "FA: 04")}} kawg

Cov Cai (rau kev txhais HEX cov lus teb rau 'qhov tseeb' qhov tseem ceeb):

txoj cai "Coffee Machine Status" thaum Yam Coffee_Machine_Status tau txais qhov hloov tshiab tom qab ntawd var String teb = Coffee_Machine_Status.state.toString () yog (response.indexOf ("ic:")> -1) {var String hexString = response.substring (3, 5)

var int num = (Integer.parseInt (hexString, 16));

var String binaryString = String.format ("%8s", Integer.toBinaryString (num)). hloov ('', '0')

var int trayBit = binaryString.substring (0, 1)

var int tankBit = binaryString.substring (2, 3) var int heatBit = binaryString.substring (7, 8) var int rinseBit = binaryString.substring (6, 7)

yog (trayBit == "0") {

postUpdate (Coffee_Status, "Tais Tsis Pom")} yog (tankBit == "1") {postUpdate (Coffee_Status, "Sau Tank")} yog (yaugBit == "1") {postUpdate (Coffee_Status, "Nias Teb")} yog (trayBit == "1" && tankBit == "0" && rinseBit == "0") {postUpdate (Coffee_Status, "Npaj")}

}

yog (teb == "Tawm") {postUpdate (Coffee_Status, "Off")} kawg

Kauj Ruam 9: Kho kom zoo dua/Todo

Yooj yim pib teeb tsa txuas rau wifi - Ua tiav. Tso tseg lub tswv yim ntawm 'hom admin' raws li nws tau thab. Tam sim no tsuas yog nkag mus rau SSID thiab tus lej cim hauv tus lej. Txuag rau EEPROM yog tias koj hloov kho/hloov pauv ntawm lub vev xaib interface.

Cov cai tshiab tseem txhawb OTA hloov tshiab tab sis koj yuav tsum tau hloov kho EEPROM ntawm ESP-01 tus qauv rau qhov no los ua haujlwm lossis tawm tswv yim tawm cov khoom OTA sib xws

Ntxiv cov cai rau kev ua cov lus teb los ntawm lub tshuab thiab nyeem cov xwm txheej zoo li tsis muaj lub tais, thaj chaw khoob thiab sau lub tank - Ua tiav. Kuv tau ntxiv cov cai los nyeem cov xwm txheej rov qab thiab tshaj tawm rau ha/kas fes. Nov tsuas yog cov lus teb nyoos thiab kuv tseem tab tom ua haujlwm txhais lus tab sis tam sim no kuv muaj Tais ploj lawm thiab Tank tsis ua haujlwm. Nws xaiv lub tshuab txhua 9 vib nas this thaum nyob thiab tshaj tawm cov lus teb rau MQTT

Cov lus teb yog nyob hauv HEX tab sis cov khoom me me qhia qhov ntsuas

Ntxiv cov cai rau lub vev xaib rau kev tswj hwm ncaj qha ntawm HTTP Tau Txais Cov Lus txib.

Internet of Things Contest 2017
Internet of Things Contest 2017
Internet of Things Contest 2017
Internet of Things Contest 2017

Thawj qhov khoom plig hauv Internet ntawm Yam Kev Sib Tw 2017

Pom zoo: