Go Down

Topic: Operating the Atmega328 without the arduino (Read 2 times) previous topic - next topic

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!:)

floresta

Quote
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

retrolefty

#2
Mar 20, 2011, 11:37 pm Last Edit: Mar 20, 2011, 11:39 pm by retrolefty Reason: 1
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.  :D


dragonuv

#3
Mar 21, 2011, 12:02 am Last Edit: Mar 21, 2011, 12:07 am by dragonuv Reason: 1
wow guys thanks for the super fast reply :D


Quote
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.


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.  :D


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:
http://img810.imageshack.us/i/img0006ae.jpg/

retrolefty

Quote
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


dragonuv


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?

retrolefty

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


floresta

Quote
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

floresta

Quote
(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

dragonuv

#9
Mar 21, 2011, 02:18 am Last Edit: Mar 21, 2011, 02:26 am by dragonuv Reason: 1

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?


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


Quote
(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?

floresta

Quote
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.

Quote
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

Graynomad

Quote
0.1 uf each, is that too much?

Just a tad :)

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

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.


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.


Quote
(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

GomerPyle

#13
Apr 03, 2011, 06:36 pm Last Edit: Apr 04, 2011, 07:25 am by GomerPyle Reason: 1

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!:)

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.
http://www.atmel.com/dyn/resources/prod_documents/8271S.pdf

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.  

floresta

Quote
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

Go Up