# Programming ATMega 168

**URL:** <https://community.sparkfun.com/t/programming-atmega-168/28006>\
**Category:** Arduino\
**Created:** [December 25, 2013, 6:40pm UTC](https://community.sparkfun.com/t/programming-atmega-168/28006 "2013-12-25T18:40:18Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![LoneWolf4](https://avatars.discourse-cdn.com/v4/letter/l/6f9a4e/32.png) [@LoneWolf4](https://community.sparkfun.com/u/LoneWolf4)\
**Post date:** [December 25, 2013, 6:40pm UTC](https://community.sparkfun.com/t/programming-atmega-168/28006/1 "2013-12-25T18:40:18Z")

</div>

Hi, I got an ATMega 168 preloaded with the Arduino bootloader, I also have a crystal, and capacitors.

As far as my understanding goes I can program it using a serial port by connecting rx, tx and dtr. I have a Prolific usb-to-serial adapter, what I dont know is if I can connect it directly to the usb-serial adapter or not. Can I do it? Or it will kill the ATMega?

---

<div class="post-metadata">

**Author:** ![Ross\_Robotics](https://avatars.discourse-cdn.com/v4/letter/r/cc9497/32.png) [@Ross\_Robotics](https://community.sparkfun.com/u/Ross_Robotics)\
**Post date:** [December 25, 2013, 8:10pm UTC](https://community.sparkfun.com/t/programming-atmega-168/28006/2 "2013-12-25T20:10:20Z")

</div>

It depends on what voltage your running the Atmega at. The adapter should be running at the same voltage.

---

<div class="post-metadata">

**Author:** ![LoneWolf4](https://avatars.discourse-cdn.com/v4/letter/l/6f9a4e/32.png) [@LoneWolf4](https://community.sparkfun.com/u/LoneWolf4)\
**Post date:** [December 25, 2013, 8:15pm UTC](https://community.sparkfun.com/t/programming-atmega-168/28006/3 "2013-12-25T20:15:16Z")

</div>

The atmega should be at 5v, so as long as my serial port is at 5v too it will be ok?

---

<div class="post-metadata">

**Author:** ![waltr](https://avatars.discourse-cdn.com/v4/letter/w/898d66/32.png) [@waltr](https://community.sparkfun.com/u/waltr)\
**Post date:** [December 25, 2013, 8:23pm UTC](https://community.sparkfun.com/t/programming-atmega-168/28006/4 "2013-12-25T20:23:07Z")

</div>

a Prolific usb-to-serial adapter

Will have RS232 Voltage levels on the serial side (read Wikipedia for details).

These are NOT 5V and are also inverted compared to TTL level serial.

Typically a MAX232, or equivalent, is used as a level translator between RS232 and TTL serial.

---

<div class="post-metadata">

**Author:** ![jremington](https://yyz1.discourse-cdn.com/sparkfun/user_avatar/community.sparkfun.com/jremington/32/6595_2.png) [@jremington](https://community.sparkfun.com/u/jremington)\
**Post date:** [December 26, 2013, 7:16pm UTC](https://community.sparkfun.com/t/programming-atmega-168/28006/5 "2013-12-26T19:16:25Z")

</div>

To program an AVR microprocessor using the Arduino environment, you need a 5V (or 3.3V if appropriate) TTl level serial adapter that also brings out a modified version of the RS232 DTR signal, for the reset. Either RS232 to TTL or usb-serial adapters will work. If you aren’t comfortable soldering as follows [http://playground.arduino.cc/Learning/AutoResetRetrofit](http://playground.arduino.cc/Learning/AutoResetRetrofit) you can buy ready made programming adapters (usually USB-serial) quite cheaply from a number of outlets. The crystal for the processor has to be 16 MHz.

---

<div class="post-metadata">

**Author:** ![LoneWolf4](https://avatars.discourse-cdn.com/v4/letter/l/6f9a4e/32.png) [@LoneWolf4](https://community.sparkfun.com/u/LoneWolf4)\
**Post date:** [December 26, 2013, 7:26pm UTC](https://community.sparkfun.com/t/programming-atmega-168/28006/6 "2013-12-26T19:26:14Z")

</div>

Now I am confused, so my adapter may work? Can I simply plug it to the computer and measure the levels with a multimeter?

---

<div class="post-metadata">

**Author:** ![Mee\_n\_Mac](https://avatars.discourse-cdn.com/v4/letter/m/aeb1de/32.png) [@Mee\_n\_Mac](https://community.sparkfun.com/u/Mee_n_Mac)\
**Post date:** [December 26, 2013, 7:58pm UTC](https://community.sparkfun.com/t/programming-atmega-168/28006/7 "2013-12-26T19:58:24Z")

</div>

> LoneWolf4:  
> Now I am confused, so my adapter may work? Can I simply plug it to the computer and measure the levels with a multimeter?

A link to your specific adapter, or it's model #, would help. As stated above it's likely to output RS232 serial, which are +/- 12v levels ... not the 0-5v TTL serial that your ATmega can tolerate. W/o specific info to the contrary I would not connect the two. If you have a DVM you could measure the resting state of the adapter, after it's been initialized, which should be a stop bit. That's 0v for TTL serial and -3v to -15v for EIA-232 (the new RS232).

---

<div class="post-metadata">

**Author:** ![LoneWolf4](https://avatars.discourse-cdn.com/v4/letter/l/6f9a4e/32.png) [@LoneWolf4](https://community.sparkfun.com/u/LoneWolf4)\
**Post date:** [December 26, 2013, 8:12pm UTC](https://community.sparkfun.com/t/programming-atmega-168/28006/8 "2013-12-26T20:12:07Z")

</div>

Well a model number its something I dont have, its from a chinese online store (and it was pretty cheap).

---

<div class="post-metadata">

**Author:** ![jremington](https://yyz1.discourse-cdn.com/sparkfun/user_avatar/community.sparkfun.com/jremington/32/6595_2.png) [@jremington](https://community.sparkfun.com/u/jremington)\
**Post date:** [December 26, 2013, 8:28pm UTC](https://community.sparkfun.com/t/programming-atmega-168/28006/9 "2013-12-26T20:28:35Z")

</div>

Was the adapter advertised as being suitable for programming an Arduino? If not, it is most likely not suitable.

If you don’t have a reset pushbutton there needs to be a capacitor (somewhere) for the DTR signal. See the schematic for this bare bones kit, which shows an 0.1 uF cap in the DTR/RTS RESET line: [http://moderndevice.com/product/bare-bo … d-bbb-kit/](http://moderndevice.com/product/bare-bones-board-bbb-kit/)
