Cov txheej txheem:

Sinilink WiFi Hloov Kho Nrog INA219 Voltage/Tam Sim No Sensor: 11 Kauj Ruam
Sinilink WiFi Hloov Kho Nrog INA219 Voltage/Tam Sim No Sensor: 11 Kauj Ruam

Video: Sinilink WiFi Hloov Kho Nrog INA219 Voltage/Tam Sim No Sensor: 11 Kauj Ruam

Video: Sinilink WiFi Hloov Kho Nrog INA219 Voltage/Tam Sim No Sensor: 11 Kauj Ruam
Video: yuav tau tsim kho tus kheej lub neej thiaj yuav vam meej tau 2024, Kaum ib hlis
Anonim
Sinilink WiFi Hloov Kho Nrog INA219 Voltage/Tam Sim No Sensor
Sinilink WiFi Hloov Kho Nrog INA219 Voltage/Tam Sim No Sensor

Sinilink XY-WFUSB WIFI USB hloov yog lub cuab yeej me me zoo rau kev qhib/tua ib qho txuas USB txuas. Tu siab nws tsis muaj peev xwm ntsuas qhov Voltage lossis siv Tam sim no ntawm cov cuab yeej txuas.

Cov lus qhia no qhia koj li cas kuv hloov kho kuv lub USB hloov nrog INA219 Voltage/Tam sim no ntsuas. Nrog qhov kev hloov kho no koj tuaj yeem saib xyuas cov khoom siv txuas nrog lub zog siv, piv txwv li lub xov tooj ntawm tes, ebook nyeem ntawv thiab lwm yam, thaum them nyiaj thiab siv lub tshuab kom kaw lub zog rau lub cuab yeej txuas ua ntej nws tau them 100% rau (tej zaum) txuas ntxiv lub neej ntawm cov roj teeb LiPo.

Nco ntsoov tias thaum kawg qhov kev hloov kho no ua rau muaj qhov poob qis me ntsis ntawm 5V cov tswv yim rau qhov tso tawm ntawm tus qauv.

Kauj Ruam 1: Yam yuavtsum tau kawm uantej/Yam khoom

Koj yuav xav tau cov hauv qab no:

  • Sinilink XY-WFUSB WIFI USB hloov
  • INA219 Voltage/Tam sim no sensor module (me dua yog qhov zoo dua)
  • 0.4mm txoj kab uas hla enameled hlau
  • tuab hlau, uas tuaj yeem ua 2-3A tam sim no
  • cua sov ntsws raj sib piv cov tuab tuab xaim
  • 25.4mm txoj kab uas hla cua sov ntsws raj
  • Cov cuab yeej ib txwm zoo li cov hlau txuas, kab laug sab, flux
  • PC uas koj tuaj yeem suav Tasmota nrog INA219 kev txhawb nqa

Kauj Ruam 2: Kev piav qhia dav dav

Kev piav qhia dav dav zoo heev ntawm USB hloov pauv, nws ntu thiab yuav qhib li cas nws tau ua tiav hauv cov vis dis aus txuas los ntawm Andreas Spiess. Cov vis dis aus no tau tshoov kuv siab kom hloov pauv kuv tus qauv nrog INA219 sensor module.

Kauj Ruam 3: ESP8285 Tsis siv GPIOs

ESP8285 Tsis siv GPIOs
ESP8285 Tsis siv GPIOs

Txhawm rau xam tawm tus Pins/GPIOs ntawm ESP8285 tsis txuas nrog Kuv tshem tawm cov nti los ntawm tus qauv. Koj tsis tas yuav ua qhov no, tsuas yog saib ntawm daim duab.

Nrog cov nti uas xav tau thiab ESP8285 cov ntawv koj tuaj yeem pom tias Pins/GPIOs hauv qab no tsis siv:

  • PIN 10 / GPIO12
  • PIN 12 / GPIO13
  • PIN 18 / GPIO9
  • PIN 19 / GPIO10
  • … thiab ntau dua …

Koj tsuas xav tau ob qho rau I2C kev sib txuas (SDA + SCL) rau INA219 tus qauv. Kuv xub xaiv tus PIN18 + PIN19 tab sis kuv tau rhuav tshem cov pawm thaum siv rau nws vim tias kuv tseem tsis tau (txawj) txawj txaus los xaws ob lub xov hlau 0.4mm ntawm tus pin ntawd thaum lawv nyob ib sab.

Kauj Ruam 4: Siv Cov Hluav Taws Xob Tam Sim No rau PCB

Cov Khoom Siv Hluav Taws Xob Tam Sim No rau PCB
Cov Khoom Siv Hluav Taws Xob Tam Sim No rau PCB
Cov Khoom Siv Hluav Taws Xob Tam Sim No rau PCB
Cov Khoom Siv Hluav Taws Xob Tam Sim No rau PCB
Cov Khoom Siv Hluav Taws Xob Tam Sim No rau PCB
Cov Khoom Siv Hluav Taws Xob Tam Sim No rau PCB

Txhawm rau ntsuas tam sim no INA219 tus qauv yuav tsum tau muab tso rau hauv cov zis +5V pub ntawm kev hloov MOSFET thiab USB chaw nres nkoj tso tawm.

