Plasma 2350 W loop animation

I made my animation software public on GitLab: Plasma 2350 W loop animation · GitLab

It’s a first setup, maybe it will inspire others.

4 Likes

I like the idea and I have done quite some similar animations using Pimoroni’s encoder wheel. Animations kick in when there is some “thinking”, “pausing”, “configuring”, or just to bridge time for the user, etc.

1 Like

I have an Encoder Wheel connected to my Plasma 2350. I have a 144 pixel RGB strip setup as my desktop lighting. I use the encoder wheel to adjust the color and brightness of the strip. I did have a couple of patterns setup but have since lost that file somehow? I had to start over with the Plasma 2350 when my plasma (2040) got fried by a power supply failure. Might have another look see for it. I think I’ll also look at my past posts to see if I posted.

Anyway, many thanks for the link to your code. I will play around with it at some point. =)

EDIT: found a copy of my old code that I posted here.

import time
import plasma
import machine
import micropython

from plasma import plasma2040
from pimoroni_i2c import PimoroniI2C
from breakout_encoder_wheel import BreakoutEncoderWheel, UP, DOWN, LEFT, RIGHT, CENTRE, NUM_BUTTONS, NUM_LEDS
from pimoroni import RGBLED

led = RGBLED(16, 17, 18)
led.set_rgb(0, 0, 0)

user_button = machine.Pin(22, machine.Pin.IN)
a_button = machine.Pin(12, machine.Pin.IN, machine.Pin.PULL_UP)

BUTTON_NAMES = ["Up", "Down", "Left", "Right", "Centre"]

i2c = PimoroniI2C(20, 21)


wheel = BreakoutEncoderWheel(i2c)
last_pressed = [False] * NUM_BUTTONS
pressed = [False] * NUM_BUTTONS

STRIP_LEDS = 144
SPEED = 20
UPDATES = 60

# WS2812 / NeoPixel™ LEDs
led_strip = plasma.WS2812(STRIP_LEDS, 0, 0, plasma2040.DAT, color_order=plasma.COLOR_ORDER_GRB)
led_strip.start()

offset = 0.0

brightness = (0.5)

pattern = 0

red = (1 / 360)
green = (130 / 360)
blue = (250 / 360)
yellow = (60 / 360)
orange = (30 / 360)
white = (1.0)

