read

I recently got hold of a Raspberry Pi along with a starter kit. My starter kit came with a couple of sensors and components.

The temperature sensor is the DS18B20

DS18B20

Getting this up and running was pretty straightforward following various instructions on the internet - the most useful being the one from Adafruit

My sensor already comes with a resistor on it’s circuit board so the wiring was just a case of plugging the red wire to the 3.3v supply, the black wire to ground, and the white wire to Pin 7 on my breakout board.

wiring disagram

To load up support for the device follow these steps:

sudo modprobe w1-gpio
sudo modprobe w1-therm
cd /sys/bus/w1/devices
ls
28-0000057cc14e  w1_bus_master1
cd 28-0000057cc14e
cat w1_slave
68 01 4b 46 7f ff 08 10 05 : crc=05 YES
68 01 4b 46 7f ff 08 10 05 t=22500

The second line of text is the temperature.

If you want to change the pin that w1 devices can connect to then you need to edit /boot/cmdline.txt and add this parameter:

bcm2708.w1_gpio_pin=<GPIO_pin_number> (for examplebcm2708.w1_gpio_pin=17).
Blog Logo

Chris Greening


Published

Image

atomic14

A collection of slightly mad projects, instructive/educational videos, and generally interesting stuff. Building projects around the Arduino and ESP32 platforms - we'll be exploring AI, Computer Vision, Audio, 3D Printing - it may get a bit eclectic...

View All Posts