Main Site Documentation

Another Relay x16 question


#1

This might not be the right forum for this but anyway:

I would like to control my LED strips, lamps, motors using either a switch or a relay (two control options - directly with switch or via touch screen & relay board on FEZ Spider) . I attached a schematic to show you how I have it wired right now and it’s not correct because when I press the switch (sometimes I have to do it couple of times) ALL relays come on on the board - yes all 16! This happens when using short cables from DC source. If I use long cables eg. 3m this does not happen and everything works as it should. Can anybody tell me what the hell is going on? :slight_smile:

Edit: All relays come on only if FEZ Spider is connected to relay board!

Thanks, Greg


#2

@ Hyperlisk - image is too low resolution to read.


#3

If you click on it… you’ll see :slight_smile:
And I don’t wanna use long cables - they won’t fit. Maybe should I reposition the switch?


#4

I feel like there’s something you’re not showing us. Can you tell if a high signal from the mainboard is turning on all the relays or is it coming from the relay module itself?

Is this only when you turn on the switch or all the time?


#5

Here are the 2 scenarios that happen:

  1. If I press the switch with my fingers ALL realys come on either after first press or 2 or 3.
  2. If I turn on relay1 (which is wired to same stuff as switch) sometimes also ALL relays come on. I have a simple code which goes through all the relays and turn them on and off one by one. It starts at relay1 and when turning it on sometimes all the relays flash (all relay leds are on and you can hear them) and when the loop goes further - relay 2,3…16 (these relays have nothing connected) - everything goes back to normal turning on and off one by one. When I repeat the loop same thing happens again.

I would say it’s the signal from mainboard because if I disconnect the Spider and press the switch million times relays stay off. Spider is powered from USB port.


#6

Sounds like it’s time to show us some code.


#7

Button is connected to port 8, Relay board to port 9. Code:


// This method is run when the mainboard is powered up or reset.   
        void ProgramStarted()
        {
            // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.
            Debug.Print("Program Started");
            button.ButtonPressed += new Button.ButtonEventHandler(button_ButtonPressed);
            
        }

        void button_ButtonPressed(Button sender, Button.ButtonState state)
        {
            for (int i = 0; i < 16; i++)
            {
                ushort relay = (ushort)System.Math.Pow(2, i);
                relayISOx16.EnableRelay(relay);
                Thread.Sleep(100);
                relayISOx16.DisableRelay(relay);
                Thread.Sleep(100);
            }
        }


#8

Yes and it seems fine for not connected relays 2-16. Still what bothers me is pressing the switch which has nothing to do with the code.


#9

It’s a microswitch - see attached picture.


#10

This switch should have the same function as relay. As I said in first post I want two independent control options - either via relay or via microswitch. Imagine this, user can touch on the touch screen to turn on the led strip or use simple arcade push button to do the same.

Relay has separate 12V input and on board voltage regulator steps that down to 5V which powers the relays - the coil inside and the shift registers. Everything else is 12V - LED strips, lamps and motors.


#11

@ Hyperlisk - I think something is screwy in your wiring. I’m not a EE, but your drawing looks fine to me. Can you simplify your setup and just put one light on one relay then try it? Then add one light on another relay and try it. Then add pieces one at a time until you can reproduce the problem.


#12

@ Hyperlisk - May youo redraw your schematic with conventional deign rules (showing coil and contact of your relay). Actually I don’t see why your input relay pin is connected to the ground of power supply.


#13

That’s a separate 12V input for Relay ISOx16 Module: https://www.ghielectronics.com/catalog/product/391

Each relay on the board has 3 pins. I have wires to pin1 and pin2 which get connected when relay is on. Pin3 is unused.

I did some testing as ianlee said and it actually works for small loads eg. LED strip, computer fan etc. As soon as I put anything bigger on it let’s say 12V 500mA motor all relays come on. I even changed my code so with button I turn on or turn off the relay 1 and after pressing the button all relays come on and when pressing it again they all turn off except relay1. If you press button for like 20 times it will work properly maybe once or twice.

I also discovered another thing - if I touch relay contacts with multimeter lead they all come on - for example if I touch relay2 middle contact with red multimeter probe. Can anybody tell me why is that?

I also did some testing with gadgeteer disconnected and if I connect pin1 with GND with some wire it comes on and it’s the only one that comes on so the relay board works ok. I would say it’s the shift registers added by GHI that are causing problems.

I tried multiple power supplies and it made no difference. I even tried with multiple power supplies - for the board and for the motors.

I thought Gadgeteer was supposed to be more like plug & play and now finding it the hard way I would say it’s more like plug & frustrate.


#14

Seems to me that the power source you’re using isn’t capable of the job. It might be causing noise on the line when you have a higher load, or it might be causing a voltage sag that’s causing other issues. You say you tried other power supplies, what other supplies were they, were they the same type as the other? Do you have a bench power supply or something with high current capacity? What current capacity is the existing supply? It could also be power from the Fez side not powering the control circuitry effectively, how are you powering that?

If this is the source of your problem, then this is an electrical problem, not Gadgeteer. The bad thing about this relay unit is it’s easy to use ! I say that because I can see it’s easy to get a situation where you can’t effectively power the loads you expect with an off-the-shelf power source.


#15

They click like crazy :slight_smile: I tried with two 3.5A power supplies and one 4A power supply. Fez is powered from USB. Tomorrow I’ll try with computer power supply. Will let you know how it goes.


#16

I agree with Brett. It sounds like a [lack of] power problem.

[quote=“Hyperlisk”]I also discovered another thing - if I touch relay contacts with multimeter lead they all come on - for example if I touch relay2 middle contact with red multimeter probe. Can anybody tell me why is that?
[/quote]

This is an interesting one… Was anything connected to the relays when you did this? Did you have your meter set to measure voltage or current?


#17

Yes, small computer fan was connected to it. Multimeter was set to measure voltage.
I tried with 600W computer power supply and it works ok for 90% of time. This is still unacceptable, I mean, 600W power supply for about 600mA of load? This is ridiculous.


#18

My 2 cents and im probably off base…

Since the module is using bit banging to simulate spi the spider is struggling.

i do the same thing on some of my spi led modules and spider ang G120 are not fast enough to bit bang and thr result is flickering…

so my guess is you will have better results with cerberus or rewrite the driver to use spi…

but like i said, prolly wrong :smiley:


#19

Well I’ve given up on this relay board and was thinking of desoldering the GHI shift registers and just use digital pins on the relay board directly. I need 7 relays only and maybe I could solder those to breakout module pins p3-p9 and pull lines high/low manually. Would that work?


#20

What exactly you want to achieve?
This should work but why the 100mS enable / disable cycles?
Relays are not designed to do this short pulses.