arendst / Tasmota

Alternative firmware for ESP8266 and ESP32 based devices with easy configuration using webUI, OTA updates, automation using timers or rules, expandability and entirely local control over MQTT, HTTP, Serial or KNX. Full documentation at
https://tasmota.github.io/docs
GNU General Public License v3.0
21.84k stars 4.75k forks source link

Sonoff DEV-not working sensors, GPIOs configuration #2341

Closed Hugo477 closed 6 years ago

Hugo477 commented 6 years ago

A few comments in one:

  1. There are GPIOs 1,3,4,5,12,13,14 available on Sonoff DEV board. In configuration UI are 1,3,4,5,12,14 only. Did I missed something, or it is the correct state?

  2. On Sonoff DEV with 5.12.0g version flashed I had connected DS 18x20 to GPIO14 only, it works well. Now I've connected AM2301 to GPIO4 and Switch1 (actually it is a rain sensor) to GPIO5. DS18x20 and Switch1 work properly on the other side AM2301 is not displayed at all. There is no readout it looks like it is not connected or recognised. Anyhow, is it a bug or did I sthg wrong? How to make it working properly? Please...

GPIO command says: MAC address is redacted. 13:18:36 CMD: gpio 13:18:36 MQT: stat/DEV/RESULT = {"GPIO1":"0 (None)","GPIO3":"0 (None)","GPIO4":"2 (AM2301)","GPIO5":"9 (Switch1)","GPIO12":"0 (None)","GPIO14":"4 (DS18x20)"} 13:18:43 MQT: tele/DEV/STATE = {"Time":"2018-04-03T13:18:43","Uptime":"0T00:00:23","Vcc":3.464,"Wifi":{"AP":1,"SSId":"HugoNET","RSSI":70,"APMac":"08:96:xx:xx:xx:xx"}} 13:18:43 MQT: tele/DEV/SENSOR = {"Time":"2018-04-03T13:18:43","Switch1":"ON","DS18B20":{"Temperature":19.8},"TempUnit":"C"}

after 15 mins:

13:32:32 MQT: tele/DEV/STATE = {"Time":"2018-04-03T13:32:32","Uptime":"0T00:14:12","Vcc":3.463,"Wifi":{"AP":1,"SSId":"HugoNET","RSSI":58,"APMac":"08:96:xx:xx:xx:xx"}} 13:32:32 MQT: tele/DEV/SENSOR = {"Time":"2018-04-03T13:32:32","Switch1":"ON","DS18B20":{"Temperature":19.7},"TempUnit":"C"}

Status 0 command says: MAC address is redacted. 13:24:12 CMD: status 0 13:24:12 MQT: stat/DEV/STATUS = {"Status":{"Module":19,"FriendlyName":"DEV","Topic":"DEV","ButtonTopic":"0","Power":0,"PowerOnState":3,"LedState":1,"SaveData":1,"SaveState":1,"ButtonRetain":0,"PowerRetain":0}} 13:24:12 MQT: stat/DEV/STATUS1 = {"StatusPRM":{"Baudrate":115200,"GroupTopic":"sonoffs","OtaUrl":"http://sonoff.maddox.co.uk/tasmota/sonoff.ino.bin","RestartReason":"Software/System restart","Uptime":"0T00:05:52","StartupUTC":"2018-04-03T12:18:20","Sleep":0,"BootCount":29,"SaveCount":65,"SaveAddress":"FB000"}} 13:24:12 MQT: stat/DEV/STATUS2 = {"StatusFWR":{"Version":"5.12.0g","BuildDateTime":"2018-03-20T18:43:45","Boot":4,"Core":"2_4_0","SDK":"2.1.0(deb1901)"}} 13:24:12 MQT: stat/DEV/STATUS3 = {"StatusLOG":{"SerialLog":2,"WebLog":2,"SysLog":0,"LogHost":"","LogPort":514,"SSId1":"HugoNET","SSId2":"","TelePeriod":10,"SetOption":"00000009"}} 13:24:12 MQT: stat/DEV/STATUS4 = {"StatusMEM":{"ProgramSize":498,"Free":504,"Heap":18,"ProgramFlashSize":1024,"FlashSize":1024,"FlashMode":3}} 13:24:12 MQT: stat/DEV/STATUS5 = {"StatusNET":{"Hostname":"DEV-0219","IPAddress":"192.168.1.59","Gateway":"192.168.1.1","Subnetmask":"255.255.255.0","DNSServer":"192.168.1.1","Mac":"5C:CF:yy:yy:yy:yy","Webserver":2,"WifiConfig":3}} 13:24:12 MQT: stat/DEV/STATUS6 = {"StatusMQT":{"MqttHost":"192.168.1.107","MqttPort":1883,"MqttClientMask":"DVES_%06X","MqttClient":"DVES_9240DB","MqttUser":"admin","MqttType":1,"MAX_PACKET_SIZE":1000,"KEEPALIVE":15}} 13:24:12 MQT: stat/DEV/STATUS7 = {"StatusTIM":{"UTC":"Tue Apr 03 12:24:12 2018","Local":"Tue Apr 03 13:24:12 2018","StartDST":"Sun Mar 25 02:00:00 2018","EndDST":"Sun Oct 28 03:00:00 2018","Timezone":1}} 13:24:12 MQT: stat/DEV/STATUS10 = {"StatusSNS":{"Time":"2018-04-03T13:24:12","Switch1":"ON","DS18B20":{"Temperature":19.8},"TempUnit":"C"}} 13:24:12 MQT: stat/DEV/STATUS11 = {"StatusSTS":{"Time":"2018-04-03T13:24:12","Uptime":"0T00:05:52","Vcc":3.463,"Wifi":{"AP":1,"SSId":"HugoNET","RSSI":66,"APMac":"08:96:xx:xx:xx:xx"}}} 13:24:17 MQT: tele/DEV/STATE = {"Time":"2018-04-03T13:24:17","Uptime":"0T00:05:57","Vcc":3.462,"Wifi":{"AP":1,"SSId":"HugoNET","RSSI":70,"APMac":"08:96:xx:xx:xx:xx"}}

I did not try rest of my sonoffs yet (would like to test during this week), so it might be solely Sonoff DEV related issue.

arendst commented 6 years ago

I'll add GPIO13 to DEV.

AM2301 should work but probably needs a pull-up resistor of 4k7 on the data line.

To assure you here is the output of two AM2301 on a wemos:

image

Although they are connected as an AM2301 and as a SI7021 both AM2301 hardware perform just fine.

image

UPDATE: I just see that GPIO13 is connected to a blue led. As I do not own a Sonoff Dev can you verify that GPIO13 is fixed to a led or can it freely be used as GPIO?

UPDATE2: Don't worry. I make GPIO13 user configurable too.

Hugo477 commented 6 years ago

You are right GPIO13 is connected to the blue LED nonetheless it has a pin in one connector as well.

With sensors I am completely confused now. I tried to connect AM2301 with a pull-up resistor with no expected result. It still behaves like there is nothing connected. Strange is that there is nothing displayed even zeroes (AM2301 Temperature and AM2301 Humidity on the main screen under or above DS 18x20).

arendst commented 6 years ago

Enable more debugging info with weblog 3 or seriallog 3. You should at least see this:

17:34:35 DHT: Received 01, B9, 00, FB, B5 =? B5
17:34:35 DHT: Received 01, B1, 00, FA, AC =? AC
17:34:35 MQT: tele/wemos4/SENSOR = {"Time":"2018-04-03T17:34:35","AM2301-12":{"Temperature":25.1,"Humidity":44.1},"SI7021-14":{"Temperature":25.0,"Humidity":43.3},"TempUnit":"C"}
Hugo477 commented 6 years ago

DS 18x20 to GPIO14, AM2301 to GPIO4 and rain sensor to GPIO5.

