Lastleaf for raspberry pi is a background unix service (process) for reporting emergency situation inside a vechile. The service resides inside the Lastleaf IOT hardware setup. The service is written in Python and Go.
- Configure a
Firebaseproject withGoogle Cloud Functionsusing this repository. - Set up a Go project and copy
ibeacon.goandmain.goto yourgoproject directory. - Download
goresources for the project using :go get github.com/paypal/gatt. Yes, you only need this one 😊.
git clonethe repository.- In your
goproject directory, execute:env GOOS=linux GOARCH=arm GOARM=5 go build - Copy the binary executable to your raspberry pi, probably using
ssh:scp ./name-of-binary-file pi@raspberrypi.local:~/ - Rename the fragment to your executable at line 34 of
Majimak.py:subprocess.call([ "sudo","./your_lastleaf" ]) - Plug in a bluetooth device if your raspberry pi doesn't have one. For
raspberry pi zero W, there is no such requirement. - Run the go executable in
sudomode to check if everything's okay.
Hurray! You are halfway already 🎉.
- Head over here to create your Soracom Account. For international, head here.
- Register your SIM card and record your
API_KEYandAPI_TOKEN. - Plug the
SoracomSIM card to your mobile phone.
-
Give your device a specific
CONST_DEVICE_IDas constant. -
Plug in your API_KEY and API_TOKEN in the program.
-
Plug in your
HC-SR04sensor with the raspberry pi GPIO pins as declared inMajimak.pyor customize them. -
Copy the
Lastleaf.servicefile into your directory. -
Now, run the following commands inside your raspberry pi shell:
sudo cp Lastleaf.service /lib/systemd/system sudo chmod 644 /lib/systemd/system/Lastleaf.service sudo systemctl daemon-reload sudo systemctl enable Lastleaf.service -
Now,
sudo rebootyour raspberry pi. -
Perform
sudo systemctl status Lastleaf.serviceto check if the service is running ! -
Now, head here to the Android client application to get instructions on deploying the complementary beacon generator for the raspberry pi.
You're done ! ✔