Onewire and DS18B20
Re: Onewire and DS18B20
It's '\x00' followed by the letter '4', 9 bytes in total.
If a byte contains a printable character, it's printed as such, and not the hex code.
If a byte contains a printable character, it's printed as such, and not the hex code.
Re: Onewire and DS18B20
I was not aware of that (so simple ) , maybe I just could have counted the bytes and
notice that one is missing.
Many thanks for your comment.
notice that one is missing.
Many thanks for your comment.
-
- Posts: 19
- Joined: Thu Jun 25, 2015 1:04 am
Re: Onewire and DS18B20 instal on pyboard ver1
Anyone here willing to help me install the drivers for the ds18b20 ?
Yes, i have looked at several sources - at least one of which is touted as simple.
Well, not to me, they are not. I am a complete noob and the only reason i
have got the pyboard running is because it came pre loaded ( Big shout out to
Damien and Co.) I have purchased 8266 and Teensy boards also, but have
given up on them - temporarily, i hope.
I have the pyboard ver.1 and have been able to get a simple resistor / thermistor
string sensing temperature and controlling a GPIO pin. If push comes to shove,
i suppose even this simple arrangement will serve in my application
I have just received some ds18b20 chips and want to get working.
I just do not have the background knowledge to use the information i have found
here to install the drivers
Yes, i have looked at several sources - at least one of which is touted as simple.
Well, not to me, they are not. I am a complete noob and the only reason i
have got the pyboard running is because it came pre loaded ( Big shout out to
Damien and Co.) I have purchased 8266 and Teensy boards also, but have
given up on them - temporarily, i hope.
I have the pyboard ver.1 and have been able to get a simple resistor / thermistor
string sensing temperature and controlling a GPIO pin. If push comes to shove,
i suppose even this simple arrangement will serve in my application
I have just received some ds18b20 chips and want to get working.
I just do not have the background knowledge to use the information i have found
here to install the drivers
Re: Onewire and DS18B20 instal on pyboard ver1
[quote="Ridley Walker"]Anyone here willing to help me install the drivers for the ds18b20 ?[/quote]
It's perhaps and old message but while there was no answer...
It's pretty simple, you just have to follow the documentation to : first, upgrade the WiPy firmware, then connect the FTP space of the WiPy to put the driver in the FTP diretory flash/lib.
Then from the console you will be able to import it.
It's perhaps and old message but while there was no answer...
It's pretty simple, you just have to follow the documentation to : first, upgrade the WiPy firmware, then connect the FTP space of the WiPy to put the driver in the FTP diretory flash/lib.
Then from the console you will be able to import it.
Re: Onewire and DS18B20
Hill all,
I can't manage to make it work.
I use the latest firmware on a WiPy 1.3, the onewire lib is installed and can import it, I have a waterproof DS18B20 sensor.
The data cable is connected on the GP2 and there is a 4K7 pull up between the cable of the sensor and GP2.
I tried to connect the sensor both on GP1 and GP3 (ground and VCC) or GND and 3V3.
Like :
sensor data > 4K7 > GP2
sensor GND > GP1
Sensor + > GP3
and
sensor data > 4K7 > GP2
sensor GND > GND
Sensor + > 3V3
No device and no temperature.
Does someone could send a pic of a working connexion please ?
My sensor is working, I can read temperatures with an Arduino micro-controler.
Thanks for any help.
I can't manage to make it work.
I use the latest firmware on a WiPy 1.3, the onewire lib is installed and can import it, I have a waterproof DS18B20 sensor.
The data cable is connected on the GP2 and there is a 4K7 pull up between the cable of the sensor and GP2.
I tried to connect the sensor both on GP1 and GP3 (ground and VCC) or GND and 3V3.
Like :
sensor data > 4K7 > GP2
sensor GND > GP1
Sensor + > GP3
and
sensor data > 4K7 > GP2
sensor GND > GND
Sensor + > 3V3
No device and no temperature.
Does someone could send a pic of a working connexion please ?
My sensor is working, I can read temperatures with an Arduino micro-controler.
Thanks for any help.
Re: Onewire and DS18B20
Hello!
I use probably the same waterproof DS18B20 as you do and it works without any problems on my Wipy. I have even tried connecting two sensors at once.
Wipy Sensor
3V3 -> red (VCC)
G10 -> yellow (DATA)
GND -> black (GND)
Pull-up resistor 4k7 is connected between VCC and DATA.
Hope this helps.
Michal
I use probably the same waterproof DS18B20 as you do and it works without any problems on my Wipy. I have even tried connecting two sensors at once.
Wipy Sensor
3V3 -> red (VCC)
G10 -> yellow (DATA)
GND -> black (GND)
Pull-up resistor 4k7 is connected between VCC and DATA.
Code: Select all
import onewire
from machine import Pin
ds = onewire.DS18X20(onewire.OneWire(Pin('GP10')))
print('devices:', ds.roms)
print('temperatures:', ds.read_temps())
Michal
Re: Onewire and DS18B20
Another tip for Brunus - use Robert's firmware with disabled multithreading:
https://github.com/robert-hh/Shared-Stu ... mcuimg.bin
Otherwise it won't work (testing with stock firmwares 1.8.4 and 1.8.5 fails for me).
Michal
https://github.com/robert-hh/Shared-Stu ... mcuimg.bin
Otherwise it won't work (testing with stock firmwares 1.8.4 and 1.8.5 fails for me).
Michal
Re: Onewire and DS18B20
It works ! \o/Miguel wrote:Another tip for Brunus - use Robert's firmware with disabled multithreading:
https://github.com/robert-hh/Shared-Stu ... mcuimg.bin
Otherwise it won't work (testing with stock firmwares 1.8.4 and 1.8.5 fails for me).
Michal
Thank you so much Miguel !
Sincerely, Brunus
Re: Onewire and DS18B20
Hi all,
I have a coding problem while playing with the DS18B20.
I want to activate/deactivate a relay if temperature is above or under 30°C.
I have two version of the code opening or closing a relay while reading the temperature, both versions are starting with :
Then I need a loop...
This code works, but it's not what I wanna do :
This code should works but it never enter in the 2nd condition.
When I add the test on the temperature in the 2nd condition, the programme ignore this condition.
There is no error casted by this code above but it's not working, it's printing the good values for temp., but it never enter the 2nd condition and I can't figure out why.
If someone see what I did wrong, it would help me a lot.
Thanks for any answer.
I have a coding problem while playing with the DS18B20.
I want to activate/deactivate a relay if temperature is above or under 30°C.
I have two version of the code opening or closing a relay while reading the temperature, both versions are starting with :
Code: Select all
import time
import onewire
from machine import Pin
ds = onewire.DS18X20(onewire.OneWire(Pin('GP10')))
print('devices:', ds.roms)
print('temperatures:', ds.read_temps())
relay = Pin('GP5', Pin.OUT, Pin.PULL_UP)
This code works, but it's not what I wanna do :
Code: Select all
while(True):
temp = ds.read_temps()
print (temp[0])
if temp[0] > 3000 and relay.value() is 0:
print('relay up')
relay.toggle()
// I do this only to test this version of this code, I don't need it if the code is working like I want
time.sleep(5)
if relay.value() is 1:
print('relay down')
relay.toggle()
time.sleep(2)
When I add the test on the temperature in the 2nd condition, the programme ignore this condition.
Code: Select all
while(True):
temp = ds.read_temps()
print (temp[0])
if temp[0] > 3000 and relay.value() is 0:
print('relay up')
relay.toggle()
if temp[0] < 3000 and relay.value() is 1:
print('relay down')
relay.toggle()
time.sleep(2)
If someone see what I did wrong, it would help me a lot.
Thanks for any answer.
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: Onewire and DS18B20
If you look at the docs http://docs.micropython.org/en/latest/w ... e.Pin.html for the WiPy you will see that the return value of Pin.value() is undefined for output pins. You should therefore write something like:
Code: Select all
value = False
relay.value(value)
while(True):
temp = ds.read_temps()
print (temp[0])
if temp[0] > 3000 and not value:
print('relay up')
value = True
relay.value(value)
if temp[0] < 3000 and value:
print('relay down')
value = False
relay.value(value)
time.sleep(2)
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.