bigjosh / OneWireNoResistor

A slight update of the popular Arduino 1-wire library that eliminates the need for the extra pull-up resistor
57 stars 10 forks source link

Esp8266 pullups? #2

Open tablatronix opened 8 years ago

tablatronix commented 8 years ago

Has anyone tested this on esp8266?

bigjosh commented 8 years ago

Do the ESP8266 GPIOs even have internal pullups? If not, then you probably could use one of the flash GPIOs that are already pulled up (GPIO0 and GPIO2) on the board. If the part is ALREADY there anyway for something else, then I think it counts as zero parts!

tablatronix commented 8 years ago

All gpios but 0 have internal pullup capability. But I think they are weak. Ill do some testing i suppose.

eyaleb commented 8 years ago

I just tested this and it does not work. I simply applied the same 4 lines change to the latest OneWire.cpp (says it is v2.3). The OneWire.h file is different as it now includes ESP8266 support. I understand that no change is required here unless one wants to include busFail().

A simple sketch works with an external pullup but fails [reset() fails] without. I reduced the number of sensors from 4 to 1 but it still does not work. I use GPIO4 for ow data.

Is there any change in OneWire.h that is required for this change to work?

[later] Just for fun I tried different pins. GPIO12 and 13 failed differently - reset() succeeded but all readings are zero. GPIO14 fails like GPIO4.

My DS18B20 module does not verify e checksums, I will add this to see what is going on. [even later] unexpectedly the checksum (of the 0 reading message) is good.

TIA

agademer commented 7 years ago

EDIT : In short : I DID'NT made it work WITHOUT external pull-up.

Hi ! I made it work (somehow) on ESP8266 with no external resistor. I had to merge the OneWire.h from the v2.3 (that include the definition of the ESP8266) with the current OneWire.h from this github. I had also to add an explicit pinMode(12, INPUT_PULLUP); for the data line.

You can find the code here : https://www.dropbox.com/s/8ejs1ix0w4pb4ai/NoPullupTester_ESP8266.zip?dl=0

Not everything perfect though....

I have weird value reading

Parasite:ON Count:1 #0=85.00 (the value should be in °C)

I have the same reading with an external pull-up so.... Parasite:ON Count:1 #0=127.94

I will have to check the signal with an oscilloscope...

In the meantime, Have fun !

Antoine

Edit: 85° is the value at reset of the DS18B20... meaning, there is something fishy here. I still have to investigate on why. Because, even with an external pull-up, it does not work.

Edit2: It seems, the power output of the ESP8266 is not enough. After a lot of reading, I had to add the line:

digitalWrite( 12 , HIGH ); pinMode( 12 , OUTPUT ); // Mandatory to make it work on ESP8266

to make it work WITH AN EXTERNAL PULL-UP (4.7k in my case, but I tried a lot (1.5k, 2.2k) without change.

Obviously, if I need to put it as an OUTPUT, I cannot use the internal pull-ups... So for now, I call myself beaten.

In short : I DID'NT made it work WITHOUT external pull-up. Maybe the info here, will help someone with new idea, or the maintainer. I hope so :)

tablatronix commented 7 years ago

85 means error if I remember correctly

bigjosh commented 7 years ago

I posted your code as a new branch on the repo here...

https://github.com/bigjosh/OneWireNoResistor/tree/ESP8266

Thanks!