by ikke4 » Mon Oct 03, 2016 12:14 pm
hi,
i love the work you've been doing on this scratch project!
i'm trying to get the DS18B20 to work in scratch, 1-wire support is enabled and the DS18B20 is working (w1_slave file gives me a temperature reading) but i don't get a temperature variable in sensor value. i used both 'gettemp' and 'gettemp 000802de3b13'
do i have to config gpio4 before have a reading? (if gpio4 is the correct pin?)
script gpio-DS18B20temperaturegraph isn't worken because my (working) DS18B20 isn't reconized by scratch
gettemp cpu works great,
please help!
-
- Posts: 1365
- Joined: Mon Oct 29, 2012 8:12 pm
- Location: Vancouver Island
- Contact: Website
Re: DS18B20 temperature readings
This is a bit odd. If you're getting a proper value in the w1_slave file you pretty much must have set things up properly.
Does it seem to work if you use a demo program like the one on https://learn.adafruit.com/adafruits-ra ... g/software ? That's what I used to work out the Scratch support code.
On my Wombat-Pi ( a nice Wombat breadboard in a small toolbox with the Pi safely stowed below) with all my test sensors it works just fine.
A really simple test is
then check the 'sensor value' block menu for the 'temp'+long number
Does it seem to work if you use a demo program like the one on https://learn.adafruit.com/adafruits-ra ... g/software ? That's what I used to work out the Scratch support code.
On my Wombat-Pi ( a nice Wombat breadboard in a small toolbox with the Pi safely stowed below) with all my test sensors it works just fine.
A really simple test is
Code: Select all
when flag clicked
broadcast gettemp
Making Smalltalk on ARM since 1986; making your Scratch better since 2012
Re: DS18B20 temperature readings
hi Tim,
still struggling with the DS18B20, the sensor works with python and from the console but still no sensor value block in scratch.
are there others out there who get this thing to work (or have the same problem as i have!)
the DS18B20 is connected directly to the gpio and i used a correct resistor. latest version of rasbian tested on two Rpi's one updated and one with completely new download.
jochem
still struggling with the DS18B20, the sensor works with python and from the console but still no sensor value block in scratch.
are there others out there who get this thing to work (or have the same problem as i have!)
the DS18B20 is connected directly to the gpio and i used a correct resistor. latest version of rasbian tested on two Rpi's one updated and one with completely new download.
jochem
Re: DS18B20 temperature readings
timrowledge wrote:
Does it seem to work if you use a demo program like the one on https://learn.adafruit.com/adafruits-ra ... g/software ? That's what I used to work out the Scratch support code.
at first the python script didn't work and i searched for other python script... but now i know what the problem was/is:
in the script there is the line: device_folder = glob.glob(base_dir + '28*')[0]
but mine DS18B20 (from Dallas) folder starts with a '10'
so i changed it to: device_folder = glob.glob(base_dir + '10*')[0]
and the whole ** thing starts to work...

so i think that this will also be the case in your Scratch code....
the question is.... can this be changed in the next version
Re: DS18B20 temperature readings
There is something different about your DS18B20 then. All normal DS18B20's use 28 as the prefix.ikke4 wrote:but mine DS18B20 (from Dallas) folder starts with a '10'
The older DS1820 and DS18S20 use 10 as the prefix, and only support 9 bit resolution instead of the 12 bits that the "B" supports.
See here for differences https://www.maximintegrated.com/en/app- ... vp/id/4377
The bit about using 10 or 28 is just after "Table 4. Scratchpad Memory Map Comparison"
Re: DS18B20 temperature readings
thank you....
i looked twice at my DS18(B)20 and it is a DS1820..... but sold at me as a B version.....
so this was my storm in a glass of water......
okay guys, back to work! nothing to see here
i looked twice at my DS18(B)20 and it is a DS1820..... but sold at me as a B version.....
so this was my storm in a glass of water......
okay guys, back to work! nothing to see here
