Hello, I have a somewhat basic question and while there is a significant load of information in internet, I cannot quite figure these few things out:
If I want to scale my project down to a single chip, instead of using Atmega328p DIP version, would it be the same as using Atmegs328p 32TQFP version of the chip, the reason why is because I want to build nice board and surface-mount everything to it nicely and 32TQFP version of the chip is smaller. Other than different size and shape and obviouse different pin location, is wiring the same? i.e. quarz and 22pf capacitors is all I need?
Every tutorial I have seen about Atmega328 chip on breadboard showing people powering it with 5v, either directly or via power regulator, however for example arduuino pro mini is 3v device, I want to make 3v device too so I can only power it from 2 AA batteries, is this an easy thing to do, is there a difference in a way how it wired, etc?
3.On Adafruit I saw that some sensors, or LED displays have 5v logic and some 3v logic, again, from my understanding that means that digital pins can read/write signal at 5v or 3v correspondingly. What dictates that, is it as simple as powering chip with 5v gives you 5v login and powering it with 3v gives you 3v logic? Asking because for my project I want to use adafruit nokia display and currently prototype is running on arduino uno via logic converter, but I am wondering if I can simply build my own device with Atmega chip running off 3V source and all logic then will already be 3v so no need to any converter?
Basically, I have a small device that with a push of a few buttons records some data and displays it on Nokia screen. Currently all of that is a prototype on breadboard running on Arduino Uno R3, I want to scale this down to matchbox size, make my own custom board, and so all surface mount solering, I want to go as small as possible, what can you suggest?
Yes, you can build up a 32TQFP design and run everything from 3V, 8 MHz.
Would be like building up a 3.3V Promini and power it from 3V on VCC pin (vs connecting 4.5V to RAW to make 3.3V).
Don't forget 0.1uF caps on all VCC and AVCC and Aref pins. Do not connect Aref to 3V.
5V IO, power from 5V.
3V or 3.3 IO, power from 3V or 3.3V.
CrossRoads:
Yes, you can build up a 32TQFP design and run everything from 3V, 8 MHz.
Would be like building up a 3.3V Promini and power it from 3V on VCC pin (vs connecting 4.5V to RAW to make 3.3V).
Don't forget 0.1uF caps on all VCC and AVCC and Aref pins. Do not connect Aref to 3V.
5V IO, power from 5V.
3V or 3.3 IO, power from 3V or 3.3V.
Great, thanks for the info, can you please take a look at this hardware I'm going to order to experiment with this, if I missed anything.
Getting few Atmega328p chips in 28DIP form so I can experiment with them first before moving to 32TQFP shape.
Few Atmega328p in 32TQFP shape
32TQFP socket so I can attach those small chips to breadboard
Another Arduino Uno R3 so i can use it to flash empty chips. (I do not need a bootloader, will be burning final version of my sketch to empty chips)
Few 22pF capacitors, as well as few 0.1uF capacitors, couple 8MHz quartz.
I think that's all I need to experiment? Or would there be something else you can suggest, besides ofcause jumper wires, resistors, diodes, etc... I have ton of those.
If you are really trying to make it as small as possible, it would be worth considering whether you need an external crystal + caps at all. The default frequency of the internal oscillator is 1MHz, which may be OK for your application (I don't know), but this can be increased to 8MHz by setting the appropriate fuse bits. It won't be as accurate as an external crystal, but again, might be good enough for the application.
Yes as already stated it is possible to run from 3 Volt on 2 AA batteries, I've had project running for over 12 months on 2 AA batteries, but there are some things to consider:
2 x AA's start out at 3 Volt, but as they drain that voltage will drop, at 8MHz you need a minimum of 2.4 volts according to the spec's, so it means your batteries are flat at 2.4 volts or 1.2 per cell.
By default the brown out detection will reset the Arduino at 2.7 volts and stop it working at less than 2.7 volts, you will need to set the fuses to allow it to work lower.
If you can run at 4MHz (as I'm doing) then you can deplete 2 AA batteries down to 1.8 Volt or 0.9 volt per cell, depending on your application, that could be a few more months of running.
Depending on what you are connecting/communicating with, the internal oscillator may be okay, however it can cause problems with serial communications especially at slow MHz speeds, as this requires a pretty accurate clock.
"I do not need a bootloader, will be burning final version of my sketch to empty chips"
It's a good idea to burn the bootloader first so the High-Low-Extended fuses are set for correct operation.
Then you can upload your sketch over it using File:Upload Using Programmer.
I burn all my 328Ps as Uno, you can do yours as 3.3V 8 MHz Promini if you are using external crystal.
Thanks everybody for help, waiting for capacitors to arrive tommorrow-ish so I can start playing with chip on breadboard, my device is time sensitive so I will absolutely have to use external quartz, I will post back the results in a day or two.
Thanks again.
my device is time sensitive so I will absolutely have to use external quartz
Define what you mean by time sensitive? If you are connecting via SPI or I2C, it doesn't matter really how accurate the oscillator is because those protocols are supplied with that timing from the chip, and everything talks following the same tick of the clock, no matter how inaccurate, they are all inaccurate exactly the same so they don't really care.
If you are needing to talk via serial, then no clock signal is passed, hence why we need both sides to have a fairly accurate clock such as a crystal so they don't both drift apart breaking the communication. Using a slow serial baud rate is an advantage as well if the clocks are not too accurate.
If you are wanting the controller to wake up at precise times to do something then sleep again, plus needing the maximum run-time duration on batteries, then the CPU is essentially as good as off during sleep mode, during this mode power consumption can be similar or less than the batteries own self discharge rate, but... the crystal is also off. Timing is done by the chips watchdog oscillator, and maximum sleep time is 8 seconds, but this can be anywhere between 6 and 10 seconds as that oscillator is not designed to be accurate, and also will vary depending on temperature. When it wakes up, then in code we can send it straight back to sleep until the time is right, but to know when that time is right, we need to count the wake-ups. Example, say you wanted 60 seconds to elapse before doing something, you can power down for 8 seconds, when it wakes up, you increment a counter, send it straight back to power down for another 8 seconds. When you've had 7 wake-ups then that is approximately 56 seconds, you could then sleep for a further 4 seconds, and in theory that's 60 seconds, but in practice you could be out by a good number of seconds.
CrossRoads:
5V IO, power from 5V.
3V or 3.3 IO, power from 3V or 3.3V.
Diggin through those 660 pages datasheet for Atmega 328p, but also let me ask here: So if 3V gives you 3V logic and 3.3V gives you 3.3V logic does it mean that if you power your project form 2AA batteries and as they going low on power they voltage drops to let's say 2.9V, does this mean that chip now has 2.9V logic? Which also means that if you have any sensor that has bias voltage, that bias voltage will be lower as battery drains?
Below the equivalent diagram of the outputs.
Atmel said in the datasheet that Rdson transistors can be worth "up to" 20 ohms.
So if the current required at the output remains low (<1mA) output delivers a signal between 0 and Vcc.
If the current is high, for example 20 mA, the output will give a signal between + 0.4V (instead of 0V) and Vcc-0.4V (instead of Vcc).
alexmg2:
Diggin through those 660 pages datasheet for Atmega 328p, but also let me ask here: So if 3V gives you 3V logic and 3.3V gives you 3.3V logic does it mean that if you power your project form 2AA batteries and as they going low on power they voltage drops to let's say 2.9V, does this mean that chip now has 2.9V logic? Which also means that if you have any sensor that has bias voltage, that bias voltage will be lower as battery drains?
Yes, your logic voltage is whatever Vcc is. This is where you need to check the datasheets of your sensors (assuming they are active with their own logic/chips). Check the minimum and maximum logic and Vcc voltages in the spreadsheet and make sure they cover your range of voltages. Most sensors will go down to quite low. You do not need to worry about the voltage changing as the sensor logic will deal with that.