Running a shape detection machine learning model using accelerometer data on the Raspberry Pi Pico W.
- Read accelerometer data
- Capture button presses
- Store accelerometer data on button press
- Make tflite-micro library interface
- Feed captured data into the model
- Display classification on LEDs
- Error Handling
For the pico-sdk, follow the guide in Raspberry Pi Pico C/C++ SDK for Windows and Debian-based1 systems. Since I use Arch, I followed this guide to install the sdk: Arch Linux guide
ensure that the PICO_SDK_PATH refers to the actual path of pico-sdk
echo $PICO_SDK_PATH
The pin numbers have been chosen according to the following wiring:
These pin numbers can be changed as per your layout:
pico-shape-detection/src/main.cpp
Lines 16 to 27 in c49df2e
In the repository directory, create a build directory, cd into it, run cmake and then make
mkdir build && cd build
cmake ../
make -j4
Before uploading the program to your Raspberry Pi Pico W, check for existing ACM terminals connected to the PC
ls /dev | grep ttyACM
Connect the cable connected to the Raspberry Pi Pico W while pressing the BOOTSEL
button and release once connected
Mount the RPI-RP2 and copy the compiled .uf2 file from the build directory to the Raspberry Pi Pico W
udisksctl mount -b /dev/disk/by-label/RPI-RP2
cp pico_acc.uf2 /run/media/<USER>/RPI-RP2/
Find the newly connected serial terminal
ls /dev | grep ttyACM
using minicom, connect to the serial terminal
sudo minicom -b 115200 -o -D /dev/ttyACMn