Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How much data can I save using PROGMEM, on the Arduino platform (Atmega328)?

For example:

prog_char path[] PROGMEM = {'M',103,95,'U',0,0,'M',103,95,'M',103,95,'M',103,95,'M',103,95,'M',

(Numbers go up to 180.)

Where can i find this information?

share|improve this question
The stack is in program memory? – AngryEE Feb 21 '12 at 17:43
@tyblu, AngryEE is right to question, stack is in SRAM, PROGMEM macro places stuff in program memory (flash) – Jon L Feb 21 '12 at 18:27
Perhaps I should familiarize myself with Arduinos before commenting in the future, @JonL ;) ... comment deleted. – tyblu Feb 21 '12 at 18:36
@tyblu, Just an FYI, Not sure if you're into Atmel's offerings, but the PROGMEM macro and types are defined in the avr-gcc library pgmspace.h - very useful if you're trying to squeeze as much as you can out of your AVR :) (so not just an Arduino specific thing) – Jon L Feb 21 '12 at 19:25

To see how much memory is available on your arduino, check the GUI after it uploaded the code: "Binary sketch size x bytes (of y byte maximum)". \$ y-x \$ would be the amount available to place data in.

Or check the tech specs of your Arduino for the value of Flash Memory. All Arduinos with a 328 offer 32kByte of flash, 2k of which is taken by the bootloader, your sketch may take 4k or so, to be on the safe side I would not store more than 20kByte of data.

share|improve this answer
ok and so i can compute how many char i can put it with: (y-x)/2 considering a prog_char type 2 bytes long. is it right? – nkint Feb 21 '12 at 13:17
prog_char is 1 byte long. You can check the size of a type with the sizeof function, see coverclock.blogspot.com/2012/02/arduino-data-types.html – posipiet Feb 21 '12 at 16:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.