Jump to content
Ultimaker Community of 3D Printing Experts
  • Sign Up
alkekmakerspace

API and changing LED color

Recommended Posts

Posted · API and changing LED color

I have been attempting to change the color of the LEDs in my Ultimaker S5s using the API, but it never seems to work.

 

When I set anything other than 0 for h or s, it just dims the lights.

I get a 204 response code.

I can then do a GET request and it shows me the values that I just set, so I know the printer is getting the data.

 

Is this part of the API broken?

See code below that I found on the forum and changed a little.

 

def set_mainled(ip, h, s, v):
    api = initAPI(ip)

    # read the current LED status
    led = api.get("api/v1/printer/led").json()
    print ("current LED state: ",led)

    if h is None:
        h = led["hue"]
    if s is None:
        s = led["saturation"]
    if v is None:
        v = led["brightness"]

    # Change the LEDs
    print(api.put("api/v1/printer/led", data={"brightness": v, "saturation": s, "hue": h}))
    led = api.get("api/v1/printer/led").json()
    print("set LED state to: ",led)

 

Share this post


Link to post
Share on other sites
Posted · API and changing LED color

The S5 doesn't have color lights. The UM3 does. Since they share a codebase it's still in the API.

Share this post


Link to post
Share on other sites
Posted · API and changing LED color
3 hours ago, nallath said:

The S5 doesn't have color lights. The UM3 does. Since they share a codebase it's still in the API.

ahh I see. So all I can do on the S5 is change the brightness?

Share this post


Link to post
Share on other sites
Posted (edited) · API and changing LED color

yes 😞

 

I'm still a little sad colors got left out when we build the S5, I would have much preferred colors to indicate printer-state or allowing the user to set a color for the printer.

Edited by robinmdh
  • Like 1

Share this post


Link to post
Share on other sites
Posted · API and changing LED color
1 hour ago, robinmdh said:

yes 😞

 

I'm still a little sad colors got left out when we build the S5, I would have much preferred colors to indicate printer-state or allowing the user to set a color for the printer.

Would have been good if was color, so if eg a filament run out happened it would for eg flash an red color so it could be easy to spot. Could someone swap the led strip for a RGB one or is it a limit on the board?

  • Like 1

Share this post


Link to post
Share on other sites
Posted (edited) · API and changing LED color

 

2 hours ago, robinmdh said:

yes 😞

 

I'm still a little sad colors got left out when we build the S5, I would have much preferred colors to indicate printer-state or allowing the user to set a color for the printer.

27 minutes ago, Carla_Birch said:

Would have been good if was color, so if eg a filament run out happened it would for eg flash an red color so it could be easy to spot. Could someone swap the led strip for a RGB one or is it a limit on the board?

Yes that's exactly what I wanted to do. When a print finished, change to a certain color, when there was an error, change to another color, etc.

 

Edited by alkekmakerspace

Share this post


Link to post
Share on other sites
Posted (edited) · API and changing LED color
2 hours ago, alkekmakerspace said:

Yes that's exactly what I wanted to do. When a print finished, change to a certain color, when there was an error, change to another color, etc.

 

so did we when implementing the initial version of the digital factory, UX voted against this because it was harder to procure color LED strips that where properly white balanced so with the next printer they went with more consistent but only white LED's.

 

3 hours ago, Carla_Birch said:

Could someone swap the led strip for a RGB one or is it a limit on the board?

 

It depends a bit on if you have a S5 with A U on the side or with an ultibot on the side, if there's an ultibot on the side the connector exists and you can just connect the led strip, AFAIK. the connector is marked as P3 in the schematic, you would have to find a common anode RGBW led strip (4 chanels of RGBW and one for the positive voltage)

If you have an U on the side it gets more complicated:
So the led strip used I2C but sending commands to it would be disabled in the S5 firmware. look for the ledRGBWUpdate function in the marlin firmware, this part of the software is open source and you should be able to request a copy from support!
if you can get a similar PWM chip you could enable it https://github.com/Ultimaker/Ultimaker3/blob/master/PCB files/1548-I Ultimainboard/Schematics and layout pdf/Schematic Prints.PDF

shows we used a PCA9632DP2 IC. you can connect it to the I2C lines via the cables going to the flow sensor, but that would likely not do for the current/voltage you need.
Anyway this would require soldering, connecting IC's and some transistors etc.

TL;DR

Yes you can plug in a RGBW strip, but only if you have an ultibot on the side of your printer iso a big U.

 

Edited by robinmdh
added to the tl;dr and added quote of Carla's post, common anode not cathode... oops

Share this post


Link to post
Share on other sites
Posted · API and changing LED color
35 minutes ago, robinmdh said:

 

so did we when implementing the initial version of the digital factory, UX voted against this because it was harder to procure color LED strips that where properly white balanced so with the next printer they went with more consistent but only white LED's.

 

 

It depends a bit on if you have a S5 with A U on the side or with an ultibot on the side, if there's an ultibot on the side the connector exists and you can just connect the led strip, AFAIK. the connector is marked as P3 in the schematic, you would have to find a common anode RGBW led strip (4 chanels of RGBW and one for the positive voltage)

If you have an U on the side it gets more complicated:
So the led strip used I2C but sending commands to it would be disabled in the S5 firmware. look for the ledRGBWUpdate function in the marlin firmware, this part of the software is open source and you should be able to request a copy from support!
if you can get a similar PWM chip you could enable it https://github.com/Ultimaker/Ultimaker3/blob/master/PCB files/1548-I Ultimainboard/Schematics and layout pdf/Schematic Prints.PDF

shows we used a PCA9632DP2 IC. you can connect it to the I2C lines via the cables going to the flow sensor, but that would likely not do for the current/voltage you need.
Anyway this would require soldering, connecting IC's and some transistors etc.

TL;DR

Yes you can plug in a RGBW strip, but only if you have an ultibot on the side of your printer iso a big U.

 

Good to know. We are actually running 8 S5s with the ultibot logo. So it sounds like it might be possible to just swap the LEDs for my situation, but I'm not going to do that on relatively brand new machines. Does that then explain why the brightness of the lights changes when I attempt to change the H and S values via the API? Are those pins connected to different pins on the white LED strips?

Share this post


Link to post
Share on other sites
Posted (edited) · API and changing LED color
7 minutes ago, alkekmakerspace said:

Does that then explain why the brightness of the lights changes when I attempt to change the H and S values via the API? Are those pins connected to different pins on the white LED strips?

Yes, the API extracts the white component from the hue / saturation / brightness  and sends that to the white LED's allowing the RGB LED's to do less; So changing the saturation should have an effect on the white brightness, setting the hue should only have an effect if the saturation is not 100% or 0%, yes.

 

you do need 24V RGBW led strips like these: https://www.superbrightleds.com/moreinfo/flexible-led-strip-lights-color-changing/5m-rgbw-led-strip-light-color-changing-led-tape-light-12v24v-ip20/5151/?replacement=1572  Most stips I find are the individually addressable ones these days.

Edited by robinmdh
added link

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...