Go Down

Topic: Standalone 3.3v Atmega 328p - [working] (Read 13375 times) previous topic - next topic

CrossRoads

Table 20-7 of the data sheet suggests that speeds of 250KHz, 500 KHz, and 1 MHz are possible with 16MHz oscillator:
fosc = 16.0000MHz
      U2Xn = 0     U2Xn = 1
      UBRRn Error UBRRn Error
115.2k 8     -3.5% 16      2.1%
250k    3     0.0%   7        0.0%
0.5M    1     0.0%   3        0.0%
1M       0     0.0%   1        0.0%

fosc = 8.0000MHz
      U2Xn = 0     U2Xn = 1
      UBRRn Error UBRRn Error
115.2k 3     8.5%   8       -3.5%
250k    1     0.0%   3       0.0%
0.5M    0     0.0%   1       0.0%
1M       -     -         0       0.0%

Read the section to understand the settings needed.
115.2 looks bad on paper, I haven't lost any data using it that I am aware of tho (with 16 MHz crystal).
In contrast, 250K, 500K, 1M look great - proper wiring would start to become important.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

fkeel

@CrossRoads - I'll have to look into that in more detail. I was actually planning to use much slower speeds for my serial link. Thanks for the page number though - I'll check it out when I am at that point.

For now I am just finalizing my first design which I want to use to run some tests (sort of a sanity check, to make sure I actually understand what I am doing.)

I'm posting my layout/schematic, hoping somebody might point out obvious errors to me, if there are any:

Red components: 0.1uF capacitor
http://www.digikey.com/product-detail/en/C0805C104K5RACTU/399-1170-1-ND/411445
Purple: 10uF capacitor
http://www.digikey.com/product-detail/en/C0805C106K8PACTU/399-4925-1-ND/1090920
Yellow: 1k Resistor:
http://www.digikey.com/product-detail/en/ERJ-6ENF1001V/P1.00KCCT-ND/118957
Blue: 10k Resistor:
http://www.digikey.com/product-detail/en/ERJ-6ENF1002V/P10.0KCCT-ND/119248
Green: 8Mhz Resonator
http://www.digikey.com/product-detail/en/CSTCE8M00G52-R0/490-5994-1-ND/3845194

I guess I might potentially drop the top two 0.1 capacitors. I might swap the blue resistor to something higher (assumption: increase battery life). The resonator might go all together, as discussed earlier.


Looking good? Anything I might be missing?
http://embodimentlabs.tumblr.com/
http://paulstrohmeier.info/

ralphd


@ralphd
I believe you and John1993 are saying the same thing...

Oops.  It looks like I did read that wrong.

CrossRoads

Looks like a pretty basic design to me.
Bring out PD3 if you can - is both a hardware interrupt pin and its a PWM output pin.
I can see how you made the choice not too, tight on space at the top of the board.
Maybe if you add a top layer ground plane, you can have some more options with placement - try turning caps 45 degrees, etc.
Draw a Polygon around the outside perimiter of the board (outside of the dimension line) and right-click, NAME it GND. Eagle can be a little fussy about the start and end point, may have to work that a little. Use Rats Nest to let if fill in.

The top pad you labelled RST is more often called DTR, as you have on the schematic, with the DTR output of the FTDI module connected to it. It should not be named the same as RST on the right hand header, as that is the Reset pin into the '328.
DO NOT DROP the 0.1uF caps, they are needed for stable operation.
10K is fine for the resistor - the pin requires very little current to pull it high - but if you go too big on the resistor the pin becomes susceptible to noise.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

fkeel

well, I don't really need PD3, so its fine for now. (I guess eventuelly I'll break it out as well, in order for others to re-use it, but for now I'll leave it as is.)(I already am breaking out more pins than I was going to, because I realized I need to add the ISP pins for burning the bootloader)

