Circuit recognition with Circular
Almost all highschool students learn about circuits in science class. For many, it is a concept difficult to grasp, due to the abstractness of electron flow, and the complexities of various circuit components (e.g. resistors, capacitors, transistors, etc.)
What if you could "see" what you are doing? Literally?
What it does
The hand-drawn circuit is captured with a computer webcam, then the components, wiring, as well as labels will be analyzed. The circuit will then be (almost instantly) reproduced digitally on the computer, allowing someone to manipulate and experiment with it.
How we built it
Once the computer receives the image, it separates the image into 3 layers:
- Text layer (contains the specifications and parameters of components)
- Component layer (contains only the drawings of components), and
- Wiring layer (contains only the drawing of connections between components)
The location and type of components are recognized using OpenCV, merged with the information provided by the text layer is sent to a circuit simulator using Microsoft's hand-written text recognition. Then, the circuit gets simulated, allowing manipulation and probing.
Challenges we ran into
Recognizing components is hard!
Initially, we have attempted to use machine learning to recognize the components, with Wolfram Mathematica. However, due to the small size of the training data and the similarities between some of the components, the results provided is highly erroneous.
Then, we tried to find the "turning points" of the component symbols, and constructing a connectivity graph. From there, we could find certain patterns of the symbols and classify them. This method is a lot more reliable than the first, but would still, occasionally, produce mistakes.
At the end, we have decided to use both the text layer and the graph method to analyze the circuit; We used the units in the specification to predict the type of the component.
Accomplishments that we're proud of
For our team, the biggest accomplishment is completing the project and to have a functional result.
Before we started, the idea seemed way too complex and difficult to implement, while we are required to learn things that are completely new (OpenCV and OCR).
What we learned
- Machine learning is not a magical black box that, given test data, spits out the right result; It only does so when fed with a lot of test data.
- Implementation of seemingly trivial features might bring unexpected surprises, especially the ones that delays your project by a few hours
- OpenCV, when used properly, can recognize a lot more than text on a newspaper.
What's next for Circular
- Support for more complex circuits and components