diff --git a/README.md b/README.md index b90f660e..742a1e9b 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,9 @@ A 3d-printable housing can be found here: - https://www.thingiverse.com/thing:5028229 (Power Meter) - https://www.thingiverse.com/thing:4571627 (ESP32-Cam housing only) +## Build it yourself +See [Build Instructions](code/README.md) + ## Donate If you would like to support the developer with a cup of coffee you can do that via [Paypal](https://www.paypal.com/donate?hosted_button_id=8TRSVYNYKDSWL). diff --git a/code/README.md b/code/README.md new file mode 100644 index 00000000..ef7cfae4 --- /dev/null +++ b/code/README.md @@ -0,0 +1,64 @@ +# Build + +## Preparations +``` +git clone https://github.com/jomjol/AI-on-the-edge-device.git +cd AI-on-the-edge-device +git checkout rolling +git submodule update --init +``` + + +## Build and Flash within terminal +### Compile +``` +cd code +platformio run --environment esp32cam +``` + +### Upload +``` +pio run --target upload +``` + +If it doesnt find the device: +1. make sure it is in bootloader mode +1. set the UART device correctly: In `platformio.ini`, set `upload_port` correctly, eg. `upload_port = /dev/ttyUSB0` + +### Monitor UART Log +``` +pio device monitor +``` + +## Build and Flash with Visual Code IDE + +- Download and install VS Code + - https://code.visualstudio.com/Download +- Install the VS Code platform io plugin + - + - Check for error messages, maybe you need to manually add some python libraries + - e.g. in my Ubuntu a python3-env was missing: `sudo apt-get install python3-venv` +- git clone this project + - in Linux: + + ``` + git clone https://github.com/jomjol/AI-on-the-edge-device.git + cd AI-on-the-edge-device + git checkout rolling + git submodule update --init + ``` + +- in VS code, open the `AI-on-the-edge-device/code` + - from terminal: `cd AI-on-the-edge-device/code && code .` +- open a pio terminal (click on the terminal sign in the bottom menu bar) +- make sure you are in the `code` directory +- To build, type `platformio run --environment esp32cam` + - or use the graphical interface: + + - the build artifacts are stored in `code/.pio/build/esp32cam/` +- Connect the device and type `pio device monitor`. There you will see your device and can copy the name to the next instruction +- Add `upload_port = you_device_port` to the `platformio.ini` file +- make sure an sd card with the contents of the `sd_card` folder is inserted and you have changed the wifi details +- `pio run --target erase` to erase the flash +- `pio run --target upload` this will upload the `bootloader.bin, partitions.bin,firmware.bin` from the `code/.pio/build/esp32cam/` folder. +- `pio device monitor` to observe the logs via uart