drawCircuit

Software to draw an electronic schematic from a text file. For Linux.
Download drawCircuit
Version 2025.9.23
(4 kB download)

This new software for Linux allows you to create and edit a schematic diagram of an electronic circuit by editing a text file. This program takes a UTF-8 or ASCII text file as input, and each character in the text file represents a tile containing a component. The tiles are rotated automatically to fit together.

The output schematic when given the example text file
The output schematic when given the example text file

These are symbols you can currently use in your text file:

.empty
wwire
lL-shaped wire
tT-shaped wire
4joined wires
xcrossed wires
=chassis connection
gground
oterminal/electrode
+positive voltage source
sswitch
bbattery
~AC source
@DC source
rresistor
ccapacitor
eelectrolytic capacitor
iinductor
ddiode
zzener diode
*lamp
ffuse
nNPN transistor
pPNP transistor
vrheostat/potentiometer/variable resistor
aantenna
(speaker
qcrystal

So your text file might look like this:

..........
.lsl......
.w.r......
.b.twtito.
.w.d.e.e..
.lwtwtwto.
..........

You can use a space instead of the '.' to represent an empty tile if you like, but most of the popular text editors don't show any trace of trailing blanks by default.

If you find that a part isn't facing the right direction, try upper case. Presumably, this should only be needed with polar components, such as the battery, diode, and electrolytic capacitor.

Output is currently an 8-bit BMP file with a palette containing 2 colors, black and white. A third color, red, will be included if there's an error.

Program Usage

Output is to stdout, so pipe it into a file if needed like this:

./drawCircuit > out.bmp

If you run the script, the BMP is piped directly to ImageMagick and converted to a PNG, which is then optimally compressed via pngcrush. Those packages must be installed to use them.

Command Line Options:

-i invert colors, swaps black & white in the palette
-p palette in hex, 8 bytes per color, 2 or 3 colors

So if you want a white background and a black circuit, use the -i option. If you want some other colors, use the -p option. If specifying a palette, you may include any amount of whitespace between palette entries or between bytes, thus you can use any of the following styles:

./drawCircuit.sh in.txt -p "11223300aabbcc00"
./drawCircuit.sh in.txt -p "11223300 aabbcc00"
./drawCircuit.sh in.txt -p "11 22 33 00   aa bb cc 00"

Future Development

Some of the tiles of electrical components don't look great, and some are still missing. Tiles are now 15x15 for better appearances than the original 7x7. (The dimensions of tiles are odd numbers so that the wires are always in the center.) It should probably be changed to 31x31 eventually.

In the future, more parts will be added. We need to figure out how to add op amps elegantly.

Notes

To see a few more examples of outputs of the program, see my electronics page.

I say it's for Linux because the data structures will probably end up with the bits in the wrong order on Windows due to the different endianness. I'm not entirely sure right now.

This is open source software and is released with the MIT license, a permissive alternative to the GNU GPL license agreement. Support open source software before everything contains spyware and backdoors. Open source also means you can tinker with the code and make improvements or just see how it works.

Created by Ron Spain.

Share and enjoy.




Page generated in 0.054628 seconds.

© 2025 Ron Spain