Git Product home page Git Product logo

octoprint-ledstripcontrol's Introduction

OctoPrint-LEDStripControl

OctoPrint Plugin that intercepts M150 GCode commands and controls local GPIOs accordingly.

Implements the M150 command syntax from the latest Marlin.

    M150: Set Status LED Color - Use R-U-B for R-G-B Optional (W)
    M150 R255       ; Turn LED red
    M150 R255 U127  ; Turn LED orange (PWM only)
    M150            ; Turn LED off
    M150 R U B      ; Turn LED white
    M150 W          ; Turn LED white if using RGBW strips (optional)

Setup

  1. Make sure that the OctoPrint user is in the gpio group via the following command.

     usermod -a -G gpio pi
    
  2. Install via the bundled Plugin Manager or manually using this URL:

     https://github.com/google/OctoPrint-LEDStripControl/archive/master.zip
    
  3. Restart OctoPrint

Configuration

NOTE: GPIO pins should be specified as physical number and not BCM number.

Configure the GPIO pins via the OctoPrint settings UI.

Disclaimer

This is not an official Google product.

octoprint-ledstripcontrol's People

Contributors

precision avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

octoprint-ledstripcontrol's Issues

Settings will not save and octo hangs

I install the plugin. Reboot. Attempt to edit settings. Enter my pin numbers. When I hit save, it hangs. I have to reboot via ssh or pull the power. It will not save the settings.

Cannot trigger with M150 command (Prusa I3 Mk2s)

I setup everything and got my pins all set, ran some test via ssh with pigpiod to make sure everything works (which it is), and updated my Prusa I3 firmware to enable BLINKM. However when i open octoprint and input M150 R255 there is no reponse, and the led's do not turn on. I also attempted to use the Pigpiod settings and still was unable to get my leds to turn on. I am unsure if this issue has to do with my printer or if it is related to the plugin.

Which LED Strips

Which LED Strip would be useable? I usually have those with the WS2812b chip. But this is not what is working here?

Daniel

Not running consistently

Hey, thanks for the great plugin.

I do have an issue though. I use octolapse and have configured two scripts for before and after a picture is taken. In these scripts, I set the LEDs:

e.g. ledShoot.sh

#!/bin/bash

pigs p 17 255
pigs p 27 100
pigs p 22 100

exit 0

I think somehow this interferes with the plugin. Sometimes, the M150 command works but stops working after using my custom scripts. Is there a rights issue or something I'm missing?
What is the recomended way of starting pigiod?

Cheers

After updating to newest octoprint version - only

I've just updated my octoprint to version 1.3.11
and it only allows me to boot in security mode.
When i deactivate LED Strip Control 0.3.6 in Plugin Manager octoprint boots normal again.
Bug in v0.3.6?

Noob question

Have plugin installed but cannot seem to get the led strip to light up. I have a maker select plus V2 printer, rgb from strip are connected to 19, 21, and 23 physical gpio pins on my Pi 3. Power hooked up to pin 1 on the Pi. Set those physical pin numbers in the plugin as described in the instructions. I also tried 11, 13, and 15 on the pi as well, no go..

Also ran the usermod command described in the instructions, but one thing to note is that I needed to run the command with sudo in front of all of it.

I'm sure I'm missing something..

Any help would be greatly appreciated..

Thanks

KeyError: 'w'

Hello
I can control the LED via python manually on my Pi Zero W (OctoPrint version : 1.3.6, OctoPi version : 0.14.0) but not if I send an M150 W command for my only-white LEDs. I see these in /home/pi/.octoprint/logs/octoprint.log :

2018-03-24 00:02:41,284 - octoprint.util.comm - ERROR - Error while processing hook LEDStripControl for phase queuing and command M150:
Traceback (most recent call last):
  File "/home/pi/oprint/local/lib/python2.7/site-packages/OctoPrint-1.3.6-py2.7.egg/octoprint/util/comm.py", line 2419, in _process_command_phase
    hook_results = hook(self, phase, command, command_type, gcode, subcode=subcode)
  File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint_LEDStripControl/__init__.py", line 147, in HandleM150
    if self._leds[l]:
KeyError: 'w'

Any clues?

Plugin does not save\function

After installing the latest version with White control I am unable to get the plugin to work. It will only save the GPIO configuration once and then requires a reboot. But I cannot get it to control the LED's yett the old version works fine.

Problem with gpio group

I´m testing your project and had a working Octoprint. But when after running
"usermod -G gpio pi" it stops to work. It can´t connect to the printer.
Error message:
Changing monitoring state from 'Operational' to 'Offline'
Changing monitoring state from 'Offline' to 'Detecting serial port'
Serial port list: ['/dev/ttyACM0']
Connecting to: /dev/ttyACM0
Error while connecting to /dev/ttyACM0: 'Timeout'
Changing monitoring state from 'Detecting serial port' to 'Error: Failed to autodetect serial port, please set it manually.'
Failed to autodetect serial port, please set it manually.
Connection closed, closing down monitor

I tried it with two different octoprint installations and both gave me the same result.
I´m not so good at Linux to find this out, just that it has something with rights to do.

Maby it should be: usermod -G -a gpio pi

Invalid gcode command

when I try to use this I get a response from the pi that it is an invalid gcode command. I am not sure how to correct this. I have verified the GPIO pins, and made sure they are related to the correct ones in the software, but it looks like the pi is not intercepting the commands.

Help

I cannot get this working no matter what i do. Running octoprint is my first try with a raspberry pi so this is mostly foreign to me.

What I know:

  • I'm part of the gpio group.
  • In the log I see:
    2018-09-04 06:38:09,986 - octoprint.plugins.LEDStripControl - DEBUG - M150 Detected: M150 R
    2018-09-04 06:38:09,987 - octoprint.plugins.LEDStripControl - DEBUG - match 1: r 2: 100.0
    2018-09-04 06:38:13,382 - octoprint.plugins.LEDStripControl - DEBUG - M150 Detected: M150 U
    2018-09-04 06:38:13,383 - octoprint.plugins.LEDStripControl - DEBUG - match 1: g 2: 100.0
    2018-09-04 06:38:14,782 - octoprint.plugins.LEDStripControl - DEBUG - M150 Detected: M150 B
    2018-09-04 06:38:14,783 - octoprint.plugins.LEDStripControl - DEBUG - match 1: b 2: 100.0
    2018-09-04 06:38:16,112 - octoprint.plugins.LEDStripControl - DEBUG - M150 Detected: M150 W
    2018-09-04 06:38:16,114 - octoprint.plugins.LEDStripControl - DEBUG - match 1: w 2: 100.0
  • In config.yaml:
    LEDStripControl:
    _config_version: 2
    b: 15
    g: 13
    on_startup: false
    r: 12
    w: 11
  • I can manually pull the led mosfets to ground and they turn off, but they don't stay off and come back on immediately.

I'm not sure how to test the gpio pins via ssh or another way. I would like to get this working but don't know what else to do.

Thank you,
Scott

Chaotic comands - only through relay

Hello,
I'm trying to configure a 12V RGB LED strip and it would not work when RGB pins are connected directly onto the RPI ZERO although I have common GND with the LED strip PSU, RPI is just running on a step-down converter (150W). They all stay ON whatever the commands I send. If I measure the GND pins from 5V PSU with the GND pins from 12V PSU they are common so I don't think the problem is there, I'm using special cable for powering RPI with 20AWG wires.

I use a 4 relay board powered at 5V same buck as RPI, pins connected on the board, numbered G12, R16, B18. GND taken straight from the 12V PSU. This setup partly works. And I say partly, because the commands I send via terminal are not the same as described in your guide. I respected the coloring of the cables from the strip to the RPI and triple checked that pin numbers are OK and correspond to the said color on the strip. Here is the setup

If I send M150 R U B then the LEDs turn off.
M150 R255 turns on Blue.
M150 turns ON all colors.

I am out of ideas and this is the first time I'm controlling LEDs with raspberry so I'm a novice, please advise.

Orange Pi Support

Does this work with Armbian on orange pi zero ? have installed the plugin and got it to output via ssh and WiringOP But not able to get a response from the octoprint interface

getting the wrong colours

hello when i type the commands as follows incorrect colours come up

M150: Set Status LED Color - Use R-U-B for R-G-B
M150 R255 ; Turn LED red (blue)
M150 R255 U127 ; Turn LED orange
M150 ; Turn LED off
M150 R U B ; Turn LED white
I ALSO GET PURPLE AND yellow im using 33 for red 32 for green 12 blue

Cabling + Compatibility Ender 3

Hello,

  • Does it work with the Ender 3 in the original configuration?-
  • Where should I enter this command line : "usermod -a -G gpio pi" ?

My biggest problem is the wiring hardware part of the led. How to wire a RGB 5050 LED strip? I have 4 solder contacts: 12V, RED, GREEN and BLUE.

Bests Regards

After install, Octoprint can't start up

After I installed and configure it to 14, 0, 0 (only had one led strip going).
And restarted Pi. Octoprint can't start up correctly.
Says "The OctoPrint server is currently not running"

After start up in safe mode, and disabling your plugin, it will start again.
I then deleted the plugin, and restartede octoprint again.
Then installed it agin via the plugin manager, and rebooted.
Same happend again .....

Any idea og what is going wrong ?

Br Tvixen

M150 commands not controlling LEDs

So I'm having some issues with the LEDStripControl plugin.

I've built a power control module for a LED strip, tested everything, and it works.
From the pi (as the pi user), I can execute "pigs p 17 255" from the command line, and it works as expected, turning the (green) LEDs on. I've tried the other colors, and they work as well.

Because of this, the pi user is in the gpio group:

# groups
pi dialout video gpio

I've installed the LEDStripControl plugin, specified the GPIO pins, saved, and restarted the octopi server. I've also ensured that pigpiod is running, at boot (which allowed me to exec the color change commands above).

When I enter a M150 command, on the terminal in octoprint, I get:

Send: M150 R U B
Recv: ok
[...]
Send: M150 R255
Recv: ok
[...]

But the LEDs never turn on, change color, or what not.

To make matters more interesting, here's what I get in the octoprint.log for the above commands:

2017-03-31 19:23:27,880 - octoprint.util.comm - ERROR - Error while processing hook LEDStripControl for phase queuing and command M150 R U B:
Traceback (most recent call last):
  File "/home/pi/oprint/local/lib/python2.7/site-packages/OctoPrint-1.3.2-py2.7.egg/octoprint/util/comm.py", line 2138, in _process_command_phase
    hook_result = hook(self, phase, command, command_type, gcode)
  File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint_LEDStripControl/__init__.py", line 93, in HandleM150
    self._leds[l].ChangeDutyCycle(dutycycles[l])
AttributeError: 'NoneType' object has no attribute 'ChangeDutyCycle'
2017-03-31 19:23:33,162 - octoprint.util.comm - ERROR - Error while processing hook LEDStripControl for phase queuing and command M150 R255:
Traceback (most recent call last):
  File "/home/pi/oprint/local/lib/python2.7/site-packages/OctoPrint-1.3.2-py2.7.egg/octoprint/util/comm.py", line 2138, in _process_command_phase
    hook_result = hook(self, phase, command, command_type, gcode)
  File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint_LEDStripControl/__init__.py", line 93, in HandleM150
    self._leds[l].ChangeDutyCycle(dutycycles[l])
AttributeError: 'NoneType' object has no attribute 'ChangeDutyCycle'

Any suggestions?

Plug-in enables two lights per one M150 command

When entering the "M150" command 2 lights of the RGB lights come on. For example,

  • the command "M150 R" turns green lights on as well as the requested "R" red lights,

  • the command "M150 G" turns blue lights on as well as the request green lights,

  • the command "M150 B" turns on red lights as well as the requested blue lights.

  • the command "M150 R U B" turns all the lights off

  • finally the command "M150 R0", "M150 G0", or "M150 U0" turns on all lights making it appear white

I've tried uninstalling/reinstalling the plug-in to no notable change in the actions above and have verified pin location and even moved to other GPIO pins.

