Author Topic: FOSS EE calculator for Android and PC  (Read 1473 times)

0 Members and 1 Guest are viewing this topic.

Online RoGeorgeTopic starter

  • Super Contributor
  • ***
  • Posts: 6207
  • Country: ro
FOSS EE calculator for Android and PC
« on: December 13, 2023, 08:43:45 am »
I need a calculator with most used EE formulas and the following features:
  • must be FOSS and must work entirely local, offline
  • EE oriented, not generic Octave or Python
  • have dedicated buttons for engineering units mV, kHz, etc, aside from the numerical buttons.  For example, when a frequency is to be typed, I do not want to type k, H, z, I want to see 4 different buttons as Hz, kHz, MHz and GHz, so to press only the 'kHz' button instead of 3 letters
  • have predefined formulas where to type only the numbers and press the button units.  For example, in \$F_{(L,\text{ }C)}=1/(2\pi\sqrt{LC})\$, I want to press only 1  0  0  uH  TAB  to jump to the C value and press 1  8  0  pF, so 9 buttons total, and see the answer live, while typing the numbers, then the MHz button to display the result as 1.186 MHz instead of 1186270.9056952952
  • have digit grouping and units by default.  Display the above number as  1'186'270.905'695'295'2  for generic use, or  1.186 MHz  for engineering.  Then press Hz if you want to see it as  1'186'270.905 Hz  Engineering calculator or not, displaying 1186270.9056952952 is absolutely stupid no matter the program.  For some reason, all programming languages, even the spreadsheets, are using the stupid mode as default.  :-// 
  • can 'rotate' a formula, for example calculate either F(L, C), or L(F, C), or C(F, L) by simply jumping with TAB between the three F, L, C entry fields, and complete with numbers any 2 of them, while for the 3rd only press the button for the units  (and no numbers).  For example, type 100.05 MHz for F, then TAB to jump to the L value and type only nH (no numbers), then TAB to jump to the capacitor and type 10 pF to calculate L in nH.
  • have a well organized collection of most used formulas, but do not nest them more than 2-3 levels
  • have suggestive icons and show a schematic, for example draw 2 parallel resistors first, then the math formula, so to be easy to recognize all visually
  • keep it simple, only numerical and units for the most common EE formulas, no 3D plots or scripting

Things like that, nothing more than common sense.  I've searched and couldn't find any decent EE calculator.

What do you use?
« Last Edit: December 13, 2023, 09:00:09 am by RoGeorge »
 

Offline tom66

  • Super Contributor
  • ***
  • Posts: 6709
  • Country: gb
  • Electronics Hobbyist & FPGA/Embedded Systems EE
Re: FOSS EE calculator for Android and PC
« Reply #1 on: December 13, 2023, 11:40:08 am »
KiCad has a built in EE calculator which can be run standalone.  Without opening it up I don't know if it satisfies all of your requirements but I am aware it does support parameter substitution for some modes.

https://docs.kicad.org/6.0/en/pcb_calculator/pcb_calculator.html
« Last Edit: December 13, 2023, 11:42:09 am by tom66 »
 
The following users thanked this post: RoGeorge

Online RoGeorgeTopic starter

  • Super Contributor
  • ***
  • Posts: 6207
  • Country: ro
Re: FOSS EE calculator for Android and PC
« Reply #2 on: December 13, 2023, 11:56:17 am »
Close, but still requires redundant actions.  For example:



Why does it need a 'Calculate' button in that screen?
It should calculate the results 'live', on events, each time a number is pressed in any of the input textboxes.

Online shapirus

  • Super Contributor
  • ***
  • Posts: 1370
  • Country: ua
Re: FOSS EE calculator for Android and PC
« Reply #3 on: December 13, 2023, 12:01:49 pm »
Why does it need a 'Calculate' button in that screen?
It should calculate the results 'live', on events, each time a number is pressed in any of the input textboxes.
You can submit a UI/UX improvement wishlist issue at https://gitlab.com/kicad/code/kicad/-/issues. Since the idea makes sense, the devs may want to implement it at some point.
 
The following users thanked this post: tom66

Offline Slh

  • Regular Contributor
  • *
  • Posts: 121
  • Country: gb
Re: FOSS EE calculator for Android and PC
« Reply #4 on: December 13, 2023, 04:51:10 pm »
You seem to know exactly what you're after. Do you have a non FOSS calculator that you're currently using?
 

Offline CatalinaWOW

  • Super Contributor
  • ***
  • Posts: 5239
  • Country: us
