A Smart Espresso Scale, powered by the Raspberry Pi Pico W board.
- Raspberry Pi Pico W board
- I2C 1602 LCD Display Module 16X2
- SparkFun Qwiic Scale - NAU7802
- arduino lib TODO: add the rest
- install VS Code
- make sure the Arduino and z-uno extensions are not installed or at least, disabled if installed
- install the PlatformIO extension
- on Chromebook
sudo apt-get install python3-venv
- restart VSCode
- warning: it may take up to 10 minutes to finish the installation and all the pio commands to become available
- on Chromebook
- install the teleplot extension
- install 99-platformio-udev.rules
curl -fsSL https://raw.githubusercontent.com/platformio/platformio-core/develop/platformio/assets/system/99-platformio-udev.rules | sudo tee /etc/udev/rules.d/99-platformio-udev.rules
- on Fedora
sudo udevadm control --reload-rules && sudo udevadm trigger
- on Chromebook
sudo service udev restart
- on Fedora/Chromebook
sudo usermod -a -G dialout $USER
sudo usermod -a -G plugdev $USER
- logout / login to O/S
- physically unplug and reconnect your board
- on Chromebook
- select connect to Linux on chromebook
- it should appear as PicoArduino in the Manage USB devices
- then, serial monitor can connect
- on Chromebook
- to initialize the project
pio project init
- should give
Project has been successfully updated!
- select the active project environment
>PlatformIO: Switch Project Environment
or from the bottom left corner of the IDE- select USB (for first upload) or OTA (for subsequent ones but change the
auth
insideplatformio.ini
file)
- to build
>PlatformIO: Build
orpio run
or from the bottom left corner of the IDE- should result in
[SUCCESS]
- to monitor the serial port for debugging
>PlatformIO: Serial Monitor
or from the bottom left corner of the IDE- should open up a new Terminal with the serial monitor
- to upload
>PlatformIO: Upload
or from the bottom left corner of the IDE- should show progress
Loading into Flash: [====] 100%
and[SUCCESS]
- if not, make sure you have installed the udev rules properly...
- warning: Upload over USB is not possible currently on Chromebooks. Therefore, the first upload MUST take place from another O/S (ie. Fedora) and subsequent uploads can happen OTA from Chromebook
the device should get smart-espresso-scale.local
as a hostname on the local network
copy secrets.h.template
to secrets.h
and insert values
- remove the battery
- unplug all USB cables
- hold the BOOTSEL button and while holding, plug in the PC USB with Power
- let go of the BOOTSEL button
- confirm mounted media
ls /run/media/user/RPI-RP2/
- change upload port to
/run/media/user/RPI-RP2
- upload
- change upload port back to
auto
- turn off USB power
- insert battery
- in
main.cpp
uncomment the#define SERIAL_DEBUG
and build/upload, to enable serial.print debug messages
rm /tmp/arduino* -rf
It is not always known why but uploading over WiFi directly to the device, can fail at random % and at random times. The same code and environment settings can fail or succeed just be retrying multiple times.
Restarting the device does not really help.
The most important thing to succeed with OTA updates, is the WiFi signal to be great. Otherwise, it may take up to 10 times/retries to succeed.