Help with AtMega328 standalone

Hi, I need help with a standalone board with the AtMega328. I'm tryng to make work a 7 segments display by turning a 10kohm potentiometer for a little project but it doesen't work properly: sometimes it works, sometimes the display doesen't even light up or it lights up randomly and doestn't change when turning the potentiometer. I set up everything on a breadboard, with a 16Mhz oscillator, 2 18picoFarad capacitors and a 1A phone charger as power input.
The code is pretty basic but when i first tried it with arduino worked perfectly.

002.ino (4.48 KB)

How are your switches wired?
make inputs INPUT_PULLUP

pinMode(myPin, INPUT_PULLUP);
.

Do you have decoupling caps? Meaning 100nF capacitors between VCC/AVCC and GND, as close to the pins as possible?

AlbertoCarl:
Hi, I need help with a standalone board with the AtMega328. I'm tryng to make work a 7 segments display by turning a 10kohm potentiometer for a little project but it doesen't work properly: sometimes it works, sometimes the display doesen't even light up or it lights up randomly and doestn't change when turning the potentiometer. I set up everything on a breadboard, with a 16Mhz oscillator, 2 18picoFarad capacitors and a 1A phone charger as power input.
The code is pretty basic but when i first tried it with arduino worked perfectly.

I've found that unstable stand-alone AVR boards are not properly bypassed. The problem is especially bad when you have short duration, high current pulses drawn from VCC (such as LED segments being controlled with PWM and no series resistor or a high power IR LED pulsed for a few microseconds at an ampere or more).

The solution is to use two capacitors: The first is a 0.1uF low ESR ceramic cap placed as close as possible to the VCC and GND pin(s) (even directly under the socket if possible). The next is a 10 to 100 uF aluminum electrolytic, preferably a good quality low ESR part.

Look at the attached image.... there are three 0.1uF caps and a 100uF cap (look for one of the 0.1uF caps UNDER the CPU socket).

This board, BTW, is for an ATtiny2313.

(click pic for full res)
attiny.jpg

(by the way, the 100uF cap isn't leaking, it's tied to the board with a piece of nylon wire lacing wax string).

somedude:
Do you have decoupling caps? Meaning 100nF capacitors between VCC/AVCC and GND, as close to the pins as possible?

You need 10 to 100uF also... the little ones alone are not enough (in pulsed current draw applications).

by the way, the 100uF cap isn't leaking, it's tied to the board with a piece of nylon wire lacing wax string

Looks like a sinus infection. :wink:

LarryD:
Looks like a sinus infection. :wink:

Yuch! Yes indeed it does. Maybe I should use a tiny drop of hot-glue instead..... :slight_smile:

Krupski:
(by the way, the 100uF cap isn't leaking, it's tied to the board with a piece of nylon wire lacing wax string).

Is that still used nowadays?