Connectting digital input - sensor DS18B20
The Raspberry Pi has digital pins, so in this section, we will look at how to connect a digital sensor to the board. We will use the digital sensor DS18B20, which has a digital output and can be perfectly connected to a digital input in our Raspberry Pi sensor. The main idea is to take temperature readings from the sensor and display them on the screen.
Hardware requirements
We will require the following hardware to take the temperature reading:
- Temperature sensor DS18B20 (waterproof)
- One resistor of 4.7 kilo-ohms
- Some jumper wires
- A breadboard
We will use a waterproof sensor DS18B20 and a 4.7 kilo-ohm resistor:

You have been reading a chapter from
Internet of Things Programming with JavaScript
Published in:
Feb 2017
Publisher:
Packt
ISBN-13:
9781785888564
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime