Table of Contents
Hardware
ATMEGA32
The PU suffix indicates that the flash memory has already been pre-programmed with code which will talk to an IDE platform such as the Arduino IDE or Visual Code PlatformIO,
The MEGA32 (an AVR MicroController) is cheap but lacks SRAM (2K). For instance, if you use the AdaFruit GFX graphics library it uses most of available RAM. If you add another library – e.g. AdaFruitGFX+SD.h for SD card read/write, it will only be able to execute a few lines of very basic code before crashing!
See here for tips on reducing program RAM usage. Especially the ideal way to use a Serial.print() or Serial.println() instruction is with the use of the F() String wrapper around the literals. For example:
Serial.println(F("Something"));
Wrapping the String Something with the F() wrapper will move the Strings to Flash memory only rather than to use SRAM space also.
If your project is going to involve multiple devices (especially a display) then consider buying an Arduino with more SRAM. If your board uses a 40-pin DIP socket, you can replace it with a 644 or 1284 chip. It is often cheaper to buy a new board containing a MEGA2560 instead of a replacement DIP chip IC!
Software
IDE’s
I have used Arduino IDE v1.8 and v2 (AIDE) and MS Visual Code Platform IO (PIO). AIDE is easier but often harder to control libraries. If you have many different projects then consider learning PlO (steeper learning curve). PIO has one advantage in that you can just give it a github URL and it will automatically download and import the whole project!
On large ‘sketch’ start by printing SRAM usage – see here for code
See YouTube for videos on Platform IO.
YTubers = Ralph S Bacon, Andreas Spies, Tomas Tarnovski, Mirko Pavleski, Programming Electronics,