Lateralus API
This is a sensor, servo and camera api for some raspberry pi hardware. Use the pushit daemon to scrape data and push them to the schism API.
Chechout the repository via git clone && cd lateralus
.
Config is done via .envrc
, you need to install direnv on your dev machine and on the raspberry.
To install dependencies run go mod download
.
To easily build the binary and run it on a raspberry you can use bob
- install it via go get gitlab.void-ptr.org/go/bob
.
Install
Raspberry Pi Zero
1. Install golang
# Create go install script
tee ~/go-install.sh <<-'EOF'
#!/bin/bash
export GOLANG="$(curl https://golang.org/dl/|grep armv6l|grep -v beta|head -1|awk -F\> {'print $3'}|awk -F\< {'print $1'})"
wget https://golang.org/dl/$GOLANG
sudo tar -C /usr/local -xzf $GOLANG
rm $GOLANG
unset GOLANG
EOF
chmod +x ~/go-install.sh
~/go-install.sh
rm -f go-install.sh
echo "export PATH=$PATH:/usr/local/go/bin" >> "~/.bashrc"
2. Build and copy from dev machine
Install direnv (sudo apt install direnv
)
# setup your local dev repo
git clone ssh://git@gitlab.void-ptr.org:2222/go/lateralus.git
cd lateralus
go mod download
# install bob
go install gitlab.void-ptr.org/go/bob
# do your modifications
git push
# Build and copy
bob build
bob copy
3. Install on raspberry
Install direnv (sudo apt install direnv
)
# Create go module folder and go into it
mkdir -p ~/go/src/gitlab.void-ptr.org/go
cd ~/go/src/gitlab.void-ptr.org/go
# Clone into ~/go/src/gitlab.void-ptr.org/go/lateralus
git clone ssh://git@gitlab.void-ptr.org:2222/go/lateralus.git
cd lateralus
direnv allow .
# install bob
go get gitlab.void-ptr.org/go/bob
# create lateralus config
cp .sample.lateralus.yaml .lateralus.yaml
# run lat-build and lat-copy on your remote machine
bob init
Hardware
RaspiCam
See camera/raspicam.go
Routes:
- POST
/camera/still
- GET
/camera/still/{id}
- DELETE
/camera/still/{id}
BME280
See sensors/bme280.go
Routes:
SI1145
See sensors/si1145.go
Routes:
NU40C16
See sensors/nu40c16.go
Routes:
SoilMoisture
See sensors/soilMoisture.go
Routes:
AirQuality
See sensors/airQuality.go
Routes:
Servos
See servos/basic.go
Routes:
Build
GOPROXY=proxy.golang.org go list -m gitlab.void-ptr.org/go/lateralus@v0.1.0