This repository contains all code that manages and interacts with the Raspberry Pi's of the ZotBins project. To view the webapp repository please visit: ZotBins Web App. For more information on ZotBins, please visit: ZotBins Landing Page
If you are using Windows and you do not have git, install [git bash] (https://gitforwindows.org/)
Open Git Bash and set up the global username and global email that is linked with your github account. If you don't want to type in your password all the time, include the third line of code as well.
git config --global user.name "John Doe"
git config --global user.email johndoe@example.com
git config --global credential.helper wincred
To view your configuration information: git config --global -l
Make sure all electronic components ( load cell + hx711, ultrasonic sensor + voltage converter ) are connected to the Raspberry Pi.
- Open Terminal (you can use the short-cut:
ctrl+alt+t
) git clone https://github.com/okyang/ZotBins_RaspPi.git
cd ZotBins_RaspPi
python3 ZBinClassDev.py
(please read user notes below)
If you are a public user, please change the last line of code in ZBinClassDev.py
from ZotBins(sendData=True)
to ZotBins(sendData=False)
then run ZBinClassDev.py
You also need to have the following files under the ZBinData:
- binData.json You can contact the Zotbins team for an example setup file or follow the data format Format:
{"bin": [{"binID": "<binID>", "tippersurl": "<apicall>"}, "<{error defaults}>"]}
- "bin" refers to the first set of rules needed to find the binID and api call
- "binID" refers to the raspberry pi ID. This is assigned through you or your organization
- "tippersurl" is the api call used to upload to the local server
If you have all the configuration files on the raspberry pi (not on this repository for security reasons) and wish to send data to the TIPPERS database, please run the program as is.
Everytime ZBinClassDev.py
is run, a log report is created, detailing bin startup and errors. It can be found in the /logs
of the ZotBins_RaspPi
folder
Optionally, you can add another file to configure error reports.
"errorData.json"
can be used to generate more detailed reports of your errors.
{"data": [{"binID": "<binID>", "tippersurl": "<api call>", "<flags>,"}],
"messages": [{"<error message id>": "<message>",}]}
"data"
refers to data needed to call the api"messages"
refers to the error codes used to debug.
Although you have to predict probable failures when writing more detailed errors, a default check using "ZBinError.py"
will log whenever a sensor has failed.
You can also access the Raspberry Pi remotely thru VNC viewer.
You can download VNC viewer Set up your VNC account (email and password) to set up your VNC network
Open the terminal (ctrl+alt+t
).
Install VNC by typing sudo apt install realvnc-vnc-server realvnc-vnc-viewer
.
On the desktop menu, navigate to Menu>Preferences>Raspberry Pi Configuration>Interfaces
.
Ensure VNC is enabled.
Find the network address by typing ifconfig
in the terminal under ipv4
.
Enter the address into VNC viewer.