Skip to content
/ psswc Public

🌈 Plasma Stick Simple Web Control: Control the animation running on your Pimoroni Plasma Stick 2040W through a simple Pico-hosted web interface

License

Notifications You must be signed in to change notification settings

tti0/psswc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

psswc

🌈 Plasma Stick Simple Web Control

Control the animation running on your Pimoroni Plasma Stick 2040W through a simple Pico-hosted web interface, written in MicroPython.

A screenshot of a web interface. Black text on a white background. The title is 'Plasma Stick Simple Web Control' alongside a rainbow emoji. Displayed beneath this is the text 'Animation: snow.py', above a drop-down box, labelled 'Choose a new animation:', and associated 'Submit' button. The drop-down box contains the text 'snow.py'.

  • Since the RP2040 is a dual-core MCU, one core can be dedicated to running the lightweight asynchronous web server, whilst the other plays user-defined animations (written in MicroPython and stored in the userscripts directory) on the attached Neopixel LEDs.
  • The animation choices on the control web page are automatically populated from the contents of userscripts, so adding a new animation script is simple.
  • Animation scripts can make use of all the Plasma Stick and Raspberry Pi Pico W's functionality, including making web requests of their own, or interacting with other hardware.
  • The selected animation is stored on the Plasma Stick, and automatically played on device startup.

Instructions

  1. Download the latest Pimoroni MicroPython UF2 firmware from here. Choose the firmware with filename matching pimoroni-picow-vx.y.z-micropython.uf2, and flash to the Plasma Stick 2040W using the instructions here.
  2. Clone this repository with Git or download it as a ZIP file from this link.
  3. Rename micropython/WIFI_CONFIG_EXAMPLE.py to micropython/WIFI_CONFIG.py and update its contents to provide:
    • SSID – the name of your WiFi network
      • e.g. MyNetwork
    • PSK – the password, if any, of your WiFi network
      • e.g. MyPassword
    • COUNTRY – the two-letter country code for your location, for proper WiFi configuration
      • e.g. GB
    • STATIC_IP – the static IP address (IPv4) at which you would like to access the control web site
      • e.g. 192.168.1.50
    • STATIC_SUBNET_MASK– the subnet mask for your network
      • e.g. 255.255.255.0
    • STATIC_GATEWAY – the IP address (IPv4) of your router
      • e.g. 192.168.1.1
    • STATIC_DNS_SERVER – the IP address (IPv4) of a DNS server
      • e.g. 8.8.8.8
  4. Using Thonny, copy the contents of the micropython directory to the root of the Pi Pico filesystem.
  5. Reset the Plasma Stick using the provided button, and navigate to the IP address you specified earlier in a web browser.
  6. Choose your first animation to play!

Optional: adding your own animation scripts

  • To add your own MicroPython animation script, place a single .py file for each in micropython/userscripts.
  • This .py file must contain a main function, which should contain the main loop of your animation.
  • The name of this .py file must comprise lower-case letters and underscores only.
  • If your script makes HTTP requests of its own, there is no need to connect to WiFi again there, as the animation scripts inherit the WiFi connection of the main web server script.
  • Running another web server in the animation script is untested, and is unlikely to work without major modification to the main.py program.

Licensing

This project is Copyright (c) tti0 2024, and licenced under the MIT Licence. Please see LICENSE for full details.

The example animation scripts provided in micropython/userscripts are Copyright (c) Pimoroni Ltd 2021, and licensed under the MIT Licence, with original source code available here.

About

🌈 Plasma Stick Simple Web Control: Control the animation running on your Pimoroni Plasma Stick 2040W through a simple Pico-hosted web interface

Resources

License

Stars

Watchers

Forks