pcmanbob
Posts: 12843
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: GPIO relay signal cross

Sat Jun 02, 2018 2:25 am

No the uln2003 just provides a ground path.

So to test it connect on lead of your meter to 5v then connect the other to the out pin on the uln2003
Make sure you connect to the correct pin on the chip or you will damage your pi.

Now when you turn the gpio to high you should see the meter read 5v as the chip is providing the ground path with the gpio set to low your meter should read zero
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

bwertman
Posts: 89
Joined: Mon Nov 27, 2017 9:32 pm

Re: GPIO relay signal cross

Sat Jun 02, 2018 3:47 am

That reading moves between 4 and 4.85v when I toggle the signal.

pcmanbob
Posts: 12843
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: GPIO relay signal cross

Sat Jun 02, 2018 10:16 am

Try repeating the test with the relay board disconnected.

and while you are at it power the relay board with 5v and ground then try using a length of wire to first connect an In pin on the relay board to ground and then to 5v .

which one turns the relay on 5v or ground connected to the In pin ?
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

bwertman
Posts: 89
Joined: Mon Nov 27, 2017 9:32 pm

Re: GPIO relay signal cross

Sat Jun 02, 2018 2:00 pm

Repeating the test with the relay disconnected got me 5v for both gpio on and off.

I’m not certain how good of a measure it is but applying 5v and ground to the relay board did nothing, no lights. I backprobed vcc and gnd on the lead to the relay to pick those up. I confirmed I had 5v at the backprobe with my dvom.

Then I connected a jumper to 5v and gnd on my hat and confirmed 5v with the dvom again. Running ground to the relay in pin did nothing, no light, nor did 5v. But connecting the lead that I had backprobed earlier lit the relay and I heard both relays click. Makes no sense to me at all.

pcmanbob
Posts: 12843
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: GPIO relay signal cross

Sat Jun 02, 2018 4:44 pm

Repeating the test with the relay disconnected got me 5v for both gpio on and off.
Ok that suggests to me that yopur ULN2003 is damaged either by your mis-connection or by the fact you soldered it directly to the pcd, don't worry about that just yet.
I’m not certain how good of a measure it is but applying 5v and ground to the relay board did nothing, no lights. I backprobed vcc and gnd on the lead to the relay to pick those up. I confirmed I had 5v at the backprobe with my dvom.

Then I connected a jumper to 5v and gnd on my hat and confirmed 5v with the dvom again. Running ground to the relay in pin did nothing, no light, nor did 5v. But connecting the lead that I had backprobed earlier lit the relay and I heard both relays click. Makes no sense to me at all.
So yes apply 5v and ground to the broad will have just powered the on board electronics, no relay activated is correct so that's good, just leave them connected.

now what I really wanted to know is what did you connect to the IN pin to turn the relay on 5v or ground ? this is the important bit, it will tell me how your relay board is working.

sorry for all the questions but if I had you board in my hands it could do the testing in seconds but as I don't I have to ask you to do it hence the questions.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

bwertman
Posts: 89
Joined: Mon Nov 27, 2017 9:32 pm

Re: GPIO relay signal cross

Sat Jun 02, 2018 6:14 pm

I tried both 5v and gnd on the IN pin. Neither did anything. That's what had me so puzzled. When I connect the 4 pin lead from my pi that I had backfired to pick up 5v and gnd the relay lights up.

pcmanbob
Posts: 12843
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: GPIO relay signal cross

Sat Jun 02, 2018 6:24 pm

You must have done the test wrong because something is operating your relays.

Connect 5v and ground to the 5v and ground pins in the relay board then just connect a wire to one of the In pins then connect this wire to the 5v pin or the ground pin one of them will make the relay operate.

I suspect you will find ground will operate the relay.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

bwertman
Posts: 89
Joined: Mon Nov 27, 2017 9:32 pm

Re: GPIO relay signal cross

Sun Jun 03, 2018 6:12 pm

OK I must have not been making a good connection in my test yesterday morning. I went out this morning and bought a new set of Alligator clip test leads and retested. I was able to confirm what you said; after running 5v to vcc and gnd to gnd of the relay board if I apply gnd to the individual IN pins it actuates each relay and lights its LED.

pcmanbob
Posts: 12843
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: GPIO relay signal cross

Sun Jun 03, 2018 6:54 pm

Good so we know your relay board is good and active low and the pi gpio is ok so it ooks like the only thing you damaged was the ULN2003 chip.

So you need to replace the chip and connect it up correctly this time.

I would also suggest you use a socket to mount it that way you can solder the socket to your PCB without risk of damaging the chip.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

bwertman
Posts: 89
Joined: Mon Nov 27, 2017 9:32 pm

Re: GPIO relay signal cross

Sun Jun 03, 2018 7:09 pm

Cool, what do you mean by socket? Like a breadboard? Do you have a link to an example?

bwertman
Posts: 89
Joined: Mon Nov 27, 2017 9:32 pm

Re: GPIO relay signal cross

Sun Jun 03, 2018 7:19 pm

Nevermind I found some on Amazon. Shipping time is outrageous long though. I may try with one of the ULN2003A that I have, now that the wires are on the PCB correctly. Thanks again for your patience and helped I'll let you know if I get it working.

pcmanbob
Posts: 12843
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: GPIO relay signal cross

Sun Jun 03, 2018 8:44 pm

I don't know we're in the world you are but I often get electronics components from eBay here in the UK.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

bwertman
Posts: 89
Joined: Mon Nov 27, 2017 9:32 pm

Re: GPIO relay signal cross

Wed Jun 06, 2018 1:15 pm

