Operating the Atmega328 without the arduino

Hi,

I thougt of assembling my own project with the atmega328 without the arduino module.
Therefore I have done the following actions:
placed the atmega328 on a breadboard, connected it to a 5v power source,
connected the RESET pin to the 5v
connected the 16Mhz oscillator to capacitors (I didn't have 22 pf so I used other small capacitors) and to the chip
And waited for led 13 to blink.

However, It seems like chip doesn't response.
When placing it back to the arduino it works properly, and connecting the power source to ampmeter I see it consumes current.

What could have I done wrong?

here is the picture of the breadboard:
http://img824.imageshack.us/img824/4125/img0005dg.jpg

Thanks for anyone who helps!:slight_smile:

And waited for led 13 to blink.

Are you sure it didn't blink once and then self destruct? (Where's the current limiting resistor?)

Don

You also need +5vdc wired to pin 7 and a ground to pin 8. And if that blob is a LED it is on wrong pins and needs a series resistor, if it's just a smug on the picture then never mind. :smiley:

wow guys thanks for the super fast reply :smiley:

floresta:

And waited for led 13 to blink.

Are you sure it didn't blink once and then self destruct? (Where's the current limiting resistor?)

Don

don't worry, this LED can handle 5v, and no it didn't burn.

retrolefty:
You also need +5vdc wired to pin 7 and a ground to pin 8. And if that blob is a LED it is on wrong pins and needs a series resistor, if it's just a smug on the picture then never mind. :smiley:

that's right, I have changed the wires to the right Vcc and ground, but still it doesn't work :frowning:
here is the new breadboard:

that's right, I have changed the wires to the right Vcc and ground, but still it doesn't work
here is the new breadboard:

You can't just change them, you need +5vdc on both pins 7 and 20 and ground on both 8 and 22.

Lefty

retrolefty:
You can't just change them, you need +5vdc on both pins 7 and 20 and ground on both 8 and 22.

Lefty

ok, I fixed the wiring and have the 5v connected to both 7 and 20,
and the ground to both 8 and 22, but it still doesnt work.
Any other ideas?

You might try adding a .1ufd 'bypass' cap across pins 7 and 8, as there is lots of chance of power noise as your power wiring is pretty long runs to your power source. Also a pull-up resistor to pin 2 (arduino pin 0), 1-10K ohms, may prevent noise from causing the bootloader to hang on improper serial input noise.

Lefty

don't worry, this LED can handle 5v

Do you mean that this particular LED has a built-in current limiting resistor, or that it is a magic LED?

Don

