Book Image

Internet of Things Programming with JavaScript

Book Image

Internet of Things Programming with JavaScript

Overview of this book

The Internet of Things is taking the tech world by storm, and JavaScript is at its helm. This book will get you to grips with this exciting new technology. Where do Node.js, HTML5 and Windows 10 IoT Core come in with JavaScript and IoT? Why Raspberry Pi Zero rather than Arduino? How do you configure and build an IoT network from scratch? All your IoT JavaScript questions are answered in this book.
Table of Contents (15 chapters)
Internet of Things Programming with JavaScript
Credits
About the Author
www.packtpub.com
Customer Feedback
Preface

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:

This is the waterproof sensor that we are using in this project.

Hardware connections

The following diagram shows the circuit on the breadboard, with the sensor and the resistor:

In the following image, we can see the circuit with the sensor: