Industrial manufacturing
Industrial Internet of Things | Industrial materials | Equipment Maintenance and Repair | Industrial programming |
home  MfgRobots >> Industrial manufacturing >  >> Manufacturing Technology >> Manufacturing process

Build a Multi‑Sensor Temperature & Light Monitoring System with Raspberry Pi & DS18B20

Build a Multi‑Sensor Temperature & Light Monitoring System with Raspberry Pi & DS18B20

What You’ll Need

Understanding the DS18B20 and 1‑Wire Protocol

The DS18B20 is a highly reliable sensor that can share a single GPIO pin with multiple devices thanks to the 1‑Wire protocol. Each sensor carries its own unique address, so the Raspberry Pi can read each one independently.

Setting Up the Breadboard

Most breadboards have a pair of power rails—red for +3.3 V and blue for GND. These rails connect all attached wires on their respective sides, making it simple to add more components later.

The central section of the board consists of rows split into two halves by a vertical gap. Connecting a wire to one side of a row links it to all other pins on that side but not to the opposite half.

For the DS18B20, the pinout is:

Place a 4.7 kΩ resistor between Pin 2 and Pin 3 to provide the required pull‑up. Wire Pin 1 to the blue GND rail and Pin 3 to the red 3.3 V rail. Repeat the same setup for the second sensor.

Programming the Pi

Insert a Raspbian SD card, power on the Pi, and open a terminal. Log in with the default credentials (pi / raspberry) and run:

sudo python dstemp.py

The first execution loads the necessary drivers; subsequent runs display temperature readings from each sensor every few seconds.

Verifying Sensor Operation

Press Ctrl+C to exit.

Adding a Second Sensor

With the Pi powered down (sudo halt), insert the second DS18B20 into the breadboard, connect its pins as described, and power the Pi again. Running sudo python dstemp.py should now show readings from both devices.

Adding an LED Indicator

To light an LED when sensor 1 exceeds 25 °C, add the following components:

Modify your Python script to monitor sensor 1 and toggle GPIO 24 accordingly. Remember to keep the Pi powered off while wiring.

For more detail: Raspberry Pi Temperature and Light Sensor

Manufacturing process

  1. Build a Raspberry Pi Temperature Logger with a $5 I2C Sensor
  2. Connect Multiple DS18B20 1‑Wire Sensors to a Raspberry Pi for Accurate Temperature Monitoring
  3. Build a Remote Temperature Sensor with Raspberry Pi and Python – Step‑by‑Step Guide
  4. Seamless Temperature & Humidity Monitoring on Raspberry Pi with EzTemp
  5. How to Connect a DS1820 One‑Wire Temperature Sensor to a Raspberry Pi Using GPIO
  6. Raspberry Pi–Based Bathroom Occupancy Sensor with Voice & SMS Alerts via Twilio
  7. Mastering Raspberry Pi Sensor & Actuator Control: Accelerometer, Servo, and Data Streaming
  8. Build an Automated Aeroponics System with Raspberry Pi and Humidity Sensor
  9. Raspberry Pi Light Sensor Tutorial – Wire an LDR and Read Light Levels with Python
  10. Build a Raspberry Pi Home Temperature Monitor with MCP9808, InfluxDB & Grafana