Using Atmega328 on it's own doesn't work (no arduino board)

Hi, I have arduino Uno and now I have programmed it and it works fine but I want Atmega328 chip to work on it's own, so I can encase it with silicone. I have connected the pins as they were on the Arduino but the led just doesn't light up. I am using an old phone charger (5V) that worked fine with the Arduino board. Atmega328 did not get damaged as I put it back and was able to update the code. I have 5V power adapter connected to VCC/GND pins and to the led (it's high power). I use logic pins to accept input from a dip switch and output PWM data via 3 pins for rgb light. Is there anything different whne using Atmega328 alone?

Are you wired up like this, or have you set the fuses to run from the internal oscillator?

Shows us the wiring drawing you used to try it out standalone.

Lefty

I wasn't aware that you need extra hardware/software to use the chip. I looked at the links but they don't seem to be for Arduino Uno or Atmega328. I really don't want to add any parts to it, I was hoping I could just program it with arduino and drop it in as it is. Is it possible to program the chip using arduino uno in a suitable way for standalone use?

It seems too much work to get it to work, considering how expensive arduino is why do people even use it? Even just Atmega328 is not that cheap, and now it seems it's not even simple to use standalone... Maybe I am missing something..?

Even just Atmega328 is not that cheap

Compared to what? Remember the 328 chip has 32k bytes of program size. There is a cheaper chip, the mega8 that can be used with a little finagling of the software. Also for the very smallest and cheapest applications there is the Atmel Tiny series of controller chips. These are not supported directly by the arduino IDE but people have come up with the software modifications to utilize these small pin count chips.

There is no cheaper development system available to the average hobbyist in my opinion. Possibly some of the PIC chips can rival it in costs but you would still need to purchase a hardware programmer compatible with the the PIC's Windows only development IDE system.

What were your expectations for chip costs and development investment needed?

Lefty

Well if I could get it to work standalone without this much trouble I wouldn't complain. Arduino board is certainly too expensive to use for a simple mood light :slight_smile:

PIC's are cheaper (and still enough for most simple projects). Don't take me wrong, arduino is a lot easier to work with but for and end project is doesn't seem very well suited, at least in this case... The thing with pic is that you only need a programmer and then you can just use the chip with no extra parts...

Any suggestions on how to make it work standalone? This link shows a minimal setup but it's only for Arduino Duemilanove. http://arduino.cc/en/Tutorial/ArduinoToBreadboard

Is something similarly simpe possible with arduino uno?

Well what about the link in above post? It clearly states that you can use internal oscilator, why is that not possible with arduino uno?

dominicm:
Well what about the link in above post? It clearly states that you can use internal oscilator, why is that not possible with arduino uno?

It is possible to run a 328 chip in standalone without using a external crystal. It would then use it's internal 8 mhz R/C clock. This would require burning a different bootloader and fuse settings onto the chip and reconfiguration of IDE settings but it is possible, people have done it. It's just a lot of details and hard to just jot down all the steps needed to get there. Ease of doing that is how do you want to program the standalone chip. Your Uno can be loaded with a sketch to act as a hardware programmer and eliminate the need to even have a bootloader on the standalone 328 chip by programming is via ISP pins. Lots of ways to do it, but for saving a $1 on a crystal it's quite a few hoops you have to step through.

You still require a couple of .1ufd bypass caps for power filtering, all controller chips require that even PICs. And a pull-up resistor on reset is a good practice, but also not required.

It's gonna be more than a buck, with shipping it will end up more like 8 bucks. It looks like arduino is just fro prototyping, and I don't see the point in prototyping anything if it's never gonna be a useful and economically viable device. As for capacitors, this link:High Power LED mood Lamp - Electronics-Lab.com shows a pic based led moodlight and I don't see any capacitors used.
If you compare the cost of the two arduino based moodlight will be ~70% costlier simply because you can't use the atmega chip alone (not like a pic anyways), it a real shame...

That link also shows that you don't need any extra parts for standalone config. How come that was the case for Arduino Duemilanove but not the Arduino uno? Or is that article incorrect?

If you have battery connected direct to VCC/GND, then it effectively acts like a Big capacitor.

As stated, you need to set fuses to run from internal oscillator.
If you can make a cable to connect to the ICSP header pins, MISO, MOSI, SCK, RESET, GND, POWER pins you can program it directly using an AVR Programmer, such as
http://www.nkcelectronics.com/pocket-avr-programmer.html
or comparable from where you are, and you will then have a tool for your next project as well.

Can you explain bit more/provide links because I have no degree in electronics so all this only makes partial sense to me :slight_smile:

Would the AVR programmer be basically like a pic programmer for atmega chips? Could I just drop the atmega328 into the project as is with no extra parts? Is there anything else I need to know? Any hardware parts?

Most folks wire up the part like the schematic above, here's one I built up like that.
Having the crytsal makes the speed very solid for serial interfacing.
If you're not doing serial interfacing then totally standalone should work; you can find threads here where people have done that. May have to look in the old forum.

To program, you could plop the part in a solderless breadboard with an 8 MHz crystal & 2 caps (or resonator), pullup resistor to +5.
Then connect the programmer to the 6 pins mentioned, and tell the IDE you wanted to burn a bootloader into a 3.3V/8 MHz Promini.
Download your sketch, check it out, then change the fuse to use the internal oscillator and try it standalone without the other parts, running on 3 AAAs or similar, or a 3.7V LiPo, etc. Most applications still add the 10K pullup resistor jsut for consistent reset operation (i.e. not fickly resetting itself when a hand is waved around the device kind of thing).

I moved a sketch from Arduino Uno on to my own hardware recently, using my Arduino Uno as an ICSP to save the cost of buying a programmer. See Prototyping small embedded projects with Arduino | David Crocker's Solutions blog for details. In that design I used an 8MHz ceramic resonator to provide the clock, but if timing is not critical you can use the internal 8MHz oscilator instead. A virgin atmega328p will run at 1MHz (i.e. 8MHz internal clock divided by 8), so if this is satisfactory for your application, you don't even need to program the fuses.

Your article is exactly what I was looking for but some of it is not clear to me. The 6 pins on the arduino - where do I connect them to exactly? I assume 6 pins need to be connected to the atmega328 but they are not marked (that's ok since I can look up pin map) and you didn't mention to which pins of the amtmega328 they need to connect to? All I want is the simplest option, with no fuse changes or anything like that..

Ok, I figured it out, almost :slight_smile:

Using these 2 links I matched most pins except "RST" and "VTG". "RST" sounds like reset is that correct? What about "VTG"?

If you look at the Arduino Uno schematic http://arduino.cc/en/uploads/Main/arduino-uno-schematic.pdf you can see the connections between the 6-pin header (labelled ICSP) and the atmega328 (labelled ZIC1). Use the same connections on your own hardware. Yes, RST goes to the Reset pin, and you also need a 10K pullup resistor between Reset and Vcc. VTG goes to +5v.