2

First question on this SE site so please be gentle.

Trying to get the above mentioned temp sensor working on the RPi but with a touch screen installed. When I run the following steps nothing starting with 28 appears.

sudo modprobe w1-gpio
sudo modprobe w1-therm
cd /sys/bus/w1/devices
ls
cd 28-xxxx (change this to match what serial number pops up)
cat w1_slave

I'm guessing this is because I have it plugged into pin 16. I have read that the single wire sensors I/O only works on pin 4 but you can change it as described on the RPI forum..

I tried this and when I run the instructions as per Adafruits nothing shows up. This is the temp sensor and this is the screen.

Any help would be very much received. This 'simple' project is turning out to be more difficult that I imagined. Thinking, I should have done it on a Arduino now :(

Regards

Chris

3

You should not be manually loading the w1-gpio and w1-therm modules.

You should now be using the device tree method of configuration.

Add the following to /boot/config.txt and reboot.

dtoverlay=w1-gpio,gpiopin=x

where x is the (Broadcom) GPIO number you want to use for the 1-wire bus.

For a description of the GPIOs and the numbering scheme see this Gadgetoid page.

  • Hi Joan, Thanks for this. It now appears to have loaded although I still needed to type the modprobe lines. Now I have three files including 00-80000000(lots) but I cannot see where I now read the temperature from because the adafruits tells me that w1_slave should provide a value? Can you help? Thanks – Davies-Barnard Nov 11 '15 at 18:27
  • Are you using Raspbian? Adafruit used to distribute an image called Occidentalis which should be avoided. – joan Nov 11 '15 at 18:33
  • Yes. I have noticed that these numbers/serials keep changing. – Davies-Barnard Nov 11 '15 at 18:50
  • Ignore me. I just found a better reference for the Broadcom Pin numbers vs other representations at pinout.xyz/pinout/pin36_gpio16. It seems to make more sense now. Could you edit your original answer to include the link I have provided so its clear to people how to find correct Broadcom Pin. Otherwise, huge thanks. Now for the python bit. – Davies-Barnard Nov 11 '15 at 18:55
  • The numbers should not change. That would suggest a poor, or loose, or incorrect connection. My /sys/bus/w1/devices/ shows two DS18B20 directories, 28-000005d34cd2, and 28-001414abbeff. Each has a w1_slave file. When I cat the file I get a temperature reading (among other information). You SHOULD NOT have needed to do the modprobe if device tree is properly enabled. What does uname -a report? – joan Nov 11 '15 at 18:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.