Help needed with PCB design based on existing project

OOPS. I put the wrong value in the numerator. It is R2/(R2+R3) = 220K/(220K+80K) so Vsensor * 0.7333.

And if we that the maximum sensor output to be Vcc = 5V then Vsensor maximum will be 3.66 Volts.

Cosmin posted some data two days ago, where it is indicated that the sensor voltage is 0,5-4,5V.
With the voltage divider 220/300 = 0,733 then the maximum sensor voltage of 4,5V will be precisely 3,3V which is the nominal maximum input voltage for the AD converter, like the microcontroller is set up according to the given schematic (AD ref = AVCC=3,3V).

The range 0,5 - 4,5V is intended to give you the opportunity for testing the integrity of the sensor loop (cabling etc.) by testing in software whether the sensor voltage is within this range (probably ok) or <0,5V (sensor not connected, short to ground) or >4,5V (short circuit to 5V or other higher voltage).
If you use the 82k resistor instead of 80k, the AD can measure up to 4,53V, and you can test for if AD value = 1023 -> fault. (You could do it with the 80k resistor too, but only if you don’t use the full range of the sensor.)
With the 82k resistor the conversion factor is 220/302 = 0,728476821…

1 Like

Hi guys

I know I haven’t posted in a long time beacause I’m caught up in some work projects and I haven’t had much free time… but, I still advanced with my little project, and unfortunately I got stuck at the end.
In the meantime, I set the exact size of the board as well as the exact position (wich are fixed) of the screw connectors so that it fits perfectly in a certain box. I tried to place the components in an order that made sense to me depending on which routes or other components.
So, I got stuck on the circuit tracks … under no circumstances did I manage to arrange them so that they didn’t overlap or intersect …
I know I’m asking you a lot, but maybe one of you has time to try, maybe you, the most experienced then me, will succeed.
Obviously, if you see any mistakes, small or large, please let me know, because I’m not a professional electronics technician and I may have made some mistakes.

Thank you in advance.

PCB.bmp (1.5 MB)
PCB.rar (540.9 KB)

I tried t have a look at your project, but pumped into some trouble quite quickly.
First thing is that you posted a .rar file.
My Linux box can sort of open it probably, but my first attempt got into trouble with “Archive Manager” (If that is the real name of that program). It keeps on extracting some file, and I stopped it after a few seconds when such a file reached 14GB.

I had some old memories of 7-zip so i did a quick:

