Automatic Pinout Diagrams

One of the more tedious aspects of documenting designs is having to produce pinout diagrams for microcontrollers. The two methods of doing this are a) draw it from scratch in Photoshop, or b) load an existing pinout into Photoshop, wipe the details so you can include your own.

To cut a long story short I wrote a PHP library to render a pinout diagram from a device definition file. By way of an example, the following device definition json file:

{
	"name": "Serial Infrared Decoder",
	"description": "Serial Infrared Decoder based on PIC12F675 8-Bit Microcontroller",
	"package-type": "SDIP",
	"pin-count": 8,
	"pinout": {
	    "undefined": "NC",
		"pins": {
			"1": {
				"name": "VDD",
				"signal-direction": "none",
				"description": "Positive supply"
			},
			"2": {
				"name": "IR IN",
				"signal-direction": "in",
				"description": "Infrared module input"
	                },
			"3": {
				"name": "IR IN",
				"signal-direction": "in",
				"description": "Infrared module input"
                        },
			"4": [
					{
						"name": "MCLR",
						"inverted": true,
						"signal-direction": "in",
						"description": "Master clear"
					},
					{
						"name": "VPP",
						"signal-direction": "in",
						"description": "Programming voltage"
					}
			],
			"5": {
				"name": "Serial Out",
				"signal-direction": "both",
				"description": "Serial data output"
	                },
			"8": {
				"name": "VSS",
				"signal-direction": "none",
				"description": "Ground reference"
			}
		}
	}
}

…produces the following output:

I’ve made the code open source available on github. It’s also available as a Composer package on Packagist.