Re: FOSS EE calculator for Android and PC
« Reply #5 on: December 13, 2023, 05:30:57 pm »
Implementation of this is not rocket science, but it is tedious.  Lots of nitty details.  Example:  To make the units buttons work as you wish the program must keep track of which formula and which part of the formula you are currently modifying.  Throw errors if you are trying to make the units for inductors pF and all that.   That kind of stuff is why I got out of programming about the time graphical interfaces became the standard.  All of the work was controlling pixels on a screen instead of the interesting stuff.  Graphical libraries helped but still the bookkeeping is the dominant part of programming.

Parsing input into engineering units is uncommon.  Years ago I wrote the code to do that for EE related numbers, in Turbo Pascal.  If I can dredge it out of my archives anyone who wants to incorporate it into such a calculator is welcome to it.
 

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6265
  • Country: fi
    • My home page and email address
Re: FOSS EE calculator for Android and PC
« Reply #6 on: December 13, 2023, 06:02:36 pm »
This could easily be done as a self-contained HTML+CSS+JavaScript page.  No network connection needed, just open the single file in a browser.  Would work the same on all OSes.  (You can use media selectors to optimize the layout on a phone vs. desktop browser, or have multiple CSS layouts the user can select between.)

The pattern you'll want to use, is a global timeout variable and a helper function that when called, clears any already pending timeout and sets a new one in say 10ms, with the timeout calling your recalculating function.  Then, use the .addEventListener("input",helper) method on all text inputs and textareas (oninput event).  This way, the event only triggers your calculation (after the timeout), instead of blocking the UI for the duration of the event.  It makes the interface much more responsive, especially on slower machines, even though it sounds complicated.

You can do tabs, or many different calculators on the same page, whatever strikes your fancy.

As to the tracking mentioned by CatalinaWOW, one useful trick is to use an ordered list of elements changed.  Then, the unknown is the oldest or not-yet-changed element in the set.

Also note that the entire visual style in such static tool pages is controllable via inline CSS.  There is nothing forcing say text input boxes to be distinguishable from the background, if you don't want them to.  Simply put, it can look exactly like you want, albeit inside the browser window.

If you don't want a browser window, you can do the same in Python.  Tk is built-in, but ugly as hell.  Qt5 is easy and nice, you can even use an external XML .ui and .css files to optimize how they look (so you can fine-tune the look-and-feel in Qt Designer or by hand without having to recompile anything), but you do need to have Python 3 and Qt5 and PySide2/PyQt5 (Qt 5 Python bindings) installed.  No problem in Linux or BSDs, but I hear it can be a bit annoying on Windows.  As long as those are installed, the app would be completely portable between OSes, though.  I haven't tested Python3+Qt5 on Android, but this example might help.
« Last Edit: December 13, 2023, 06:09:38 pm by Nominal Animal »
 
The following users thanked this post: CatalinaWOW, tooki, RoGeorge

Online RoGeorgeTopic starter

  • Super Contributor
  • ***
  • Posts: 6207
  • Country: ro
Re: FOSS EE calculator for Android and PC
« Reply #7 on: December 13, 2023, 06:55:26 pm »
You seem to know exactly what you're after. Do you have a non FOSS calculator that you're currently using?

That was only a list of annoyances combined with first idea that came to mind about how to avoid them.  I don't know any calculator to have all that, payed or free.

The request came after writing for a thousand time a spreadsheet formula to convert from dBm to mW, and had a typo in it, and searched for am online calculator, then open an online page that didn't work at first, then open another page that work (but kind of ugly and cumbersome), you got the idea.

Similar problem, a couple of weeks ago I had to read some SMD resistors marked with EIA-96.  The search engine found an online converter from digikey, only that that page doesn't work without net, and from time to time they want to know I'm not a robot.

I was hoping somebody already put all the most used EE formulas together, but after searching for an hour or so and trying various suggested calculator, couldn't find any, and returned to my spreadsheet.

Maybe I should grow a collection of spreadheets instead of discarding them as draft calculations.  But then, I wouldn't always have a PC on the workbench, and a spreadsheet is not ideal for a small phone screen.



The local webpage calculator idea seems the most attractive and portable, thanks.
Though, I'm rather clumsy at programming, and never did any web design so far.
« Last Edit: December 13, 2023, 07:04:58 pm by RoGeorge »
 

Offline CatalinaWOW

  • Super Contributor
  • ***
  • Posts: 5239
  • Country: us