Ua ntej nqa ceg ntawm USB ntsawb.

Thib ob txuas cov hlau tuab (liab) rau lub ncoo ntawm PCB, uas yog qhov tso tawm ntawm MOSFET ntawm lwm sab ntawm PCB, cov xaim no yuav mus rau "Vin+" ntawm INA219.

Tom qab ntawd siv cov xaim tuab (xim dub) rau Tus Pin ntawm USB ntsawb, qhov no yuav mus rau "Vin-" ntawm INA219.

Kuv muab qee qhov cua sov tiv taus Kapton daim kab xev nruab nrab ntawm lawv thaum siv lub tshuab txuas thiab tom qab ntawd ntxiv qee qhov cua sov ntsws tubing ncig cov xaim dub. Kuv tseem tso daim kab xev Kapton tso rau hauv.

Kauj Ruam 5: Cov Khoom Siv Cov Ntaub Ntawv Txuas mus rau ESP8285 Pins

Cov Ntaub Ntawv Siv Hluav Taws Xob rau ESP8285 Pins
Cov Ntaub Ntawv Siv Hluav Taws Xob rau ESP8285 Pins

Ua ntej khoov cov xov hlau ua ntej yuav siv lawv rau hauv lub nti, koj yuav tsum tsis txhob ua rau lub zog ntau dhau ntawm cov ntaub qhwv nrog cov pins ntawm lub nti.

Siv ob lub xov hlau txuas rau tus pin 10 thiab 12 ntawm lub nti.

Raws li koj pom ntawm daim duab kuv tau hlawv cov pins 18 thiab 19 ntawm sab xis ntawm lub nti, yog li sim ua kom lub cua sov qis thiab siv lub sijhawm luv luv.

Kuv kuj tau kaw ob lub xov hlau ntawm ntug ntawm lub rooj tsavxwm kom muaj kev nyuaj me ntsis.

Kauj Ruam 6: Solder Vcc/Gnd Wires rau 3V3 Regulator thiab USB Port

Solder Vcc/Gnd Wires rau 3V3 Regulator thiab USB Port
Solder Vcc/Gnd Wires rau 3V3 Regulator thiab USB Port

Siv cov xaim hlau txuas rau qhov tso tawm ntawm AMS1117 3V3 tus tswj hluav taws xob, qhov no yuav mus rau "Vcc" ntawm INA219 tus qauv. (Thov txim rau daim duab tsis zoo)

Siv cov xaim txuas rau Gnd tus pin ntawm USB txiv neej lub txiv neej, qhov no yuav mus rau "Gnd" ntawm INA219 tus qauv.

Kauj Ruam 7: Cov Cuab Yeej Siv Hluav Taws Xob rau INA219 Module

Solder Wires rau INA219 Module
Solder Wires rau INA219 Module
Solder Wires rau INA219 Module
Solder Wires rau INA219 Module

Muab cov xaim xaim txuas rau INA219 tus qauv. Khaws qhov chaw txaus ntawm lub ntsiab PCB thiab tus qauv txhawm rau ntxig lub npog xiav ntawm Sinilink ntaus ntawv.

  • Vin+ - (liab) los ntawm ncoo ntawm PCB
  • Vin- - (dub) los ntawm tus pin ntawm USB tso zis
  • Vcc - los ntawm AMS1117 3V3 qhov ntsuas hluav taws xob
  • Gnd - los ntawm Gnd tus pin ntawm USB txiv neej nkaus
  • SCL - los ntawm PIN12 / GPIO13 (SCL / SDA tuaj yeem hloov pauv hauv Tasmota teeb tsa)
  • SDA - los ntawm PIN10 / GPIO12 (SCL / SDA tuaj yeem hloov pauv hauv Tasmota teeb tsa)

Kauj Ruam 8: Sib dhos

Los ua ke
Los ua ke
Los ua ke
Los ua ke

Txiav qee qhov rau hauv daim npog xiav ntawm Sinilink lub cuab yeej kom dhau los ntawm cov xov tooj uas koj siv.

Ntxig lub hau npog ntawm Sinilink PCB thiab INA219 tus qauv thiab khoov cov xov hlau ze rau ntawm rooj plaub.

Siv cov cua sov ua kom sov ib ncig ntawm ob qho qauv.

Kauj Ruam 9: Tsim Tasmota Nrog INA219 Kev Txhawb Nqa

Koj yuav tsum tau suav sau Tasmota nrog INA219 kev txhawb nqa, tus txheej txheem tasmota-sensors.bin, uas muaj INA219 kev txhawb nqa, loj heev kom haum rau hauv ESP8285.

Cov hauv qab no yog cov lus piav qhia luv luv ntawm cov txheej txheem tsim siv docker, cov ntsiab lus ntxiv ntawm no.

Tsim cov npe:

$ mkdir/opt/docker/tasmota-builder

Tsim docker-compose.yml

