pschulz
pschulz

Reputation: 1535

Drawing "ascii" (text) schematics with unicode characters

I'm trying to draw electronic schematics with text. I used to do this with ascii-only letters, but wanted to have something more fancy. Here is an example in ascii:

  VDD -------------*---------*-----*-----------------*-----*---------*-------                                                                   
                   |         |     |                 |     |         |    
                   |         |     |                 |     |         |     
               |---|     |---|     |---|         |---|     |---|     |---|        
    vclk o----o|--------o|             |o--   --o|             |o--------|o----o vclk             
               |---|     |---|     |---|   \ /   |---|     |---|     |---|     
                   |         |     |        x        |     |         |    
                   |         |-----*-------* *-------*-----|         |                             
                   |               |        x        |               |    
                   |               |---|   / \   |---|               |    
                   |                   |---   ---|                   |          
                   |               |---|         |---|               |    
                   |               |                 |               |     
                   |---------------*                 *---------------|                    
                                   |                 |     
                               |---|                 |---|                
                    vinp o-----|                         |o----o vinn         
                               |---|                 |---|                
                                   |--------*--------|    
                                            |    
                                            |    
                                        |---|    
                              vclk o----|        
                                        |---|    
                                            |    
                                            |    
  VSS --------------------------------------*--------------------------------- 

which I now changed to

  VDD ─────────────┬─────────┬─────┬─────────────────┬─────┬─────────┐                                                                          
                   │         │     │                 │     │         │    
                   │         │     │                 │     │         │     
               ║───┘     ║───┘     └───║         ║───┘     └───║     └───║        
    vclk o────o║────────o║             ║o──   ──o║             ║o────────║o────o vclk             
               ║───┐     ║───┐     ┌───║   ╲ ╱   ║───┐     ┌───║     ┌───║     
                   │         │     │        ╳        │     │         │    
                   │         └─────┼──────── ────────┼─────┘         │                             
                   │               │        ╳        │               │    
                   │               └───║   ╱ ╲   ║───┘               │    
                   │                   ║───   ───║                   │          
                   │               ┌───║         ║───┐               │    
                   │               │                 │               │     
                   └───────────────┤                 ├───────────────┘                    
                                   │                 │     
                               ║───┘                 └───║                
                    vinp o─────║                         ║o────o vinn         
                               ║───┐                 ┌───║                
                                   └────────┬────────┘    
                                            │    
                                            │    
                                        ║───┘    
                              vclk o────║        
                                        ║───┐    
                                            │    
                                            │    
  VSS ─────────────────────────────────────────────────────────────────

I'm quite happy with the result, but the newer drawing is missing some important things:

  1. Is it possible to get little dots ON the wires where wires cross, similar to the asterisks that I used in the ascii schematic? I tried a few combining characters but nothing looked right.
  2. Is there a possibility to connect the diagonal lines to the straight ones? From what I found online these characters don't exist, but maybe I'm wrong or there is another way.

To be precise, the two questions are (for example) about these parts:

       here
└────────┬────────┘    
         │ 

and

──   ──
  ╲ ╱  
   ╳   
─── ───
   ╳   
  ╱ ╲  
──   ──
     ^
    here

Upvotes: 3

Views: 467

Answers (2)

oqieurj
oqieurj

Reputation: 1

Here is AACircuit, for drawing ASCII Art schematics. It is VERY old, but still works! (I have it on Windows 10).

https://josoansi.de/download.php

Example:

  .---o----o------o---o---------------o---o----o------------o 12-15V
  |   |    |  22uF| + |               |   |    |
 .-.  |   .-.    ###  |              .-.  |    |    .-------o
 | |<-'   | |    ---  |              | |  |    |    |   .---o
 | |5k    | |5k6  |   |              | |  |    |    |   |
 '-'      '-'     |   o--.           '-'  |   _|_   o  /o
  |        |     ===  |  |            |   |  |_/_|-   /
 .-.       |     GND  | ---100n   LED V   -    |     /
 | |       |          | ---           -   ^    |    o
 | |6k2    |          |  |            |   |    |    |
 '-'       |          | GND           '---o----o    '-------o
  |        |       2|\|7                       |
  o-----------------|-\ LM741      ___       |/
  |        |        |  >-------o--|___|--o---|
  |        o---o----|+/ 6      |   22k   |   |>  BC547
  |        |   |   3|/|4       |         |     |
 .-.       |   |     ===       o---.    .-.    |
 | |       |   o---. GND       |   |    | |5k6 |
 | |2k7   .-.  |   |   ___    _V_  |    | |    |
 '-'     KTY10 | + '--|___|--|___|-'    '-'    |
  |       | | ###      47k   220k        |     |
  |       '-' ---                        |     |
  |        |   |                         |     |
  |        |   |                         |     |
  '--------o---o-------------------------o-----o------------o GND

Upvotes: 0

Absurd Squirrel
Absurd Squirrel

Reputation: 46

I wound up here while searching for basically anything about drawing circuit diagrams with unicode, and sadly there doesn't seem to be much of it out there. Which is a real shame, because unicode is really only missing a few characters that would make this work quite well.

Poking around the unicode tables for options, angle brackets look viable for the sideways-Y intersections:

──   ──
  ╲ ╱  
   ╳   
──❬ ❭──
   ╳   
  ╱ ╲  
──   ──

But transitioning from diagonal to orthogonal otherwise doesn't seem to have any clean answers. IMHO it's probably best to stick with right angles.

As for junctions, I think maybe using the heavy versions of the box drawings characters might work:

└────────┳────────┘
         │

Maybe even in combination with the split-thickness lines:

└───────╼┳╾───────┘
         ╿

I think that's the best I can offer. Hope it helps you or anyone else who comes along looking for the same thing.

Upvotes: 3

Related Questions