Community
OpenEnergyMonitor

Community

ATMega328P - 3.3v vs 5v, and 8Mhz vs 16Mhz

Tags: #<Tag:0x00007f6e0e8c9960> #<Tag:0x00007f6e0e8c9898> #<Tag:0x00007f6e0e8c97d0> #<Tag:0x00007f6e0e8c9708> #<Tag:0x00007f6e0e8c95f0>

I am new to eMon and have built my first Arduino Pro-Mini four channel prototype … and it’s mostly working. :slight_smile:

In this first iteration I am using an Arduino Pro-Mini with the ATMega328P at 3.3v, running at 8Mhz.

I’m curious about the following design considerations:

  1. What are the trade-offs of using 3.3v vs 5v? I’ve read much of the learning section of the website, and the examples are given for both. I’m trying to think through the trade-offs of designing around either voltage. Obviously interfacing to other components is one issue, but in the ADC is there an advantage to basing the interfacing circuitry on 3.3v vs 5v?

  2. What are the possible implications or issues running at 8Mhz vs 16Mhz? I’ve read a few posts that seem to touch on this subject, and do understand that it’s all about timing - and the potential unreliable timing of the utility company - but I want to understand if the 16Mhz solution would provide more accuracy or … well … I’m not sure what else?

I’m going to build a second Arduino Pro-Mini solution this afternoon, using a 5v 16Mhz version, and I"m curious what differences I would expect to see vs my current version.

Thank you again for this forum, and incredible solution!

The big penalty for using the higher voltage is it restricts your choice of current transformer. There is a huge range of c.t’s designed for a 1 V reference (or thereabouts), i.e. 0.333 V rms output. As you increase the reference voltage, you either reduce the resolution by using only part of the input range, or you need higher power rated current transformers to deliver the higher voltage.
It’s easier in the voltage department. For a start, the a.c. line voltage is more or less constant (compared to the current range, anyway), but even so, the only purpose-made voltage transformer I know of has a 0.333 V output.

The disadvantage of the more sensitive input is it ought to pick up more interference and noise. However, in our experience, the usual problem with noise is not noise picked up on the input cables, but noise getting into the ADC via the power supply or the voltage reference, and that’s down to proper circuit layout, filtering and grounding.

A little while ago, my colleague @Bill.Thomson posted a link to a piece about the ADC and clock speed - that is worth tracking down and reading. (My search skills have failed me - I can’t provide a link.) Also, don’t ignore the Atmel data sheets and application notes - they really should be authoritative sources.

See also About ATMEGA328P with 8Mhz internal oscillator crystal. Standalone

Here’s the link @Robert.Wall referred to:

1 Like

Also, do not think that you are tied to using 16MHz with 5v and/or 8MHz at 3.3v.

All the OEM “ATmega328” hardware (bar the Arduino emontx-shield) are running at 3.3v with an external 16MHz xtal.

Even the pro-mini’s CAN be 3.3v 16MHz (the’re the ones I use generally, although it’s been a while since I have) despite most info telling you otherwise. You need to hunt them out and be sure of what you are buying (vs what you get supplied) when looking at auction sites etc. I haven’t looked recently, but even the Arduino IDE used to only list 3.3v/8MHz or 5v/16MHz versions, if that is still the case you can add a custom board entry (that’s what I did) or just use the 5v/16MHz option without a problem despite it being 3.3v, the IDE only gets involved in the clock speed, it is unaware and uninterested in the voltage.

I think 16MHz at 3.3V is slightly overclocking. If I’m reading this graph correctly, 13.3MHz is as fast as you can safely go at 3.3V:

Thanks @dBC I have no doubt you are 100% correct!

Just to be clear. My comments were just about getting a pro-mini closer resembling the OEM hardware.

The Arduino IDE board option list and numerous sales listings, forum comments and blogs would have you believe that 3.3V/16MHz pro-mini’s do not exist. This is not true, I have some, I have used them and I have had good results from them.

I had hoped my comment about 3.3V/16MHz being the typical OEM device spec might head off any real in-depth discussion about whether a 3.3V/16MHz pro-mini is possible or accurate, my point being “it is possible to use 16MHz at 3.3V, most of the OEM hardware already does that” and a pro-mini model of the same spec is available, it could easily be believed otherwise as they are not common.

I can only assume the OEM dev team of the day, did their calcs and decided 3.3V/16MHz was fine for the application in hand. I do not have the test equipment or theoretical knowledge to argue that point.