How does the Light On/Off control work?

Repetier said:
M42 can control pins directly. Some pins are prohibited (see pins.h bottom sensitive pins). For lights there is already a function to turn it on/off.
Where can I find some info for implementing this light function?  I am just setting up a new build running Repetier Server Pro 8.0? (an about button would be helpful here...) on a Raspberry Pi3 connected to a MKS SBASE V1.3 (Smoothie compatable - apparently).  I can see how I can configure one of the spare pins (e.g. P0.8) on the MKS board to use for this - but what commands (presumably G or M codes) does Repetier use for this function and what is the command syntax to use?

Comments

  • Support for lights is defined in the firmware configuration file. In install folder is a subfolder containing firmware definitions. Check repetier.xml and search for light to find the relevant parts.

    I don't know if smoothieware supports them and which commands get used then - don't have a smoothieware printer myself. But you can add the adopted commands from repetier.xml into smoothieware.xml especially:

        <command type="caseLightsOn">M355 S1</command>
        <command type="caseLightsOff">M355 S0</command>
        <response type="caseLights" value="1">^Info:Case lights on</response>
        <response type="caseLights" value="0">^Info:Case lights off</response>
        <response type="toggleLightsSupported">^Cap:TOGGLE_LIGHTS:(\d)</response>

    It might be thatsmoothieware does not return back such informations, then omit the settings. You need to restart server to take effect. Please report back if you find something that works, so I can add it in default firmware config.
  • OK, I think I'm starting to understand...  It seems your firmware is the only one to use the M355 command (according to RepRapWiki), so this is not directly supported in Smoothie firmware.  However, it seems like it will be an easy fix:  It is possible to define a switch module in the Smoothie config file, assign a pin to it, and specify the command(s) to turn it on or off.  It seems you can also define the response.

    The only problem seems to be that you have to define the output pin type: either digital (high/low) or  pwm (0 - 255).
    If set to digital you would need a different command for turning off (ie. M355 - turn on, M356 - turn off) or if you set it to pwm then to turn on the command would have to be M355 S255  (It would be nice to have dimmable lights )

    Could I just change the commands in smoothieware.xml to the following?
    <command type="caseLightsOn">M355 S255</command>
      <command type="caseLightsOff">M355 S0</command>
  • I will try it when I have some time & let you know if it worked.

    BTW - Thank you for your excellent software!  I've been using Reptier Host for years, but only just started playing around with the server on the Pi.  All your hard work is appreciated!
  • Yes, the idea of these firmware files is that we can have different solutions for the same target. You can even use a different M code if required.
  • Excellent!   Thank you ... Now I just need to figure out how to edit the file on the Pi ...  :-B
  • OK, I'm at my wits end here ... how do I edit the smoothieware.xml configuration file??  I know just about nothing when it comes to linux - but surely there should be a reasonably simple way to edit this file.

    From what I can see, this file is located inside another (.deb) file - which is presumably some sort of archive or bin container.  Using WinSCP I can see the .deb file, but opening it just gives me gibberish.  

    I installed the image to the sd card from the image download on the site, so I can't even get into that.... I really don't want to spend months trying to figure out linux just to get a simple function going - Please help!


    ~X(
  • Log in with ssh and enter
    sudo nano /usr/local/Repetier-Server/firmware/smoothieware.xml

    or use scp to copy the file. But since it is not owned by pi you may need to copy it before to a location you can read/write to do so.

    When changed just restart server
    sudo service RepetierServer restart

  • Thank you ... it's so easy when you know how!
  • Awesome - I just tested it and it works perfectly!!  From the web interface (console) I can even control the brightness as I have the leds on a pwm pin on the MKS SBASE board.  From the Pi's display of course I can only turn ON/OFF.  

    This is what I put in the Smoothie config:

    switch.caselights.enable                      true             #
    switch.caselights.input_on_command            M355_S255        #
    switch.caselights.input_off_command           M355_S0          #
    switch.caselights.output_pin                  3.25             #
    switch.caselights.output_type                 pwm              # pin mode
    switch.caselights.output_on_command       1                # lights on response
    switch.caselights.output_off_command       0                # lights off response

    I also modified the smoothieware.xml file on the Pi as per the above.

    It would be nice to be able to control the brightness from the Pi's display (like the Fan , Flow , Speed settings) ...
    ;)
  • I have a question about the pins that can be turned on. What is the output voltage? My LEDs are 12v, but don't the control boards output 5v? I have a Smoothie board (its actually a Re-ARM board with a RAMPS on top).
  • Pins on smoothie return 3.3V, 10-20mA. But if they are connected to a mosfet like fan/heater outputs they have the main voltage you deliver so 12/24V depending on what you use.
  • That's what I was thinking, thanks for the info!
Sign In or Register to comment.