Case light over I2c PCA9685

I have an PCA9685 PWM Board connected over I2c on my Marlin Board. I use it to control a laser via PWM.
Now I would like to use it also for the case light but I don't know how I can do this. In the configuration I can't set the case light to an I2c Pin I think. Any ideas?? 

Best regards



  • Marlin board = using marlin firmware? Then no. You can add a gcode for it converting a variable to pwm frequency. But I think you will need to write some code.
  • Ups, no i was wrong. It is a melzi Board.

    I dont want an PWM Frequency, I want only switch it on and off, no need for dimming. But I want to use one of the PWM Output for the case light, because directly on the board there is no GPIO free to use it....
  • You can use any output as digital output, that is no problem even pwm pins:-) What does not work is using any pin as I2C or control a I2C device without writing some code. So if it is just a digital pin out put you need just use it as case light pin and it will switch 5V on/off for 20mA. Connect it to a mosfet for more power and different voltages.
  • edited April 2019
    do you use Repetier Firmware and the custom events example from github for the pca9685?
  • RAyWB said:
    do you use Repetier Firmware and the custom events example from github for the pca9685?
    Yes I do.
  • ok, so it´s simple.
    go to my github repository

    you can take the M42 section from custom mcodes

    pin numbers for the pca965 start at 200 for pin0 to 215 for pin16 of pca 9685.

    if you need assistance , let me know

  • Hello,
    thanks for that, i'll try it.
    But i wanted to have it integratet, so that i can use it from within the printer UI and directly from the repetier server menu, without adding extra Printer makro. I think this is not easy to do ?
  • if you give me your entire setup , i´ll give it a try.
    (you have the melzi board plus the pca 9685 board (which address?), something else on I2C ?
    shouldn´t be too complicated..
  • edited April 2019
    For me it would be more important to do from the Repetier Server than from the GUI, so I could simply rewrite the M355 Command, then i could use it with the Server but not from the GUI.

    If i'm not able to get it i'll come back to you, best regards.

  • edited April 2019
    for GUI it should be possible to use  EVENT_UI_OVERRIDE_EXECUTE to redefine UI_ACTION_LIGHTS_ONOFF
    see events.h

  • Okay, I managed to get it to work with rewriting the M355 command.
    Thanks for the help
Sign In or Register to comment.