while True:
    
    # Read all of the encoder wheel's buttons
    for b in range(NUM_BUTTONS):
        pressed[b] = wheel.pressed(b)
        if pressed[b] != last_pressed[b]:
            print(BUTTON_NAMES[b], "Pressed" if pressed[b] else "Released")
        last_pressed[b] = pressed[b]

    if pressed[UP]:
        pattern = 0
        wheel.clear()
        for i in range(NUM_LEDS):
            wheel.set_hsv(i, 1, 0, brightness)
        for s in range(STRIP_LEDS):
            led_strip.set_hsv(s, 1, 0, brightness)
        wheel.set_hsv(0, 1.0, 0, 1.0)
        wheel.set_hsv(6, blue, 1.0, 1.0)
        wheel.set_hsv(11, blue, 1.0, 1.0)
        wheel.set_hsv(12, green, 1.0, 1.0)
        wheel.set_hsv(13, red, 1.0, 1.0)
        wheel.set_hsv(18, red, 1.0, 1.0)
        color = white

    if pressed[RIGHT]:
        pattern = 0
        wheel.clear()
        for i in range(NUM_LEDS):
            wheel.set_hsv(i, blue, 1.0, brightness)
        for s in range(STRIP_LEDS):
            led_strip.set_hsv(s, blue,  1.0, brightness) 
        wheel.set_hsv(0, 1.0, 0, 1.0)
        wheel.set_hsv(6, blue, 1.0, 1.0)
        wheel.set_hsv(11, blue, 1.0, 1.0)
        wheel.set_hsv(12, green, 1.0, 1.0)
        wheel.set_hsv(13, red, 1.0, 1.0)
        wheel.set_hsv(18, red, 1.0, 1.0)
        color = blue
        
    if pressed[DOWN]:
        pattern = 1
        wheel.clear()
        '''
        for i in range(NUM_LEDS):
            wheel.set_hsv(i, green, 1.0, brightness)
        for s in range(STRIP_LEDS):
            led_strip.set_hsv(s, green,  1.0, brightness)
            
        wheel.set_hsv(0, 1.0, 0, 1.0)
        wheel.set_hsv(6, blue, 1.0, 1.0)
        wheel.set_hsv(11, blue, 1.0, 1.0)
        wheel.set_hsv(12, green, 1.0, 1.0)
        wheel.set_hsv(13, red, 1.0, 1.0)
        wheel.set_hsv(18, red, 1.0, 1.0)
        '''
        
    if pressed[LEFT]:
        pattern = 0
        wheel.clear()
        for i in range(NUM_LEDS):
            wheel.set_hsv(i, red, 1.0, brightness)
        for s in range(STRIP_LEDS):
            led_strip.set_hsv(s, red,  1.0, brightness)         
        wheel.set_hsv(0, 1.0, 0, 1.0)
        wheel.set_hsv(6, blue, 1.0, 1.0)
        wheel.set_hsv(11, blue, 1.0, 1.0)
        wheel.set_hsv(12, green, 1.0, 1.0)
        wheel.set_hsv(13, red, 1.0, 1.0)
        wheel.set_hsv(18, red, 1.0, 1.0)
        color = red
        
    if pressed[CENTRE]:
        pattern = 0
        wheel.clear()
        for s in range(STRIP_LEDS):
            led_strip.set_hsv(s, 0, 0, 0)              

        
    # Has the dial been turned since the last time we checked?
    change = wheel.delta()
    if change != 0:
        # Print out the direction the dial was turned, and the count
        if change > 0:
            print("Clockwise, Count =", wheel.count())
        else:
            print("Counter Clockwise, Count =", wheel.count())

        position = wheel.count()
        
        brightness = ((position + 25) / 50)
        
        if brightness < 0:
            brightness = 0
            
        if brightness > 1:
            brightness = 1
        
        print ("Brightness =", brightness)
        
        wheel.clear()
        
        if pattern == 0:
        
            if color == white:
                for i in range(NUM_LEDS):
                    wheel.set_hsv(i, 1.0, 0, brightness)
                for s in range(STRIP_LEDS):
                    led_strip.set_hsv(s, 1.0,  0, brightness)         

            else:
                for i in range(NUM_LEDS):
                    wheel.set_hsv(i, color, 1.0, brightness)
                for s in range(STRIP_LEDS):
                    led_strip.set_hsv(s, color,  1.0, brightness)         

            wheel.set_hsv(0, 1.0, 0, 1.0)
            wheel.set_hsv(6, blue, 1.0, 1.0)
            wheel.set_hsv(11, blue, 1.0, 1.0)
            wheel.set_hsv(12, green, 1.0, 1.0)
            wheel.set_hsv(13, red, 1.0, 1.0)
            wheel.set_hsv(18, red, 1.0, 1.0)
            
    if pattern == 1:
        SPEED = min(255, max(1, SPEED))
        offset += float(SPEED) / 2000.0
        offset %= 1
        
        for s in range(STRIP_LEDS):
            hue = (offset + float(s) / STRIP_LEDS) % 1
            led_strip.set_hsv(s, hue + offset, 1.0, brightness)
        for i in range(NUM_LEDS):
            wheel.set_hsv(i, hue + offset, 1.0, brightness)            
            
        time.sleep(1.0 / UPDATES)        

    wheel.show()

2 Likes

thanks for searching and sharing

1 Like

It was nice not to have to start over. Also going to give @PimoPete code a try on a spare plasma stick I have.
Wireless Plasma Kit (Pico W Aboard)