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.
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)
(by the way, the 100uF cap isn't leaking, it's tied to the board with a piece of nylon wire lacing wax string).