Programming ATINY and ATMEGA328 with Arduino IDE

Hello all!
I am only an occasional micro programmer - based on occasional projects.
Years ago - I started programming PICs - and will occasionally have a PIC project.
But I really prefer the Arduino World-Wide Community!!
I also find the Arduino IDE as a wonderful platform for programming - because the libraries and code examples allow one to get up and running quickly.

I still however enjoy programming PICs which come in DIP package.
I'm wondering if the ATINY and the ATMEGA328 would be viable candidates as DIP package devices - which I can program using the Arduino IDE.

Is anyone doing this?
And if so - could you point me in the direction that I can pursue?
Very sincere thanks!

You need to install the cores; plenty people use it.

For the ATtiny: GitHub - SpenceKonde/ATTinyCore: Arduino core for ATtiny 1634, 828, x313, x4, x41, x5, x61, x7 and x8
For the 328 (not 328P): GitHub - MCUdude/MiniCore: Arduino hardware package for ATmega8, ATmega48, ATmega88, ATmega168, ATmega328 and ATmega328PB

Please do not post in "Uncategorized"; topic moved. See the sticky topics in Uncategorized - Arduino Forum.

Note:
328P can be directly programmed without additional cores (5V/16MHz).

Wonderful!
Thank you!
I thought I posted this in the "Using Arduino" category - but maybe it didn't take? But thank you very much for your very helpful response!

I have another question for you.
I notice the Arduino UNO board can come with the ATmega328P in a DIP package - inserted into a 28 pin socket on the UNO board.

I would assume that I could program that chip on that board using the Arduino IDE - and simply pull the chip out and install it on a project board when its time for its permanent location.

It would of course need the external crystal setup.
And also the installation of a boot-loader within any new 328 device
But I'm wondering if that would not be a viable platform for programming that device?

Sincere thanks

Definitely! You might also find the ATmega1284P to be an interesting candidate. It is available in a DIP package and has excellent Arduino support via the "MightyCore boards platform. This is useful for projects where you need more I/O pins or more memory than the ATmega328P can provide.

The price of the chip is significantly higher, but for one-off projects an extra $5 in BOM might not be significant. In cases where it is and your project doesn't require so much memory, there are some other members of the ATmega1284P family also supported by MightyCore that are available for a bit less (I have found the ATmega32 for a quite reasonable price in the past).

Also definitely worth looking at the ATmega4809. This is one of the newer generation of AVR chips, so slightly less well supported by the Arduino ecosystem as a whole than the classic AVR chips, but this is the microcontroller on the Arduino Nano Every so it is in widespread use by the community. It has good resources at a reasonable price point for a DIP package Arduino compatible microcontroller. MCUdude comes to the rescue once again to add comprehensive support for this chip through the excellent MegaCoreX boards platform.

If you put a factory fresh ATmega328P chip on the UNO board, you must connect an ISP programmer to the board and then do a "Burn Bootloader" operation in Arduino IDE in order to:

  • Set the configuration fuses on the chip to the appropriate settings.
  • Flash the bootloader that allows you to upload sketches via the UNO's USB cable as usual.

If you don't have a dedicated AVR ISP programmer, you can use a spare Arduino board as a DIY "Arduino as ISP" programmer:

You can actually upload sketches to the chip via the ISP programmer by selecting Sketch > Upload Programmer from the Arduino IDE menus, so the bootloader is optional, but setting the configuration fuses is not optional (unless the factory default fuse settings happen to meet your requirements, which is rare).

It is not mandatory. You can run the microcontroller from the internal clock source. You can configure the chip for this clock via MiniCore:

  1. If you haven't already, install MiniCore by following the instructions in the readme:
    https://github.com/MCUdude/MiniCore#boards-manager-installation
  2. Select Tools > Board > MiniCore> ATmega328 from the Arduino IDE menus.
  3. Select Tools > Clock > Internal 8 MHz from the Arduino IDE menus.
  4. Connect an ISP programmer between the UNO board and the computer.
  5. Select the appropriate programmer from the Tools > Programmer menu in Arduino IDE.
  6. Select Tools > Burn Bootloader from the Arduino IDE menus.

This will configure the chip to run off the internal clock source. This means that when you pull it out of the UNO, you can use it in a project board that doesn't provide an external clock source. The internal clock is not as accurate, but it it good enough for many applications (there are actually some popular Arduino boards that use AVR microcontrollers running from the internal clock source).

The problem is that the socket is not really ideal for this application. It takes a fair bit of force to remove the chip and it tends to come loose very suddenly. If the pins come loose from one end of the socket before the other, the pins can become badly bent, which is inconvenient to realign and can cause them to break off if it happens multiple times.

But other than that, it is great. You can also use it with the other pin compatible chips in the family like ATmega168 and ATmega8 (which are also supported by MiniCore).

There are these "ATmega8 Minimum System" boards available from the online marketplaces:

They have a ZIF (zero insertion force) socket that is specifically designed for this application where chips will be inserted and removed from the socket frequently. The ATmega8 is pin compatible with the ATmega328P, so they work just as well for any of the chips of that family.

The boards (as well as the "ATmega32 Minimum System" variant for the DIP-40 chips) are quite reasonably priced (probably about the same as you would pay for the socket component alone). The crystal is in a machine header, which makes it easy to swap for other frequencies or remove for verifying the chip is running on the internal clock.

I wish they had a 2x3 ICSP header (which is the standard in the Arduino world) instead of the 2x5 header. I also wish they had an "FTDI" header to make it easy to connect a USB to serial adapter to the chip for communication or uploading via the bootloader. For a use case where those features are important, the UNO as platform might be more attractive.

WOW!!!! Thank you very much!!!
Very sincere thanks!!!

You are welcome. I'm glad if I was able to be of assistance.

Regards,
Per

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.