Plasma Software not working

I have a string of 6 DotStar LEDs that I’m trying to drive via my Picade x hat’s hacker port. But for some reason the plasma software doesn’t seem to be working? The software installed perfectly via

curl https://get.pimoroni.com/plasma | bash

I changed the plasma.service file’s output device option to -o SERIAL:/dev/ttyACM0 to reflect my x hat and I edited the plasma executable’s LED count from 10 to 6.

After restarting my Picade, the LEDs do not light, which was my first sign that something may not be working properly. Pressing F4 to exit emulation station and typing plasma makes the LEDs light up perfectly though. (Yes!) However, I’m not returned to the pi@retropie:#$ command prompt, which I would expect to be. All I get is the following

2020-03-08 16:20:21.267363: Starting plasma in the foreground with framerate 30fps
2020-03-08 16:20:21.267372: Plasma input pipe: /tmp/plasma
Opening...
Open...
2020-03-08 16:20:21.361884: Loaded pattern file: /etc/plasma/default.png
_

Each subsequent press of Enter just returns another underscore. Nothing I type in like ls or cd\ will return me to the pi@retropie:#$ prompt, I just get another underscore.

@alphanumeric has been a great help in a OT thread, but we’ve drawn a blank so far, hence this more specific thread. Could anyone offer any advice on why the plasma software isn’t working for me? I feel like that’s the issue here. My LEDs light up fine in a random rainbow fashion. But because plasma doesn’t seem to be executing properly, I’m unable to run anything else like plasmactl or even return to emulation station.

Hopefully he won’t mind me @ing him but @Gadgetoid it would be great if you could offer some advice on this, pretty please!

I deleted the plasma folder in Home Pi Pimoroni and the plasma folder in Home Pi.
Then ran the curl bash command. Its what created the plasma plasma folders in Home Pi Pimoroni.
Just to see what would happen I copied the second plasma folder into the first so its now
Home Pi Pimoroni plasma daemon.
Then ran the install.sh in the daemon folder.
That got me a “Directory /etc/plasma already exists, I’m not going to overwrite it!” message. Likely because of my first install, might have to redo my SD card and start over from scratch?
If I do that I think I’ll do the clone, then run the install.sh in the plasma folder, then the install.sh in the deamon folder. And see what happens.

Ok, started with a fresh Raspbian Buster with Desktop, fully updated.
I then did the following
git clone https://github.com/pimoroni/plasma
cd plasma
sudo ./install.sh
It did a whole bunch of stuff, so I’m guessing that it installed the plasma part. All the stuff the bash curl command does.
I then did a
cd daemon
sudo ./install.sh
And all I got was the "Directory /etc/plasma already exists, I’m not going to overwrite it!” message? I have no idea what that means other than the installer likely didn’t finish? Nothing else showed on screen, it just put me back to the Home Pi plasma daemon folder. Maybe I shouldn’t have run the install.sh in the plasma folder? Just the one in the daemon folder?
@sandyjmacdonald @gadgetoid

2 Likes

Thanks once again for going to all that trouble @alphanumeric. I really appreciate it.

I got the same I’m not going to overwrite it! message when I tried sudo ./install.sh What I think that is though is the installer seeing that the directory already exists and therefore halts.

Debian seems to need switches a lot (compared to dos, as least) added to commands to give extra context, such as ‘if X exists, overwrite it’ otherwise it’ll default to cancelling the command. I found that out yesterday when trying to move a folder. I needed to add -r so that the folders entire structure was copied as well.

Have you tried executing plasma ? Does it do anything to your Blinkt? Specifically, does it execute properly and return you to a proper command line? Instead of mine, which just returns an underscore.

No I haven’t tried running plasma, I was going to but got sidetracked. I may have a go in a little bit. I was hoping Sandy or Phil would chime in with something. I need to know what edit I have to make to that file for Blinkt to work.

