Design principles
Used components
PWM driver needed?
If we would like to control the fan speed, then we should use a Arduino pin that supports PWM.
Hence, we choose D3.
Wiring
The pinout on a MOSFET is (from left to right, looking at the printed side of the MOSFET) gate - drain - source.
Low side driver
Code
See https://www.mysensors.org/build/humidity_si7021 and https://github.com/mysensors/MySensors/blob/development/examples/GatewaySerial/GatewaySerial.ino
Development
Use the Arduino IDE or PlatformIO for development.
For PlatformIO you will need this folder structure:
Project-Node-DeltaTempFanController |-- platformio.ini |-- DeltaTempFanController | |-- DeltaTempFanController.ino |-- lib | |-- SI7021 | | |-- SI7021.cpp | | |-- SI7021.h
These files can be downloaded at:
First sign of life
Serial output after first successful start:
16 MCO:BGN:INIT NODE,CP=RNNNA---,FQ=16,REL=255,VER=2.3.2 26 TSM:INIT 28 TSF:WUR:MS=0 34 TSM:INIT:TSP OK 36 TSF:SID:OK,ID=1 37 TSM:FPAR 41 ?TSF:MSG:SEND,1-1-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 447 TSF:MSG:READ,0-0-1,s=255,c=3,t=8,pt=1,l=1,sg=0:0 452 TSF:MSG:FPAR OK,ID=0,D=1 2050 TSM:FPAR:OK 2051 TSM:ID 2052 TSM:ID:OK 2054 TSM:UPL 2059 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1 2067 TSF:MSG:READ,0-0-1,s=255,c=3,t=25,pt=1,l=1,sg=0:1 2071 TSF:MSG:PONG RECV,HP=1 2074 TSM:UPL:OK 2076 TSM:READY:ID=1,PAR=0,DIS=1 2082 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100 2089 TSF:MSG:READ,0-0-1,s=255,c=3,t=15,pt=6,l=2,sg=0:0100 2097 TSF:MSG:SEND,1-1-0-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=OK:2.3.2 2107 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0 2121 TSF:MSG:READ,0-0-1,s=255,c=3,t=6,pt=0,l=1,sg=0:M 2131 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=11,pt=0,l=22,sg=0,ft=0,st=OK:DeltaTempFanController 2142 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=OK:1.0 2150 TSF:MSG:SEND,1-1-0-0,s=0,c=0,t=6,pt=0,l=22,sg=0,ft=0,st=OK:DTFC - Top Temperature 2210 TSF:MSG:SEND,1-1-0-0,s=1,c=0,t=7,pt=0,l=19,sg=0,ft=0,st=OK:DTFC - Top Humidity 2269 TSF:MSG:SEND,1-1-0-0,s=2,c=0,t=6,pt=0,l=25,sg=0,ft=0,st=OK:DTFC - Bottom Temperature 2329 TSF:MSG:SEND,1-1-0-0,s=3,c=0,t=7,pt=0,l=22,sg=0,ft=0,st=OK:DTFC - Bottom Humidity 2392 TSF:MSG:SEND,1-1-0-0,s=4,c=0,t=4,pt=0,l=10,sg=0,ft=0,st=OK:DTFC - Fan 2449 MCO:REG:REQ 2452 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=OK:2 2459 TSF:MSG:READ,0-0-1,s=255,c=3,t=27,pt=1,l=1,sg=0:1 2463 MCO:PIM:NODE REG=1 2466 MCO:BGN:STP DeltaTempFanController 1.02817 MCO:BGN:INIT OK,TSP=1 2859 TSF:MSG:SEND,1-1-0-0,s=0,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:27.74 2919 TSF:MSG:SEND,1-1-0-0,s=1,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=OK:0.52 2977 TSF:MSG:SEND,1-1-0-0,s=2,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:23.49 3034 TSF:MSG:SEND,1-1-0-0,s=3,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=OK:0.67 3094 TSF:MSG:SEND,1-1-0-0,s=4,c=1,t=3,pt=2,l=2,sg=0,ft=0,st=OK:10 3150 MCO:SLP:MS=10000,SMS=0,I1=255,M1=255,I2=255,M2=255 3155 TSF:TDI:TSL
About combined Temp + Hum MySensors
Q: | I'm using mysensors to send temp and hum to domoticz. When registring the node I see temp and hum added as 2 nodes separately:
Fine with me, but now only the temp+hum is updated. The temp is only update once. How can I solve this? |
---|---|
A: | You cant, first it receives the temp, then the humidity, and domoticz makes it a TEMP+HUM sensor, it is supposed to be. Place a $ character infront of the name of the separate temp sensor, and it won't be visible (only in the devices table). If MySensors had a S_TEMPHUM type, we could avoid this. |