Advice regarding my Thermostat project

Hi,

I could use some advice regarding my project, I’m very new to Electronics and I am currently working on a mains (240v) thermostat to use with Home assistant.

I have created a schematic and a PCB layout, but being relatively new I could use a more experienced community eye, cast over my work. To my inexperienced eye, I believe that the only issue with my pcb layout is that I need to potentially increase the width of the traces on the AC side of the circuit before the AC/DC converter.

any advice and tips would be greatly received.

here is my schematic.

and here is my pcb

Also another possible issue I’ve noticed is that the display will only be slightly above the relay component.

I’ll upload a 3d viewer image when Kicad forums raise my trust level a little to allow more images.

Actually the current on the AC side will be lower due to the step down so you do not need to increase the current carrying capacity by increasing the width.

However as with all projects involving mains there is danger. In your place, I would use a wall wart to supply the power and not have mains at all on the PCB. If you must then pay attention to isolation. I don’t have mains on my PCBs so I will leave it to others more knowledgeable to comment.

2 Likes

Thank you for your reply,

so with my current thermostat, that isn’t a “smart” thermostat, its currently powered from the boiler i.e 240v in a wall back box, and then has dry contacts for the signal to turn on and off the boiler. I wanted to keep this thermostat of the same setup but with all safety measures such as a slow blow fuse with a MOV for the A/C side and thermal fuse for the converter. This can all be isolated safely by the boiler isolation switch.
Of course I completely understand something Ive built myself will not be safe to leave in place should I move out of my property, so I would remove it should this happen.

Actually the current on the AC side will be lower due to the step down so you do not need to increase the current carrying capacity by increasing the width.

should I not allow for any possible surges in current on the A/C side, even though the converter is very low amperage?

top image of 3d viewer

If you ever want to plug anything into the usb eg for reprogramming, that fuse position is going to be jolly annoying …

yeah it’s not ideal, however once the initial code is uploaded all code after is wireless via WiFi. However if all else fails I would probably de-solder the fuse, or maybe I could solder female headers to the PCB and male headers to the micro controller, so it can be easily removed.

Due to the height of the songle relay, I have quite a bit of space below the display. (unfortunately)

The main concern for the width is temperature rise of the copper. A temporary surge would not be a problem. Besides I would think SMPS modules have soft-start otherwise plugging in phone chargers would trip fuses. There’s a calculator in KiCad for width required for a given current and temperature rise.

1 Like

well I leaned something new today, thanks for the tip, much appreciated. I’ll have a look at the calculator and learn a bit more about it for potential new projects.

I would add some silkscreen markings on the PCB to make it clear which are main components.

There is a attention footprint which can also be added. Also add silkscreen dashed lines outlining the mains comp[onents. It’s too easy to touch something especially if you are relooking at this project in 6 months, 1 year and have forgotten what is live.

Puting the USB port close to a exposed mains fuse is asking for trouble. You might be inclined to just do a quick program update and forget to switch it off.

2 Likes

thanks for the advice, I like the ideal of highlighting the mains side components, I’ll have a look at how to add all these additions to the pcb.

as with all my micro controller projects with Home assistant and ESPHome, If I mess up the code and have to re-upload the code via usb again I would isolate from the mains and remove the PCB/micro-controller before ever connecting.
My light switches although “smart” (esp32 based) off the shelf devices, I would treat these the same and disconnect from mains, if I needed to re-upload the initial code again.

Rotating J1 & J2 by 90º would give enough room for you to move the fuse to the right. Or you could swap the positions of J1 &∨ J2 and the fuse. But maybe the positions of J1 / J2 are fixed.

Agree absolutely!

Sorry @Bulldog , but that is an appalling board layout. Far too dangerous.
If you absolutely must have mains on the board, then it should be all mains at one end of your conversion module, all low DC at the other end, and nothing in the “no mans land” in between the module in and out.

A few notes on the Schematic, to ease readability.
Convention is the input on the left reading across, like a book, not up and then across.
Mirror your power module so -ve is lower than +ve out. That way your Gnd points down and the 5V points up.
Mirror the transistor and place it under the relay, because it is switching to Gnd.
Place the diode parallel to the relay coil, to make it easier to understand its purpose.
I’d also place U1 above U2 and mirror the relay on the Y axis so J2 is under J5.

1 Like

so I have J1 and J2 on the reverse of the PCB along with Hi-link AC/DC converter and the thermal fuse. this is so that these bulking components fit within a standard UK electrical, wall backbox, (the 2 large holes are for securing the plastic casing to the backbox) but it is possible I could shift a few things around to allow more room on that side.

back view 3d model:

thanks for the advice, I will take your notes about my schematic on board and redesign my schematic and PCB to accommodate, bare in mind I’m not expecting this to be production ready and final, I have come here to learn and develop my knowledge first before settling on a final product design and have my PCB fabricated, I understand this is a long term, as in years project not a slap together and attach dangerously to mains hoping for the best type of thing.

1 Like

The board layout was JMHO.

The schematic should be drawn to make it easy to read, like a book. L to R, top to bottom (within reason).
The schematic should tell the story as simply as possible, not wander over the place.

Lowest potential at the bottom. ie, you don’t look up to see the ground. :grinning:

Edit: I’d also suggest removing the clip-in fuses and using solder to PCB types. They use far less real estate and are mechanically more reliable. Won’t come loose, start arcing in two years time and burn the house down.

2 Likes

And I appreciate your honesty, I’m not offended at all , just thought I should show that I’m very inexperienced and have come here to learn from a community with experience. I learn by doing , so this is my first time using software of this type and developing a PCB. The most I’ve done is basic prototyping.

I’ll start by redesigning my schematic and posting the update on here for review.

So about the fuses , the thermal fuse is a THT component but I couldn’t find a obvious component spacing , so I chose the fuse holder as the spacing would be the same. As for the other fuses , I was considering solder to PCB types especially sub miniature for size reasons, but worried that I would have to desolder if they blew. However I do value your recommendation.

When I was learning electronics everything was reversed - highest potential was at bottom at all transistor circuits schematics :slight_smile:

I agree with all comments regarding schematic being easier to read.
But…
What voltage and current is switched by K2.
Shouldn’t tracks connecting K2 with J2 be thicker and trying the preserve distance between them. K2 has big distances between pads, J2 has big distances between pads. But you having lot of space decided to route them not preserving that distance.

True, but if they blow there is probably a reason. I’d bet the soldering iron will have to be fired up for something else as well. :slightly_smiling_face:

Recognize the PTC fuse topic. You need not to desolder them if they blew. You only need to switch the power off and let them cool down.

@Piotr I was also looking into resettable fuses, but I couldn’t find much information with using them in conjunction with an MOV, but if this is acceptable in this use case, it might be the better route.

What voltage and current is switched by K2.
Shouldn’t tracks connecting K2 with J2 be thicker and trying the preserve distance between them

it wont be switching much current as the boiler requires dry contact switching to signal the boiler to turn on which I believe was up to 5 volts I think although the boiler documentation always suggests its “volt free”)

@jmk which solder to PCB fuses besides resettable could you recommend? looking on mouser.com I found a lot that were acceptable for the slow blow of the AC side and the quick blow of the DC side, at the required voltages and current ratings including “little fuse” sub miniature surface mounted options.