8 years, 6 months ago.

Ledwiz Output change default voltage level

Hi, and thanks for your fantastic job,

I'm wondering if it was possible to configure the defaut ledwiz Output voltage level. It's because I'm using low level relays to control my toys and by default each relay is open when the KL25 is plugged to the USB port.

Maybe in a configuration file on the card or directly in the config.h file by adding a field to the struct "ledWizPortMap" to set the default voltage level "High or Low" (and the rebuild the firmware).

I hope my question is clear, thank you for reading it.

Trjalm

Question relating to:

An input/output controller for virtual pinball machines, with plunger position tracking, accelerometer-based nudge sensing, button input encoding, and feedback device control.

I think this is the schematic: http://i01.i.aliimg.com/img/pb/929/747/435/435747929_674.jpg Seems like a nice option to directly connect it to the TLC5940.

BTW the relays have two outputs, can't you simply use the inverted one?

posted by Markus Kalkbrenner 11 Oct 2015

Hi Markus, I've done this, but when a knocker is connected to the relay and the kl25 is not powered the knocker is always activated. It's not a problem for a LED but for a coil... :-(

posted by Trj alm 12 Oct 2015

1 Answer

8 years, 6 months ago.

Hi - that would probably be doable, but before looking into that, let me ask: how are you planning to wire the relays to the KL25Z? The KL25Z GPIO ports can't generate enough current to drive even the smallest relay coil directly - each GPIO port is limited to 4mA, and small relay coils are usually around 100mA. If you're using a relay board that has some driver electronics built in to allow triggering on such small signals, that should be okay, but definitely don't try to hook up your relay coils directly to the GPIO pins or you'll damage the KL25Z. If you don't already have some driver electronics as part of the relay board you're using, then you're going to have to build something with a transistor, in which case you'll probably be able to work with the current high/low signal levels directly. And if you do build a transistor circuit, I'd recommend just ditching the relays and using the MOSFET circuit in the build guide - it's simple and cheap (cheaper than relays) and will handle high-current devices without relays or any other extra parts.

Regards, Mike

Accepted Answer

Thanks for you answer, maybe you can help me to create my own version of you firmware if it's not a priority for you to modify your version.

The relay is a cheap relay that you can found on Ebay (for ex : http://www.ebay.com/itm/5V-Four-4-Channel-Relay-Module-With-optocoupler-For-PIC-AVR-DSP-ARM-Arduino-8051-/310574401892?hash=item484fad4964) the voltage is taken from the 5v output of the kl25 board. I'm actually using this relay and everything is fine but my problem is only the inversion of the high an low level.

Thanks again.

posted by Trj alm 09 Oct 2015

Do you happen to have schematics for that board? From what I can see on the eBay page, I'm still a little concerned about over-driving the KL25Z outputs. It looks to me like the controller board GPIO pin is meant to drive an opto, which usually takes about 20mA. If you don't have a schematic for the relay board, you might want to connect an ammeter and see what it's actually drawing. The KL25Z GPIO pins are rated for 4mA source or sink, so running 20mA through them might eventually fry the board.

Anyway, I'll take a look at adding an Active-Low option to the config. In the meantime, you can make a custom version with a little change to the LwPwmOut and LwDigOut classes. Change their set() methods by adding a line saying "val = 1 - val;" at the beginning of each one, like this:

    virtual void set(float val) 
    { 
        val = 1 - val;
        // leave the rest of the existing method the same as it was
    }

That'll change a 1 into a 0 and a 0 into a 1 each time an output is updated, effectively reversing the voltage levels for "on" and "off".

Regards, Mike

posted by Mike R 09 Oct 2015

Thanks, I'll try that sooner !

posted by Trj alm 10 Oct 2015