From a paper sketch to a running circuit: building Sketch2Sim with Gemma 4 in one hack day
说明与用途
在一次黑客松中,团队构建了一个应用程序,使用Gemma 4和验证器将手绘电路草图转换为可在Wokwi中运行的Arduino仿真。
问题
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.
结果
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.
工作流
- 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
证据
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.
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.
Before I even had an API key, I fed the validator a deliberately broken answer. It made 20 repairs and produced a valid circuit.
- 记录日期: 2026-11-01T16:13:56.552Z