Sending RGB signals to LED source

  • Hi, I have a KRC4 Compact and want to send 'on / off' and 'change colour' instructions to a programmable LED.


    Hoping for some advice as I am pretty lost with it all.


    Arduino hardware seems pretty widely used in the use of programmable LEDs. I've read elsewhere on this forum that in order to send a signal from the KRC4 to Arduino I'd need an octocoupler to isolate the circuits. Can anyone verify this and / or recommend a suitable hardware setup?


    I think the bigger issue is the colour changing aspect. can anyone simplify in programming terms how to send an output signal from the KRC4 that will turn the LED on and change it to a specific colour?

  • AD
  • Most of the "programmable" LEDs rely on SPI communications, which uses some extensive Arduino libraries, which are not available for industrial robots.


    Establishing a serial connection from the robot to an Arduino could be difficult -- KRC4s don't have serial ports.


    OTOH, connecting normal I/O on the KRC (what I/O does your KRC have?) to the Arduino's I/O should be a simple matter of dealing with the voltage mismatch. Relays or a set of properly-wired transistors would do the job, but some properly-chosen optocouplers are probably the best and most reliable choice. Also the safest, almost eliminating the chance of a wiring mistake frying part of your hardware.


    At that point, you're using the Arduino as an intermediary -- the Arduino has the complex communication libraries for running the LEDs, and your application program "listens" to the GPIO inputs from the KRC and sends commands to the LEDs accordingly.


    It's a tad kludgey, but probably the approach with the lowest technical risk.

  • The krc is normally working with 24DC while the Arduino works with 5 VDC.

    Thanks for confirming - I think this is what the octocoupler is for that I mentioned in op. This github reop recommends it but I think the readme is incomplete - https://github.com/fablabbcn/KUKAIO


    I am more confused about how to send an output signal from the KRC4 that specifies a colour for the Arduino to send to the LED

  • Well, first, you have to determine what I/O your KRC has (and, in fact, what model KRC you have). KRC4s, for example, have no I/O by default -- it's entirely optional. KRC2s came with DeviceNet by default, but that still required adding DeviceNet slave nodes to the robot in order to break out the DN I/O into individual hardware signals.

  • Well, first, you have to determine what I/O your KRC has (and, in fact, what model KRC you have). KRC4s, for example, have no I/O by default -- it's entirely optional. KRC2s came with DeviceNet by default, but that still required adding DeviceNet slave nodes to the robot in order to break out the DN I/O into individual hardware signals.

    I have the KRC4 Compact RAL 7016

    IOs are Beckhoff EK1100, EL1809, and EL2809


    https://ibb.co/1Rp2FHW

    https://ibb.co/Jp34g02

    https://ibb.co/xg5dHzx

    Maybe you can use EK1100 EtherCat Coupler and EL6001 RS232 terminal from Beckhoff if you want the serial communcation from KRC4...


    I'm using just right now the EL6021 RS485 and sending and receiving data from and to PC(USB to Serial adapter)...


    https://www.beckhoff.com/EL6001/

    Thanks, I'll look into this

  • and what is the type of LED strip you are working with? what are electrical specs?

    I'm looking at this LED but open to other options, as long as it is bright (variable brightness preferred), and can change colour - https://www.adafruit.com/product/1260

    Specs are:


    • 0.5" (12.5mm) diameter circle PCB, 0.1" (2.5mm) total thickness
    • 800 KHz speed protocol
    • Chainable design
    • 5-9VDC power (can run at 3.5V but color will be dimmed), constant current 18.5mA per LED (~55mA max total per pixel)

    How many unused outputs do you have on those BL modules? How many different commands do you need to send from the KRC to the Arduino?

    As far as I can tell all of them are available - it looks like they lead to an X12 port on the exterior of the KRC4 Compact. Pic here - https://ibb.co/xg5dHzx

    I'd like to send as many commands as possible but happy to work with 16 if that's all the IO will allow.

    I gather I would have to set variables ahead of time in Arduino ahead of time for the colours I'd like to use, rather than send a signal that sets the LED to any of the 256*256*256 RGB colours spontaneously.

  • it all depends on what you really want to accomplish...

    there are LED strips for different voltages and using various type of LEDs.


    some LED strips are using communication to get individual LEDs programmed to particular color. in this case you will need something like an Arduino that can talk to them. driving them directly from KRC I/O is not going to work.


    but most of the RGB strips (cheaper ones) are bussed. this means that all LED segments of same color are grouped together. no individual LED control is possible, you control entire channel together and controller output need to be able to handle the current (the longer the strip, the more LEDS.... the more LEDs the more current). also they are designed for NPN, meaning that channel is lit when pulled low. note that KRC outputs are usually PNP style. this can be sorted out by using relay or suitably biased transistor per channel. optocouplers cannot handle much current, so it would need to their biffed up cousin SSR (solid state relay). or even regular electromechanical relay if you don't mind noise and slower switching speed. if using SSRs, read the specs and check voltage drop for example. if using electromechanical relays, also read specs and check switching time and wiping current.


    if you use this and simply wish to to turn on/off one of channels, this can be done directly from KRC, just need proper signal matching. using relay per channel will do just fine, so for RGB you would need three relays. for RGBW you would need 4 relays. nice thing about this is that relay contacts are isolated from KRC outputs so LED strip can be operating at any voltage, you just need separate power supply for it. you can turn more than one channel at once to get certain (fixed) color mix but... you cannot dial in arbitrary color. that would require PWM and robot outputs are not fast enough for making this flicker free.


    if you need to control the colors (get particular orange for example) or do animation (colors gradually change from one to another) you have no choice but using something that can ensure proper (sufficiently fast) timing. then the option of adding EtherCat shield to an Arduino is the way to go. KRC can specify whatever it wants and Arduino would receive signals and turn them into something that LED strips need - be it PWM, communication or just turning on/off.


    EDIT,


    just saw your response. to get color and brightness change you will need to use Arduino and EtherCat shield to interface this to a robot.

    1) read pinned topic: READ FIRST...

    2) if you have an issue with robot, post question in the correct forum section... do NOT contact me directly

    3) read 1 and 2

  • So, you have a KRC4 Compact with the X12 option, then?


    16 outputs -- how many GPIOs does your Arduino have? They come in different flavors.


    With 16 bits, you could encode 65535 different states. IIRC, the Arduino library for those LED strips uses 3 8bit values -- one each for the intensity of Red, Green, and Blue. So you'll have to lose some resolution, but that shouldn't be a big issue.


    Your Arduino program could, for example, monitor GPIO 1-5, and convert that into an 8bit Red value. Ditto for GPIO 6-10 for the Green, and GPIO 11-15 for the Blue. The math would be Color Intensity = GPIO Value / 31 * 255.

  • Thanks, this is useful though might take another read to fully get my head around.

    I actually emailed a couple of etherCAT shield manufacturers an hour ago for their advice on 1) wether it would work and 2) setup recommendations.


    For the moment I only need to use one LED so in this case would I get any benefit from using a SSR over an optocoupler?

  • So, you have a KRC4 Compact with the X12 option, then?


    16 outputs -- how many GPIOs does your Arduino have? They come in different flavors.


    With 16 bits, you could encode 65535 different states. IIRC, the Arduino library for those LED strips uses 3 8bit values -- one each for the intensity of Red, Green, and Blue. So you'll have to lose some resolution, but that shouldn't be a big issue.

    Yes, it came with a plug by pack kit for the X12

    I haven't bought the Arduino yet, do you have any recommendations?

    65535 should be plenty!


    Quote

    Your Arduino program could, for example, monitor GPIO 1-5, and convert that into an 8bit Red value. Ditto for GPIO 6-10 for the Green, and GPIO 11-15 for the Blue. The math would be Color Intensity = GPIO Value / 31 * 255.

    Thanks for this!

  • not bad... that would eliminate need for EtherCat shield but would still need interface from X12 to Arduino.

    if isolation is needed, bunch of optocouplers would be needed (and resistors).

    one can also transfer the color values one at a time to keep higher resolution and save on I/O

    For example use 8 bits for value and three more to identify RGB color...

    1) read pinned topic: READ FIRST...

    2) if you have an issue with robot, post question in the correct forum section... do NOT contact me directly

    3) read 1 and 2

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