Cheap Arduino solution??

Hi!
I am a total idiot concerning electronics, but I wanna learn it. So my question might be totally stupid but recently I saw bare microcontrollers (Chips) in electronic circuits:

Is it possible to use the atmega168-20AU without the arduino board?
I use arduino for developement and because the programming language is so damn cool in contrast to other microcontroller code I saw on the net. But for my little projects it's too expensive to use a full arduino diecimilla board. :frowning:

What do I need , to do the following: (with PSEUDO Code)

PC-->SERIAL Connection-->Send char '1'-->ATMEGA168-20AU
--> if(serial_input == '1')
{
Write(DigitalPin, High)
sleep(1000);
Write(DigitalPin, Low)
}

So the PC shall send a char '1' to the microcontroller. If the microcontroller gets this char it shall write to a digtal pin a HIGH signal for 1sec.

Is this possible? It works on the arduino but does it work with the atmega168 alone too?

Edit: I found out that I will be needing a Crystal oscillator??, but what else?
An Atmega48 will be sufficient for this task?

If you preprogram a chip on the Arduino board this setup will do Arduino Playground - Standalone.
Then you can either;

(1) Buy another atmega168 with the bootloader preprogramed to replace the original.

(2) Get a blank chip and program the bootloader yourself to replace the original, additional hardware required.

(3) Program a blank chip with the the sketch and no bootloader, additional hardware required.

Other than the Atmega8, Atmega168, and sort of the atmega644 via the Sanguino are supported by the Arduino IDE as far as I know so an atmega48 would be out of the question, at least as of now anyway.

Another alternative is the RBBB from Modern Device http://www.moderndevice.com/. You would also need a FTDI TTL-232R USB-to-TTL serial cable or a P4 RS232 to TTL Serial Adapter Kit depending on weather you use a USB or serial port interface respectively, however they are a one time buy.

Thank you for your thorough reply. :slight_smile:

I have a hardware store nearby which has the atmega168 as a blank chip.
If I plug it into my arduino diecimilla, how can I upload the diecimilla bootloader?

Can I programm the atmega168 on the arduino and then plug it off and put it on a breadboard, and it will work like on the arduino?
Or do I need "electronic stuff" between the pins of the atmega168 and the "normal wiring" so that I get digitalPins? This way I can't use any anymore PWM? Or is PWM designed by the atmega168 chip?

But what do I need if I planning to use a usb cable to get 5V and a breadboard?
-usb cable
-atmega168
-breadboard
-oscillator 16mhz?
-capacitors?
-resistors?

For burning the bootloader or burning a sketch directly to a chip see http://www.arduino.cc/en/Hacking/Bootloader.

Can I programm the atmega168 on the arduino and then plug it off and put it on a breadboard, and it will work like on the arduino?

Yes, see the link on my previous response for the minimum required parts to run a preprogramed chip on a breadboard. If you use the bootloader you may need to connect the RX pin to ground via. a 10K resistor to avoid it from reading garbage noise and mistaking it for communication which my cause you sketch to never start. Also i think you may want to connect the reset pin to 5v if you are not adding a reset button.

(2) Get a blank chip and program the bootloader yourself to replace the original, additional hardware required.

(3) Program a blank chip with the the sketch and no bootloader, additional hardware required.

You don't need extra hardware, you can burn the bootloader (or other sketchs) using this mod :
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1217113409

Probably I will invest a bit more money, on an atmel avrisp mkII so that i can program all? atmel microcontroller chips.
Because I have some little projects I want to make which shall be very small so that I want to use an atmel tiny microcontroller.

But please can you tell me what is the difference between the ATMEGA 168-20DIP and ATMEGA 168-20AU?
I found also other atmel chips with "postfixes" SO, SO8, 10SU, SI, PI, .. Is this only the casing? Does it even matter?

Most suffix letters matter, some don't. Look at the data sheet (usually near the end but before the index) to be sure.

ATmega8 family devices are available in 2 speed/voltage variants (low voltage V variant vs. full speed 5V variant with no letter designation, the number after the dash tells you the speed), leaded and lead free variants, and 4 different physical packages (DIP and 3 different surface mount). The P tells you it's a DIP package.

I has lead, U is lead-free (think unleaded). These don't really matter, unless you are manufacturing for delivery in Europe or have very long term reliability issues. Pretty much everything else matters in making sure you get the right part.

The AVRISPmkII is great, I have one. For about half the money, you can get the USBtiny from LadyAda. I have no experience with that one, but its reputation is good.

-j

I haven't tested this "mod your arduino" solution yet, but I guess that avrdude-serjtag can program any avr chip that supports ICSP and have a profil in AVRGCC.

Is it normal that I get an "ISP Mode Error" if I have the original Atmega168 in the arduino while connecting with the atmel isp mkII (AVR Studio) to the arduino board via the ISP Port?

If I replace the original chip atmega168 on the arduino I don't get this msg. Please help.