Re: FOSS EE calculator for Android and PC
« Reply #8 on: December 13, 2023, 11:19:33 pm »
This could easily be done as a self-contained HTML+CSS+JavaScript page.  No network connection needed, just open the single file in a browser.  Would work the same on all OSes.  (You can use media selectors to optimize the layout on a phone vs. desktop browser, or have multiple CSS layouts the user can select between.)

The pattern you'll want to use, is a global timeout variable and a helper function that when called, clears any already pending timeout and sets a new one in say 10ms, with the timeout calling your recalculating function.  Then, use the .addEventListener("input",helper) method on all text inputs and textareas (oninput event).  This way, the event only triggers your calculation (after the timeout), instead of blocking the UI for the duration of the event.  It makes the interface much more responsive, especially on slower machines, even though it sounds complicated.

You can do tabs, or many different calculators on the same page, whatever strikes your fancy.

As to the tracking mentioned by CatalinaWOW, one useful trick is to use an ordered list of elements changed.  Then, the unknown is the oldest or not-yet-changed element in the set.

Also note that the entire visual style in such static tool pages is controllable via inline CSS.  There is nothing forcing say text input boxes to be distinguishable from the background, if you don't want them to.  Simply put, it can look exactly like you want, albeit inside the browser window.

If you don't want a browser window, you can do the same in Python.  Tk is built-in, but ugly as hell.  Qt5 is easy and nice, you can even use an external XML .ui and .css files to optimize how they look (so you can fine-tune the look-and-feel in Qt Designer or by hand without having to recompile anything), but you do need to have Python 3 and Qt5 and PySide2/PyQt5 (Qt 5 Python bindings) installed.  No problem in Linux or BSDs, but I hear it can be a bit annoying on Windows.  As long as those are installed, the app would be completely portable between OSes, though.  I haven't tested Python3+Qt5 on Android, but this example might help.

Nominal, you have described exactly why I got out of programming for a living.  I am not denigrating the skills you have developed, or even the body of knowledge that has resulted in Tk, Qt5 and all the others.  But it isn't what got me into science and engineering.

I congratulate your ability to do this stuff and also as evidenced by many other posts on this forum, keep up with the engineering and physics underlying why we want to generate all those pretty screens.
 

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6265
  • Country: fi
    • My home page and email address
Re: FOSS EE calculator for Android and PC
« Reply #9 on: December 14, 2023, 12:32:51 am »
Nominal, you have described exactly why I got out of programming for a living.
All I can say is that I couldn't do programming for a living for any of the existing software companies either.  They don't make a profit by solving actual problems, which is what I do and want to do.
 
The following users thanked this post: tooki

Online RoGeorgeTopic starter

  • Super Contributor
  • ***
  • Posts: 6207
  • Country: ro
Re: FOSS EE calculator for Android and PC
« Reply #10 on: December 16, 2023, 05:48:12 pm »
Searching for a visual style, does this arrangement makes sense at a glance look, without explanations?
« Last Edit: December 19, 2023, 02:41:20 pm by RoGeorge »
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14488
  • Country: fr
Re: FOSS EE calculator for Android and PC
« Reply #11 on: December 16, 2023, 09:37:48 pm »
Nominal, you have described exactly why I got out of programming for a living.
All I can say is that I couldn't do programming for a living for any of the existing software companies either.  They don't make a profit by solving actual problems, which is what I do and want to do.

They create the problems. That's a different kind of business. ;D
 

Offline CatalinaWOW

  • Super Contributor
  • ***
  • Posts: 5239
  • Country: us
Re: FOSS EE calculator for Android and PC
« Reply #12 on: December 17, 2023, 04:26:24 am »
Searching for a visual style, does this arrangement makes sense at a glance look, without explanations?

It would work for me, but doesn't check all the OP's boxes.
 

Online RoGeorgeTopic starter

  • Super Contributor
  • ***
  • Posts: 6207
  • Country: ro
Re: FOSS EE calculator for Android and PC
« Reply #13 on: December 17, 2023, 09:35:07 am »
True that, trying to keep the spreadsheets free of macros or programming.  At least the exponent powers is always a multiple of 3, though it looks cluttered.  AFAIK spreadsheets can not display SI unit multiples/submultiples+letter, and cannot take input letters mixed with numbers either.

Looks a little better without grid, but still, having many rows for results is confusing, and it's easy to read by mistake a result from a row that is not affected by the last input changes.

The .ods is the LibreOffice format, but I've attached an .xls version, too, yet I don't use Excel.  Just out of curiosity, does it opens correctly in Microsoft office, with math formulas and all?

Online EPAIII

  • Super Contributor
  • ***
  • Posts: 1069
  • Country: us
Re: FOSS EE calculator for Android and PC
« Reply #14 on: December 19, 2023, 07:36:48 am »
I don't know what spreadsheet was used for the example above. But I have created some SIMPLE calculators using Excel. Nothing as complicated as the OP wants, but they were made to allow untrained personnel to get correct results in calculations they needed to use each day. I can say several things about Excel.

1. Excel CAN display numbers in almost any format that you can define. If the format is not already included in Excel, you can create it. Want numbers separated into fields of two digits that are separated by exclamation points instead of commas; it can do that. Want the numbers yellow if negative and purple if positive; Excel can do that. Want units added to the number; Excel can do that. You can even invent any suffix and Excel can do it. If you can define it Excel can probably do it.

2. Excel can take any type of input you wish: anything you can type on the keyboard. Numbers, letters, combinations of both, punctuation, symbols, Greek letters, other languages, etc. all can be used. You just treat the field as a string of characters and take it apart. I have used such techniques to allow drill sizes to be entered in English or metric units, in number and letter drill sizes using a table look-up, decimal and fractional notation, and any units attached.

3. Appearance: Almost any appearance can be attained. Cells can have any background color and the outline is completely under your control, also including the color and weather there is an outline or not. Cells can be combined to create wider or taller regions or allow for more or larger text. Excel can even import images so you can have the exact appearance of a HP or TI calculator. Or the man in the Moon. I am staying away from macros, but there are also things like Command Buttons, Drop Down Lists, Check Boxes, Option Buttons, and more.

4. SI unit multiples/submultiples+letter? I am not 100% sure what you mean by that, but I would be willing to bet Excel can do it. I just typed 123456.789 in a cell of an Excel spreadsheet. It looked like that. Then I formatted that cell for Scientific notation and it looked like 1.23E+05. Another change to special format that I had created some time ago and it showed as 123.5E+3. I could format it to display "Even" if the number is odd and "Odd" if the number is even. Almost complete freedom to format the display any way I want.

And, there is conditional formatting which allows different formats to be defined for different types of numbers, like positive and negative or different colors for different conditions. And the condition does not even need to refer to the number; it can come from anywhere on the sheet or on other sheets in the workbook or even from a completely different workbook (Excel file).

None of the above requires macros. With macros you really can do anything.



True that, trying to keep the spreadsheets free of macros or programming.  At least the exponent powers is always a multiple of 3, though it looks cluttered.  AFAIK spreadsheets can not display SI unit multiples/submultiples+letter, and cannot take input letters mixed with numbers either.

Looks a little better without grid, but still, having many rows for results is confusing, and it's easy to read by mistake a result from a row that is not affected by the last input changes.

The .ods is the LibreOffice format, but I've attached an .xls version, too, yet I don't use Excel.  Just out of curiosity, does it opens correctly in Microsoft office, with math formulas and all?
Paul A.  -   SE Texas
And if you look REAL close at an analog signal,
You will find that it has discrete steps.
 

Online EPAIII

  • Super Contributor
  • ***
  • Posts: 1069
  • Country: us
Re: FOSS EE calculator for Android and PC
« Reply #15 on: December 19, 2023, 07:42:21 am »
I downloaded the Excel version of your spreadsheet. The grid appears to work OK when new entries are made. But the formulae at the bottom just appear as blank rectangles. I have an older version of Excel (2K) so a later version may do better.

Wait, it was a color problem: white text on a white background. When I change the background color of the rectangles, the text appears, like magic. So everything did come through but the colors need to be corrected.

That just convinced me that when I upgrade I need to get the latest version of Excel and not a "compatible" program.
« Last Edit: December 19, 2023, 07:46:35 am by EPAIII »
Paul A.  -   SE Texas
And if you look REAL close at an analog signal,
You will find that it has discrete steps.
 
The following users thanked this post: RoGeorge

Online RoGeorgeTopic starter

  • Super Contributor
  • ***
  • Posts: 6207
  • Country: ro
Re: FOSS EE calculator for Android and PC
« Reply #16 on: December 19, 2023, 11:30:47 am »
Thanks for testing.  The white color is my fault, I'm using a dark theme with grey cells instead of white, so I've changed the default color for formulas to white, for a better visibility on my screen.


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf