Raspberry Pi_Eng_25.8.2 Measuring Temperature with Digital Sensor DS18b20

25.8.2 Measuring Temperature with Digital Sensor DS18b20

25.8.2.1 Features of DS18B20 Sensor

There are many sensors to measure temperature on the market, but Raspberry Pi does not have an ADC (analog to digital converter), so analog temperature sensors like TMP36 can not be used directly.

Here we will measure temperature by connecting the digital sensor DS18B20 directly to Raspberry Pi.

Raspberry Pi_Eng_25.8.1 Sensor Overview

25.8 Sensor

25.8.1 Sensor Overview

A sensor is a device that grasps the state of an object around it and performs a function corresponding to a person’s sense. The sensor detects the condition of the object around it, detects the occurrence of the event, senses and measures the variation of the quantity, and delivers it by an electric signal or an optical signal. There are various kinds of sensors such as a light sensor, a temperature sensor, a gas sensor, a pressure sensor, and a magnetic sensor.

Raspberry Pi_Eng_25.7.2 Digital Input – Button Input

25.7.2 Digital Input – Button Input

Here we will show an example of connecting a button to Raspberry Pi, reading the pin’s input signal, and processing it to see if the button is pressed.

25.7.2.1 Input Method of library

There are falling method and interrupt method to process input using library. The following describes each of them.

Raspberry Pi_Eng_25.7.1 Digital Output – LED On/Off

25.7 Digital Input/Output

25.7.1 Digital Output – LED On/Off

Here we will try to implement an example of connecting a LED to Raspberry Pi and blinking the LED using a program.

25.7.1.1 Installing LED

When making the circuit, connect a LED, a resistor, and Raspberry Pi using a breadboard as shown below

Raspberry Pi_Eng_25.6.3 RPi.GPIO library

25.6.3 library

25.6.3.1 Overview of Library

This library provides a class module that allows you to manipulate the GPIO of Raspberry Pi in Python development language.

This library is not suitable for the applications that are in real-time or where time-synchronization is important. Because python can not predict when garbage collect will occur and it runs in a Linux kernel that is not suitable for real-time processing. This is that because Linux is a multitasking O/S, other processors may have a higher priority than the GPIO processing program for the CPU and in that case the GPIO processing program may be confused.

Raspberry Pi_Eng_25.6.2 WiringPi library

25.6.2 library

25.6.2.1 Overview of Library

library is a GPIO tool developed by Gordon Henderson. This is a GPIO processing library developed in C language for use with the BCM2835 used in Raspberry Pi and is distributed under the terms of the GNU LGPLv3 license. This library was originally developed to make it easier for users familiar with Arduino’s “wiring” system to easily use Raspberry Pi.

Raspberry Pi_Eng_25.6.1 Meaning of GPIO Library

25.6 GPIO Library

25.6.1 Meaning of GPIO Library

To use GPIO in a program in Raspberry Pi requires not only a deep understanding of the hardware, but also an expert level of low-level programming knowledge required to manipulate the hardware. The software module that experts have already developed in advance to make it easy for ordinary users to use GPIO functions without experiencing these difficulties is called library. A library means a set of modules made by developing programs to provide various functions that are commonly used and integrating them into a package in the manner that other programs can easily take out and use them.

Raspberry Pi_Eng_25.5.7 Sensor

25.5.7 Sensor

A sensor is a device that grasps the state of an object around it and performs a function corresponding to a person’s sense. The sensor detects the condition of an object around it, detects the occurrence of an event, senses and measures a variation of quantity, and delivers it with an electric signal or optical signal. There are various kinds of sensors such as a light sensor, a temperature sensor, a gas sensor, a pressure sensor, and a magnetic sensor. There are also passive sensors (camera, MSS, TM, HRV) that passively accept the ambient conditions according to the way they operate, and active sensors (Radar, Laser) that send electromagnetic waves and receive it again.

Raspberry Pi_Eng_25.5.6 LED Light

25.5.6 LED Light

LED (Light-emitting diode) is widely used as a oupput device for determining whether electricity flows through a specific line when constructing an electronic circuit. LED lights up when the voltage is applied, so it can indicate whether the specific GPIO port of the Raspberry Pi is high or low, and can determine if electricity flows on a certain line of the circuit. The GPIO port of Raspberry PI does not provide high power enough to drive high-brightness LED, so buy low-power LED (typical LED) when purchasing LED.

Raspberry Pi_Eng_25.5.5 Push Button

25.5.5 Push Button

There are many types of buttons used in electronic circuits. Among them, Push-Button is a very simple input device. Pressing the button will connect the circuit, and if the switch is released, the connection is cut off immediately, so it is also called a momentary contact switch.