Suitable resonator

In Kicad I am designing a PCB with an atmega328 in TQFP. I want the board to be assembled by JLCPCB. They do not sell the same one which is used on arduino boards.

I think I have found a suitable one, but I am not entirely sure.

On JLCPCB's stocklist I found one which is currently in stock. It looks fine to me, but I am not really home in the crystal and resonator world.

The one JLCPCB has is: AWSCR-16.00CV-T
JLCPCB part list

And it's datasheet

Can I use this resonator to work with an atmega328 @ 16MHz?

The datasheet dictates there is a ground pin, input pin and output pin. I assume that both input as output pins can be connected to the X1 and X2 pins of the atmega without other components, correct? Does it matter which pin of the resonator goes on which pin on the atmega?

Can this particular resonator be soldered by hand. Judging on the pictures I believe it can be done? But can it really?

Kind regards,

Bas

Yes that ought to be fine - the ATmega328 datasheet suggests C1 and C2 be in the range 12pF to 22pF, and that resonator has 22pF. Yes no extra components needed.

Note that a resonator has low accuracy compared to a quartz crystal, so for some applications its the wrong choice.

I'd strongly recommend soldering using an oven or a hot-air rework station or even a hotplate for populating a surface mount pcb. It really helps to get a stencil and solder paste too.

If its your first time using TQFP version of the ATmega328 you have to consider how you are going to program the bootloader onto it. This requires access to the SPI pins and the reset pin IIRC.

You can also post your schematic and the PCB layout here. You will surely get some more opinions on the design.

Thank you for your answers.

Might be important. The PCB will be decoding DCC signals. To save you from a lot of info. DCC signals exist out of bits of 54us (logic 1) and 100us (logic 0) long. I only need to tell which is a 0 and which is a 1. I believe that the resonator would be accurate enough. But I must confess I have not calculated it.

Well, not. Because of

this. I made myself a dedicated programmer. It exists out of an arduino Nano, ZIF socket for attinys in DIP and a 2x3 ISP connector which can be used with a 2x3 clamp with pogo pins.

Besides I am going to use every IO pin but 1. Rx and Tx pins will be used to drive pins of a ULN2803, hence I have no need for a bootloader nor I need serial communication

All my new PCB designs have a 2x3 ISP connector (just holes, I don't solder anything on it) in 1.27mm pitch (really small). Besides attinys I can also program other arduino boards with it.
The clamp can be easily replaced by jumper cabels if needed.

When it is finished I'll upload it. I usually first make sure I have the right components before I start routing. It sucks real hard if JLCPCB does not have your components in stock or if you have change to a larger component.. and redo everything.. again :sweat:

Kind regards,

Bas

Of course, that is all true but you may have the same problem if a justified design flaw is pointed out to you and you have to rework some part of it.

Ok my schematic.

The purpose of this device is to control 12 LEDs via uln2803 of which only 4 will burn at any given time.

I see I forgot to wire the resonator to ground. The input voltage will a be square wave anywhere between 15V and 19V. With a voltage divider this signal is also directly tied to an input pin to decode the signal. Voltage on this pin cannot exceed 5V.

The 5V line is only used to power the atmega chip and the base currents of the 2 ULN2803. I won't be drawing needless current to power an onboard LED. Because of that I believe that a linear voltage regulator will suffice.

I can program the board via the ICSP connector using my programmer and pogo pin clamp. I hope atleast :stuck_out_tongue:

I quickly put the components on the pcb layout. This is still work in progress. I am not restricted to a maximum size.

This resonator stil looks rather big, but that is ok. I can probably solder it by hand so the first proto I can make myself. But looking at the simplicity, I think I can let this board assembled without flaws....

Bas

I have only noticed this on the schematic:

  1. dip6 and dip7 need pull-up resistors because these are pure analog pins.
  2. missing decoupling capacitors on the ULN2803 chips.
  3. The bridge rectifier looks odd for a DC power input. You can use a P Channel Mosfet instead for polarity reversal protection if that is the purpose.
  4. I might have considered an opto coupler for DCC+ (high voltage signal input)

Generally:
You could save pins with (a) an input shift register for the dip switches and (b) power shift registers (e.g. tpic6b595 ) to replace the ULN2803s.
No FTDI header is broken out for using the serial console for debugging etc. If you add this, you need an extra capacitor. Programming can be done, as you have said, without this using the ICSP header.

Thank you, I completely forgot about the analog pins A6 and A7 not having pullup resistors.

I know I can safe pins with IO extenders, but I simply do not have to as I have enough pins on the atmega. Given it's simple task I wont be needing a serial interface for debugging.

The bridge rectifier is actually needed, there is no DC voltage, it is DCC voltage. It is a digital square wave which switches polarity continuously. This is how model train centrals deliver continuous power as well as information to the trains using only 2 conductors. The rate of switching is depending of 0 and 1 bits.
image

I have doubt about the optocoupler. Many other designs use them for the exact same purpose. But I have heard more than one story about the optocoupler giving up the ghost.

It does make me think to use external clamping diodes in the form of a BAT54S

Kind regards,

Bas

OK. I see. So I am not sure how your voltage divider to ground works if DCC+ can go negative. Even more reason to use an opto coupler. Maybe one intended for AC with 2 diodes such as H11AA1.
I guess that circuit will be electrically noisy so decoupling is important.

Since you are already connected to the circuit I don't see advantages of using an optocoupler. The diode clamp should be enough. Note it will shunt current into your 5 V rails - your circuit must consume this current even under worst case conditions. If unsure add a 5V6 Zener diode to limit Vcc. (Another option is 5V1 Zener on the pin instead of the clamp.)

Looking at that wave form again, it is clear that an AC type opto-coupler, which I suggested previously, would not be appropriate because the switching times would probably be too rapid leaving the opto-coupler always active.
However, I would still tend do use a standard opto-coupler (with external reversed diode and current limiting resistor) to replace the voltage divider and any clamp arrangement for no better reason than to try, where possible, to reduce exposure to all the electrical noise that this polarity changing pseudo DC source will generate.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.