Your going to like this, lol
I ran plasma from the default terminal window prompt and the LED on my Fan Shim lit up. Its blinking / flashing and changing colors as it blinks. So I guess I have actually got the plasma part installed. Next step is the plasmactl service I guess?
Forgot to mention, I got that message you posted above
Starting plasma in the foreground etc and ended up with a block for a cursor and no way back to the standard command prompt.

1 Like

Oh wow, that’s awesome! Nice job!
Does running plasma return you to a proper prompt? What does plasma run when you execute it, what shows in the terminal window?

No, I end up where you ended up as you posted above The time stamp with Starting plasma etc. And the cursor is just a white square that does nothing except move on screen. Plus, if I close my terminal window the LED stops flashing and changing color. It just freezes at what ever color it is when I click the X to close the Window.

I rebooted and ran plasmactl --list and got all the options. Then ran plasmactl --tripping but nothing happened. Rebooted and still nothing? Running plasma gets me back to the LED blinking and the messed up cursor?

I found this, which I think is the info needed to get the daemon setup correctly.
I don’t have time to mess with it right now I have an errand to run. I think I am close to figuring this out though.

Ahh very interesting! Well at the very least we know that the issue is reproducable and it’s not just me! Nor my picade x hat for that matter. Thanks again for your efforts.

I think I’ve seen that function reference. I nano’d the plasma program and saw the light count, which I changed to 6. It didn’t make any difference.

I think the issue here is the plasma program failing to initialise properly. Because without being placed back to a proper prompt, we can’t do anything anyway? Perhaps another plasma software user can confirm if this is correct behaviour or not? The blinking underscore and not being returned to a ‘proper’ prompt? Becuase it makes no sense to me. I think @cheekymoomin might have a plasma button kit?

Also, are Sandy or Phil around even? I’ve tried looking for recent posts by them in the forum and there doesn’t seem to be any. :(

Not as much as they should be IMHO. There is hardly any Pimoroni presence here it seems? Which is pretty frustrating if I’m honest. It seems to go in spurts. Phil or Sandy will blast though a bunch of threads then lay low for a while? Thats how it seems anyway.

I’d like to get the daemon working so plasma runs on boot up all by itself. Just have to figure out what the syntax is for the options.
Now that I have some light I’m going to see if I can switch it over from my Fan Shim to my Blinkt. Then play with plasmactl some more.

Ok, I just ran

sudo nano /etc/systemd/system/plasma.service

and changed the -o GPIO:14:15 to -o GPIO:23:24
and rebooted.
My Blinkt lit up all on its own with I believe the default pattern. No having to run plasma from the command line. =)

Don’t edit the one in Home/pi/plasma/daemon/etc/systemd/system/plasma.service
It won’t do anything. ;) Edit the one in Home/etc/systemd/system/plasma.service
You have to turn on show hidden to see it. ;)

What edit did you do to set the number of LED’s? My BLINKT has 8?

Hi gizmo1990,

Sorry, I haven’t had time to look into this as I bought neopixels rather than dotstars.

Seeing as you have dotstars, they look like they should be driven by the plasma library.

So firstly, my /etc/systemd/system/plasma.service is running the following:

/usr/bin/plasma -d -o GPIO:14:15

In linux if you want to run that in the background just add a ‘&’ afterwards:

/usr/bin/plasma -d -o GPIO:14:15 &

If this works for you, then the software is installed correctly and you want to make sure it is plumbed into systemd.

sudo systemctl start plasma

This will start it, however if you want it on reboot you have to run:

sudo systemctl enable plasma

