All Projects → yryz → ds18b20

yryz / ds18b20

Licence: Apache-2.0 license
Golang get temperature from ds18b20 sensor connected to a Raspberry PI (GPIO w1 pin).

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to ds18b20

esp32-ds18b20
ESP32-compatible C library for Maxim Integrated DS18B20 Programmable Resolution 1-Wire Digital Thermometer.
Stars: ✭ 61 (-1.61%)
Mutual labels:  ds18b20, temperature-sensor
avr-ds18b20
AVR library for controlling DS18B20 temperature sensors
Stars: ✭ 52 (-16.13%)
Mutual labels:  ds18b20, temperature-sensor
WeatherPi TFT
a weather display for a raspberry pi and a TFT display written in python3 and pygame
Stars: ✭ 66 (+6.45%)
Mutual labels:  raspberry
raspberry-pi-kiosk
A simple set of commands to set up a raspberry pi for use as a stand alone kiosk screen
Stars: ✭ 45 (-27.42%)
Mutual labels:  raspberry
Env-KB
A custom mechanical keyboard inspired by the CFTKB Mysterium utilizing the Raspberry Pi Pico
Stars: ✭ 203 (+227.42%)
Mutual labels:  raspberry
lcds
Light Centralized Digital Signage
Stars: ✭ 17 (-72.58%)
Mutual labels:  raspberry
cloud4rpi
Cloud4RPi Client Library
Stars: ✭ 21 (-66.13%)
Mutual labels:  raspberry
anyfesto
Low cost Raspberry Pi /Linux based access point with audio, education and communications local content server. Inspired by the ideas of sharing with others. Anyfesto - a platform from which to speak.
Stars: ✭ 66 (+6.45%)
Mutual labels:  raspberry
Three-Factor-Security-Door
What do you get when you mix a Raspberry Pi, a MySQL database, an RFID reader, an LCD touchscreen, a relay switch, an electronic door strike and a Twilio SMS account?
Stars: ✭ 49 (-20.97%)
Mutual labels:  raspberry
pi-explorer
Web File Explorer UI for linux server
Stars: ✭ 13 (-79.03%)
Mutual labels:  raspberry
iot-security-vulnerability
Raspberry PI Vulnerability Study using Flask, PWA VueJS 2, Requests, Vue-Socket.io and Flask SocketIO
Stars: ✭ 24 (-61.29%)
Mutual labels:  raspberry
FaceGuard
Face Guard: Machine Learning + IoT Surveillance demo! Face recognition
Stars: ✭ 13 (-79.03%)
Mutual labels:  raspberry
SONOFF-BASIC-firmware
Sonoff Basic firmware; config by browser, OTA, MQTT, DS18B20
Stars: ✭ 19 (-69.35%)
Mutual labels:  ds18b20
SolPipLog
Logger for the PIP Inverter series ( USB / RS232 version )
Stars: ✭ 72 (+16.13%)
Mutual labels:  raspberry
Python-NEO-6M-GPS-Raspberry-Pi
Python script for the NEO-6M GPS module on the Raspberry Pi
Stars: ✭ 41 (-33.87%)
Mutual labels:  raspberry
yamete
Yamete - Hentai downloader in PHP CLI - Easy site downloader PHP system
Stars: ✭ 63 (+1.61%)
Mutual labels:  raspberry
RaspAC
Web-enabled AC remote
Stars: ✭ 28 (-54.84%)
Mutual labels:  temperature-sensor
ControlBlockService2
This is the driver for the ControlBlock re.v 2.X, a power switch and input/output/gameapd gadget for the Raspberry Pi
Stars: ✭ 18 (-70.97%)
Mutual labels:  raspberry
Selfhosted-Google-Photos-Alternative
A complete guide on exiting Google, Amazon or any proprietary service Photos storage with all the features you would want.
Stars: ✭ 143 (+130.65%)
Mutual labels:  raspberry
rpi-backup
raspberry pi backup,树莓派系统备份,最小镜像备份
Stars: ✭ 213 (+243.55%)
Mutual labels:  raspberry

ds18b20

Get sensor data from ds18b20 connected to the Raspberry (GPIO w1 pin).

Usage

Connect DS18B20

On the Raspberry Pi, you will need to add dtoverlay=w1-gpio" (for regular connection) or dtoverlay=w1-gpio,pullup="y" (for parasitic connection) to your /boot/config.txt. The default data pin is GPIO4 (RaspPi connector pin 7), but that can be changed from 4 to x with dtoverlay=w1-gpio,gpiopin=x.

Here's what I did:

sudo echo dtoverlay=w1-gpio-pullup,gpiopin=4 >> /boot/config.txt
sudo modprobe w1_gpio && sudo modprobe w1_therm

Drivers

1-Wire drivers need to be loaded in order to create the connection between the physical sensor and the rPI. You can load them from the terminal (or from the bin/modules.sh script).

sudo modprobe wire
sudo modprobe w1-gpio
sudo modprobe w1-therm

Install

go get github.com/yryz/ds18b20

Code

package main

import (
    "fmt"

    "github.com/yryz/ds18b20"
)

func main() {
    sensors, err := ds18b20.Sensors()
    if err != nil {
        panic(err)
    }

    fmt.Printf("sensor IDs: %v\n", sensors)

    for _, sensor := range sensors {
        t, err := ds18b20.Temperature(sensor)
        if err == nil {
            fmt.Printf("sensor: %s temperature: %.2f°C\n", sensor, t)
        }
    }
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].