Skip to content

booyaa/heyo-presto

Repository files navigation

Heyo Presto

Scripts

Audio

Starting to experiment with the built in piezo speaker. It's not very powerful, but if you keep the lower frequences and don't try to complicated

Volume control

code: audio-volume.py

Using duty cycle to increase volume of simple frequency range. Borrowed heavily from Sam Galope's ESP32 PWM audio post.

Playing samples badly

code: audio-samples.py

This is inspired by antirez (yes of Redis fame)

I grabbed the original wav files from GitHub:

Converted them to pcm (raw) files using ffmpeg

ffmpeg -i some-sound.wav -ar 8000 -acodec pcm_u8 -f u8 some-sound.raw

It took a bit of tinkering to work out how to slow down the samples, but to be honest it felt like guess work. I should probably reread antirez's post.

The samples are very quiet (well on my Presto it sounds quiet on mine).

Important

You'll need to copy the raw files over to the Presto using mpremote cp even if you use mpremote run to run the script locally.

Scaled text

code: heyo-presto.py

Displays text at varying scale using the 8-bit font and Pico Graphics

code: heyo-vecto.py

Displays text at varying scale using Pico Vectors

Display web image

code: display-web-image.py

How to display an image from the internet without saving.

Warning

The image needs to be small enough to load into RAM

Sleeper

code: sleeper.py

A very poor attempt at power saving. It works by turning the backlight off and goes into a loop that runs between idle/light sleep. Copy this to your presto and pick it from the launcher. I've not measure how much power draw this is compared to running a regular app. If you're really paranoid you could just unplug the presto.

Presto bridge

code: presto_bridge.py

This is a small flask app to handle sending and receive messages to meshtastic. We only send to a specific person (in my case my mobile node).

export MESHTASTIC_HOST='1.2.3.4' # IP address of your node
export MESHTASTIC_DEFAULT_SENDER='!deadbeef' # user id
flask --debug --app presto_bridge run --port 5050 --host 0.0.0.0

Meshtastic console

code meshtastic_console.py

This is a Presto app that allows you to send and receive messages from meshtastic. It requires the Presto bridge to work.

Upload it you Presto and change the HOST_BASE_URL to match the IP address and URI scheme where your Presto bridge is running on.

Others

  • The tweaked folder is where I've taken existing examples and made small changes like backlight.
  • The examples-from-others folder is stuff I've found on the internet that I want to keep for reference.

Resources

Reading

  • Shop - specs of the Presto
  • Learn - the getting started guide for the Presto
  • Docs - the documentation folder for the Presto code examples
    • Pico Graphics - the documentation for the Pico Graphics module. Also contains details of how to use BitBank's JPEGDEC

Software / Tools

  • Presto (shop link)
  • Thonny IDE to easily connect to the presto
  • mpremote when you're ready to hit the terminal
    • mpr - a wrapper around mpremote to use wildcards and cross compiled runs

Thonny set up

  • Make sure your Presto is connected to your computer via the USB data cable that came with the kit
  • Set your interpreter to "MicroPython (Raspberry Pi Pico)" (Tools > Options > Interpreter tab)
  • Select the correct USB serial device mine was "Board CDC @ COM4" you may have a different USB device name and serial port number (COM)
  • Check "Interrupt working program on connect", this will stop the launch and go into dev mode
  • You can then use file open and select "Raspberry Pi Pico" to open files on the Presto
  • You can press the Play butto to start programs

mpremote

I use uv as my all in one python tool. If you don't use uv, you should be able to reuse these commands by removing uv.

uv venv
# activate environment .venv/bin/activate (*nix) .\.venv\Scripts\activate
# TODO: uv pip install -r requirements
uv pip install mpremote
mpremote ls
# to move files on the remote file system
mprmote cp :some_file_on_remote_fs.py :some_dir_on_remote_fs/
mprmote rm :some_file_on_remote_fs.py

Note

: indicates remote file system

Miscellany tips

Convert your square images into 240x240 px. This assumes they're in the directory

mkdir converted
ls -tp | xargs -I{} ffmpeg -i {} -vf scale=240:240 "converted/{}"
mpremote cp converted/. :gallery/

Create new icons

Source: pimoroni

  • Search for icon
  • Select icon
  • Scroll down right panel nav until you see code point

Important

You need to download the materials symbol font from the source repo

# Piano codepoint is e521
cd examples-from-others
python font2picovector.py --font MaterialSymbolsOutlined-Regular.ttf --size 40x40 e521

About

doing cool stuff with the pimoroni presto

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages