Skip to content

Drive devices & sensors using raspberry pi in pure golang.

License

Notifications You must be signed in to change notification settings

wlzxzq/rpi-devices

 
 

Repository files navigation

rpi-devices

Build Status

rpi-devices let you drive the devices and sensors using a raspberry pi in pure golang. The following devices & sensors had been implemented in the current version, and I will keep implementing new devices and sensors.

Sensors Image Description Example App
Button Button module example vedio-monitor
Buzzer Buzzer module N/A car, door-dog
Collision Switch A switch for deteching collision example car
DHT11 Temperature & Humidity sensor example home-asst
DS18B20 Temperature sensor example auto-fan
Encoder Encoder sensor example car
GPS ) location sensor example gps-tracker
HC-SR04 ultrasonic distance meter example auto-light, doordog
Infrared Infrared sensor example N/A
L298N motor driver N/A car
Led Led light example car, vedio-monitor
Led Display led digital module example auto-air
Oled Oled display module example home-asst
PMS7003 Air quality sensor example auto-air
Relay Relay module example auto-fan
RX480E-4 Wireless remote control example remote-light
SG90 Servo motor example auto-air, car, vedio-monitor
Step Motor Step motor example N/A
SW-420 Shaking sensor example auto-air-out
US-100 ultrasonic distance meter example car
Voice Voice sensor N/A N/A
ZE08-CH2O CH2O sensor example ch2o-monitor

Compile & Deploy

It is very easy to cross-compile and deploy for golang. It is an example that compiles the binary for raspberry pi on MacOS.

$ CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -o app.pi main.go

If you aren't sure the cpu info of your raspberry pi, check it out by,

$ lscpu
# those are the cpu info of my raspberry pi 2.
# ------------------------------------------------------------
# Architecture:        armv6l
# Byte Order:          Little Endian
# CPU(s):              1
# On-line CPU(s) list: 0
# Thread(s) per core:  1
# Core(s) per socket:  1
# Socket(s):           1
# Vendor ID:           ARM
# Model:               7
# Model name:          ARM1176
# Stepping:            r0p7
# CPU max MHz:         700.0000
# CPU min MHz:         700.0000
# BogoMIPS:            697.95
# Flags:               half thumb fastmult vfp edsp java tls
# ------------------------------------------------------------

And then, deploy the binary to your raspberry pi by,

$ scp app.pi pi@192.168.31.57:/home/pi

192.168.31.57 is the ip address of my raspberry pi, you need to replace it with yours.

ssh to you raspberry pi, and run the binary.

$ ssh pi@192.168.31.57
$ ./devices.pi

# or, run it in background
$ nohub ./devices.pi > devices.pi 2>&1 &

App

About

Drive devices & sensors using raspberry pi in pure golang.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 76.4%
  • HTML 14.5%
  • Python 7.3%
  • Shell 1.8%