As I began to solder the ULN2003A on my hat I could see some of the pin holes on the hat looked like they were not in the best condition. So I bought a new hat and some socket pins. I;
1) Soldered the socket pins to the breadboard section of the new hat
2) Removed the old ULN2003A and gpio wiring for the outputs and relay leads from my original hat
3) Re-soldered the gpio outputs and relay leads to the new hat to mirror how they were on the old hat.
4) Connected a new ULN2003A to the socket pins ensuring that the ground wire, along with my gpio inputs, were on the same side as the dimple with the ground write at the opposite end of the dimple.
5) Plugged the lead wires into the control side of their respective relay boards then powered up my RPi.

All relay LEDs lit up at boot. I tried passing on and off commands to one and it behaved the same as before, the LED went bright or dim depending on the command but no relay click could be heard.

bwertman
Posts: 89
Joined: Mon Nov 27, 2017 9:32 pm

Re: GPIO relay signal cross

Wed Jun 06, 2018 3:53 pm

Due to my urgency in needing to solve this I've cross linked this post to one I made earlier on Stack Exchange's Raspberry Pi Q&A site and offered a bounty of 100 reputation points. Here is a link to that post https://raspberrypi.stackexchange.com/q ... gnal-cross

bwertman
Posts: 89
Joined: Mon Nov 27, 2017 9:32 pm

Re: GPIO relay signal cross

Wed Jun 06, 2018 4:18 pm

I think I asked this earlier, but is a 5V external power supply necessary? As I have it wired now I'm sourcing 5V for the relay board from the 5V pins on my Raspberry Pi. This post seems to suggest that an external 5V power supply is needed. viewtopic.php?t=84337

pcmanbob
Posts: 12843
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: GPIO relay signal cross

Wed Jun 06, 2018 6:39 pm

By all means try an external 5v supply to power the relay boards. ( you might have to one to work powering it from the pi )

connect the 5v external supply to the common on the ULN2003 and the relay board , after disconnecting the 5v from the pi, leave the pi ground connected and add the external 5v ground to the same point.

one last this do you have the jumper in place on voc/vcc
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

bwertman
Posts: 89
Joined: Mon Nov 27, 2017 9:32 pm

Re: GPIO relay signal cross

Wed Jun 06, 2018 6:44 pm

What do you mean by jumper at voc/vcc? I don't think I have that.

bwertman
Posts: 89
Joined: Mon Nov 27, 2017 9:32 pm

Re: GPIO relay signal cross

Wed Jun 06, 2018 6:53 pm

You're talking about the VOC/VCC pins on the relay. Yes, the jumper is on those. They came that way and I didn't change it.

bwertman
Posts: 89
Joined: Mon Nov 27, 2017 9:32 pm

Re: GPIO relay signal cross

Thu Jun 07, 2018 3:19 pm

Can you tell me is the jumper needed or not? Here is an image with the relays and wiring as I have them now. I have also tried some changes to my code after seeing some issues that others had similar to mine. Basically instead of configuring the gpio as "out" it suggests to try to configure them as "high" or "low when you declare them. I'm linking to those posts as well.

https://github.com/fivdi/onoff/issues/102
https://github.com/fivdi/onoff/issues/57
piHat3.jpg
New Wiring w/ Darlington
piHat3.jpg (224.14 KiB) Viewed 2235 times

pcmanbob
Posts: 12843
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: GPIO relay signal cross

Thu Jun 07, 2018 7:29 pm

I still think you have your chip wrongly connected.

Image

so I rotated you image so that the u shaped cut out on the chip is at the top.

so it matches my original diagram

Image

so inputs are on the left ( gpio connect to here ) outputs are on the right ( relay boards connect to here).

you appear to have connected it the opposite way round, if I am reading you image right.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

bwertman
Posts: 89
Joined: Mon Nov 27, 2017 9:32 pm

Re: GPIO relay signal cross

Thu Jun 07, 2018 8:05 pm

I just checked I marked the dimple in the wrong end of the chip compared to where it actually is on on the Darlington soldered to my hat. The dimple is actually at the GPIO8 yellow wire at the top left of your flipped drawing.

bwertman
Posts: 89
Joined: Mon Nov 27, 2017 9:32 pm

Re: GPIO relay signal cross

Thu Jun 07, 2018 8:17 pm

piHat3.jpg
Corrected dimple location
piHat3.jpg (218.21 KiB) Viewed 2194 times

pcmanbob
Posts: 12843
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: GPIO relay signal cross

Fri Jun 08, 2018 2:05 pm

Now we know things are connected correctly
To answer your original question yes you need the jumper because you are only using one 5v supply.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

bwertman
Posts: 89
Joined: Mon Nov 27, 2017 9:32 pm

Re: GPIO relay signal cross

Fri Jun 08, 2018 3:02 pm

OK, so as far as wiring everything should be correct, right?

I did some voltage tests on the IN pins leading to the relay board with the plug disconnected from the board.

At boot I was seeing 600mv at the IN pin when actuated it moves between 900mv and 1.7mv. The 900mv seems low. I added details of the reading to my Stack Exchange post. You can see them there.

https://raspberrypi.stackexchange.com/q ... gton-added

I'm not sure where to go from here.

pcmanbob
Posts: 12843
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: GPIO relay signal cross

Fri Jun 08, 2018 7:35 pm

If this was my project would set up the uln2003 on a breadboard and use Dupont cables to connect it to the rely boards then using a 5v supply test the operation by hand just applying a 3v input on the relevant uln2003 inputs.

That way you can prove the chip can drive the relay boards.

Then add the pi to the setup and test again.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

Return to “Troubleshooting”