ATMega328 Standalone Help?

Discussion in 'Computer Software and Operating Systems' started by dj505, Nov 14, 2015.

  1. dj505
    OP

    dj505 Inexperienced Romhacker

    Member
    478
    104
    Oct 4, 2014
    Canada
    Most likely at the arcade
    Hi all!

    So, I saw this video showcasing how you can shrink down Arduino projects by just running the code off a standalone ATTiny85 chip. The video describes how to set up the chip and use another Arduino to program it, which I have the parts to do. I was wondering if the same can be done with an ATMega328? I ordered a few off eBay since I needed more I/O pins and storage space for sketches.

    My main question is how to run the Arduino code off an ATMega by itself. The reason I ask is that all the tutorials I've seen tell you to use a 16mHz crystal and two small capacitors and stuff to make an Arduino-compatible circuit right on a breadboard. That's not what I want to do. Someone told me I don't need those components, because the ATMega chip has fuses and an internal clock, and I don't need to burn a bootloader, but I just want to make sure. All I need is just the ATMega on the breadboard, capable of running Arduino code, even if it's only at half speed, like this:
    Image
    As you can see, no components other than the breadboard and ATMega.
    EDIT: Or can I just program the ATMega in the Arduino, take it out, and place it on the breadboard? If so how do I power it?


    On a side note, how would you power it? 5 volts connected to the +V pin and ground? Or could it handle 9 volts directly?
     
    Last edited by dj505, Nov 14, 2015
  2. dj505
    OP

    dj505 Inexperienced Romhacker

    Member
    478
    104
    Oct 4, 2014
    Canada
    Most likely at the arcade
  3. The Real Jdbye

    The Real Jdbye Always Remember 30/07/08

    Member
    GBAtemp Patron
    The Real Jdbye is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    11,429
    4,751
    Mar 17, 2010
    Norway
    Alola
    I would recommend to add a 16mhz crystal osc and two ceramic capacitors (18/22pF) as I believe the code only runs at a reduced 8mhz otherwise, and timing will be less accurate. You can get them very cheaply. I have a breadboard Arduino I set up this way, I also added a reset switch to it. Works exactly like a real Arduino, minus the built-in USB.

    You're planning on using the ArduinoISP sketch with your regular Arduino to program the breadboard Arduino? I could never get that one to work, and had to resort to using the bitbanging mode of the FTDI chip on my Arduino board to "emulate" an ISP programmer in software using a modded version of avrdude. Not recommended, it was a pain in the ass to get working. A cheap USBtinyISP programmer is a useful thing to have, I went and bought one for $8 on eBay so I would never have to go through that ordeal again. I would especially recommend one if you are programming several atmega328 chips, it makes life so much easier.

    I would also recommend getting a USB-TTL adapter to upload sketches and talk to them through serial directly so that you don't have to piggyback on the Arduino board to do anything. It's a very useful tool to have. Mine broke shortly after getting it though. Note to my future self: don't cheap out on the USB-TTL adapter, get a proper FTDI one even if it costs way more.

    Both of those will cost you maybe $7 in total with free shipping and they are one-time investments that can be reused for other projects so it makes sense to have them if you do a lot of Arduino stuff. FTDI USB-TTL adapters are way cheaper than last time I checked, I can find them on eBay for as low as $2 now when they used to cost $20. Probably cloned chips, but who cares as long as they work.

    Actually, since then I bought a few breadboard-able Arduino clones off of eBay which have built in programmable USB and only cost me $8 a piece, I find that there's not much point in making a barebones Arduino yourself anymore when you can get everything on one tiny board that fits nicely onto a breadboard for only $8, and can be soldered directly onto if you want a more permanent project. Though there is something to be said for making your own Arduino, it's a pretty cool project.
     
    Last edited by The Real Jdbye, Nov 18, 2015