Use pigpiod is unchecked

cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

Octoprint 1.4.0
LED setup
12v led strip ran thru relays
All relays work fine with enclosure plug in but would have to be toggled on/off. But within this plugin, not so well.

Unable To Save Config Without Reboot Then Freeze

Hey,

Hoping to get some help, I just recently installed LedStripControl. Unfortunately I haven't been able to try it out due to flakiness.

installed from Octoprint plugin manager

Once installed, ill try to set the following pins in the config ui

8, 10, 12, 15

upon clicking save, the save spinner will just sit their spinning(waited up to 10 minutes), after forcing a reboot, I am greeted with a white screen when trying to boot into touchui.
52775035_480374016043983_1428692141978157056_n
53150246_669206073552110_8402197164855394304_n

I then went into the config.yaml and found the following config

LEDStripControl:
   _config_version: 2
   b: 12
   g: 10
   on_startup: false
   r: 8
   w: 15

I then removed the LEDStripControl config and performed a reboot which allowed Octoprint to boot normally but puts me right back to where I started.

Any help would be greatly appreciated

Raspberry Pi 3 B+, used Raspyberry Pi 7" touchscreen with TouchUI
Printer: Prusa i3 MK3
OctoPrint version : 1.3.10
OctoPi version : 0.15.1

adressable leds

hello,
first off thank you for this nice plugin.

is it possible to control addressable leds, especially ws2812(B)(/ws2811)?

thank you
c_ascha

Not an actual issue, more of a question.

Hey I LOVE the plugin!! Works very good. Here is something I'd like to implement: A loop that shows all colors in the RGB spectrum. Would this be something too implement in your plugin? Like a special m150 command or somthing. Or would this be something to use with a script?

add a button on octopi page to light on/off the led

hi,
it would be cool if we could light on/off the led (rgb or not) with a button on octopi, like that,
we turn on the led when we look the print with the camera and we can turn off the led after,
to consume less electricity.
thank you

Wrong link for pigpiod.

The pigpiod and document links, link to the wrong address you have "abyz.co.uk" it should be "abyz.me.uk"

Initialize led pins to low

Hello,

Looking at the code it appears the pins are initialize to HIGH. When I reboot my Raspberry and turn on the PSU, the light will be on. I would like them to be off, after all I need light only when it's dark.

Is it possible to add an option in the settings to let users decide wether they want the ligths on or off after a raspberry boot?

Not showin up in Plugins tab

Hi, i have following problem:
after successfully installing your plugin it does not show up in the plug-in tab to configure it.
Error message "A plugin was installed successfully, however it was impossible to detect which one. Please Restart OctoPrint to make sure everything will be registered properly" is displayed.
After the restart, it wont show up in plugin manager not the config tab.
please help :(

best regards
Jonny

Setup?

New to Octopi, is there a guide on how to set this up. Im just getting all white lights all the time. Never turns off after print is done. Also I think it would be really cool if you can choose colors based on a color wheel or pallet in the plugins.

M150 Codes Ignored By Terminal

I'm using Octoprint 1.3.9 on OctoPi 0.15.1. I don't have the box checked for Use pigpiod and pigpio is not installed. The pi user is in the gpio group and I'm using the physical pin numbering scheme (13 for red). When I enter M150 codes in the terminal I never get a response back, and the inputs never change. I don't see any errors in the log related to this. I did add the buttons suggested in #20 but they don't have any effect either. Any ideas on what to try next?

Feature Request: UI button to run M150 command

So far the plugin is working great, now that I've got it figured out!

Would it be possible to add a button or two to the main UI, perhaps in the nav-bar, to run a M150 command, and turn the lights on, or off? This assumes the plugin is working, as designed. Ideally you could configure what the button did; like button A = "M150 R U B" & B = "M150 R255", etc.

Additional GPIO control

Any chance we can get more than just three control points?
My MOSFET board has four mosfets for example..
Might be nice to control a fan, or other accessory.
Maybe offer 4-6 GPIO points?
I dont mind having to string them all in M150

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.