$ miv /opt/docker/tasmota-builder/docker-compose.yml version: "3.7" cov kev pabcuam: tasmota-builder: container_name: tasmota-builder hostname: tasmota-builder restart: "no" # qhov chaw: https:// hub.docker.com/r/blakadder/docker-tasmota duab: blakadder/docker-tasmota: tus neeg siv kawg: "1000: 1000" tagnrho: # docker ntim yuav tsum tau pib los ntawm tib tus neeg siv uas yog tus tswv # tus lej qhov chaws-./tasmota_git:/tsum tsum

Clone git chaw cia khoom thiab hloov mus rau qhov tshwj xeeb tagged tso tawm ntawm Tasmota:

/opt/docker/tasmota-builder $ git clone https://github.com/arendst/Tasmota.git tasmota_git

/opt/docker/tasmota-builder/tasmota_git (tus tswv) $ git checkout v8.5.1

Ntxiv cov ntaub ntawv tshem tawm kom suav nrog INA219 kev txhawb nqa:

$ miv /opt/docker/tasmota-builder/tasmota_git/tasmota/user_config_override.h

#ifndef _USER_CONFIG_OVERRIDE_H_#txhais _USER_CONFIG_OVERRIDE_H_#ceeb toom **** user_config_override.h: Siv Chaw los ntawm Cov Ntaub Ntawv no ****#ifndef USE_INA219#txhais USE_INA219#endif

Pib tsim:

"-e tasmota" txhais tau tias nws tsuas yog tsim tasmota.bin binary, tsis muaj dab tsi ntxiv.

/opt/docker/tasmota-builder $ docker-compose khiav tasmota-builder -e tasmota; docker-compose cia

Qhov tshwm sim binary, tasmota.bin, yuav nyob hauv:

/xaiv/docker/tasmota-builder/tasmota_git/build_output/firmware/

Teeb lub cuab yeej Sinilink nrog Tasmota raws li tau piav qhia los ntawm Andreas Spiess hauv nws daim vis dis aus. Ua ntej flashing thiab tom qab ntawd teeb tsa tus qauv/ib txwm GPIO teeb tsa rau lub cuab yeej no.

Xwb siv koj tus kheej suav sau Tasmota binary lossis tsuas yog siv tus qauv tso tawm ua ntej, thiab tom qab ntawd hloov kho ntawm webgui rau koj tus kheej ua ke version.

Kauj ruam 10: Tasmota Configuration rau INA219

Tasmota Kev teeb tsa rau INA219
Tasmota Kev teeb tsa rau INA219
Tasmota Kev teeb tsa rau INA219
Tasmota Kev teeb tsa rau INA219

Thawj kauj ruam yog hloov kho tus qauv kom haum rau kev hloov kho.

Mus rau "Configuration" -> "Configure Template", xaiv rau GPIO12 thiab GPIO13 tus "Neeg Siv (255)" tus nqi. Nyem "Txuag".

Tom qab rov pib dua mus rau "Kev teeb tsa" -> "Kho Tus Qauv", xaiv rau GPIO12 -> "I2C SDA (6)" thiab rau GPIO13 -> "I2C SCL (5)". Los yog pauv cov ntawd yog tias koj muab cov xov hlau sib txawv. Nyem "Txuag".

Hloov qhov tso tawm/tshaj tawm qhov tseeb ntawm tus qauv. Hloov raws li koj xav tau.

Mus rau "Console" thiab sau cov lus txib hauv qab no.

TelePeriod 30 # xa MQTT qhov ntsuas qhov ntsuas txhua 30 vib nas this

VoltRes 3 # 3 tus lej tseeb ntawm qhov ntsuas hluav taws xob WattRes 3 # 3 tus lej tseeb ntawm Watt kev suav AmpRes 3 # 3 tus lej raug rau qhov ntsuas tam sim no

Kauj Ruam 11: Qhov Kawg

Zaum Kawg
Zaum Kawg
Zaum Kawg
Zaum Kawg

Yog tias txhua yam tau ua tiav raug tam sim no koj tuaj yeem tshuaj xyuas Voltage thiab Tam sim no siv los ntawm USB txuas txuas ncaj qha hauv Tasmota Web GUI.

Yog tias koj tseem muaj teeb tsa rau Tasmota los tshaj tawm qhov ntsuas ntawm MQTT rau hauv InfluxDB koj tuaj yeem tsim cov duab ntawm Grafana los qhia kev them nqi tam sim no dhau sijhawm, ntawm no yog piv txwv ntawm kuv lub xov tooj them los ntawm ~ 10% txog ~ 85% lub peev xwm.

Thiab ua raws qhov teeb tsa koj tuaj yeem siv lub cuab yeej siv hluav taws xob zoo li Node-RED kom txiav tawm USB hloov pauv thaum lub sijhawm tam sim no poob qis dua qhov txwv.

Nco ntsoov tias txij li INA219 siv 0.1 Ohm resistor raws li qhov tam sim no shunt koj yuav tau txais qhov hluav taws xob poob los ntawm cov tswv yim mus rau cov zis, nyob ntawm koj lub zog siv thiab "txawj ntse" ntawm cov cuab yeej txuas nws yuav tsub nqi qeeb dua ua ntej.

Pom zoo: