Skip to content

Drive devices & sensors using raspberry pi in pure golang.

License

Notifications You must be signed in to change notification settings

JakeFAU/rpi-devices

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

321 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rpi-devices

Build Status

rpi-devices implements the drivers of devices or sensors for raspberry pi in pure golang. The drivers for the sensors below have been implemented, and I will keep developing for new sensors.

Sensors Image Description Example App
ADS1015 Analog-to-digital converter N/A joystick
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
GY-25 angle sensor example car
HC-SR04 ultrasonic distance meter example auto-light, doordog
Infrared Infrared sensor example N/A
Joystick XY Dual Axis Joystick example car
L298N motor driver N/A car
LC12S 2.4g wireless module example car
Led Led light example car, vedio-monitor
Led Display led digital module example auto-air
MPU6050 6-axis motion sensor example N/A
Oled Oled display module example home-asst
PCF8591 Analog-to-digital converter N/A N/A
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 test 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 test 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.

# from /home/pi
$ ssh pi@192.168.31.57
$ ./test

# or, run it in background
$ nohub ./test > test.log 2>&1 &

App

Using the driver programs, I built several applications. The most complex and interesting project is the self-driving car, more than 10 sensers were used to build the smart car. I highlight few interesting apps here, please go to app for all apps I development. You can learn how to use the driver programs from my apps.

play the video on youtube.

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 82.0%
  • HTML 10.6%
  • Python 6.1%
  • Shell 1.3%