-->
Page 1 of 2

NodeMCU Only pin D4 working with onewire ds18b20

PostPosted: Sun May 28, 2017 4:06 pm
by jamief
I've got a V1 NODEMCU it says Amica on the bottom. I've made a simple script in arduino ide to read the temperatures from a one-wire ds18b20 using D4 as the sensor pin works just fine. I can also use 2 as the sensor pin as D4 is just a mapping of gpio pin 2. The issue is if I try any other pin. Specifically D2 is the one I'm wanting to make work. If I do that using D2 or 4 for the pin the script just acts like it's got nothing attached. THis happens for every pin except D4.

Tutorials online show D2 as being perfectly fine with nothing special in the code for this purpose. THere is nothing special to the wiring switching from D4 to D2. I'm thinking this is either a dead/dying board or a firmware issue.

Does anyone have any suggestions? Can anyone point me to where to flash the nodemcu back to stock in the even that I somehow screwed that up? I found the cloud flash builder but I'm not sure what all needs included to flash it to it's original state.

Thanks

Re: NodeMCU Only pin D4 working with onewire ds18b20

PostPosted: Sun May 28, 2017 7:23 pm
by jamief
I made a breakthrough. It has something to do with the version of the oneWire library. 2.3.3, 2.3.2 and 2.3.1 all don't work but 2.3.0 works just fine. The onewire library code is beyond my quick glance abilities so I've filed a bug report.

Re: NodeMCU Only pin D4 working with onewire ds18b20

PostPosted: Mon May 29, 2017 2:08 am
by schufti
maybe you forgot to add pullup?
gpio0/2 usually have pullups (AFAIK even internal ones are active)
gpio4/5 don't usually have pullups and interal ones are not activated/existing.

Re: NodeMCU Only pin D4 working with onewire ds18b20

PostPosted: Mon May 29, 2017 9:12 am
by jamief
It shouldn't be a hardware issue ie missing pullups if it works with the older version of the library but doesn't with newer.