pull/536/head
helgibbons 2022-10-18 14:25:02 +01:00
rodzic a7dd4b3baf
commit ce76ff5ea3
2 zmienionych plików z 49 dodań i 26 usunięć

Wyświetl plik

@ -21,25 +21,27 @@
## About Plasma Stick
Plasma Stick 2040 W is a compact little controller for WS2812 strip, powered by Raspberry Pi Pico W and perfect for easy, seasonal lighting. It has built in ✨wireless connectivity✨, courtesy of the onboard Pico W.
Plasma Stick 2040 W is a compact controller for WS2812 strip, powered by Raspberry Pi Pico W and perfect for easy, seasonal lighting. It has built in ✨wireless connectivity✨, courtesy of the onboard Pico W.
[store link coming soon]
You can buy one on its own or in a kit:
If you're after buttons, current sensing, APA102 support or USB-C, you might prefer [Plasma 2040](https://shop.pimoroni.com/products/plasma-2040).
- [Plasma Stick 2040 W](https://shop.pimoroni.com/products/plasma-stick-2040-w)
Plasma Stick ships without firmware, so you'll need to download the latest `pimoroni-picow` build from the link below.
- [Wireless Plasma Kit](https://shop.pimoroni.com/products/wireless-plasma-kit)
Plasma Stick ships with MicroPython firmware pre-loaded, but you can download the most recent version at the link below (you'll want the `pimoroni-picow` image).
- [MicroPython releases](https://github.com/pimoroni/pimoroni-pico/releases)
## Plasma Library
You can control your WS2812 / NeoPixel™ strip using our MicroPython Plasma library.
You can control your WS2812 / NeoPixel™ strip using our handy MicroPython Plasma library.
- [PicoGraphics MicroPython function reference](../../modules/plasma)
## Using Breakouts
Plasma Stick has a Qw/ST (Qwiic/STEMMA QT) connector. Breakouts with Qw/ST connectors, can be plugged straight in with a [JST-SH to JST-SH cable](https://shop.pimoroni.com/products/jst-sh-cable-qwiic-stemma-qt-compatible?variant=31910609813587). You can also connect any I2C Breakout Garden breakout using a [JST-SH to JST-SH cable](https://shop.pimoroni.com/products/jst-sh-cable-qwiic-stemma-qt-compatible?variant=31910609813587) coupled with a [Qw/ST to Breakout Garden adaptor](https://shop.pimoroni.com/products/stemma-qt-qwiic-to-breakout-garden-adapter).
Plasma Stick has a Qw/ST (Qwiic/STEMMA QT) connector. Breakouts with Qw/ST connectors, can be plugged straight in with a [JST-SH to JST-SH cable](https://shop.pimoroni.com/products/jst-sh-cable-qwiic-stemma-qt-compatible?variant=31910609813587). You can connect I2C Breakout Garden breakouts without Qw/ST connectors using a [JST-SH to JST-SH cable](https://shop.pimoroni.com/products/jst-sh-cable-qwiic-stemma-qt-compatible?variant=31910609813587) and a [Qw/ST to Breakout Garden adaptor](https://shop.pimoroni.com/products/stemma-qt-qwiic-to-breakout-garden-adapter).
- [List of breakouts currently supported in our C++/MicroPython build](https://github.com/pimoroni/pimoroni-pico#breakouts)
@ -63,27 +65,32 @@ i2c = PimoroniI2C(sda=(4), scl=(5))
## Basic Examples
### Alternating Blinkies
[alternating-blinkies.py](alternating-blinkies.py)
A simple example with two alternating colours, great for festive lights!
### Fire
[fire.py](fire.py)
A simple 🔥 fire effect example 🤘 (warning, flashy).
### Moon
[moon.py](moon.py)
Spooky moon simulator - the LEDs will get brighter as midnight approaches!
Needs to be run from Thonny to get the correct time.
### Rainbows
[rainbows.py](rainbows.py)
Some good old fashioned rainbows!
### Thermometer
[thermometer_pico.py](thermometer_pico.py)
Reads the temperature from the Pico W's internal temperature sensor and changes the LED strip an appropriate colour.
@ -93,27 +100,32 @@ Reads the temperature from the Pico W's internal temperature sensor and changes
These examples require additional hardware.
### CO2
[co2.py](co2.py)
Reads CO2 level from a [SCD41 CO2 breakout](https://shop.pimoroni.com/products/scd41-co2-sensor-breakout) and turns the LED strip an appropriate colour.
### Encoder
[encoder.py](encoder.py)
Adjust the colour of your LEDs easily with an [RGB Encoder breakout](https://shop.pimoroni.com/products/rgb-encoder-breakout?variant=32236590399571).
### Moon (RTC)
[moon_rtc.py](moon_rtc.py)
Spooky moon simulator - the LEDs will get brighter as midnight approaches!
Gets the time from a [RV3028 RTC breakout](https://shop.pimoroni.com/products/rv3028-real-time-clock-rtc-breakout).
### PIR
[pir.py](pir.py)
Connect a PIR motion sensor and trigger some ominous effects. We like [these ones](https://shop.pimoroni.com/products/micro-pir-motion-sensor-2-pcs) - we connected ours to the QwST connector using [this cable](https://shop.pimoroni.com/products/jst-sh-cable-qwiic-stemma-qt-compatible?variant=31910609846355) and some [socket to socket](https://shop.pimoroni.com/products/jumper-jerky-junior?variant=1076482185) jumper jerky.
### Thermometer (BME280)
[thermometer_bme280.py](thermometer_bme280.py)
Reads the temperature from a [BME280 breakout](https://shop.pimoroni.com/products/bme280-breakout) and changes the LED strip an appropriate colour.
@ -125,15 +137,16 @@ The wireless examples need `network_manager.py` and `WIFI_CONFIG.py` from the `c
- [micropython/examples/common](../../examples/common)
### Cheerlights
[cheerlights.py](cheerlights.py)
Sets your LED strip to the current #cheerlights colour.
Find out more about the Cheerlights API at [https://cheerlights.com/].
### Weather
[weather.py](weather.py)
This Plasma Stick example connects to Open Meteo to access the current weather conditions.
It then does some cool weather appropriate stuff with LEDs.
Find out more about the Open Meteo API at [https://open-meteo.com].

Wyświetl plik

@ -1,6 +1,8 @@
# Plasma <!-- omit in toc -->
The Plasma library is intended to drive APA102 / DotStar™ or WS2812 / NeoPixel™ LEDs on the Plasma 2040 board, though it can be used with your own custom pins/wiring.
The Plasma library is intended to drive APA102 / DotStar™ or WS2812 / NeoPixel™ LEDs on our [Plasma 2040](https://shop.pimoroni.com/products/plasma-2040) board, though it can also be used with your own custom pins/wiring.
It can also be used to drive WS2812 / NeoPixel™ LEDs from [Plasma Stick](https://shop.pimoroni.com/products/plasma-stick-2040-w). Note that APA102 compatibility, user buttons, RGB LED and current sensing functions are not present on Plasma Stick.
- [Notes On PIO Limitations](#notes-on-pio-limitations)
- [WS2812](#ws2812)
@ -9,12 +11,12 @@ The Plasma library is intended to drive APA102 / DotStar™ or WS2812 / NeoPixel
- [Set An LED](#set-an-led)
- [RGB](#rgb)
- [HSV](#hsv)
- [Set Brightness](#set-brightness)
- [APA102](#apa102)
- [Getting Started](#getting-started-1)
- [Set An LED](#set-an-led-1)
- [RGB](#rgb-1)
- [HSV](#hsv-1)
- [Set Brightness](#set-brightness)
- [Using the Buttons & RGB LED](#using-the-buttons--rgb-led)
- [Buttons](#buttons)
- [RGBLED](#rgbled)
@ -33,6 +35,8 @@ In most cases you'll use `0` for PIO and `0` for PIO state-machine, but you shou
Construct a new `WS2812` instance, specifying the number of LEDs, PIO, PIO state-machine and GPIO pin.
For Plasma 2040:
```python
import plasma
from plasma import plasma2040
@ -43,6 +47,18 @@ FPS = 60
led_strip = plasma.WS2812(LEDS, 0, 0, plasma2040.DAT)
```
For Plasma Stick:
```python
import plasma
from plasma import plasma_stick
LEDS = 30
FPS = 60
led_strip = plasma.WS2812(LEDS, 0, 0, plasma_stick.DAT)
```
Start the LED strip by calling `start`. This sets up a timer which tells the RP2040 to DMA the pixel data into the PIO (a fast, asyncronous memory->peripheral copy) at the specified framerate.
```python
@ -54,12 +70,6 @@ led_strip.start(FPS)
Some WS2812-style LED strips have varying colour orders and support an additional white element. Two keyword arguments are supplied to configure this:
```python
import plasma
from plasma import plasma2040
LEDS = 30
FPS = 60
led_strip = plasma.WS2812(LEDS, 0, 0, plasma2040.DAT, rgbw=True, color_order=plasma.COLOR_ORDER_GRB)
```
@ -92,16 +102,6 @@ Set the first LED - `0` - to Red `0.0`:
led_strip.set_hsv(0, 0.0, 1.0, 1.0)
```
### Set Brightness
APA102 pixels support global brightness, allowing their brightness to be specified independent of their colour. You can set the overall brightness of your strip by calling:
```python
led_strip.set_brightness(15)
```
You can set brightness from `0` to `31`. This directly maps to the 5-bit brightness value sent to the APA102 LEDs.
## APA102
### Getting Started
@ -144,6 +144,16 @@ Set the first LED - `0` - to Red `0.0`:
led_strip.set_hsv(0, 0.0, 1.0, 1.0)
```
### Set Brightness
APA102 pixels support global brightness, allowing their brightness to be specified independent of their colour. You can set the overall brightness of your strip by calling:
```python
led_strip.set_brightness(15)
```
You can set brightness from `0` to `31`. This directly maps to the 5-bit brightness value sent to the APA102 LEDs.
## Using the Buttons & RGB LED
The `pimoroni` module contains `Button` and `RGBLED` classes to simplify button debounce, auto-repeat and PWM'ing an RGB LED.
@ -212,7 +222,7 @@ led.set_rgb(0, 0, 255) # Full blue
## Measuring LED Strip Current Draw
Plasma 2040 feasures low-side current sensing, letting you measure how much current a strip of LEDs is drawing. This could be used just for monitoring, or as a way to reduce the maximum brightness of a strip to keep its current draw within the range of the USB port or power supply being used.
Plasma 2040 features low-side current sensing, letting you measure how much current a strip of LEDs is drawing. This could be used just for monitoring, or as a way to reduce the maximum brightness of a strip to keep its current draw within the range of the USB port or power supply being used.
The `pimoroni` module contains an `Analog` class to simplify the reading of this current draw.