Go Down

Topic: Calculating board's computation ability (Read 462 times) previous topic - next topic

ardfoss

Hi All,
Generically how do we calculate the amount of memory required to hold c/ python library  , which arduino board is suitable.
Do we have a online calculator for these.
For example : haversine formula compute using math library.


wvmarle

Start by writing some simple code, compile it for your intended target board, see what the resulting file size is.
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

ardfoss

#2
Nov 11, 2019, 12:10 pm Last Edit: Nov 11, 2019, 12:43 pm by ardfoss
Thanks for the reply but how to choose "intended target board".
Let's say  a program gets verified on a particular board but another board may be more suitable than this !
A typical haversine call shows
On Atmega328:
Sketch uses 4110 bytes (8%) of program storage space. Maximum is 48640 bytes.
On Arduino Zero:
Sketch uses 30016 bytes (11%) of program storage space. Maximum is 262144 bytes.

we still do not know which one will fare better when we add gsm, gps and sdcard modules and how effective it is when used at a particular frequency, not to forget which 3.3/5V will suit the device and cost effectiveness if produced on a large scale. Can we simulate these things.

wvmarle

That is where engineering experience comes in play!

There's code size. But then there's computing power. There's processor features (e.g. number of ADC, number of Serial ports, number of timers, timer functions, interrupts, ...). There's so much more to choosing a board than "does this code fit?".

Just recently I did a project revolving around a stepper motor. Embedded, low cost, rather simple application so code size won't be too big. Just an encoder for input, limit switch and 7-segment LED display.

First was counting required inputs/outputs. The project required lots of timing for the stepper, so timers are important. That got me to the ATtiny441. But the ATtiny44a is much cheaper - and actually its two timers is enough for what I had to do, and I had no need for hardware I2C or Serial communication. I needed 11x I/O so that left no space for an external crystal, well 8 MHz is enough for the application. Not very precise or stable that oscillator but good enough for this application.

Then programming. For long time I managed to keep the code under 4 kB. But of course feature creep set in and the code grew over 4 kB, so switched to an ATtiny84a in the final project.

Another project was a bit simpler. Again as small as possible. I had developed the code before on an 80 MHz ESP8266, and high resolution and stable timing is important. AVR processors max out at 16 or 20 MHz, a difference that mattered there. For cost again the ATtinyx4a seri
Lotses; code is about 6.5 kB so that's calling for an ATtiny84a. In this case running with a 20 MHz crystal.

Yet another project of mine calls for almost 40 I/O lines, plus I2C and two Serial interfaces, and will have lots of code. For that one I picked the ATmega1281, with 16 MHz crystal for speed. When the programming is done I may switch to another processor in the same family based on code size, and I may bump the speed to 20 MHz but that's probably not necessary.

The moment WiFi comes in play, the natural choice is the ESP8266. But mind, it's a very different beast than the AVR line. I've had weird crashes with them, simply because I ran out of memory while I thought I had like 36 kB of RAM free. I've had crashes when I let it work really hard - to the extent that I had to reduce the SoftwareSerial to 2400 bps to not lose bits - and am now redesigning that to split off the control part (gonna run on AVR) from the user interface and WiFi part (running on ESP8266).

That's how I choose a processor. A bit of preselection, followed by a bit of trial and error.

For prototyping, start with the ATMega328p unless you have good reason to go for another board (more I/O pins needed, Serial ports, WiFi communication, etc).

Those boards are dirt cheap, and you can never properly simulate how it behaves on another computer. Start as I mentioned by counting I/O requirements, then start writing some basic code. See how it performs on the board of choice. Start with the cheapest, if that's not good enough move up.
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

ardfoss

That was great insight. Thanks for the pointers.
How do you see xilinx and vhdl in comparison to arduino.

wvmarle

How do you see xilinx and vhdl in comparison to arduino.
I don't know them. Maybe someone else can pitch in on that.
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

MarkT

#6
Nov 22, 2019, 11:28 pm Last Edit: Nov 22, 2019, 11:29 pm by MarkT
Hi All,
Generically how do we calculate the amount of memory required to hold c/ python library  , which arduino board is suitable.
Do we have a online calculator for these.
For example : haversine formula compute using math library.


No, never heard of such a thing.  You need an operating system that's supported by Python to run standard Python, its more than just a language, its a complex software environment.  You either have enough disc space or not(!)

Micropython might be more appropriate.  Not the same thing though.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

Go Up