17:25:27 CMD: weblog 3
17:25:27 MQT: stat/DEV/RESULT = {"WebLog":3}
17:25:27 CFG: Saved to flash at F7, Count 133, Bytes 1648
17:25:32 MQT: tele/DEV/STATE = {"Time":"2018-04-03T17:25:32","Uptime":"0T00:02:55","Vcc":3.462,"Wifi":{"AP":1,"SSId":"HugoNET","RSSI":100,"APMac":"F4:F2:xx:xx:xx:xx"}}
17:25:32 DHT: Timeout waiting for start signal high pulse
17:25:32 MQT: tele/DEV/SENSOR = {"Time":"2018-04-03T17:25:32","Switch1":"ON","DS18B20":{"Temperature":18.5},"TempUnit":"C"}
17:29:09 CMD: seriallog 3
17:29:09 RSL: Group 0, Index 1, Command SERIALLOG, Data 3
17:29:09 MQT: stat/DEV/RESULT = {"SerialLog":"3 (Active 3)"}
17:29:10 CFG: Saved to flash at F6, Count 134, Bytes 1648
17:29:14 MQT: tele/DEV/STATE = {"Time":"2018-04-03T17:29:14","Uptime":"0T00:06:37","Vcc":3.462,"Wifi":{"AP":1,"SSId":"HugoNET","RSSI":100,"APMac":"F4:F2:xx:xx:xx:xx"}}
17:29:14 DHT: Timeout waiting for start signal high pulse
17:29:14 MQT: tele/DEV/SENSOR = {"Time":"2018-04-03T17:29:14","Switch1":"ON","DS18B20":{"Temperature":0
18.5},"TempUnit":"C"}

If I remove all sensors and connected AM2301 to GPIO14:

17:34:37 DHT: Timeout waiting for start signal high pulse
17:34:47 MQT: tele/DEV/STATE = {"Time":"2018-04-03T17:34:47","Uptime":"0T00:01:03","Vcc":3.462,"Wifi":{"AP":1,"SSId":"HugoNET","RSSI":100,"APMac":"F4:F2:6D:9B:94:A2"}}
arendst commented 6 years ago

Do you provide enough power? When connecting the am2301 you'll need to power cycle also.

Hugo477 commented 6 years ago

It was my first concern. Sonoff DEV is powered by USB adapter providing up to 2 Amps. AM2301 still connected to GPIO14. 08:09:06 CMD: gpio 08:09:06 RSL: Group 0, Index 1, Command GPIO, Data 08:09:06 MQT: stat/DEV/RESULT = {"GPIO1":"0 (None)","GPIO3":"0 (None)","GPIO4":"0 (None)","GPIO5":"0 (None)","GPIO12":"0 (None)","GPIO14":"2 (AM2301)"} 08:09:14 MQT: tele/DEV/STATE = {"Time":"2018-04-04T08:09:14","Uptime":"0T00:00:43","Vcc":3.463,"Wifi":{"AP":1,"SSId":"HugoNET","RSSI":88,"APMac":"F4:F2:6D:9B:94:A2"}} 08:09:54 MQT: tele/DEV/STATE = {"Time":"2018-04-04T08:09:54","Uptime":"0T00:01:23","Vcc":3.463,"Wifi":{"AP":1,"SSId":"HugoNET","RSSI":92,"APMac":"F4:F2:6D:9B:94:A2"}} 08:09:55 DHT: Timeout waiting for start signal high pulse

Hugo477 commented 6 years ago

Is there any chance to have it working with all sensors if I erase flash by esptool.py --port COM5 erase_region 0x0F4000 0x008000 and reflash 5.12.0i or any other version of Tasmota again?

Dickesplumpel commented 6 years ago

I don't know why but my devices with AM2301, BH1750 and BME180 began only showing values after a firmware upgrade with the same firmware after sensores were plugged. There may be a more professional way I don't know :-))

Hugo477 commented 6 years ago

I've tried your solution and it works :)) but why?? Great thank you anyhow..

Dickesplumpel commented 6 years ago

Trying to answer questions like why can bring you in great trouble, thats what life can show you when you look back when you are older! ;-)) It works thats all that counts for me. I'm playing around with these things often I fail and sometimes I make a discovery - thats all.