New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sensor DS18b20 and DH11/DH22 not work #2745
Comments
And in what ESPEasy version did it work well? |
All version on Release 20191116 | ESP_Easy_mega-20191116_normal_core_241_ESP8266_4M1M.bin |
the 20190630 version work well |
ESP_Easy_mega-20191003_test_core_260_sdk3_alpha_ESP8266_4M1M.bin |
The topic title suggests the Dallas sensors also don't work, but like I showed you, they work on my setup. |
Inglese IN MY CONFIGURATION WITH THE 20190630 VERSION THE Dallas sensors and the DHT11 / DHT22 WORK WELL. IN NEW VERSIONS FROM SEPTEMBER TO FORWARD DO NOT WORK. THE VALUE IS NaN |
please provide debug log from units where they are connected I see on screenshot that boiler sensor works, but 2 other sensors are unavailable. |
64974: EVENT: Clock#Time=Sat,13:43 |
BOILER SENSOR IS REMOTE SENSOR ON ANOTHER ESPEASY WITH EASPEASY 20190630 |
You need to get logs from the unit that actually has the sensor connected. |
the local sensor DH22 not work . |
Well the plugin P005_DHT was last changed in August, so I guess it is not something in the plugin itself. Does the plugin give data sometimes? Or are all measurements failing? |
DH22 all measurements failing after August, |
Which August build? |
I don't know that in October I am in agreement with the sensor malfunction |
DHT22 works for me with latest code, just recompiled and tested @TD-er it is first report about not working sensor from long time, in my opinion it is hardware related Lines 175 to 179 in 0d6d136
|
Hi, |
@uzi18 Moving the interrupts up is fine, as long as you make sure they are enabled before exiting the function. Also, what is the common change for both Dallas and DHT plugins? |
@TD-er not sure if it's related, but roughly after 20191108 I experience also again more strange issues, like laggy-webpages, HW-WD reboots, Units that won't connect to AP anymore (especially when signal is weak), NeoPixel's don't run smoothly anymore, etc. To me it looks like timing issues or background tasts that do not get executed or stalled... Which could explain why Dallas sensors are not read anymore correctly (wrong timing etc.)... Can't really nail it currently, I'm searching, but did something change in WiFi handling or handling of background tasks? |
@TD-er small tweaks here #2748 @clumsy-stefan maybe it is core related? |
Could very well be, yes, as I'm using latest GIT core... I'm still trying to track down what exactly happens... It could also be memory related, as the 1M units have more problems than the 4/16M ones... |
1M units often have more low-cost flash chips. Maybe we should lower the flash frequency on those? Or maybe it is lowered and that's what does make it more slow. |
strange thing is, it happens only since about a week ago or so (after 20191108) and I have a 16M unit with some Dallas sensors and 50 Neopixels. I see wrong colors on the strip or laggy movement of the color pattern, which normally means some timing is not correct when driving the neo's.... |
This 16M module, what SPIFFS size do you use? |
I experienced the same problem as OP with my DHT22 sensor, going from firmware version file |
Hi there, Just jumped on the easyesp ship this week and I'm excited. So here I am with my observations using easyesp with DS18B20 in parasite power mode. The problem is that in parasite power mode the one wire bus must be held high when a measurement is being performed or when the data is being written to eeprom. This is because of the amount of current required during this time. The DS18B20 cannot store enough energy to complete a conversion. It needs power from the bus during this time. How it gets this power is not the debate for me - I've had success with really low pullup resistors (1k) when there are 8 or more DS18B20 or setting the GPIO pin as output high during conversion. Now the crux of the problem with easyesp as I've just observed today. This means that the DS18B20 gets the power it needs to achieve a successful conversion. However with more than one DS18B20 easyesp sends the start measurement command (44) to the 1st DS18B20 AND THEN IMMEDIATELY sends a start measurement command to the next DS18B20 starving the 1st of the power it needs to succesfully perform a measurement. So the 1st fails and results in NaN but the last DS18B20 succeeds. This was using one esyesp "device" in single vs dual vs quad mode. I also had varying degrees of success by using each DS18B20 on its own easyesp "device" but on the same one-wire bus. Conclusion: The issue with DS18B20 NaN is not communication or hardware issues but because the firmwaare implementation is not honouring the requirement of a DS18B20 to have the one-wire bus to be held high WHILE A MEASUREMENT IS IN PROGRESS. Easyesp is attempting to communicate with other devices on the one-wire bus and therefore starving those DS18B20s that are trying to perform measurements of the power they need for succesful measurement. I had both a DS1054 and a picoscope looking at the onewire bus and both wave form and data are fine and not corrupt at all. The issue for most is not the pullup resistor or not likely to be wire length. It is the problem that the firmware is writing to the one-wire bus while a device is trying to perform a measurement. Now how to fix? No idea yet. Only just got started with easyesp. Off to take a look at the code for the DS18B20 plugin. Others that know the code better may beat me to a fix now they know the crux of the problem. Regards, Andy. |
Parasitic powering of the Dallas sensors is not supported. |
@TD-er Ahh, Ok. I misunderstood then in the device stats where it stated "Parasite Powered:" with a true flag as being recognised & therefore supported. Maybe a comment on that page to advise that parasitic powered configuration is not supported would save those from the frustration of trying to get it to work and understanding why it is not working? Is parasitic power config on the road map at all? I guess not in the immediate future from the wording of your reply... Regards, Andy. |
As an additional thought, I believe it is possible to initiate measurement/converrsion to all DS18b20 simultaneously on the one-wire rather than addressing and initiating a measurement to each DS18B20 individually by sending a global 44h instead of a 55h and the ROM address and then 44h. That should allow all devices in a quad to measure simultaneously and be read interleaved as is already the case but also preserving the state of DQ while measurement takes place? The limitation would then be up to 4 DS18B20 per one-wire bus as a single easyesp "device". Andy. |
Nah, I'm not convinced I got this right. Can't find where I thought I saw it now. But it was a while ago. A. |
See documentation where it is stated that parasitic power is not supported.
What happens with the Dallas sensors on several tasks is that they will start the measurement, one task after another and then reschedule the tasks to read the sensors. However it is not guaranteed this will always be done in this sequence. |
Hi @TD-er , So I found the sequence to initiate a measurement on all Ds18B20 on the one wire bus in one hit. Perform a one-wire reset then write CCh (ROM skip command) followed by 44h (initiate measurement command). Then set the one-wire bus high. This should syncronously start measurements on all the devices on the one wire bus. After the conversion time has passed the event schedule can then poll each device to read the values as it does already. This has the downside of only working for 4 devices on the one bus and other easyesp "devices" with physical devices on the same bus would interfere with this process. Also other devices would be interfered with by this process! I have another idea which must wait until I'm in front of a real keyboard to type it up! Regards, Andy. |
Just to avoid confusion in explaining. In ESPEasy we have a plugin, which is a piece of code describing how to interact with some sensor (or other hardware like a display) So what you call "devices", you probably mean "tasks" right? |
Yes I think so, Not with the lingo yet... A. |
Ok, So quick aside as I thought I'd got this nailed right now but as they say one step forward and you fall off the cliff... So my use case for easyesp. I'd been using a PI to read in 10 dallas 10b20s and posting to a local emoncms server monitoring a heating system which has been recently ripped out and replaced. I need to monitor flow and return as a quick verification and I thought a wemos D1 mini and easyesp capable of both ds18B20 and emoncms would be plug and play.... However. Parasite power not supported - fair enough. But it does work if you only have one device on the bus. So I just set up two devices on separate GPIO. Fine and dandy. Values flowing out the serial monitor. Now to emoncms that was working aok with NaN values across 4 sensors on one bus. As field1 field2 etc. however now they are on separate "tasks" (yay!) both devices are referred to as "field1" rather than the task name or the task device value (correct notation?). And as the emoncms node id is tied to the easyesp instance on the wemos the two dallas values are pasting over the top of each other on one emoncms input instead of being sent to two different inputs (temp1, temp2) on the same node or the same field1 on two different nodes 41,42 etc. Bugger, there's the cliff. This "feature" is more to do with the emoncms controller than the dallas thread and ought to be raised somewhere else - probably would be nice to push the task value name to emoncms rather than field1 field2 etc. But it became apparent because of the problem I was having with the dallas DS18B20. Bedtime. Andy. |
I have never used EmonCMS. To 'flush' the values in a dummy, you can call You can even call taskvaluesetandrun (as last one) But why do you need to use the Dallas sensors in parasitic mode? |
The sensors are already in and wired. I was avoiding having to rewire them thinking this would work with the wemos as is. Moving the old software to a pi zero was the immediate idea but for the problem that there is no easy access to power and a wemos/easyesp combo was attractive from a power point of view being able to last a significant time on a battery compared to the pi. In hindsight (or starting afresh) a three wire one-wire (there's an irony) with wemos/ easyesp would have been the thing to do. And may well be what I end up doing in the end. A. |
So emoncms would take data in the form value1Name:value,value2Name:value etc. Easyesp emoncms plugin uses field1,field2 etc as the value name and this works when posting the data from a Ds18B20 task in quad mode. The one task sends the four values which get sent to emoncms as field1, field2, field3, field4. One for each temp sensor. Great. However when using a separate plugin task for each Ds18B20, each task instance sends its own value via the emoncms controller as "field1", so the values from the four sensors end up in emoncms in one input feed instead of four separate ones.
I'm completely newbie to easyesp. It is obviously a capable bit of kit - my initial attraction to it being the WiFi setup out of the box and straight forward to get up & going on power efficient hardware. I will have to set time aside to understand what it can do and give these other ways you describe a shot. Thanks for the pointer... A. |
Just to get the concepts straight of what role a task has in ESPEasy.
A 'dummy' task does not interact with hardware, but can hold task values and send them over to the controllers.
One of the commands for a 'dummy' task is to set a value to the dummy task: |
Hi @TD-er, Thanks for the above. I will endevour to invest some time to discover how you intend espeasy to be used instead of being butchered by old hacks like me. However: I added this method to Dallas1WireHelper.cpp:
And then in P004_data_struct.cpp changed the line:
to
and basically it works a treat. So the CCh, 44h combo initiates a global measurement on all devices on the onewire bus and then the read of values is just as already coded. I did a bit of hacking so that only the 1st of 4 sensors in the loop initiates the gobal read and also to make sure the resolutions are the same. I'm thinking a CCh command will also allow a global config of all sensor resolutions to be set in one hit as well but not got that far. So for completeness (as I haven't had time to push it to github yet) (and it's a shameful proof of concept hack at this point) here's the mod to bool P004_data_struct::initiate_read() that calls the hacked _sensors[i].initiate_global_read(..)
Anyhow this is installed and pushing me the data I need for now to emoncms so I'm a happy bunny. And I've found a new toy (espeasy) in the process. Andy. |
Looks interesting.
|
Quick reply before I call it a night.
Sure... My initial quest was to get parasitic power working but that's opened a pandora's box.
As far as I'm aware (research and experience) the value obtained by a measurement action stays in the scratch space until it's overwriten with the next measurement or the power is removed. So potenitally indefinately.
My understanding is that the CCh command is part of the dallas spec and as such is implemented by the knock offs also. 99% of the time the issue with parasitic powering is not holding the onewire high enough for long enough for all the devices on the bus to achieve their measurement simultaneously. It is their source of power while this takes place. One PI implementation with 8 sensors was fixed using a 680R pullup resistor which would seem way overkill but so long as all the devices and the PI can sink the 680R to ground then it worked!
For sure there needs to be a way of determining are we global or discrete. Maybe the parasitic power flag is a heads up that discrete is going to fail.
Break it I guess. Once a measurement has commenced in parasite power mode the line cannot be used for anything other than powering the device that has a measurement in progress. This is the fundamental reason for NaN (125 or 85 degC) values being returned accross the planet for these devices in parasite power mode. The Onewire line was disturbed before the measurement was allowed to complete. I can't speak for other sensors but what I can say is that they have to wait patiently for DS18B20 to finish the measurement before they can communicate. But isn't the CC44h spec a One-wire spec rather than just a Dallas spec? So all devices would be busy measuring at that point anyway? We just have to wait for the longest device to complete before we start asking for results ad that point. But this shouldn't be a problem. If DS18B20 are all on one GPIO and other sensor types are on another? I'd be reluctant to mix device types on a bus but then my use case is quite specific. I don't see a problem with 20 or 30 or more DS18B20 on one GPIO in parasite power mode from a hardware point of view. CC44h would initiate a read on all 30 in one hit. Then you've got to read the data. Which is the same timing challenge that you have from a separate power 3 wire implementation point of view anyway. Enough for now. Later, |
There are also Dallas 1-Wire tags (like RF-ID, but electrical contact), an 1-wire counter, etc. |
@TD-er time gone, but do you know now how accurate functions like micros64() are? |
@uzi18 Typically the crystal should be within 10 ppm, so that's about the accuracy of the micros. |
@TD-er asking you because have new data about esp32. This explains why we changed timmings in OW and DHT and can't find accurate. |
Long time no reply in this issue, so most likely it has been solved, especially as there have been a lot of updates on ESPEasy code regarding these plugins. This can most likely be closed. |
This has for sure been solved as I have been tweaking those plugins using a logic analyzer on both ESP8266 and ESP32 with the latest ESP32 SDK. |
On Release mega-20191116 Sensor DS18b20 and DH11/DH22 not work,
Its value NaN.
The text was updated successfully, but these errors were encountered: