I often need to create diagrams showing how to make wiring harnesses for test cables in work. I have tried previous versions of WireViz and found it to be useful but needed a little more work. I am not a coder by any stretch of the imagination and YAML (Yet Another Markup Language) syntax is new to me.
Here is the Hackaday article on WireViz:
https://hackaday.com/2020/06/23/an-open-source-tool-to-document-your-wiring/
Installing WireViz is fairly simple assuming one has Python installed properly and the system variables in the path. Instructions for installing Python correctly here:
https://docs.python.org/3/using/windows.html#
Ensure you add the python path to the system variables...if this doesn't happen WireViz does not work.
Next grab the latest version of Wireviz....
Open a command prompt and type:
pip install wireviz
Once installed check things are working by typing:
wireviz --version
If things are working correctly the result should read:
WireViz 0.4.1
If that doesn't happen please check your python installation and system variables etc.
For reference here is the git repository for the WireViz Project - it contains useful information and example files:
https://github.com/wireviz/WireViz
If WireViz has correctly installed we can start to create a simple wiring harness diagram. Lets create a simple test cable - a BNC to screw terminals connector on one end and a red 4 mm banana connector and a black 4 mm banana connector at the other end with two red and black wires which are 24 AWG. Lets make the cable 400 mm in length.
To describe this in YAML we create a text file. I like to use notepad++ but one can use any text editor they wish providing it can save the file with a yml extension. We can call it whatever we like but it is good practice to use a sensible filename. I called mine BNC2Banana.yml. Ensure you save it in a folder you can locate.
While we are at it lets create a folder called IMG within the same folder we are using to store the text file. We will need this later...
Lets look at the example code provided for some context:
connectors: X1: type: D-Sub subtype: female pinlabels: [DCD, RX, TX, DTR, GND, DSR, RTS, CTS, RI] X2: type: Molex KK 254 subtype: female pinlabels: [GND, RX, TX] cables: W1: gauge: 0.25 mm2 length: 0.2 color_code: DIN wirecount: 3 shield: true connections: - - X1: [5, 2, 3] - W1: [1, 2, 3] - X2: [1, 3, 2] - - X1: 5 - W1: s
connectors: 4mm_Red_Banana: 4mm_Banana_Red # Red 4mm Banana type: 4 mm Red Banana Connector pinlabels: [+VE] 4mm_Black_Banana: 4mm_Banana_Black # Black 4mm Banana type: 4 mm Black Banana Connector pinlabels: [GND] BNC_SCREW_Terminal: # Female BNC to Screw Terminals type: BNC Connector female - Screw Terminal pinlabels: [+VE, GND]
cables: C: colors: [RD, BK] # number of wires implicit in color list gauge: 0.25 mm2 # also accepts AWG as unit show_equiv: true # auto-calculate AWG equivalent from metric gauge length: 0.4 # length in m shield: false
connections: - - BNC_SCREW_Terminal: [1] - C.C1: [1] - 4mm_Red_Banana: [1] - - BNC_SCREW_Terminal: [2] - C.C1: [2] - 4mm_Black_Banana: [1]
connectors: 4mm_Red_Banana: # Red 4mm Banana type: 4 mm Red Banana Connector pinlabels: [+VE] 4mm_Black_Banana: # Black 4mm Banana type: 4 mm Black Banana Connector pinlabels: [GND] BNC_SCREW_Terminal: # Female BNC to Screw Terminals type: BNC Connector female - Screw Terminal pinlabels: [+VE, GND] cables: C: colors: [RD, BK] # number of wires implicit in color list gauge: 0.25 mm2 # also accepts AWG as unit show_equiv: true # auto-calculate AWG equivalent from metric gauge length: 0.4 # length in m shield: false connections: - - BNC_SCREW_Terminal: [1] - C.C1: [1] - 4mm_Red_Banana: [1] - - BNC_SCREW_Terminal: [2] - C.C1: [2] - 4mm_Black_Banana: [1]
- An SVG file
- An HTML file
- A TSV file
- A PNG file
The other files are copies of the above diagram except the TSV file which is a tab separated value file making up the bill of materials.
connectors: 4mm_Red_Banana: &4mm_Banana_t # https://uk.rs-online.com/web/p/banana-connectors/2080252 pinlabels: [+VE] type: 4 mm Red Banana Connector manufacturer: RS Components mpn: 2080252 supplier: uk.rs-online.com spn: 2080252 subtype: male color: RD image: src: IMG/4mm.Red.Banana.png 4mm_Black_Banana: # https://uk.rs-online.com/web/p/banana-connectors/2080251 <<: *4mm_Banana_t pinlabels: [GND] type: 4 mm Black Banana Connector mpn: 2080251 spn: 2080251 color: BK image: src: IMG/4mm.Black.Banana.png BNC_SCREW_Terminal: # https://uk.rs-online.com/web/p/coaxial-adapters/1242521 pinlabels: [+VE, GND] type: BNC Connector Male - Screw Terminal manufacturer: RS Components mpn: 1242521 supplier: RS Components spn: 1242521 subtype: female color: BK image: src: IMG/BNC-SCREW-TERM-MALE.png
&4mm_Banana_t
<<: *4mm_Banana_t
- 4mm.Red.Banana.png
- 4mm.Black.Banana.png
- BNC-SCREW-TERM-MALE.png
connectors: 4mm_Red_Banana: &4mm_Banana_t # https://uk.rs-online.com/web/p/banana-connectors/2080252 pinlabels: [+VE] type: 4 mm Red Banana Connector manufacturer: RS Components mpn: 2080252 supplier: uk.rs-online.com spn: 2080252 subtype: male color: RD image: src: IMG/4mm.Red.Banana.png 4mm_Black_Banana: # https://uk.rs-online.com/web/p/banana-connectors/2080251 <<: *4mm_Banana_t pinlabels: [GND] type: 4 mm Black Banana Connector mpn: 2080251 spn: 2080251 color: BK image: src: IMG/4mm.Black.Banana.png BNC_SCREW_Terminal: # https://uk.rs-online.com/web/p/coaxial-adapters/1242521 pinlabels: [+VE, GND] type: BNC Connector Male - Screw Terminal manufacturer: RS Components mpn: 1242521 supplier: RS Components spn: 1242521 subtype: female color: BK image: src: IMG/BNC-SCREW-TERM-MALE.png cables: C: colors: [RD, BK] # number of wires implicit in color list gauge: 0.25 mm2 # also accepts AWG as unit show_equiv: true # auto-calculate AWG equivalent from metric gauge length: 0.4 # length in m shield: false mpn: UL1007-24AWG connections: - - BNC_SCREW_Terminal: [1] - C.C1: [1] - 4mm_Red_Banana: [1] - - BNC_SCREW_Terminal: [2] - C.C1: [2] - 4mm_Black_Banana: [1]
In my opinion that is a more than satisfactory diagram for a test cable harness. There are ways to set the page size adding a header section to ensure that the code is more readable. I would like to be able to add a template with a title block but at the moment this feature isn't working.
metadata: title: BNC <-> 4 mm Banana pn: BNC2Banana01 authors: Created: 2025-09-14 name: Lang date: 2025-09-14 Approved: name: Lang date: 2025-09-14 revisions: A: name: Lang date: 2025-09-14 changelog: Initial commit template: name: din-6771 sheetsize: A3 connectors: 4mm_Red_Banana: &4mm_Banana_t # https://uk.rs-online.com/web/p/banana-connectors/2080252 pinlabels: [+VE] type: 4 mm Red Banana Connector manufacturer: RS Components mpn: 2080252 supplier: uk.rs-online.com spn: 2080252 subtype: male color: RD image: src: IMG/4mm.Red.Banana.png 4mm_Black_Banana: # https://uk.rs-online.com/web/p/banana-connectors/2080251 <<: *4mm_Banana_t pinlabels: [GND] type: 4 mm Black Banana Connector mpn: 2080251 spn: 2080251 color: BK image: src: IMG/4mm.Black.Banana.png BNC_SCREW_Terminal: # https://uk.rs-online.com/web/p/coaxial-adapters/1242521 pinlabels: [+VE, GND] type: BNC Connector Male - Screw Terminal manufacturer: RS Components mpn: 1242521 supplier: RS Components spn: 1242521 subtype: female color: BK image: src: IMG/BNC-SCREW-TERM-MALE.png cables: C: colors: [RD, BK] # number of wires implicit in color list gauge: 0.25 mm2 # also accepts AWG as unit show_equiv: true # auto-calculate AWG equivalent from metric gauge length: 0.4 # length in m shield: false mpn: UL1007-24AWG connections: - - BNC_SCREW_Terminal: [1] - C.C1: [1] - 4mm_Red_Banana: [1] - - BNC_SCREW_Terminal: [2] - C.C1: [2] - 4mm_Black_Banana: [1]