I'm making a PCB with GSM module and ATMEGA328p on it,only problem is that GSM uses 2.8V CMOS logic level.Crystal I'm using is 16mhz.If I power my atmega328p with 2.8v CMOS logic will be 2.8v,right? but will it affect frequency or something?
In the datasheet there is a very nice graph (Fig 29-1 Maximum Frequency vs. VCC). Since 2.8V for Vcc is ok the frequency at 16MHz is too much. Safe operating frequency is only about 10MHz. You can switch to internal oscillator which is 8MHz.
but it's not very accurate
I’m in a hurry and I need this PCB tomorrow and I can’t really find a shifter today.Also I’m short with space
If it is brand new project, why not to use 8MHz crystal with same size? It is more precise then internal oscillator, same precision as 16MHz just slower.
I do have 8 MHz ones at home but is it 101% compatible with original arduino nano? I don’t want to have problems with uploading sketches or wrong delay/millis/baud.I’ll have really long delay in my code (24 Hours).I have a 32.768 kHz crystal but im not sure how compatible is it going to be with original arduino.PCB will have cuple of sensors and it needs to text me sensor readings to my phone once a day,at 9PM.Nothing too complicated.
The 8MHz is ok from32768Hz Arduino's view. Absolutely no problem. Of course, you have to select proper board or edit your board.txt (just frequency). Then the all is question of build process.
The 32768Hz crystal is usable also but ATmega328P shares pins for main crystal and Timer2 crystal, so you have to decide what you want. For an example ATmega1284P has it on separate pins. You can run main clock on high frequency and T2 with 32768Hz for precise time. If you need precise time on 328P the solution could be to use e.g. DS3231 RTC chip and drive the HW interrupt with 1Hz on the 328P. This is usual way. BTW, as I posted, the crystal 8MHz is more precise then internal RC oscillator but it is still not good for date & time, therefore separate RTC is using for such application.
Maybe you could provide more exact description of your aim to obtain better advice.
My goal is,when you turn this board on for first time,it takes time from SIM900 and updates itself,then you send a text to it and it saves your phone number to EEPROM,and turns off SIM900,but atmega328p is still working and running some type of “RTC” or similar.After 5 hours,turn on SIM900 and update time agin,and turn SIM900 off to save power.I think 5 hours is not too much so time should stay accurate.And when it’s 9PM send a sensor reading to a phone number,and update time agin.
I know atmega328 is not a good RTC but it should do because it has accurate time source from what it can be updated.Hope you understand me.If you have any better ideas I’ll be glad to hear them.
If the accuracy of the ATmega328P is good enough for you, it can run at 8MHz from external crystal. I think, you have the choices as follows:
- External crystal 8MHz - not quite accurate time.
- Internal oscillator 8MHz and watch crystal 32768Hz for Timer2 (uses same pins as in #1!) - better time accuracy but it is depending on the watch crystal type, excellent accuracy can be achieved.
- External crystal 8MHz and external RTC (DS3231) with 1Hz to INT0 (pin #2 of Arduino) input of ATmega328P - excellent time accuracy.