Post about your Basic project here

Moderator: Mmiscool

User avatar
By heckler
#34713 After hooking up a ds18b20 to my little ESP-01... I find that the "temp" command is only useful if the sensor is connected to Pin 5, which the esp-01 module does not have :(
Would it (Please, Please) be possible to allow the "temp" command work with either of the two inputs on the esp-01??
I have several of these esp-01 modules and really wanted to use them to read temperature.

If possible PLEASE make these BASIC commands work with the ESP-01 modules as they are very popular and are the smallest for distributed IOT type functionality, and the cheapest $$.

I have been able to read temperature using LUA and nodemcu

Code: Select all 
 function getTemp()

            data = nil
            data = string.char(
            data = data .. string.char(
            t = (data:byte(1) + data:byte(2) * 256)
            if (t > 32768) then
                t = (bxor(t, 0xffff)) + 1
                t = (-1) * t
            t = t * 625
            ctemp = t
            ftemp = (t * 9)/ 5 + 320000
            print("F: " .. ftemp)

User avatar
By Mmiscool
#34718 Unfortunately i2c is already mapped to those pins. An esp-12 can be purchased for less than $2 these days. ... eb201560_9 ... SwniRWNxYt
User avatar
By heckler
#34729 hey mmiscool,

thanks for the quick reply.

So, if possible, could I ask a few more questions?

> What is the limitation with the -01 module?
I have seen several examples with the arduino ide being able to make the -01 module work with an ds18b20.

>Could the BASIC OS be modified before compiling to allow the -01 module to communicate with the temp sensor on either GPIO2 or GPIO0??

I know the other -12 modules are relatively cheap but the little -01 module is so small and PERFECT for small IOT sensors that it really seems a shame to not be able to use this great BASIC code with it.

Would it be possible for the "temp" command to include a parameter to choose the pin to communicate with the ds18b20??

I know your developing fast and furious but if this is possible then could it make it on to a wish list??

thanks for considering
User avatar
By martinayotte
#34730 You can take Micheal's source and tweak it to your needs, or you can change the DS18B20 to some I2C sensors, such as LM75.