Skip to content

Running a shape detection machine learning model using accelerometer data on the Raspberry Pi Pico W

License

Notifications You must be signed in to change notification settings

risb21/pico-shape-detection

Repository files navigation

pico-shape-detection

Running a shape detection machine learning model using accelerometer data on the Raspberry Pi Pico W.


Checklist of implementation

  • 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

Running the project

Prequisites:

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:

Wiring for the Raspberry Pi Pico

These pin numbers can be changed as per your layout:

enum Pin {
// buttons
b_send = 13u,
b_record,
// I2C pins
mpu_sda = 16u,
mpu_scl,
// LEDs
};

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/

Reading output from serial port

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

About

Running a shape detection machine learning model using accelerometer data on the Raspberry Pi Pico W

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published