Seeking help with project - a simple desktop trinket

Got it, makes sense.

I guess I should describe my project. It will be a simple street traffic light using red, green, and yellow LEDs. An ATmega328 will control lighting the LEDs and it will run off a 9v battery… It’s just a simple desktop trinket, while learning KiCad.

As previously mentioned, I’m basically copying an Adafruit design, but adapting it as I see fit. I’ve laid the parts out in Pcbnew, and I have a few questions about this part of the design process.

First is the concept of mounting holes for PCBs. I’ve looked this up and I kinda understand the way KiCad deals with them. I think I have mine defined correctly, but I’m curious as to how to delete the silkscreen label for the mounting hole in Pcbnew. I can move the part label around as desired, but can’t seem to be able to delete the label for a mounting hole. I guess I could move the label so it’s where the hole is, this way the label will be removed when the hole is drilled.

Also, do I need to set the grid origin for the PCB? I’ve generated the gerber files and drill files, looked at them in KiCad’s gerber viewer and also in Gerbv, and the files look good in both cases.

Here’s my current PCB layout:


If anyone notices any problems with my layout, please let me know!

I’m planning on having a PCB made for this and I already have almost all the parts to assemble this.

Thanks for any help,
Randy

.

Put your cursor over the hole. Press ‘E’ for edit, clear the checkmark called ‘Show’ on the layer ‘F.SilkS’. Click OK

One thing I found strange was how KiCad handled the pin headers. When I created the schematic, I added in 4 female connectors, the 2 horizontal ones at the top, and the 2 horizontal ones at the bottom, of the PCB in the previous post. I set those footprints to be 2.54mm pin headers, thinking that will give me female pin headers. When viewing the PCB in the 3d viewer, those ended up being male pin headers. I had to change the footprints from pin headers to pin sockets to get the correct style connector. Likewise, every connector I wanted to be a male pin header, ended up being a female pin socket, and I had to change those too.

Maybe it’s me being stupid, but to me there is 2 types of pin headers, male or female. I didn’t know of pin sockets until now. I found this a little confusing, but I can work with it.

Also, the 2.1mm barrel jack I’m using, or any of the others I looked at, didn’t have a proper 3d object. Viewing them in 3d just shows the copper pads, but not the actual part. I realize actual part dimensions can vary, but something in the 3d view is better than nothing.

Just a couple of random thoughts…
Randy

Any model included with KiCad has to meet the KiCad Library Convention (KLC), have a design attribution and be dimensionally accurate to avoid any nasty surprises.

You are free to duplicate any footprints into your own library and add a model. Many manufacturers allow you to download their models - but the manufacturer retains the copyright. The KiCad library maintainers are not permitted to include these in the distributed libraries.
There are plenty of 3d repos like grabCAD that have loads of models that you can use for your own use too.
If you design your own KLC compliant, dimensionally accurate model you can submit it( together with a datasheet) to the librarians for consideration for inclusion.

Samtec exists as long as I remember:
https://pl.mouser.com/datasheet/2/527/ces-1369975.pdf

This way I was designing PCBs in the late eighties.
Modern ICs are build with smaller and smaller technology (the smaller semiconductor area used - the cheaper production and competition needs it). The effect is smaller and smaller capacitance in circuit so the faster and faster slopes. Currently each product using digital IC you should consider having hi frequency technology onboard. Because of this it is very beneficial to have GND zone covering the entire bottom layer. Thanks to that each signal has as short return path as possible so the smallest area emitting and receiving disturbances.
So now my designs are 2-layer PCBs with whole bottom being GND (I use SMD elements). I add 47…100 ohm 0603 resistor in really each digital line (reduces current pulses in lines and in supply, costs zero, zero, nothing). Side effect of these resistors is that they help a lot to route all tracks at one layer left for me (top). If I have to cross tracks I prefer to use 0R resistor instead of breaking my GND zone.

As Piotr already mentioned, a PCB is not just a list of connections to make with narrow tracks.

The complete absence of a GND plane is the first thing that spind, but placement of decoupling capacitors is also far from optimal. To keep things simple concerning decoupling. Put a 100nF decoupling capactor physically close to each set of power pins of your microcontroller.

The voltage regulator U1 is also quite vulnerable. The TO220 package is designed to be screwed to a heat sink. In your case a heatsink is not needed, but it should not stick out of the PCB like that. You also have plenty of space to use for example “TO-220-3-Horizontal_TabDown” and then secure it to the PCB with an M3 screw.
Or use a “TabUp” version, then first screw a screw to the PCB with two nuts, then put on the voltage regulator and add a third nut. With “TabUp” you can even add a heatsink, but that is probably not needed for this PCB, unless both the input voltage is very high, and you also use it to feed external circuitry.

Your via’s are also pretty small. Although it’s less important now then it used to be, minimizing the amount of drill sizes still is a thing. Optimimum would be to use the same drill size for your via’s as you already use for THT parts.

I’ve also had problems with the power connection and nearby switching circuitry. Especially with hagogen lights with block transformers and the ballasts of flueroscent lighning. These generate spikes which often do not get filtered by your boards power supply and can cause (seemingly) random resets. The best remedy would be to put a filter in the power supply, but I find that any sort of inductor in the power supply helps to reduce or eliminate this problem.

Some time I interacted with another user and his first design.
You may get some good tips from reading that old thread:

Sorry, I’m a little late to the conversation. I’m still catching up from taking the first week of August off. :wink:

While, yes, you used the PWR_FLAG well enough to pass ERC. But I would argue that you are ignoring a potential documentation aspect of the PWR_FLAG. Using your example of the next paragraph that I didn’t quote, you placed the PWR_FLAG on the input of the regulator because the diode didn’t pass the properties of PWR_FLAG through. (Yes, that is a KiCad limitation, I’m not saying it isn’t.) But if you think of where power is coming from for the circuit, it is coming out of the diode. Thus I would have put that PWR_FLAG on the “output” (i…e. cathode) of the doide to document the source of power for not only the regulator, but also the two caps. This doesn’t change the netlist, but adds a level of documentation to your schematic.

Just IMHO, but something you may want to consider.

In another message:

I wouldn’t call you “stupid”, just inexperienced here. If you look at the end that you solder of pin headers and pin sockets (the pin headers are male, sockets are female, just a terminology thing) you would notice that the formed metal tab of the socket is significantly smaller than the square pin header. Thus it makes sense to actually use a smaller drill hole so you don’t both waste solder filling in the air gap in the THT, but also a closer fitting hole will help with alignment. This usually doesn’t matter, and I forget if the KiCad libraries use smaller drill holes for the pin sockets vs. pin headers.

But there is another type of header that you aren’t thinking about, probably because you just haven’t encountered them. Round, machined headers (and their accompanying machined sockets). (I’m mostly familiar with the Mill-Max brand.) Most hobbiests have likely not encountered them because they are significantly more expensive than the square headers and formed sockets that we all know and love(?). They offer a much more reliable and vibration resistant interconnect, but are way over engineered for most hobby use.

1 Like

Thanks for all the input!! I have read all the replies a few times to absorb all the info posted here.

I value all the advice on how to improve this, but at the end of the day, I just need to turn out a pcb that will work. As I mentioned, this is based on the Adafruit boarduino, which I assumed works. I say that because I bought one, but never assembled it, It’s in a box somewhere…

I could’ve sent this off and had a board made, but the OCD side of me said to add ground plane to it. So what is the workflow for doing this?

Let’s say the bottom of the board will be the ground plane. Do I route everything that isn’t ground on the front of the board, as much as I can, then fill in the ground plane area? Do I need to route ground traces? And is the ground plane created after all non-ground traces are routed? By that, I mean, can I create the ground plane, then define traces that won’t be connected to the ground plane and the ground plane will adjust itself. From what I have seen, the ground plane won’t change, so I’m thinking that is one of the last things I want to define/create.

Thanks for all advice,
Randy

In KiCad I add GND plane (at top) as my first step in designing PCB. I make it much bigger then my PCB to cover PCB and all elements that at the beginning are out of PCB.
All planes (including that GND plane) adjust themselves whenever you press hotkey ‘b’.
Thanks to that GND plane most GND connection line disappears and thanks to that I see only connections I have to route (as I plan to have GND at bottom all connections to GND will be just vias near the pad needing be connected to GND. Seeing only connection you need to do is very helpful during placement (I have to press ‘b’ frequently). You can imagine which way (staying only at top) you will route each track. For long connections I sometimes route them temporarily just to hide that line and help to imagine if others will be possible to route.
When I have most placement already done and start to route I add GND plane at bottom. It was not needed before as I use really only SMD elements. With SMD and THT elements I would probably start with placing top and bottom GND planes and with only THT elements I would probably start with only bottom GND plane. So really I use GND planes to hide GND connection lines. In V6 (it will be possible to hide specified nets) I will probably not start design with GND plane.
If you left both GND planes or only the bottom is your decision. I left both. Bottom is 100% plane (without openings) and each small part of my top GND is via-stitched to my bottom GND plane.

Thanks for the explanation on working with ground planes!

I’m glad I started over on the PCB routing! I think I have a much cleaner design now…

A ground plane on the bottom layer, and only 6 via’s needed. I used 1mm x 0.6mm via’s, as I understand it, it’s the most common size via.

I am open to all comments and I am still refining this. Up next, I will be working on silkscreen labels for connectors.

Thanks for all the comments & suggestions,
Randy

Does SW1 need to be in its current position? If it were moved to the right side of the board, it would simplify your routing significantly and allow you to have a much more intact ground plane.
You could also move R3 and use the space underneath it to run several tracks.

The “bus” between JD2 and IC1 can probably be moved to the front side if you just push some other tracks further from the way and maybe move some components a bit. That makes a big difference.

Smaller changes: wwap the places of UI and C3. Rotate C1 180 degrees and move R2 downwards.

Reducing the amount of vias isn’t a top priority. You can for example run the leftmost track from C1 in the top layer and change to the bottom layer only when it hits other tracks. Together with the JD2/IC1 connection on the top it gives continous bottom plane.

Thanks for all the replies!

I sent the files to Aisler for fabrication and got 3 boards made. I had all the parts needed to assemble the board, but forgot to get a socket for the ATMEGA328. So I ordered an IC socket and some other stuff from amazon. Once I got the socket, I assembled one board, everything fit and the board worked. I had some problems programming the board, but got that figured out.

While waiting on shipments, I went into KiCad and learned how to create my own symbols & footprints for an LED. I also took the 3d file for the LED into FreeCAD and changed the colors of the 3d object. I then created a schematic and PCB for the stop light portion of this project.

Here’s what I came up with:

12 LEDs, two groups of three giving me a 4 sided traffic light. Here’s a PCB view:

The idea is right hand connectors will make the long PCB stand up vertically from my home brew arduino. The three smaller boards connect with right angle connectors to each other and then to the long PCB, giving me a 4 sided traffic light. I didn’t spend time designing proper PCBs for this because I’m not having any made. Part of my amazon order included a pack of various sized double sided protoboards, I’ll just hardwire it together.

I welcome all thoughts and ideas,
Randy

Ehhh… I suppose that’s better than ordering from eBay. I don’t know if I would trust Amazon as a reliable vendor for things electronic. I usually go with the big 3 (DigiKey, Mouser, Newark not necessarily in that order) here in the states, occasionally from smaller electronics vendors (for example Jameco).

The problem I have (for myself, YMMV) with ordering something technical from Amazon is they usually don’t have any of the support documentation available, nor do you necessarily know what vendor you are getting your parts from through Amazon and counterfeit parts are a thing. At a previous job we got some counterfeit chips through DigiKey (or maybe Mouser? I forget the details) and they bent over backwards to remedy the issue and I got the impression (based on the forensic reports that they shared with us) that they were trying to figure out where the counterfeits came from. I doubt Amazon would put that much effort into policing the supply stream.

You sir, are correct. My amazon order was a 10 pack of 28-pin dip sockets, an assortment of colored 5mm LEDs, a pack of right angle pin headers, and an assortment of proto boards. The dip sockets are scrap. One had a mangled connector and the one I used, one of pins wanted to push up and out of the plastic socket as I inserted into the pcb. Haven’t looked at the LEDs or the headers. The proto boards are double sided PTH boards and are of good quality. Yes, it is a YMMV case with amazon & ebay.

The next part of the project is building a USB interface board for my home made arduino, so I can program directly from my pc, without using another arduino. Here’s my schematic:

and my PCB:

It’s all SMD because I have to learn to work with it. I have no experience with this stuff, so I choose larger footprint components. All parts for this was ordered from digikey.

I’ve been reading this thread:
https://forum.kicad.info/t/smd-assembly-hot-air-plate-or-oven/30716/16

I don’t have a hot air set up for this type of work, or an oven to use for this type of work. But I do have a clothes iron from another hobby, and a saute pan with sand is easy to do also…

Will update when I get results.

I’m open to any suggestions,
Randy

In my opinion good 2 layer SMD design has as continuous GND at bottom as possible.
For example - you could go with TXD and RXD on top without any vias by going under D2 and R1 (using 0805 case) to point only one.
If you really have to use bottom for tracks they should be as short as possible (Instead of jumping with track to bottom I use 0R in such cases).
And you should add (randomly at PCB) some more vias to connect top GND and bottom GND.

I keep repeating myself. Feels like a parrot.

One thing I notice that revolt_randy used 7805s, today I would use switching variant. Like for instance https://www.digikey.fi/product-detail/en/recom-power/R-78E5-0-0-5/945-1648-5-ND/2834904
They don’t get hot, but they don’t like reverse voltage, and they fit on the original 7805 footprint.
In my experience Arduino CPUs are quite tolerant about how power and those 100nFs are routed. I once forgot one power supply connection of Atmega2560, and board worked normally. But it is better to learn good habits now. One friend built a truly minimal STM32L00 CPU board and could leave out many of those capacitors, STM32L are not Arduinos of course.
If you live in Europe you could use https://www.tme.eu/fi/ too.

Edit: those Switching 7805 can be found on KiCad in DCDC library. But Kicad libraries are not too easy to search.

In my opinion it is possible to solder 0603 and larger SMD parts normally. Take soldering iron with small tip and thin solder. The CPU should be possible also. Look for shorts and unsoldered contacts.
With good tools It is possible to solder 100 pin CPUs.

Hey, thanks for the replies!

I ordered boards and a solder paste stencil from https://aisler.net/, because I’ve used them before, I like their pricing, and their support for FOSS. Parts & solder paste ordered from Digikey. Waiting on stuff to arrive…

I guess this is one area I haven’t thought of yet, routing under small components. Last PCB I had made, before this thread was started, used breakout boards. Sure, I routed traces under those boards, but never thought about under components.

After reading that remark, I read up on decoupling caps, they will be in the next design!

Thanks for pointing those out, I will look into them.

I think the Atmega328p used in Arduino’s will work with 3.3v-5v power, but don’t quote me on that… Very tolerant processor.

I wish I had good tools, or a budget for them. I went with bigger parts because I thought they would be easier to work with. I do need to be able to solder 100 pin CPUs, But I’m starting off small (with larger parts) to get the workflow down.

Anyway, thanks for the replies!

Randy