paul@cezanne:~/documents/dagboek$ apt search 7zip
i   p7zip                                  - 7zr file archiver with high compression ratio   
i   p7zip-full                             - 7z and 7za file archivers with high compression 
p   p7zip-rar                              - non-free rar module for p7zip  `

So If I install that non-free module I may be able to extract your files.
However, it is not my problem.
If you want other people to look at your stuff, then don’t use proprietary software to share your stuff.
Rar is just a bad file format.

I could see the file names in your project. It is still a KiCad V5 project, and I do not have KiCad V5 anymore. About 60% of my interest in your project is to get some more hands-on expericence with KiCad V6, and I I use KiCad V6 then you can not open the project anymore in KiCad V5 because the file formats have changed.

I also see you archived some backup files. In some instances (for example during trouble shooting) this can be a good thing, but for “regular” work it’s a waste of disk space & bandwith. That does not matter much these days, but a cleaned-up project looks neater to share, it shows you have paid some attention to detail, and others have a better overview of your project quicker because it contains less files.

I also had a bit of fun with you PCB.bmp file.
I saved it as a .png and it shows how obsolete the .bmp file format is. In .png format your file is 37kB, which is 40 times smaller. It makes me wonder what kind of idiot ever thought that thinking up the bmp file format was a good idea. It’s probably some kind of multi billion dollar company that does not care about their customers.
It also renders directly if you drag it into an edit window.

Your footprint placement does look quite good, although I can not give a definitive answer without seeing the ratsnest. I think it’s doable to do this on a 2 layer PCB, although I can not make any promises. It also depends on the current handling for your relays, and how fat those tracks have to be.

Thank you for taking the time to take a look at my project. Regarding not cleaning back up files … I thought it might help.
Please tell me in what format to archive them, so that they can be used by others, because I archived them with what I had at hand without thinking too much about it … Not out of bad will but out of ignorance.

As for the Kicad V5 and V6, I think I could switch to V6 too, because it doesn’t hold anything to me related to V5. Honestly, the last time I checked, in December, the V6 was not officially released and I haven’t checked since. So, assuming most of you switched to V6, I’ll do the same.

KiCad V6 has been released into the wild last christmas.
Upgrading to KiCad V6 should be simple, but you do have to be aware that when you saved a project in KiCad V6, you can not open it in KiCad V5 anymore.

I think that after all these years, Zip is still the most widely used format for archiving. I think that 7zip does compress a bit better and has also been quite popular for a while (It was also much quicker then ZIP in the '90-ies) but zip has become the defacto standard. It is for example also used for epub files (very much resemplance to zipped html) and a lot of other file formats. For example LibreOffice and and FreeCAD uses it for their native file format. The KiCad Project manager also has the zip format built-in as it’s archive format.

So if you:

  1. Install KiCad V6, open your project in it.
  2. Look at it (verify) if it works.
  3. Save it (both schematic and PCB).
  4. Optionally weed through it a bit and do some cleanup.
  5. Zip the project.
  6. Post it again here.

… then I’ll have a look at it.
Do you have any special considerations? How much current do your relays need to be able to handle?
I also see a very small amount of room around your AMS1117. I don’t know how much power it’s going to dissipate, but these usually need a bit of copper around them as a heatsink.

I also see a DC-DC converter. Have you looked at it’s datasheet? These usually need extra electrolytics on both input and output to function properly.

My suggestion: use SMD elements. Hand soldering SMDs down to 0603 is easy. Also with small transistors (SOT23, SOT323) you will have no problem. Soldering SMDs is even easier than THT as you need not to have a control of both sides during soldering (there is no problem with THT resistors but when you came to BC547 you just can’t put your PCB at table and solder them.
SMD ICs with 1.27mm raster are also very easy to be hand soldered. I think TQFP with 0.8mm raster should also be no problem.
When you use such elements you start to place them exactly at the place it is needed without need for special order at PCB. And you will got lot more space at your PCB.

I mostly agree with using SMT, but for starters I recommend to not go below 0805 for resistors / capacitors. I also have no problem with 0603 and SOT23 but I do have some decent tools, mainly good tweezers, a stereo microscope and extra flux.

For this design though it does not matter much. Most of the parts are relays and connectors, and there are already two SMT parts (1117 voltage regulator and CC1101 module).

SMT resistors and capacitors do have a disadvantage too. The’re made of ceramic material and quite brittle. Especially with PCB’s such as this there is a chance they can break when the PCB is being bent while screwing in wires.

Updated to 6, opened the project without any problemes, saved it and .zip-ed it. :sweat_smile:
Relays must handle max. 10A.
“I also see a DC-DC converter. Have you looked at it’s datasheet? These usually need extra electrolytics on both input and output to function properly.” this one beats me! :rofl:
PCB.zip (652.4 KB)

What is this:

It looks like an input relay just to get galvanic isolation. Usually opto couplers are used for this.

But why the diode over the switch? Is the relay mirrored somehow?
As shown, then when the relay closes, it puts +5V on the base of the transistor, and the transistor will burn out.

To me it only makes sense if you both mirror the relay (so the coil is on the diode side and then swap pads 1 and 2 of the transistor, so the relay is controlled by the “REL.3” label and it has a 1k resistor to limit the base current of the transistor.

At the moment I would also swap pins 1 and 2 of those connectors, so they go straight to the relays on the PCB. Now you have crossed ratsnest lines.

With an: Eeschema / Tools / Update PCB from Schematic, KiCad complains about:

Warning: No net found for symbol J5 pin 5.
Warning: No net found for symbol J5 pin 6.

It would be a bit neater to use a 6-pin connector in the schematic for the LCD, and then also add two no-connects. But it’s a small thing.

I also see a bunch of messages like:

Reconnect U1 pin 38 from Net-(U1-Pad38) to unconnected-(U1-Pad38).
Reconnect U2 pin 6 from Net-(U2-Pad6) to unconnected-(U2-Pad6).
I’m guessing that KiCad V6 just uses another naming convention for single pin nets.

Same with messages like:

Reconnect K4 pin 1 from Net-(J14-Pad2) to Net-(K4-Pad1).
Reconnect J14 pin 2 from Net-(J14-Pad2) to Net-(K4-Pad1).
It’s the same connection but KiCad names the net differently.

You have not set up the net classes. Pcbnew / File / Board Setup / Design Rules / Net Classes It only has the “Default” netclass with default settings. I find 0.25mm tracks quite narrow, and have the tendency to make them as fat as will fit in between two IC pins. I’ve set both Clearance and Track Width to 0.3mm (Which is 11.81mils) This is probably more of a habit then really needed. I think most (all?) PCB manufacturers should be able to handle the defaults easily.

I see you left a copper track segment at pad 1 of D3 with a “predefined track width” of 0.5mm. Net classes work much better for defining track widths and clearances. Put some effort into learning how these work.

How much of the layout is “fixed”.
For Example I’ve turned some of the resistors R1, R2 R3 R7 a bit to make routing easier.
The location of J2 is unfortunate. It’s on the far West side and most of the tracks go all the way to the East side.

I’d also like to move some other of the small parts around a bit.
I’d also like to add at least three extra decoupling capacitors. One for the PCF8583 and one for each power pin of the ATmega1284.

  1. In the first phase I had another relay symbol and when I changed the relay symbol I did not check if the routes fit and because of this they are twisted.

  2. The copper route from D3 is not a reference, it is just something I forgot to remove.

  3. Regarding the display plug, I had also thought of using an IDC 2x3 plug and using only 4 pins, but I was still undecided and I left it at the end.

  4. The placement of the components is not fixed, except for the screw terminals and board size. You can rearrange them as you wish.

5.If you want, you can make changes or improvements as you wish, especially since it is seen from the plane that you are a professional.

PS: With the risk of repeating myself, I’m just getting started with electronics. I’m a construction engineer by profession … so I don’t have a solid theory base and that’s why there are mistakes in what I did.

Yes, I think is swaped because I changed the symbol and didn’t check it.
The 4 relays are output relays wich will control some pumps based on the sensors readings.

I had a little fun with your project:
The PCB now looks like:

It was quite easy to route.
The main change was probably moving connector J2 to the right side of the PCB.
As you can see, there are a lot of vertical tracks in the center of the PCB, and that connector would have to cross them all multiple times, and that would have made a big mess.
Footprint placement is a very important part of PCB design.

I do not know why you made a 4-layer PCB for this. Two is quite adequate.
Te back is a GND plane, with just a few short gaps.

You may want to make your GND plane smaller.
As a general rule, you filter the incoming voltage outside the GND plane, to keep the GND plane clean.
For the same reason you may also want to remove the GND plane around the relays. It’s not good to couple noise from the relay switching into your GND plane.

I just had some fun with this PCB, and it definitely is NOT ready to be sent out for production.
Some cleanup and a lot of verification and checking needs to be done for that.

I also made some additional notes in the schematic.

2022-01-29_PCB.zip (525.6 KB)

I did put a few hours into this.
If you think it’s worth something, then consider making a donation to KiCad.
https://donate.kicad.org/

2 Likes

Also, again: the Relays K4 through K7 really do like they’re connected backwards. Together with the faulty wiring of the transistors. I think I already mentioned that :thinking:

Your DC-DC converter links to a datasheet of the TMR1 from Tracopower.
The direct link does not work anymore, but I easily found a copy on some other site.
Here is what it suggests as input filter:

I am surprised a bit that they suggest an inductor straight at the input, instead of (also) a capacitor there.

I also read through most of this old post again.
Apparently you’re struggling quite a lot with PCB design, and this also shows in both the relays and transistors which are connected wrong and still need fixing.

In your first post you mentioned:

So I’m wondering what you consider a “fair price” as a donation to KiCad if I finish this design.

:blush: Easy for you to route. For me was a pain in the back door.

First time I made it with 2-layer but I couldn’t route all the circuits so I went for a 4-layer…

Can you tell more about what to verify before sending it to the manufacturer? Except the 4 relays wich are upside-down (wich a saw after you pointed it to me).

Definitely!

The relays I know how to wire them corectly, but as for the transistor…you got me again.

So it will work in the configuration from my eschema?

I say it again. Yes, if the price is OK, no problem. I will pay/donate without hesitation. But you have to name the price, because it’s your time and work.

There are capacitors at Vin and at Vout inside DCDC converter. That capacitors are enough big for current pulses needed by DCDC so there is no need for extra capacitor in paralel. But there are ripple voltage at them so filtering. Task is to not send that ripple to the rest of circuit.
When I used such DCDC I also filtered its output and added ferrite beads (in both + and - lines) to have them in serie with common mode noise.

I’m not interested in the money myself, unless it’s enough to buy a house (approx EUR350000) and that is why I asked for a donation to KiCad.

I can not put a number on it either. Money is a weird thing. EUR10 can be a lot of money for a student with some side jobs, while other people readily pay EUR 100 or more if it saves them from having to learn something that is not in any particular area of interest for them but they just want some result. It also depends a lot on which part of the world you live in, and what sort of career you’ve built up there.

If you want to do it properly, then a part of the process is to collect, read and understand all the datasheets of all the parts you are actually want to use.
For example, I’ve been reading through some datasheets as a result of Piotr’s post and verified that input capacitors are indeed “optional” and mostly for extra filtering and EMC. One of the datasheets mentioned that big output capacitors such as your 470uF can lead to starting problems.

Once I also salvaged unknown REED relays, and about half of them did not seem to work (I had 150 of them) Later I discovered they had freewheel diodes built in, which means the coil can not be reversed.
And there are many (hunderds?) of other small things.

I understood in the first time that you mentioned a donation for kicad and not for you personally. I asked you to say a sum, because you are the one who worked on my PCB, but I also understand your point of view.

Although I like electronics as a hobby and anyway I will try to learn as much as possible in my free time, I would prefer you to take care of the PCB further, to be sure that it will work and not be a fiasco.

I just made my first donation to Kicad and will continue to do so in the future.

Please help me with the PCB to the end, with what you advised me and with what you wrote me in the diagram and you can bet that I will make another donation to kicad. :blush: :crazy_face: