Search code examples
arduinoraspberry-pimultiplexingeepromflash-memory

Arduino Mega vs Uno


We're programming a doorbell recognition system and have decided to use the Arduino to handle most of the circuitry. The one thing I'm unsure of is the program capacity of the Arduino Uno vs the Arduino Mega. I know the Uno has only about 32 KB of flash memory, but our program is projected to land within a thousand lines of code (which I assume would go over the 32 KB threshold).

We don't have much time to complete the project, so we don't want to spend a lot of time figuring out how to multiplex or add memory to the Uno if it can't handle what we need from it out of the box.

How difficult (and time consuming) would it be to add EEPROMs to the Uno? Would it be better to just stick with the Mega?

Also, would it be easier to just use a PC (with a DAQ board or something else) or a Raspberry Pi rather than an Arduino in the first place?

The system we are designing is being used to read input from a fingerprint scanner and output a unique ring to a speaker. What we need is for the system to be physically compact so it can fit to replace and actual doorbell system in a home (which hopefully the Arduino can help to accomplish).

The reason the code is projected at around a thousand lines is since we may implement mobile application communications into it, locking/unlocking the door, etc. I'm making the assumption that 32 KB (from the Uno) is not enough based on the sizes of some of my C programs (that are in the thousand lines range) which are usually around 100 KB.

Basically, we need it to be scalable to a point where the program could be greater than our projected size or even less than it. We don't want to end up having to purchase multiple boards if one will suffice.


Solution

  • 32 KB in a microcontroller is a lot of program memory. 1,000 lines of code is likely to assemble down to a few kilobytes, and all the Arduino libraries are likely to still be bigger than your program.

    If I recall, I don't think any of the ATMegas support having external program memory. If you have something like a large lookup table, you could get an I²C EEPROM and load it into there.

    As for the PC/Raspberry Pi, some sort of I/O board for the computer is likely to cost much more than an Uno or Mega, ditto with the Raspberry Pi, especially if you need analog inputs or PWM.

    I would say, for now, stick with the Uno, but keep any pins you use as #defines, that way, if you do run out of program ROM, you could easily port it over to the Mega.