HELP, Electronics noobie trying to design his first atmega based pcb

Hello everyone, this is my first post on here and im seeking help. i am trying to develop a Gear indicator for my sim racing games, i had it working with an arduino uno and now decided to make it a pcb for a more compact design, i am using a MAX7219 Driver with a 8x8 matrix screen and i think that should work fine but i cant seem to find a lot of schematic examples of a atmega328p with usb communication (im using a CH340G). i uploaded my schematic in the post and hope someone can help me further, i would love to get this project up and running

C2 -> 10uF
Add resistors between USB1 and CH430 D+, D- -> 22 ohm
(confirm on Datasheet)
R4 -> 10K
0.1uF on Each of VCC, AVCC pins.
Add diode across R4, anode on Reset, Cathode to 5V. Will keep any spikes from reset button from tricking the 328P into going into High Voltage Programming mode, and then looking hung.

Suggest breaking out unused IO pins to pads where you can access them, might come in handy later if you decide to connect some more buttons or other LEDs or something.

Hey, thanks for responding and helping me. i think it should be good now, i will upload the picture bdw if i messed up the wiring of the diode or something its because im very new to pcb design

Good idea to check the circuit works on breadboard first ...................

Still missing a 22 ohm resistor in the D- line between connector and the chip.
Read the CH340G datasheet, confirm if it says 20 or 22 ohm.
Or maybe none at all.
Also, check the number of caps they recommend, and on which pins.
CH340E-DS-16278-1826268.pdf (271.3 KB)

And you are still missing a 0.1uF cap for AVCC or VCC. The caps are critical and one needs to placed right next to the pin.

Why aren't you using SPI to send data to the MAX7219? That is much better, much faster, than using software pins which you seem to have connected.

Additionally, I'd recommend implementing the standard arduino auto-reset circuit by connecting DTR to RST, with optionally a small cap (100nF~470nF) between RST and GND.
See the schematic of e.g. arduino nano.

Just checked the datasheet and it doesnt show that there needs to be a capacitor connected to the D+ and D-. isnt the 100nF Capacitor already connected to it tho? also i dont know how pick what pins are best i just need to be able to connect and be able to communicate to the atmega328p so that a piece of software called SimHub can convert the gear the car is in ingame to the gear displayed on the matrix display, when i used a arduino pro micro i put the wires on 3,4,5 as it should matter for speed or so i think.

CH340G doesn't require any additional components to D- and D+. No resistors, and certainly no capacitors.

Sure. But it may also be kind of nice to be able to update the software on the atmega from the Arduino IDE, right? You have the USB stuff on there anyways; might as well turn this into a fully functional Arduino-clone board that supports IDE uploads. Put it differently; it would be kind of silly not to do it.

The caps are needed on the power pins.

No resistors on the data lines. Some USB chips do need them. some do not.

There should also be a 0.1uF cap between DTR (pin 13) and the Reset line, so the bootloader is started when the IDE starts a download.
Otherwise, you will need to press Reset at the right time during a download to start the bootloader; or, use a Programmer connected to the ICSP header to load code into the chip.

You could also put a small switch on the board so you can choose to have DTR connect to Reset, or not have it connected if you determine that SimHub doesn't need automatic Reset.

Ok thanks for all the tips. did i connect the RX and TX correctly aswell in some examples they are switched around. i am going to make a few of these so ideally arduino IDE programming would be nice. This is my updated design rn

Not quite; C11 should not go to GND but to RST.

Ah ok misread that bit, this should be good now :sweat_smile:

No, it should go to the RST pin on the Atmega328p (pin 29).

Btw, I wouldn't recommend implementing design changes whose function you don't understand.


i think i got it this time. im trying to learn more about this stuff but its really hard to find good videos explaining everything and lots of different types of components i need to learn.

Don't limit yourself to videos. Datasheets, application notes, schematics etc are usually not published in video format, but they are the essential information for this kind of endeavor. I don't like the "everything used to be better in the old days" sentiment, but I gotta say that the current emphasis on videos is sometimes counterproductive. Videos force a synchronous information uptake, which does not align well with the asynchronous and iterative task of actually understanding something.

yeah i understand what u mean, i just find it hard to read a 500 page Atmega328p datasheet or reading in general i learn much better with doing stuff and watching videos. im also doing an Engineering college which next year i will get embedded design courses so i will hopefully learn a lot from it

Microchip's datasheets are quite well-structured. I would recommend learning to read them efficiently. Nobody reads such documents back to front, obviously. But it's very easy to find what you're looking for by simply using the table of contents, for instance.

If they expect you to study through watching YouTube videos, get your money back and enroll in a proper education. But I assume you'll learn the way it's done properly - from the books and classes.

No they dont teach with videos but proper classes and also have lots of practical stuff. Here is a picture of the prototype on a breadboard and a ftdi serial communication instead of the ch340g, and the old pcb which ill have to replace now