(I didn't have 22 pf so I used other small capacitors)

Are the capacitors between 12pF and 22pF and are they both the same value? You might try repositioning the crystal and the capacitors so that you do not need hookup wire between them and the chip. Put the crystal in at an angle and bridge the capacitors over the 'blue line' between the horizontal and the vertical runs of your breadboard.

Don

retrolefty:
Also a pull-up resistor to pin 2 (arduino pin 0), 1-10K ohms, may prevent noise from causing the bootloader to hang on improper serial input noise.

Lefty

do you mean a resistor should connect between pin 2 and the Vcc?

floresta:
Do you mean that this particular LED has a built-in current limiting resistor, or that it is a magic LED?

Don

I meant that the led can still work at 5v and nothing bad will happen to it if it will light for a few seconds

floresta:

(I didn't have 22 pf so I used other small capacitors)

Are the capacitors between 12pF and 22pF and are they both the same value? You might try repositioning the crystal and the capacitors so that you do not need hookup wire between them and the chip. Put the crystal in at an angle and bridge the capacitors over the 'blue line' between the horizontal and the vertical runs of your breadboard.

Don

the capacitors are 0.1 uf each, is that too much?

I meant that the led can still work at 5v and nothing bad will happen to it if it will light for a few seconds

You can also drive 70 mph in a 55 mph zone and nothing bad will happen ...... for a while. Resistors are a lot cheaper than micro-controllers.

the capacitors are 0.1 uf each, is that too much?

Well the data sheet calls for values between 12 pF and 22 pF. You are using more than 4500 times the specified value, what do you think?

Don

0.1 uf each, is that too much?

Just a tad :slight_smile:


Rob

dragonuv:

retrolefty:
Also a pull-up resistor to pin 2 (arduino pin 0), 1-10K ohms, may prevent noise from causing the bootloader to hang on improper serial input noise.

Lefty

do you mean a resistor should connect between pin 2 and the Vcc?

Yes, if you have nothing wired to pin 2 then it will be floating and can cause the bootloader to hang up on noise. It's not a fix all, but needed in your breadboard set-up as shown.

floresta:
Do you mean that this particular LED has a built-in current limiting resistor, or that it is a magic LED?

Don

I meant that the led can still work at 5v and nothing bad will happen to it if it will light for a few seconds

There are two issues here the led and the output pin, a led without a resistor will draw too much current from the arduino output pin and can damage the output pin as well as the led. Just because the led is not damaged yet doesn't mean the output pin hasn't been overstressed. ALWAYS use a series current limiting resistor when wiring leds to arduino output pins. To not use a resistor is foolish and will bite you sooner or later.

floresta:

(I didn't have 22 pf so I used other small capacitors)

Are the capacitors between 12pF and 22pF and are they both the same value? You might try repositioning the crystal and the capacitors so that you do not need hookup wire between them and the chip. Put the crystal in at an angle and bridge the capacitors over the 'blue line' between the horizontal and the vertical runs of your breadboard.

Don

the capacitors are 0.1 uf each, is that too much?

Yes, much too much and probably the reason your set-up isn't working as the crystal can't oscillate.

Lefty

dragonuv:
Hi,

I thougt of assembling my own project with the atmega328 without the arduino module.
Therefore I have done the following actions:
placed the atmega328 on a breadboard, connected it to a 5v power source,
connected the RESET pin to the 5v
connected the 16Mhz oscillator to capacitors (I didn't have 22 pf so I used other small capacitors) and to the chip
And waited for led 13 to blink.

However, It seems like chip doesn't response.
When placing it back to the arduino it works properly, and connecting the power source to ampmeter I see it consumes current.

What could have I done wrong?

here is the picture of the breadboard:
http://img824.imageshack.us/img824/4125/img0005dg.jpg

Thanks for anyone who helps!:slight_smile:

These are the instructions for setting up an Atmel chip on a breadboard.

Make sure the microcontroller is plugged in starting at row 11 bridging across the two sides
of the breadboard.

Set up Power to the Breadboard

  1. Connect the left and right rails of the breadboard with two pieces of
    wire, connecting red to red and blue to blue.
  2. Plug the voltage regulator (7805) into the breadboard on the left side.
    Plug the input pin into row 28, the ground pin into row 29 and the
    output pin into row 30.
  3. Make sure this is correct, or else it won't work!
  4. Then using wire connect row 29 of the breadboard to the blue
    (ground, “-”, GND) rail.
  5. Now connect the red wire of the battery clip into row 28.
  6. Connect row 30 of the breadboard to the red rail.
  7. Connect the black wire of the battery clip to the blue rail.
  8. Do not connect the battery yet!

Wire up the Microcontroller

  1. You will need to cut and strip 6 short wires for this step.
  2. Using wires, connect pin 7 of the microcontroller to the red (+5V) rail of the
    breadboard.
  3. Connect pin 8 of the microcontroller to the blue (GND) rail.
  4. Connect pins 20 and 21 of the microcontroller to the +5 rail (this is on the
    right side of the breadboard).
  5. Connect pin 22 of the microcontroller to the GND rail.
  6. Connect the RESET pin (pin 1) to the +5V rail.
  7. Connect the crystal oscillator to pins 9 and 10 on the MCU.
  8. Insert the 0.1uF capacitor between pins 7 and 8 of the microcontroller (+5V and GND).
  9. Connect row 25 on the left side of your breadboard to GND. Connect a SPDT switch into rows
    24, 25, and 26 of the breadboard. The switch will connect pin 14 of the MCU to GND when the
    switch is up and disconnects it when the switch is down. This will allow us to tell the MCU when
    we want it to boot into programming mode or to run the program already on the chip.

Wire up USB cable

  1. Connect the black wire to the blue GND rail.
  2. Connect the red wire to row 9 of the breadboard (Row 9 is an empty row)
    The red wire can be used to supply power to the MCU if connected to the Positive rail on the breadboard,
    remember to disconnect the battery!
  3. Connect the yellow wire to MCU pin 2 (row 12 on the breadboard).
  4. Connect the green wire to MCU pin 3 (row 13 on the breadboard).

Here is the Datasheet for the Atmel chip it shows what the pinouts are.

Also if your chip is new it needs a bootloader.

If your wanting to build your own Atmel based microcontroller check out Nerdkits.
They send you everything you need along with great instructions, they also have a support forum with tutorials.

Make sure the microcontroller is plugged in starting at row 11 bridging across the two sides
of the breadboard....

My breadboard doesn't have any numbers on it. Now what do I do?

What about the capacitors that are supposed to be used with the voltage regulator? I don't see them mentioned.

Don

floresta:

Make sure the microcontroller is plugged in starting at row 11 bridging across the two sides
of the breadboard....

My breadboard doesn't have any numbers on it. Now what do I do?

What about the capacitors that are supposed to be used with the voltage regulator? I don't see them mentioned.

Don

If your breadboard doesn't have numbers on it then number it, or buy one that has the standard numbers and letters on it.

Only one capacitor is needed I listed it and it's connected to VCC and ground not the voltage regulator!
"8. Insert the 0.1uF capacitor between pins 7 and 8 of the microcontroller (+5V and GND)."

This is how I have mine hooked up on my breadboard and it works fine. I bought a kit that included instructions and all the needed parts.

"My breadboard doesn't have any numbers on it."
Yes it does, they are clearly seen in the picture, from 1 to 30.

I found another breadboard but it's numbers are upside down and only every fifth number appears. Can I use the other rows? My letters are upside down as well and they are capitalized, will that make a difference?

Umm, please tell us you're taking the piss floresta.

numbers are upside down...My letters are upside down as well

Here's a tip, turn the bread board around.


Rob

I can't believe that you are responding to my idiotic posts instead of to the one that started all this. Actually the capacitor part was for real, I think Gomer knows as much about three terminal regulators as his namesake.

Don