Using Atmega1284 with Arduino

I downloaded an archive for my selected branch of Arduino (version 1.6.3 at the time of writing).

Mighty 1284P: An Arduino core for the ATmega1284P

I connected my programmer AVRISP mkII to the ISP header of the board to upload the Arduino bootloader. I also connected the FTDI device to provide the 5V power to the board; otherwise, programming doesn’t work.


I use the variant of the microcontroller pin definitions “avr_developers”, also known as “sanguino” for my project.

You can find the definitions in the file ~/arduino/hardware/arduino/avr/variants/avr_developers/pins_arduino.h

// ATMEL ATmega1284P (should also work for SANGUINO/ATmega644P)
//                       +---\/---+
//           (D 0) PB0  1|        |40  PA0 (AI 0 / D31)
//           (D 1) PB1  2|        |39  PA1 (AI 1 / D30)
//      INT2 (D 2) PB2  3|        |38  PA2 (AI 2 / D29)
//       PWM (D 3) PB3  4|        |37  PA3 (AI 3 / D28)
//    PWM/SS (D 4) PB4  5|        |36  PA4 (AI 4 / D27)
//      MOSI (D 5) PB5  6|        |35  PA5 (AI 5 / D26)
//  PWM/MISO (D 6) PB6  7|        |34  PA6 (AI 6 / D25)
//   PWM/SCK (D 7) PB7  8|        |33  PA7 (AI 7 / D24)
//                 RST  9|        |32  AREF
//                 VCC 10|        |31  GND
//                 GND 11|        |30  AVCC
//               XTAL2 12|        |29  PC7 (D 23)
//               XTAL1 13|        |28  PC6 (D 22)
//      RX0 (D 8)  PD0 14|        |27  PC5 (D 21) TDI
//      TX0 (D 9)  PD1 15|        |26  PC4 (D 20) TDO
// INT0 RX1 (D 10) PD2 16|        |25  PC3 (D 19) TMS
// INT1 TX1 (D 11) PD3 17|        |24  PC2 (D 18) TCK
//      PWM (D 12) PD4 18|        |23  PC1 (D 17) SDA
//      PWM (D 13) PD5 19|        |22  PC0 (D 16) SCL
//      PWM (D 14) PD6 20|        |21  PD7 (D 15) PWM
//                       +--------+

I use my AVRISP mkII programmer to load the bootloader into the microcontroller. I use Atmel AVR Studio (version is 4.19).

I go to Tools -> Program AVR -> Connect. Then I select my programmer.

Selecting a programmer, AVRISP mkII in my case
Selecting a programmer, AVRISP mkII in my case
Reading the signature from Atmega1284p
Reading the signature from Atmega1284p
Selecting the bootloader hex file, optiboot_atmega1284p.hex in my case.
Selecting the bootloader hex file, optiboot_atmega1284p.hex in my case. Click on Program to upload the bootloader into the chip.
Program the fuses into the chip.
Program the fuses into the chip.

Then I copy the files from the downloaded archive into the hardware/arduino/avr/ subdirectory of the installed Arduino directory and add the settings for the avr_developers board into boards.txt.

############################################################## pinouts 16MHz using Optiboot

After that I select this board in the Arduino IDE: Tools -> Board

Arduino Clock Atmega1284p with MIDI player and Internet

The Arduino Clock
  • uses the C++ object-oriented code written for the Arduino framework
  • is powered by the 8-bit Atmel’s microcontroller ATmega1284P
  • is installed on the PCB from Wise Clock 4
  • displays information on the Sure Electronic’s 32X16 RG Dual Color LED Dot Matrix Unit Board (display colors: red, green, orange)
  • adjusts time from the Internet using the NTP protocol via the Wi-Fi RN-XV WiFly Module
  • shows the weather forecast from the Internet
  • has alarms that can be configured to activate every day or once on a specific date or tomorrow or on different week days
  • plays music in the RTTTL format that was popular in mobile phones
  • plays music in the MIDI format via the Fluxamasynth Shield that uses the Atmel’s and Dream’s ATSAM2195 MIDI chip
  • changes the brightness of the display depending on the light level in a room detected by the light-dependent resistor
A video with the description of the clock menus
Here are the internal devices of the clock
Download the code for the clock

From Github: