Hi - first post here!
I’m trying to create something called an arduinoboy (it’s a midi controller for making music with a gameboy). Going based off this schematic:
I believe I’m almost there, I think my schematic and pcb layout are good, but as this is my first KiCad project I’m looking for some reassurance, and/or pointing out of errors etc. Any feedback is appreciated really. Even as I managed to make it this far I still feel I have no idea what I’m doing here heh.
So here is my schematic:
And my layout:
I have the ground (-5v) as a filled zone on the second layer for now so that I could hide it to more easily see what traces I need to draw between the components, but I was wondering if there’s another way to get rid of the extra ground connection wires or to hide them? Also, I understand there is technically a difference, but for the purposes of something like this does it matter if I use -5v vs Gnd?
I am planning to power this from the J3 (1x5 connector), but added the +5v/-5v power input symbol (and footprint) as I thought it was probably necessary for the pcb layout. Is this maybe not necessary though? Or conversely a good idea, (and no harm to have it) in case I decide want to power it from elsewhere?
Sorry this post kind of bridges multiple categories (schematic, pcb layout, projects) - any help/feedback is really appreciated
Many bugs in the schematic.
U2 Pin 3 is unconnected
C2/C1 should be on either side of crystal
You have no -5V (it’s GND). You would have ±5 V if you had a bipolar supply (+5, GND, -5V). You have a unipolar one and this is typically called +5V/GND (or VCC if you want it more generic).
Also decide on one net label and stay with it (e.g. +5V and GND), don’t put multiple net labels on one net (e.g. VCC and +5 V)
You can hide GND in the net appearance panel (or color it differently).
You can rearrange the Atmega symbol to be like the one you are copying. That would make comparison simpler, plus, your layout could be a bit improved.
It’s been awhile since I’ve played around with Arduino, but, the original schematic D3 pin. Is that correct? That looks like it should be on the reset pin? I guess it is some code dependent thing?
I won’t fully review your schematic but, I see some problems.
Always best to use the Device’s Datasheet.
Assuming you’re using Atmel 328 (or 166 - same layout) see image below or search for one you like…
Use one that shows the Ports/Banks.
If you plan to have a Reset button, it goes to PC6. Example below
And the crystal should connect to pins 9 & 10
This looks like Vcc = 5V and GND = -5V, which would be a 10V power supply for the uC.
I am also missing some buffer and decoupling capacitors. In general, put a 100nF ceramic capaicitor on each set of power pins (one for pins 7 + 8, and a second for pins 20 + 22 (Where is pin 22?) (It’s probably a symbol from KiCad’s default libraries, with those “stacked” GND pins…)
A bigger buffer capacitor is also important to decouple the power for the on board circuitry from the (probably) of-board power supply. Something like an 10uF electrolytic is probably sufficient. Adding an inductor or ferrite bead in the power supply also makes the circuitry more robust.
When designing a PCB for an atmega, I also always add a programming connector, and it’s wiring.
Thanks so much everyone - this is all super helpful.
@Martinn I fixed the bugs you pointed out. For the power could I just remove the +5v and -5v, leaving the connector directly attached to VCC and GND?
@hermit the button is a mode button so yes I think it’s software dependent, in this case there’d be no reset (although now that you mention, maybe it’s a good idea and I may decide to add one).
@BlackCoffee thanks - I need to become more familiar with reading datasheets, and plan to spend some time with my arduino uno learning more basics after I finish this project
@Raptor - thank you v much, I missed way more things here than I was expecting.
@paulvdh - WHERE IS PIN 22?! Is this a problem I need to solve or is it ok since the chip is grounded via pin 8? I’m not sure what you mean about the “stacked” GND pins from the default libraries… do I need to add something? Just checked and pin 22 is present in the layout, so it must be there (perhaps “stacked” under pin 8, if that’s what you meant?).
Thank you all so much for your help with this!
Electronics is an area where all those small details matter. You made a lot of (simple) mistakes in copying this circuit and putting it in KiCad, and that is OK, we all had to start somewhere. But you will have to learn to pay more attention to details, with just copying you will not get very far in electronics. You also have to grow knowledge about why things are connected the way they are, and takes effort, knowledge and time to grow them.
Learning how to handle the (sometimes many hundreds (or even thousands) of pages) of datasheets effectively is also part of that. The datasheet of the atmega328 is still quite manageable. And yes, it is important to connect all the GND pins, (And add decoupling capacitors).
You can use the highlight function or watch the ratsnest lines to see whether KiCad knows that pin has to be connected to GND. And it is indeed how pin stacking works. You can see this when you open the symbol in the symbol editor. There will be multiple pins in the same location, and all except one will be set to “hidden” so you do not see them in the schematic symbol itself.
Yes, just pick one net for supply and ground. VCC and GND is OK, personally I’d use +5V and GND as this is a 5 V design and you might as well make it obvious.
To more cosmetic details: A schematic is not (only) a netlist establishing the connections, a viewer should also understand quickly what’s going on. Your schematic is quite OK, some details:
Line from PD3 to SW1: Don’t draw wires across components. It’ll work, but I’d consider that bad practise.
Clean up the placement of component labels (reference designator, e.g. R1) and values. Most are drawn over a wire or otherwise collide with something. Might get difficult when there’s not much space (like LEDs and resistors) - make space by expanding the schematic and rearrange the labels. Hint: You can place refdes or value (R1 or 2k) inside a resistor rectangle, saving space. Whether you like that or not is a matter of personal taste.
Thanks I appreciate the advice to check pin 22 in the ratsnest. It is indeed connected to gnd. I’ve taken some of your advice on adding the bypass caps. Hoping this all looks good now and the only thing left to do is clean up the pcb layout
@Martinn also cleaned up the component labels as suggested. Thanks for that.
In KiCad 5 (I’m on an older computer) I’m not finding where to hide the GND in the net appearance panel, or to color differently. Is there any reason not to just use another layer and keep it hidden while I arrange the parts on the main layer? That would seem easiest way to move things around without getting confused by the extra lines…
I believe this feature appeared with KiCad 7, along with the curved netlines.
Realizing that as a novice this isn’t the most beautiful layout ever. Does this look as though it should work though? Any novice mistakes I’m making? Note the ground is a separate layer and hidden.
I noticed the power trace is a lot thicker in the pcb I’ve based this on. Any reason I should do that, or make a power plane rather than just regular trace?
Also the midi DIN connectors that need to be at the edge of the board, anything to remember/watch out for to make sure they line up properly with the edge?
Thanks again for the help!
The decoupling caps (C3/C4) must be as close to the power pins as possible.
SMT would be better, but a properly placed THT should work as well.
Same for crystal. Google “atmega crystal pcb layout” to see how it’s done.
Be careful with ground fill around the crystal lines, this will increase the load capacitance, especially for long tracks.
Put a GND test point near the crystal so you can ground its can, otherwise it’s a huge antenna.
Note that selecting a proper crystal/load cap setting is nontrivial, it might not oscillate or fail later due to overload. Relevant for production mainly - don’t worry, just for your information.
Use thicker tracks for power (why not 1-2 mm if space permits). Or use bottom GND fill and top VCC.
Make your silk screen so it helps you assemble/debug. It’s free! Move designators so you can read them, Maybe add some text in readable size to connectors, pins…
Bigger pads and attached tracks to footprints for mechanical components. ie. the switch and all the sockets. After 12 months of use those pads and tracks will probably break from the PCB otherwise.
In fact, bigger tracks everywhere. You’ve paid for the copper, might as well keep some.
There seems to be a white track between pin 16 IC1 & R3. Is that correct?
Is there an outline on the PCB? (Draw a graphic rectangle on the Edge.Cuts layer). Maybe add some mounting holes too?
Swap the “22” (22nF?) capacitor footprints for the crystal for footprints for ceramic caps. These are also available in 2.54mm pitch and 5.08mm. Make sure you have the right footprints before you order the PCB.
Remove those stupid angled lines from your PBx pins to resistors in your (revised) schematic.
Use 90deg lines or labels. If you HAVE to use angled lines for some reason then they ALL should be 45deg.
Clearly you are a novice, which is fine, but to me you seem to be running before you can walk. Using a program like KiCAD is the end point of lots of research, design and hand scribbled notes. And that’s before the complexities and idiosyncrasies of laying out a PCB.
Read Paul’s reply above again and really take it onboard. When you do your research and have looked over many circuit diagrams and datasheet recommendations etc you will start to pick up what a good schematic is.
Anyway, like I said, I think you’re trying to use an EDA at the wrong time in your learning of electronics, so you will end very frustrated when things don’t work as expected and you don’t know why.
Breadboards are your friend atm using them will teach you SO much AND the circuit can be changed as necessary without having to make, pay and wait for another PCB to arrive from your fab house
I’ve tried to address everyone’s suggestions here.
@paulvdh I wasn’t sure about the footprint change so I changed one of the crystal caps - is this better? If so I’ll change the other one to match. Does it cause problem with the circuit to have improper footprint or is it just bad design? Of course I understand design is important as it can lead to mistakes with assembly if the design is unclear!
The only other question I have is for my power - the 5v is sometimes going to be supplied by J4 (via a usb - I may switch this component…). But at others it will be supplied via J3 (sharing battery power from another device). Do I need some sort of a switch to ensure the batteries aren’t being used when I use the usb power?
@Martinn - not sure what you mean about putting a GND test point to ground its can. Could you elaborate? I believe it’s currently grounded via the gnd plane, and I’m not sure how I would remove that connection to make a separate one for it, but also not sure if I’m misunderstanding…
Thanks again to everyone for the generous help/suggestions. I’m of course going to fill in the rest of the traces and silk screen but I’ve been staring at this too long for right now
Crystal placement is OK, wiring is not. Avoid those J loops and connect crystal to oscillator pins as short as possible. Maybe look here:
Watch the plane fill spacing if you do a top side fill (not necessary, bottom fill is plenty).
Crystal GND: Currently as drawn the crystal metal case is not grounded. For a small crystal, this is probably OK so don’t worry too much. A metal can can both emit noise and act as an antenna, picking up disturbances. So in old school designs one would see the crystal laid flat on the PCB with a wire loop over it, soldered to GND. As I said, just for your information.
But the crystal is not, as you state, connected to GND. Even if you fill the top side with GND, there would be the top solder mask isolating it. And even if you remove the top solder mask there, you could not rely on the crystal housing making contact (might be intermittent if at all).
A few tips on schematic standards which makes things a lot easier to read, or when you relook at the schematic in 6 months time and wonder what you have done.
VCC (And postitive power) symbols generally always point up, and GND points down.
Add k or R notations to your resistor values so you know exactly the values. ie 2k for 2000 ohms, or 68R for 68 ohms.
Also cosmetic, but again makes it easier to read. J4, rotate it 180 so that wires are not looped.
Reset will also need a 10k pullup to Vcc.
You can also use c_small for smaller cap symbols.