Arduino Forum

Using Arduino => General Electronics => Topic started by: audxv on Aug 01, 2020, 11:37 pm

Title: Does this schematic look OK?
Post by: audxv on Aug 01, 2020, 11:37 pm
Hello!

I've been working on a schematic with a power regulator and ATMEGA328 that controls a potentiometer and a 4 digit 7 segment display. This is one of my first schematics (and definitely the most complex). Can you internet geniuses take a look at it for me?
(https://i.imgur.com/jQciSgo.png)

A few notes:

I used 13pF capacitors for my crystal; I used this guide  (https://blog.adafruit.com/2012/01/24/choosing-the-right-crystal-and-caps-for-your-design/) and the 16mhz crystal that I chose was rated for 9pF.

I added pads for each pin on the ATMEGA328 that I can connect to an arduino uno board (without the chip installed), in order to program the ATMEGA chip.

Any replies are greatly appreciated!!  :D
Title: Re: Does this schematic look OK?
Post by: larryd on Aug 02, 2020, 02:51 am
No geniuses here.

C4-5 are backwards.

On USB1 if Vcc is 5V the 7805 will not work.

You need decoupling capacitor on 328 Vcc.

7 segment needs series resistors if not already built in.

Add a power LED.

Add a reset switch.

If you will be using FTDI for programming, review what needs to be connected to get the connector properly dealt with.


Title: Re: Does this schematic look OK?
Post by: Wawa on Aug 02, 2020, 03:01 am
A 5volt regulator powered from 5volt USB won't work.
An (old-school) 7805 regulator needs at least 7volt on it's input to make a stable 5volt on it's output.
The input capacitor is also too small for an 7805 (330n minimum, see datasheet).
Can power the chip directly from the USB socket (with some buffer capacitance).
Add some ceramic decoupling on the chip's VCC pin(s) too, close to the chip.

I see you advised a current limiting resistor to a poster in another thread, and yet you don't use them yourself.
That LED display needs eight resistors in the cathode lines.

The two 13pF (12 and 15 are E12 values) capacitors are from the crystal's point of view in series,
so you have 13/2= 6.5pF across the crystal, plus some layout and chip capacitance.
Seems ok for a 9pF crystal, and this is not critical unless you make a clock/stopwatch or something.
Leo..
Title: Re: Does this schematic look OK?
Post by: audxv on Aug 02, 2020, 05:23 am
Thanks for the responses!

The resistors for the 7 segment display totally flew over my head - not sure why I figured such a display wouldn't need them. I'll add some 220hom resistors.

I'll redo the power supply circuit, copying that of the pro mini (not using anything right of the solder jumper):
(https://i.imgur.com/KUzqoOc.png)
Would this work?

I'll also add a power LED and reset switch as stated.

I want the clock to be as accurate as possible. Going off of what Wawa wrote, I'll change the capacitors in series to 18pF (18/2=9).

Finally, I'll add a decoupling capacitor on VCC.

I'll post a schematic as soon as I finish reworking it - would this fix everything?
Thanks again, you guys!!
Title: Not really!
Post by: Paul__B on Aug 02, 2020, 06:35 am
According to this post (https://forum.arduino.cc/index.php?topic=698467.msg4694099#msg4694099), you already know that you need segment resistors for the LED display.  These need to be 1k as all the segment current - at least 7 segments for the digit "8" - is being carried by a single ATmega pin.

If you are powering this from a USB source ("phone charger"), why are you trying to insert a regulator?

It would make more sense (cheaper, more practical) to just use a Pro Mini and mount it as a daughterboard to your own PCB.  And use one of the many pre-built display modules instead of trying to multiplex in code.  :smiley-roll:
Title: Re: Does this schematic look OK?
Post by: audxv on Aug 02, 2020, 07:17 am
No need to use my own post against me - again. As stated in my previous post, I forgot to add resistors. I continued to add them in.

As for powering the circuit: should I be worried about too much voltage / current? I figured I should be, in the off chance that the circuit is powered through too powerful of a charger (like 5v, 3A) and the ATMEGA / rest of the circuit would be damaged.

I'm not sure what the pre-built display modules are that you're talking about, but I already have a display, and code for it.

As for why I'm going for an "impractical" approach, I want to learn how to use an ATMEGA without an arduino. The goal of the project is for me to learn more about how arduinos and electronics in general work. If you have any suggestions for how to learn this topic, please let me know.
Title: Re: Does this schematic look OK?
Post by: 6v6gt on Aug 02, 2020, 09:39 am
Yes. Multiplexing is good learning experience and can save using an extra chip.
You seem to have a misunderstanding about current. A circuit will take only as much current as it requires (assuming even that is available). So connecting an arduino to 5 volt power source, whether 2A or 200A, should function correctly. The regulator reduces voltage, say 12volts down to 5 volts and, in the case of a linear voltage regulator, burns the excess away as heat.
Title: Re: Does this schematic look OK?
Post by: PerryBebbington on Aug 02, 2020, 09:48 am
Quote
As for powering the circuit: should I be worried about too much voltage / current? I figured I should be, in the off chance that the circuit is powered through too powerful of a charger (like 5v, 3A) and the ATMEGA / rest of the circuit would be damaged.
That question is answered by understanding Ohm's Law (https://en.wikipedia.org/wiki/Ohm's_law).
Not directly relevant to that particular question but essential basic electrical theory is also Kirchhoff's circuit laws (https://en.wikipedia.org/wiki/Kirchhoff%27s_circuit_laws)
Title: Re: Does this schematic look OK?
Post by: Wawa on Aug 02, 2020, 10:04 am
Going off of what Wawa wrote, I'll change the capacitors in series to 18pF (18/2=9).
Read it again.
I also wrote that there is some layout (circuit board traces) and chip (input) capacitance.
That could easily add up to several pF.

We're only talking about second(s) difference per day if you don't get it right.
Not worth spending too much time on it, since it's also temp dependent.
13pF is fine. 12pF or 15pF is too.
Leo..
Title: Re: Does this schematic look OK?
Post by: 6v6gt on Aug 02, 2020, 10:28 am
If you are soldering the MCU chip, it is a good idea to add an ICSP header, and you'll anyway need some connection to load at least the boot loader, if you are using one.

If you are using an FTDI interface for programming and viewing the serial console for debugging etc. (already mentioned), you need an additional capacitor for reset, and it is good to have standard the pin order for a 1:1 connection with a common FTDI type device.
Title: Re: Does this schematic look OK?
Post by: Smajdalf on Aug 02, 2020, 10:58 am
Usually the resistor for the decimal point is larger because the area of the LED is smaller and so it seems brighter when lit with the same current.
Title: Re: Does this schematic look OK?
Post by: MarkT on Aug 02, 2020, 03:09 pm
Firstly you have a footprint for the ATmega328PB, which is a different chip from the ATmega328P - do
you realize this?

Vcc and AVcc must both be connected to 5V, and you must have 100nF ceramic decoupling capacitor to ground on each one, right next to the pin.  Failure to power Vcc and AVcc at the same time can fry the chip.

Most crystals are rated for more capacitance, 22pF load caps presents 11pF to the crystal, which is in
parallel with the chip's capacitance, making around 15--20pF that the crystal sees, and 20pF crystals are
most common I think.  Its not too crucial.
Title: Re: Does this schematic look OK?
Post by: Grumpy_Mike on Aug 02, 2020, 04:27 pm
Quote
These need to be 1k as all the segment current - at least 7 segments for the digit "8" - is being carried by a single ATmega pin.
Note that with 1K resistors and a 4:1 multiplex ratio the display will be very dim. It is normal to drive the anodes through a PNP transistor with the Arduino connected to the Base of the transistor through a 1K resistor or there about.
Title: Re: Does this schematic look OK?
Post by: ShermanP on Aug 02, 2020, 04:46 pm
It won't make the display any brighter, but you could save four resistors by putting one resistor on each common anode line instead of the eight segment lines, and multiplexing by segment instead of by digit.  You would use 470Ω resistors, and refresh twice as fast.  The SevSeg library supports that.
Title: Re: Does this schematic look OK?
Post by: MK1888 on Aug 02, 2020, 07:20 pm
I would:

* Make C4 10uF.
* Add 1uf or 10uF next to C5.  As noted C4 and C5 are backwards, but 100nF caps usually have no polarity...just like C1.
* But, as noted, USB -> 7805 won't work as that regulator needs (I think) 2-ish volts overhead.
* Use 470 ohm resistors on the display segments, 1K could be okay if that brightness is fine with you.  You'll see when you get the multiplexing running.
* Switch the anodes with 2N3906 (PNP) transistors with 1K base resistors to ATmega.  Are you sure you're using a common anode display?
* Check the datasheet for "total current sinked (to have been sunken?) by port" or similar.  If the display is red, 470 ohm resistors will give you about 5mA per segment...7 segments makes it 35mA (and another 5mA for decimal point).
* Use 22pF (or 15pF is okay) caps for the crystal.  Better stability.
* Can't you use an entire port (port E?) for the display segments?  Would make the code nicer.
* When coding for multiplexed 7-segment displays, make sure you turn off the segments before you switch to the next digit or you will see "ghosting".  Then again, you could ignore this advice and learn it for yourself. :)
Title: Re: Does this schematic look OK?
Post by: audxv on Aug 02, 2020, 08:16 pm
Huge thanks to all of you.

I'm working on fixing all my mistakes right now, but I want to make sure of something:

Do I need any sort of power regulator? As 6v6gt cleared up for me, only needed current will be taken, and nothing more than 5v will ever be powered through a micro usb cable.

Also, what do the arduino pro mini / micro use a mic5205 for?

Thanks in advance.
I'll work on getting back to each of you; again, I could never thank you all enough for your responses.
Title: Re: Does this schematic look OK?
Post by: blh64 on Aug 02, 2020, 10:20 pm
Also, what do the arduino pro mini / micro use a mic5205 for?
That is the 3.3V regulator since those boards operate at 3.3V, not 5V
Title: Re: Does this schematic look OK?
Post by: Paul__B on Aug 05, 2020, 01:08 pm
That is the 3.3V regulator since those boards operate at 3.3V, not 5V
I don't think so!  :smiley-eek:

The 3.3 V version of the Pro Mini - with an 8 MHz crystal - uses a 3.3 V regulator but the 5 V version necessarily uses a 5 V regulator.

The Pro Micro is of course 5 V; the 3.3 V regulator has no part in its operation and is present only for compatibility with other Arduino boards which provide a 3.3 V source,