btw: the code for plasma has the default GPIO pins as gpio_data=14, gpio_clock=15. (https://github.com/pimoroni/plasma/blob/master/library/plasma/gpio.py). I’m assuming this is just connected through to the xhat pins.

Hope this helps. Maybe I’ll buy a dotstar strip, then I can ditch my metro mini and just extend the plasma bus. The dream.

NOTE:
I just looked at /usr/bin/plasma. It’s just a python file. It can run detach using -d option.

def main():
    opts = options()

    if opts.daemonize:
        fork()
def options():
    parser = OptionParser()
    parser.add_option("-d", "--daemonize", dest="daemonize", action="store_true", default=False,
                      help="run plasma as a daemon")

Hey gizmo1990,
I just reread your original post. It says you changed the -o option in the plasma.services; and it doesn’t work. However if you run ‘plasma’ on the command line, then it does. Well, the default for plasma is for the GPIO pins. So I would contend that you should put your /etc/systemd/system/plasma.service back to

[Unit]
Description=Plasma LED Sequencer Daemon
DefaultDependencies=no
After=local-fs.target

[Service]
# Change -o to SERIAL:/dev/ttyACM0 for Plasma via Picade Player X
ExecStart=/usr/bin/plasma -d -o GPIO:14:15
Restart=on-failure
Type=forking
PIDFile=/var/run/plasma.pid

[Install]
WantedBy=multi-user.target

@cheekymoomin Thats some good info. I’ll have to go poke around on my system for a look see.
It was just blind luck that my Fan Shim LED uses GPIO 14 and 15.

EDIT: I think gizmo1990 might have just edited the wrong plasma.service file?

It looks like /usr/bin/plasma is where you change the number of LED’s. One of the places to change them anyway. I used sudo nano /usr/bin/plasma to edit that file.
Mine had a LIGHTS = 10 line I changed to LIGHTS = 8
Need to figure out how to change the pattern and how to turn it off lol.

EDIT: You can also change the pattern by editing that file.
look for a line with load_pattern(“default”) at the end. I changed mine to load_pattern(“trippy”) and it switched.

This is great stuff guys, thanks so much. Bear with me tho, I’m trying to keep up with you two!

First off, before I go any further, I’m wary that the installs I have, have been placed in the wrong directory structure. Could I just just get confirmation of what the ‘exact’ structure should be, starting from /home/pi/

So in my case the install created the daemon folder in
/home/pi/Pimoroni/plasma/daemon

I also have another install at
/home/pi/plasma/daemon

What is the directory structure you guys have? I know one of the plasma directories I have is not needed, but I have a sneaking suspicion that both structures are wrong??

Currently all I have is the /home/pi/plasma/daemon
As all I did this time around was the git clone https://github.com/pimoroni/plasma

Hi gizmo1990,

I think you are looking in the wrong place. So when you do the curl command, it downloads a script then the pipe to bash runs the script. This looks to be cloning the git repository here: https://github.com/pimoroni/plasma

The script then copies various bits and pieces from here to where they should be in your system. So it doesn’t really matter where the clone happened (this is not where it will be running from). You need to see where they are actually installed.

So for example on my pi, the clone of /home/pi/Pimoroni/plasma/plasma/daemon/etc/systemd/system/plasma.service is copied to its proper location of /etc/systemd/system/plasma.service so that it can be started by systemd.

If you type ‘which plasma’, hopefully you will see it has been installed to /usr/bin/plasma.

However, I really think that if you type ‘plasma’ and the strip lights up, then this is using the default GPIO pins. Therefore you should put your plasma.service back to using the GPIO pins.

def options():
    parser = OptionParser()
    parser.add_option("-d", "--daemonize", dest="daemonize", action="store_true", default=False,
                      help="run plasma as a daemon")
    parser.add_option("-f", "--fps", action="store", dest="fps", type="int", default=FPS,
                      help="set plasma LED update framerate")
    parser.add_option("-l", "--lights", action="store", dest="lights", type="int", default=LIGHTS,
                      help="set number of lights in your plasma chain")
    parser.add_option("-o", "--device", default="GPIO:14:15")

alphanumeric, you should probably use the option to set the number of lights in your strip. i.e. change your plasma.service to use the -l (or --lights) option when calling ‘plasma’. Also for changing the pattern, have you used the plasmactl as described here: https://learn.pimoroni.com/tutorial/sandyj/fitting-picade-plasma-buttons

Sorry, it’s hard to explain.

Hi Alphanumeric,

Try running the install script, rather than cloning yourself.

curl https://get.pimoroni.com/plasma | bash