FOSS EE calculator for Android and PC - Page 1
Forum section: electronics / general

author: RoGeorge
author_rank: Super Contributor
timestamp: December 13, 2023, 08:43:45 am
content: I need a calculator with most used EE formulas and the following features:must be FOSS and must work entirely local, offlineEE oriented, not generic Octave or Pythonhave dedicated buttons for engineering units mV, kHz, etc, aside from the numerical buttons. For example, when a frequency is to be typed, I donotwant 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 lettershave 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 only100uHTABto jump to the C value and press180pF, so 9 buttons total, and see the answer live, while typing the numbers, then theMHzbutton to display the result as1.186 MHzinstead of1186270.9056952952have digit grouping and units by default. Display the above number as1'186'270.905'695'295'2for generic use, or1.186 MHzfor engineering. Then pressHzif you want to see it as1'186'270.905 HzEngineering 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 levelshave suggestive icons and show a schematic, for example draw 2 parallel resistors first, then the math formula, so to be easy to recognize all visuallykeep it simple, only numerical and units for the most common EE formulas, no 3D plots or scriptingThings like that, nothing more than common sense. I've searched and couldn't find any decent EE calculator.What do you use?

author: tom66
author_rank: Super Contributor
timestamp: December 13, 2023, 11:40:08 am
content: 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

author: RoGeorge
author_rank: Super Contributor
timestamp: December 13, 2023, 11:56:17 am
content: 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.

author: shapirus
author_rank: Super Contributor
timestamp: December 13, 2023, 12:01:49 pm
content: Quote from: RoGeorge on December 13, 2023, 11:56:17 amYou can submit a UI/UX improvement wishlist issue athttps://gitlab.com/kicad/code/kicad/-/issues. Since the idea makes sense, the devs may want to implement it at some point.

author: Slh
author_rank: Regular Contributor
timestamp: December 13, 2023, 04:51:10 pm
content: You seem to know exactly what you're after. Do you have a non FOSS calculator that you're currently using?

author: CatalinaWOW
author_rank: Super Contributor
timestamp: December 13, 2023, 05:30:57 pm
content: 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.

author: Nominal Animal
author_rank: Super Contributor
timestamp: December 13, 2023, 06:02:36 pm
content: 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 (oninputevent). This way, the event onlytriggersyour calculation (after the timeout), instead ofblockingthe 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, butthis examplemight help.

author: RoGeorge
author_rank: Super Contributor
timestamp: December 13, 2023, 06:55:26 pm
content: Quote from: Slh on December 13, 2023, 04:51:10 pmThat 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.

author: CatalinaWOW
author_rank: Super Contributor
timestamp: December 13, 2023, 11:19:33 pm
content: Quote from: Nominal Animal on December 13, 2023, 06:02:36 pmNominal, 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.

author: Nominal Animal
author_rank: Super Contributor
timestamp: December 14, 2023, 12:32:51 am
content: Quote from: CatalinaWOW on December 13, 2023, 11:19:33 pmAll 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.

author: RoGeorge
author_rank: Super Contributor
timestamp: December 16, 2023, 05:48:12 pm
content: Searching for a visual style, does this arrangement makes sense at a glance look, without explanations?

author: SiliconWizard
author_rank: Super Contributor
timestamp: December 16, 2023, 09:37:48 pm
content: Quote from: Nominal Animal on December 14, 2023, 12:32:51 amThey create the problems. That's a different kind of business.

author: CatalinaWOW
author_rank: Super Contributor
timestamp: December 17, 2023, 04:26:24 am
content: Quote from: RoGeorge on December 16, 2023, 05:48:12 pmIt would work for me, but doesn't check all the OP's boxes.

author: RoGeorge
author_rank: Super Contributor
timestamp: December 17, 2023, 09:35:07 am
content: 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?

author: EPAIII
author_rank: Super Contributor
timestamp: December 19, 2023, 07:36:48 am
content: 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.Quote from: RoGeorge on December 17, 2023, 09:35:07 am

author: EPAIII
author_rank: Super Contributor
timestamp: December 19, 2023, 07:42:21 am
content: 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.

author: RoGeorge
author_rank: Super Contributor
timestamp: December 19, 2023, 11:30:47 am
content: 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.