This repository contains code that one can use to make a "virtual hamster journey".
The web application shows the shows the current location of your hamster and how far along their journey they are. The virtual route your hamster will travel is determined by the following file route.gpx, you can replace this file by any desired GPX file as long as it contains at least one (valid) track.
The microcontroller (and the code uploaded to it) allows for for measuring the amount of rotations your hamster makes. The microcontroller will communicate over MQTT to an given broker, the web application should be pointed towards the same broker as the microcontroller, such that events published by the microcontroller can be subscribed to by the web application.
- Node.js / npm
- Python / pip / rshell
- Docker (optional)
- MicroPython-able microcontroller (e.g. ESP32)
- digital Hall-effect sensor (e.g. A3144)
- temperature / humidity sensor (e.g. bme280)
- (self-adhesive neodymium) magnet
- MQTT broker (e.g. Eclipse Mosquitto)
cd ./web/frontend
npm install
npm run production
cp dist/* ../backend/public/
cd ../backend
npm install
export NODE_ENV=production
npm run start
For wiring see this Fritzing schematic.
cd ./esp32
rshell
connect serial /dev/tty/path/to/your/esp32
cp ./main.py /pyboard/
cp ./boot.py /pyboard/
cp ./bme280.py /pyboard/
repl
import upip
upip.install("micropython-umqtt.robust")
upip.install("micropython-umqtt.simple")
After following these instructions reboot your MicroPython-able microcontroller.
cd ./web
docker build -f Dockerfile.amd64 -t virtual-hamster-journey .
docker run -it -p 8080:8080 -v /path/to/where/you/want/your/database:/usr/src/app/res virtual-hamster-journey
docker-compose up
Pull requests and issues are welcome.