Xlblaze
Posts: 5
Joined: Sun Feb 07, 2021 3:07 pm

PI Zero W - Hottub Controller - Help needed

Tue Jun 08, 2021 8:05 pm

I have a project I am working on, but so far I have destroyed 2 PI Zero W s so I would like some help figuring out where i am going wrong

I am 100% it is on my 230VAC / 12DC / 5DV conversion

I have a relay board already installed in the hottub that i am trying to use, and the relays need 12v to trigger hence why i need the 12v line

I have a converting the 230vAC mains to 12vdc
https://www.amazon.co.uk/gp/product/B07 ... UTF8&psc=1

and then a
https://www.amazon.co.uk/gp/product/B07 ... UTF8&psc=1
converting the 12v to 5v

I also have a MAX6675 connected to the PI

I am then using a ULN2003A (Darlington transistor array) with pins 1-7 connected to the outpins of the PI
PIN 9 going to the positive 12v and to the header for the relay board
PINS 10 - 16 going to the header for the relay board.
the first PI Zero W had pin 8 going to a ground pi on the PI
assuming this was my error for the 2nd one i put pin 8 to the negative 12v but this time i got mythical blue smoke from the ULN2003A and a 2nd dead pi

I haven't connected the relay board to the header yet.

Can anyone see what I am doing wrong or offer any advise?

Image

An for anyone that is wants to know i have coded a control script in python with a web front end the hope is i can get this in side the hottub next to the current relay board.

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

Re: PI Zero W - Hottub Controller - Help needed

Tue Jun 08, 2021 8:21 pm

Have you got a link to the relay board you are using ?

Then I can check your diagram as you will need a pi ground connection to the ULN2003A.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

Xlblaze
Posts: 5
Joined: Sun Feb 07, 2021 3:07 pm

Re: PI Zero W - Hottub Controller - Help needed

Tue Jun 08, 2021 8:36 pm

thanks for the quick response. its the really board that come with the old hot tub controller, so I don't have a spec sheet or diagram but I do have some photos from when it was last out of the hot tub I am not using the transformer from this board.

The output header from the board that is getting replaced
Image

Input to the relay board
Image

The Relays
Image

The whole board
Image

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

Re: PI Zero W - Hottub Controller - Help needed

Tue Jun 08, 2021 10:03 pm

So the unl2003a is already in the relay board in the hot tube controller ?

And you are trying to drive this using the gpio pins on your pi via the header you show in your first picture ?

Or are you replacing this board with a cheap relay board designed for use with the pi/Arduino ?
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

Xlblaze
Posts: 5
Joined: Sun Feb 07, 2021 3:07 pm

Re: PI Zero W - Hottub Controller - Help needed

Tue Jun 08, 2021 10:58 pm

Sorry I was unclear the first picture is the board that I am replacing, that is the current control board that drives the relay board.

the other 3 pictures are the relay board that i will be using.

The original control board had a unl2003a but i am not using that, that was just to show what i am trying to replicated/replace.

This the the board I am replacing, it contains a unl2003a and is connected to the relay board where I have highlighted.

Image

ghp
Posts: 1999
Joined: Wed Jun 12, 2013 12:41 pm
Location: Stuttgart Germany
Contact: Website

Re: PI Zero W - Hottub Controller - Help needed

Wed Jun 09, 2021 7:39 am

Think the GND connection of ULN to PI is missing in your description.

(1) you need to connect GND of ULN2003 to GND of PI. Do not break this connection while system in operation. Best case use a soldered connection.
(2) the relay current will flow through this wire. 70mA * 8, so ensure it is not too thin.
(3) here the relay current and pi power is flowing, ensure wire is not too thin.
(4) the input GND and output GND are connected according to the photo of the vendor.

I would propose to set up the system as drawn in the sketch: relay not yet connected; GPIO not yet connected to ULN2003.
There should be no blue smoke, pi should be up and running. If ULN gets hot check polarity of 12V on the chip and replace the chip.
You should measure the 12V between ULN2003 pin 8 and 9. This is important. The ULN will basically work when COM is not connected, but transistors can be destroyed when you operate a relay on output.

(5) use a LED with 1k resistor on the output of ULN. No light, no blue smoke expected.
Temporarily connect corresponding input of ULN (in the sketch pin 4) to 3V3 of pi. LED should light up.
Disconnect the input then.

Connect relais between VCC_12 and GND. Should switch. Disconnect. Should switch off.

(6) connect the relais. Light off, relay off.
Temporarily connect corresponding input of ULN (in the sketch pin 4) to 3V3 of pi. LED should light up. Relais should switch.
Disconnect the input then.

Then connect a GPIO of PI to ULN and run your code.
sketch.png
sketch.png (104.59 KiB) Viewed 502 times

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

Re: PI Zero W - Hottub Controller - Help needed

Wed Jun 09, 2021 8:34 am

Xlblaze wrote:
Tue Jun 08, 2021 10:58 pm
Sorry I was unclear the first picture is the board that I am replacing, that is the current control board that drives the relay board.

the other 3 pictures are the relay board that i will be using.

The original control board had a unl2003a but i am not using that, that was just to show what i am trying to replicated/replace.

This the the board I am replacing, it contains a unl2003a and is connected to the relay board where I have highlighted.

Image
So is this PCB shown that you are using to replace the other one something you designed yourself or something you purchased ?

because to safely connect a pi to it we really need to see a circuit diagram so we can understand how it works and what voltages are present were,

you might need to add isolation between the pi and the PCB to protect the pi gpio from voltages higher than 3.3V.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

Xlblaze
Posts: 5
Joined: Sun Feb 07, 2021 3:07 pm

Re: PI Zero W - Hottub Controller - Help needed

Wed Jun 16, 2021 6:57 pm

Thanks for the help

This is now working on the desk bread boarded with an led,
Image

next to run it from the actual output gpios my program uses and then to test it with the relay board.
I am going to get some reading from the input pins on the relay board just to be sure there is nothing funny there so I don't loose a 4th pi

I think I now know what I did wrong with the first PI.

Image

meaning any 12v current was having to pass through the PI to get to ground

the 2nd pi, I may have done a similar thing,
the 3rd i was stupid and touched a live wire to a gpio without thinking

so anyone got any use for 3 dead PI Zero W?

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

Re: PI Zero W - Hottub Controller - Help needed

Wed Jun 16, 2021 7:06 pm

As I said without more details about the relay board shown it's impossible to give exact advice, but if the board is using 12V I would suggest you use opto isolators between the pi gpio and the relay board.

Then you can totally isolated the pi 5V and ground from the relay board.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

drtechno
Posts: 261
Joined: Fri Apr 09, 2021 6:33 pm

Re: PI Zero W - Hottub Controller - Help needed

Sat Jun 19, 2021 12:10 am

The first thing I am going to tell you that your driver chip is not the greatest thing to interface with the pi. Because mosfets are what should be used. But its not impossible to get them working, but you need to use safety circuits to protect your pi.

Here is a method of implementing a safety circuit:

Image

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

Re: PI Zero W - Hottub Controller - Help needed

Sat Jun 19, 2021 8:43 am

drtechno wrote:
Sat Jun 19, 2021 12:10 am
The first thing I am going to tell you that your driver chip is not the greatest thing to interface with the pi. Because mosfets are what should be used. But its not impossible to get them working, but you need to use safety circuits to protect your pi.

Here is a method of implementing a safety circuit:

Image
The problem with using the ULN2003 is 2 fold .

1. You still have to have the 12V ground and the pi 5V ground connected together, this can cause problems as others have found when switching mains voltages on the same circuit board because of electrical noise being over laid on the 12V ground.

2. This only works if the relay driver circuit requires a ground to make it operate, looking at the picture of the board the OP is using it may well require a voltage to drive the inputs.

Either way the opto isolator can be used for both high and low driver and provides the full ( including ground ) isolation of the pi from the relay board.

As I have said before we really need a diagram of the board that the OP intends to connect the pi to so we can see how it works, as it is now we are just guessing which may very well end with yet another pi destroyed.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

drtechno
Posts: 261
Joined: Fri Apr 09, 2021 6:33 pm

Re: PI Zero W - Hottub Controller - Help needed

Sun Jun 20, 2021 4:45 am

pcmanbob wrote:
Sat Jun 19, 2021 8:43 am
The problem with using the ULN2003 is 2 fold .
1. You still have to have the 12V ground and the pi 5V ground connected together, this can cause problems as others have found when switching mains voltages on the same circuit board because of electrical noise being over laid on the 12V ground.
There shouldn't be any as looking at the led supply they are using is a double insulated switcher. If there is any noise, it could be mitigated with an external capacitor. I wouldn't even bother with using a uln2003 because the 12V is going to be present in the base circuit when its not in conduction. That is why he blew up one when he connected the uln2003 without the relays. Of course I have bought a tube of these chips before and had to throw some away because they were shorted. That is why I don't use that supplier much anymore (Jameco) because the date codes were old on top of this bad batch, which most likely the bought back from an assembler.

pcmanbob wrote:
Sat Jun 19, 2021 8:43 am
2. This only works if the relay driver circuit requires a ground to make it operate, looking at the picture of the board the OP is using it may well require a voltage to drive the inputs.
On a relay board like this with the pinout labeled this way, you supply the 12V to the vcc pin and ground the other pins to turn on the corresponding relay. Which he should have simulated this. And can do any time with a 12V supply or battery.
pcmanbob wrote:
Sat Jun 19, 2021 8:43 am
Either way the opto isolator can be used for both high and low driver and provides the full ( including ground ) isolation of the pi from the relay board.
You might be able to power a few optos however you really have to find ones that don't pull very much current considering the mosfets driving the gpio in the pi cpu are equivalent to the mosfets in a cd4050.
pcmanbob wrote:
Sat Jun 19, 2021 8:43 am
As I have said before we really need a diagram of the board that the OP intends to connect the pi to so we can see how it works, as it is now we are just guessing which may very well end with yet another pi destroyed.
yes he could, but even doing the live test on the relay board will get the characterization he would need to build the circuit. But its very apparent how this relay board works.
I would do this one since the relay is 75mA and a bs170 is a 500 mA relay driver mosfet:
Image

Return to “Other projects”