Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

From a paper sketch to a running circuit: building Sketch2Sim with Gemma 4 in one hack day

Description and use

During a hackathon, the team built an app that turns handwritten circuit sketches into a running Wokwi Arduino simulation using Gemma 4 and a deterministic validator.

Problem

Turning a hand‑drawn circuit sketch into a working simulation is slow and error‑prone, requiring manual pin selection, resistor placement, firmware writing and debugging.

Outcome

Within a hackathon, the team produced a functional prototype that converts handwritten circuit sketches into runnable Wokwi simulations, demonstrating the feasibility of AI‑assisted circuit design.

Workflow

  • Take photo of sketch
  • Upload image to app
  • Gemma 4 parses image and returns JSON with parts, wires, and firmware
  • Validator corrects pin names, adds missing components, and repairs wiring
  • Output files are copied into Wokwi and run
  • Result is displayed to user

Evidence

Gemma 4 reads the image. I used gemma-4-26b-a4b-it through the Gemini API. The prompt contains a catalog of nine Wokwi parts with their exact pin names, a few wiring rules ... and one worked example. The model answers with JSON: parts, wires with a one-line reason per pin, and the firmware.

Source

A validator checks everything. This is plain TypeScript, with no AI involved. It maps invented part types onto real ones, fixes pin names, adds missing resistors, moves servos to PWM pins, wires forgotten GND and 5V pins, and swaps parts wired with reversed polarity.

Source

Before I even had an API key, I fed the validator a deliberately broken answer. It made 20 repairs and produced a valid circuit.

Source

  • Record date: 2026-11-01T16:13:56.552Z