I am a bit constraint by the methods I use for etching - it'll turn out nicer without the ground-plane, so again, for now I'll leave it. Is there any electrical reason for using the ground plane? As in, does it somehow make things more stable? (that's my intuition, but I have know idea to be honest.)

Yep, I get what you're saying about DTR. They *are* connected to the same pin though, correct?
http://embodimentlabs.tumblr.com/
http://paulstrohmeier.info/

Coding Badly

#20
Jan 21, 2014, 09:18 pm Last Edit: Jan 21, 2014, 09:31 pm by Coding Badly Reason: 1
I'll be posting my finished designs, once I am there.


Thank you for that.

Quote
Potentially considering using a tiny instead of a mega.


Unless price, physical size, or strange feature # is a huge concern, don't.  Use an ATmega processor.  Having a third timer is worth it.

# ATtiny processors often have domain specific features.  The ATtiny85 is a good example: it is capable of running at 16 MHz / 64 MHz with no external clock.

Quote
Thanks for the pointer about the LiPo. I am aware of this, but didn't think it completely through. I guess I need to use the internal reference voltage for the ADC then (in order to measure the battery voltage and automatically shut off after a threshold).


That will work as long as all the parts external to the processor can be turned off (e.g. no power LED).

Quote
As the reference of 1.1v is really low, do I use a voltage divider...


No.  You make the battery voltage the reference and measure the bandgap (the 1.1V reference).  Basically, you measure "in reverse"...
http://forum.arduino.cc/index.php?topic=38119.0

Quote
Will the 1.1v stay stable over a varying voltage?


Yes.  But the voltage is 1.1 ±0.1.  Any given processor has a stable reference but its reference voltage could be as low as 1.0 and as high as 1.2.  You will have to calibrate / check each processor (or just adjust the threshold to compensate for the variance).

JoeO

Why are you using the pin out the way that you are?

I would think that it would be better to bring in the 3.3 at the top of the board on the opposite side.
Same thing with the ground.  Bring it in on the top and on the other side.
Shorter runs.
Slide all the signal pins down 2 positions.

Also, are you going to put screw holes on the board so it can be mounted?

fkeel

@Coding Badly

Thank you! I vaguely remembered having seen something like that, but forgot everything about it. Was hoping someone would remind me again.
http://embodimentlabs.tumblr.com/
http://paulstrohmeier.info/

Coding Badly

@CrossRoads - I'll have to look into that in more detail. I was actually planning to use much slower speeds for my serial link. Thanks for the page number though - I'll check it out when I am at that point.


The zero error baud rates are the ones I referred to as "clock friendly".  If you can use a baud rate from this list... 1M, 500k, 250k, 125k, 62.5k, 31250, 15625 ...and tune the oscillator for 8 Mhz you will have no problems with serial communications.

Other combinations (like using an "unfriendly" baud rate with a low error) are likely to work but doing the two things mentioned above have always worked reliably for me.

CrossRoads

Quote
Yep, I get what you're saying about DTR. They *are* connected to the same pin though, correct?

No. DTR goes thru 0.1uF C2 to the '328P reset pin.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

AJB2K3



A risk with LiPo batteries is draining them too death.  You will need a cutoff.  Depending on what else is in the circuit you may be able to put the processor into Power Down sleep mode (after turning everything off) when the battery voltage reaches the floor.

This article has details about draining (and charging)...
http://batteryuniversity.com/learn/article/charging_lithium_ion_batteries


The problem is not with draining them to death, it causing voltage to drop so low that a chemical trip cuts in. There are ways to revive them and restore them but it can be risky if done wrong! (I have revived 3 lipo's so far but they were all only a year old when they tripped!)
Sorry for the noobish post but my knowledge is 10 years out of date!

john1993

there is no "chemical trip". only those with built-in protection circuit i referred to earlier will shut down safely on low voltage but these are not common.  most lipos will sustain damage if fully discharged as described in the link from coding badly.  and, unlike nixx, there is no way to revive a damaged lithium cell.

fkeel

#27
Jan 22, 2014, 10:44 pm Last Edit: Jan 22, 2014, 11:37 pm by fkeel Reason: 1
So there is a snowstorm and my Digikey order got delayed. I have no Resonator.

I decided, I would test it without the resonator. I built the circuit using only the capacitors, no other components (added an image). I then took a UNO and uploaded the Arduino ISP sketch to it. I then connected:

UNO --> MiniArduino
MOSI --> MOSI
MISO --> MISO
SCK --> SCK
3.3v --> VCC
GND --> GND
D10 --> Reset (not DTR :-) ...)

I added a 10uF capactor on the UNO between RESET and GND
(Sorry only have that crappy image right now. Was taken before I added the CAP. Thought I had another one, but apparently I dont...)

I then selected Arduino Pro Mini 3.3v (8Mhz) in the Arduino IDE,
Selected  Arduino as ISP for my programmer
Clicked 'burn bootloader'

I got the following response:
"error while burning bootloader"
avrdude: Yikes!  Invalid device signature.
        Double check connections and try again, or use -F to override
        this check.

Haven't had time to tinker with it too much since then - will get back to that later tonight or tomorrow.

I'm open to suggestions though. (I also have access to a programmer which I can use instead of the Arduino, and will try that out later)
http://embodimentlabs.tumblr.com/
http://paulstrohmeier.info/

ralphd

I do my programming with a USBasp, but I expect the Arduino ISP would be similar.  With the USBasp, the reset line is connected directly - no capacitor.
You use a cap on the reset line for connecting a reset button, not for programming.  When programming reset is held low for the duration.  To reset (reboot) the AVR, reset is only brought low for a short pulse.

fkeel

@ralphd

are you speaking of the ArduinoUNO's reset pin, or the reset pin of my mini-Arduino?
http://embodimentlabs.tumblr.com/
http://paulstrohmeier.info/

Go Up