ElectroDB - Android app

Code - 14-10-2017

Presentation of ElectroDB

ElectroDB is an offline, light and open source tool that makes looking for pinouts and datasheets a child's play! With its 12,000+ components database, most of your needs will be covered!

Designed for hobbyists as well as electronic engineers, this app will avoid you the hassle of browsing the web to find the information you need for your projects.

Within the touch of a button, it will immediately give you access to all the knowledge you need about any component: pinouts, datasheets, features, etc.

From Arduino boards to fairly uncommon chips, this data is there when you need it the most.

Spend less time browsing and more time doing actual electronics!

ElectroDB is available on the Google Play store, for free, with no ads. Its source-code is on GitHub (see below).

Qr code to download the app.

Google Play


Source-code and technical details

In this section, I will be doing a technical overview of the implementation of ElectroDB: how it works, what I used, etc.

This diagram represents the general workflow of the app:

Workflow of the app. Worflow of the app: a JSON database is constructed from KiCad's lib and dcm files, read at run-time to show the pinouts

The database scrapper

The first issue I tackled was the generation of the database. To fetch data from the biggest number of components I could possibly support, I chose to scrap the KiCad library files because:

  1. Thanks to the large developer community, it is often updated which means that the database should be fairly complete and error-free;
  2. Being open-source, there are very few restrictions to the usage of these files (CC-BY-NA license).
  3. There are third party libraries that I could support at a later date.

To use these resources, I extracted all the information that they contained and assembled it into a universal and easy to read format: JSON. To do so, I developed an AWK script. This quite dense script parses all the files and outputs a single, structured JSON file with all the required information included. This format is then very efficient to parse at run-time with Android's library org.json.

The Android app

ElectroDB was the first Android app I published on the Google Play Store.

Generating pinout pictures

After the database, the most important aspect of the app is showing a picture of the pinout of every chip. Some pictures are manually saved (mostly for popular board, such as the Arduino Uno). However, due to the number of supported components, the pictures cannot all be stored in the app: they have to be generated at run-time.

The pinout pictures are drawn on a canvas with bitmaps and text. Some packages are straightforward: TO-92, for instance, always has 3 pins. For this package, we simply need to write the pins description on the package picture, based on the information from the database.

TO-92 LM35 automatically generated package A TO-92 component automatically generated picture (LM35 temperature sensor)

However, there are other packages that have a variable shape and number of pins. To show them in my app, they are dynamically built with a set of "tiles". For instance, DIP packages are made out of 3 different pictures: top, mid and bottom part. The most extreme example is the QFN/QFP package, that is made of 11 different tiles.

QFN automatically generated package A 20 pin QFP package automatically generated picture (ATtiny406-M microcontroller)

Unsupported package types such as BGA show their pinout in a table.

Look and feel

Design-wise, I followed Google's Material design guidelines. There are numerous advantages to this choice:

  • The app's style is consistent with the Android UI/UX,
  • It is very intuitive and efficient,
  • The layout is simple and fast to develop,
  • The design language is well defined with strict rules, making it easier to follow.

Material Design from ElectroDB Some Material Design assets I drew for ElectroDB (components icons)

Search engine algorithm

To search component names in the database, we need a way to evaluate the similarity between the input string and every component name in the database. We keep and rank the top N results.

I first used a naive implementation of the Levenshtein distance. It measures the edit distance between two character sequences (insertion, deletion, substitution or transposition of characters). This metric is used to pick the most relevant results to a query string from the database.

I then switched to an implementation of the Jaro-Winkler similarity algorithm: the results tends to be better in this context, with the same O(n×m) time complexity.

Lately, I switched to a more advanced "Partial Ratio" algorithm from FuzzyWuzzy. It is still fundamentally based of the Levenshtein distance, but it has the huge advantage of being immune to offsets.

External libraries and resources

I used the following resources:

Source-code

The source-code for both the database scrapper and the app is available on this GitHub repository: https://github.com/CGrassin/electrodb

To go further

Although I want to keep ElectroDB lightweight, fast and focused, there are several features that I am thinking on adding to the app in future updates:

  • Add other tools (resistor value calculator, circuit examples, etc.): having all these functions in one app with a common UX design language could be very convenient.
  • Enrich my DB: I could gather more information to offer a powerful parametric search. For instance: usual price, power requirements, etc.

Feel free to contact me if you want to share ideas with me!

Author:


What is on your mind?

  • #1 dj

    Wow. I just started looking for such a program yesterday and Google suggested it today. I retired a couple of years ago in a non-related field and finally have the timw I want to spend learning more about computers and electronics.I hesitate to call it a lab but I've spent that 2 months equipping my electrical work area (I'm far from done.) I'm mostly a vb.net guy with a little C# thrown in. Yesterday I bought a Brother label printer I can hook up to my computer and print labels for all the bins and shelves I sticked with components. Then it occurred to me that what I really need is a simple inventory management system that I can print labels from, track my inventory, find pinouts, datasheets etc. I really need your app on my home LAN. I'm not much of a phone guy as I've got fat fingers and I'm getting a little shaky in my retirement years. I will definately take a look at your Github site soon. Last night, I even popped over to Digikey to see what kind of API they have but I haven't found it yet. I loaded your app to my phone and then went straight to the Chrome store hoping to load a Chrome extension. It would seem that ElectroDB is mobile only at this point? I look forward to such a possible expansion in your future. Thanks for the open sharing and best of luck in your endeavors. Great job on what I have seen so far. Cheers.

    on February 9 2024, 17:52

  • #2 Quyen

    Hey! I just wanted to ask if you ever have any issues with hackers?
    My last blog (wordpress) was hahked and I ended up losing months of hard work due tto no back
    up. Do you have aany methods to protect against hackers? https://Www.Waste-ndc.pro/community/profile/tressa79906983/

    on March 21 2024, 22:56

  • #3 Ahmed Al-Qttawy

    Thank you for this wonderful program.
    I have a simple problem, which is that I use my phone in Arabic and when I use the program and search for a component, the components appear on the right without names, and I have to click on each component to know its number.
    Is it possible to install the list of components on the left as in English, or to support languages ​​from right to left?
    Note that when the device language is changed to English, the search list appears on the left and the names of the components appear.

    on November 19 2024, 6:21

  Back to projects

Related articles