Question

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.

Was it helpful?

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.

OTHER TIPS

It all depends on what your doorbell recognition scheme actually is. If it requires FFT and/or fancy floating point arithmetics, then you may easily exhaust the AVR's SRAM. If it is only some glorified finite state machine with a somewhat decent implementation I would be surprised if this exhausts an Uno.

The most important question though is: what are you building? A protoype? A one of? Or a pilot for a series? If it is not for a series then developer time is most expensive --> go for a bigger machine in the first place. If you are developing for a series compute hardware cost vs. developer time --> aim at the cheapest controller that will still fit your needs. That is: take the biggest of the Atmel family and once you have a running prototype shrink it down. IMHO a doorbell whatever thingy should fit into an ATiny.

The Atmel microcontrollers do not support an external program bus that would allow adding ROM and expanding the amount of code. Some devices support extending the data bus which would allow RAM to be added. I would say this is one of the key distinctions between a microcontroller and a microprocessor, although there may be some fuzziness in the separation. So when you run out of code or memory, you are stuck with finding efficiencies or cutting features. My advice when picking a microcontroller is decide first:

Am I cost constrained or time constrained?

If cost constrained, then you pick the device you can afford and make your application fit. If constrained by time, pick the largest device you can get away with.

You say you are time constrained and uncertain of the code scale. If there is any way you can justify a $1000 PC+IO board the go that route. Sounds a little expensive for a doorbell...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top