4
\$\begingroup\$

First things first, this is the schematic I'm following.

Now, as for the intent of this design.

The idea is simple, create a prototype for an electronic candle that uses PWM LEDs to create the illusion of a flickering flame. Additionally, the prototype will have a screen where it will display the current time, the time elapsed since it was turned on, and the time remaining before it shuts down on its own (this can be modified by the user). To assist in manipulating the clock and the timer, there are five push-down buttons available: left, right, menu/enter (it changes if you're already in the menu), return and on/off. The crystal oscillator is there to provide greater accuracy compared to the ATMEGA328P-PU's internal oscillator.

Regarding the reason I'm making this query, take a look at the following design:

I created this design as a draft of the PCB I will be (hopefully) commissioning in the near future. The reason it's a draft is mostly due to the fact that I possess none of the components shown herein, which means I'm putting the cart before the horse. I believe I can benefit from this design notwithstanding. So, I would appreciate it if you could point out any mistakes from the most glaring to the subtlest ones.

\$\endgroup\$
1
  • \$\begingroup\$ Comments are not for extended discussion; this conversation has been moved to chat. \$\endgroup\$
    – Voltage Spike
    Oct 14, 2022 at 5:29

4 Answers 4

4
\$\begingroup\$

The other answers are good but focus on improving a working circuit.

I will list things here what needs fixing before it even has a chance to work at all or in a stable fashion.

  • Not all MCU power supply and ground pins are connected. Half of MCU internals are missing power. Connect them.

  • No bypass caps at the MCU supply pins. Add them.

  • Reset pin has no connection. It should still work, but please use manufacturer suggested connection for stable operation.

  • The AVR runs at 16 MHz only when supply voltage is 4.5V or above. If you intend to use a 4.5V battery, please understand that the AVR does not need to work at all after battery voltage has dropped below 4.5V. Either change supply to be higher than 4.5V or lower the frequency.

The datasheet and hardware design considerations can be consulted how to fix these.

\$\endgroup\$
2
\$\begingroup\$

One of the best improvements would be to place a full ground plane on one side, (often called a Pour). With a full ground plane all of your separate ground traces go away, all that is needed is a pad or a via and you have a ground. Once you eliminate all the ground traces you'll have a many ways to simplify the rest of layout, the board could likely even be made 30% or 40% smaller.

If you're not mounting the LED's and switches on the board (you don't show any silk screen shapes) it is usually better to bring most external connections to the edge of the PCB. That way you will not have wires running to the middle of the board making assembly and board mounting more difficult.

Revise the push button function to be a momentary short to ground, (detect a low signal instead of a high). That way you could make use the internal pull up resistors of the ATMEGA I/O pins. That change would eliminate the need for the five 450 ohm resistors.

If you don't required the LED connections to be on the left side: You could move the crystal downward and closer to the ATMEGA chip, then move the LED connections and associated resistors to the right side top corner of the board. Bring the LCD data connections to the right. Those changes could help reduce the board size significantly, (eliminates much of the needed space to the left of the ATMEGA chip).

Place mounting holes where needed early in the PCB design. Doing this early reduces the potential problems of having to move components or traces later that wind up being too close to screw heads or mounting bosses.

If at all possible, try not to mix SMD and through hole components on the same board, (for eg. caps on the crystal pins). If being made by an outside vendor this adds extra steps and costs. Even if being made by hand this adds difficulty and requires extra tools.

Keep trace to trace connections at 90 degrees angles or greater. Tight angle connections tend to be less reliable and sometimes do not etch well.

When making a trace connection to an IC initially try to run the trace straight away (at 90 degrees). This gives more clearance in case you need to run a new trace between the IC pins later.

As in other comments, it is best to add one or more by-pass caps on the ATMEGA power pins (VCC to GND), this should be placed as close as possible to the pins. With that said, if you are going to use a socket for the ATMEGA try to add the correct size outline around the existing chip graphic. That way you will know how close other components can be placed at the sides of the chip.

Many of the other comments have very good advice, be sure to review them all.

Best of luck with your design.

\$\endgroup\$
1
  • \$\begingroup\$ @Ismael - I think you had commented that you didn't know how to add a ground plane. In Proteus it seems that the copper pour function is known as a Power Plane and is found under the menu: Tools - Power Plane Generator. Here is a video on performing the function: labcenter.com/powerplanes \$\endgroup\$
    – Nedd
    Oct 14, 2022 at 8:57
1
\$\begingroup\$

The first thing to do is remember that traces have resistance and inductance. The smaller you make the traces the more resistance and inductance you will have. You can calculate this with tools available if you know the trace within the length.

It's usually a bad idea to have a ground that is a single trace because it would add a small resistor and inductor onto the end of each component. Another problem is between components the voltage will not be the same for each ground. Any current going through these ground traces will create a small voltage which will create noise for your parts and could create problems with voltage differences between parts.

The way to overcome this is with a good solid ground plane where possible. If that can't be done then at least make ground traces as wide as possible.

You also need power bypass caps, because traces and wires have inductance, any increase in current of the load will cause a voltage drop on the VCC of the part. Placing a capacitor between VCC and ground will keep the voltage steady and acts as a filter. So on most parts a 0.1uf and/or 1uf it's good to place between VCC and ground of the part.

\$\endgroup\$
1
  • 2
    \$\begingroup\$ Trace impedance probably isn't a big deal with this circuit. Bypass capacitors are definitely a good idea though. \$\endgroup\$
    – user253751
    Oct 13, 2022 at 15:15
1
\$\begingroup\$

Don't be discouraged by the long list... a lot of it is just for your convenience.

  • Add a ground plane on at least one side
  • Add decoupling capacitors on all power inputs
  • connect reset and all power pins as suggested by Microchip
  • make the tracks wider (it will help you with botch wires)
  • make the pads bigger, especially when you're hand soldering (oval pads are easier for hand soldering)
  • put a LED with a resistor on "power"
  • put LEDs with resistors on unused pins (you'll start to love them when debugging)
  • Add a header (and the connections and components) for ISP (In cicuit programming)
  • add protection (a small fuse and a 1N4004 diode can be enough) to protect the rest of the electronics about wrong polarisation on the power inputs

Enjoy your hobby!

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.