Custom board with ATmega328 and crystal (or not)


  • Mod

    While creating a board for another project using an ATmega328 I found that it might be easier to create a MySensors board with the standalone microcontroller instead of a complete Arduino (and all overkill components).

    The first question that comes up while working on the design of the board is 'do I need the crystal or not'.

    I am not really sure.
    I saw a couple of projects with and without but I did not really find out what advantages/disadvantages come with doing the board this way (other than maybe use less current).


  • Code Contributor

    @marceltrapman I'm running almost all of my nodes (+gateway) using custom ATmega328 setup vs. using an Arduino (quite a few of them just on a breadboard for now). I did not try without a crystal. At the end you need to look at which operation is most time critical. Usually these are communication but SPI is not that time critical with the clock signal being generated by the MCU itself. I don't know for sure about e.g. one-wire if you want to use a DS18B20 or so. If you want a time aware sensor you probably should go with a crystal to get at least a little accuracy 🙂
    For power consumption you should carefully check. I guess the ATmega based on the fuses turns on or off the internal clock - you might lose some of the lower power consumption again because now the ATmega itself consumes more...


  • Mod

    @ToSa Well, that sounds like I should use the crystal.
    Thank you for your reply!



  • In my opinion there's no need to use the crystal, you can use de 8MHz internal clock. And if you check the datasheet you'll see that a lower clock speed also reduces your power consumption...

    Here's an awesome tutorial that I found, it explains step by step how to use the standalone atmega328p chip.

    http://www.gammon.com.au/forum/?id=11637


  • Mod

    @royaraya16 said:

    In my opinion there's no need to use the crystal, you can use de 8MHz internal clock.

    I have not yet read the article by why is it then that all Arduino boards (that I know of) make use of a crystal?


  • Admin

    @marceltrapman said:

    @royaraya16 said:

    In my opinion there's no need to use the crystal, you can use de 8MHz internal clock.

    I have not yet read the article by why is it then that all Arduino boards (that I know of) make use of a crystal?

    Becauses it is easier, gives a more reliable oscilator (over a wide temperature, and voltage range), and the first arduino was designed with 16Mhz crystal (if I remember correctly). the maximum internal rc osc. is 8Mhz

    / Thomas


 

439
Online

8.2k
Users

9.0k
Topics

96.0k
Posts