Boards¶
Predefined board templates and factory functions.
boards ¶
Predefined Raspberry Pi board templates.
esp32_devkit_v1 ¶
Create an ESP32 DevKit V1 board with 30-pin GPIO header.
The ESP32 DevKit V1 is one of the most popular IoT development boards, featuring Wi-Fi and Bluetooth connectivity. It has a dual-row vertical pin layout with 15 pins on each side (30 total).
Pin layout (physical pin numbers): Standard 2x15 header layout: - Left column (odd pins): 1, 3, 5, ..., 29 (top to bottom) - Right column (even pins): 2, 4, 6, ..., 30 (top to bottom)
| RETURNS | DESCRIPTION |
|---|---|
Board
|
Configured ESP32 DevKit V1 board with all pins positioned
TYPE:
|
Examples:
Source code in src/pinviz/boards.py
esp8266_nodemcu ¶
Create an ESP8266 NodeMCU board with 30-pin GPIO header.
The NodeMCU is one of the most popular ESP8266 development boards with built-in USB-to-serial and 30 pins in a dual-row layout.
| RETURNS | DESCRIPTION |
|---|---|
Board
|
Configured ESP8266 NodeMCU board with all pins positioned
TYPE:
|
Examples:
Source code in src/pinviz/boards.py
get_available_boards ¶
Get a list of all available board configurations.
Scans the board_configs directory and returns metadata for each board including its canonical name and aliases.
| RETURNS | DESCRIPTION |
|---|---|
list[dict[str, str | list[str]]]
|
List of dictionaries with board information: |
list[dict[str, str | list[str]]]
|
|
list[dict[str, str | list[str]]]
|
|
list[dict[str, str | list[str]]]
|
|
Examples:
>>> boards_info = get_available_boards()
>>> for board in boards_info:
... print(f"{board['name']}: {board['aliases']}")
raspberry_pi_5: ['rpi5', 'rpi']
raspberry_pi_4: ['rpi4', 'pi4']
raspberry_pi_pico: ['pico']
Note
This function dynamically discovers boards from the board_configs directory, so it will automatically include any newly added boards.
Source code in src/pinviz/boards.py
load_board_from_config ¶
Load a board definition from a JSON configuration file.
This function reads a board configuration from the board_configs directory, validates it against the BoardConfigSchema, calculates pin positions based on layout parameters, and returns a fully configured Board object.
The configuration file must specify: - Board metadata (name, SVG asset, dimensions) - GPIO header layout parameters (column positions, spacing) - Pin definitions (physical pin number, name, role, BCM GPIO number)
Pin positions are calculated automatically based on the layout parameters to align with the board's SVG asset.
| PARAMETER | DESCRIPTION |
|---|---|
config_name
|
Name of the board configuration file (without .json extension) For example, "raspberry_pi_5" will load "raspberry_pi_5.json"
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Board
|
Configured board with all pins positioned
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
FileNotFoundError
|
If the configuration file doesn't exist |
ValueError
|
If the configuration is invalid or fails validation |
JSONDecodeError
|
If the JSON file is malformed |
Examples:
>>> board = load_board_from_config("raspberry_pi_5")
>>> print(board.name)
Raspberry Pi 5
>>> print(len(board.pins))
40
Note
This is the recommended way to add new board types. Simply create a new JSON configuration file in the board_configs directory following the schema defined in BoardConfigSchema.
Source code in src/pinviz/boards.py
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 | |
raspberry_pi ¶
Create a Raspberry Pi board (alias for raspberry_pi_5()).
Convenience function that returns the latest Raspberry Pi board. Currently points to Raspberry Pi 5.
| RETURNS | DESCRIPTION |
|---|---|
Board
|
Configured Raspberry Pi board
TYPE:
|
Examples:
Source code in src/pinviz/boards.py
raspberry_pi_4 ¶
Create a Raspberry Pi 4 Model B board with 40-pin GPIO header.
Uses standard 40-pin GPIO pinout (same as Pi 2, 3, 5, Zero 2 W). All GPIO pins operate at 3.3V logic levels and are NOT 5V tolerant.
This function loads the board definition from a JSON configuration file (raspberry_pi_4.json) which specifies pin layout, positions, and metadata. Pin positions are calculated automatically to align with the board's SVG asset.
Pin layout (physical pin numbers): Standard 2x20 header layout: - Left column (odd pins): 1, 3, 5, ..., 39 (top to bottom) - Right column (even pins): 2, 4, 6, ..., 40 (top to bottom)
| RETURNS | DESCRIPTION |
|---|---|
Board
|
Configured Raspberry Pi 4 Model B board with all pins positioned
TYPE:
|
Examples:
>>> board = raspberry_pi_4()
>>> print(board.name)
Raspberry Pi 4 Model B
>>> print(len(board.pins))
40
Note
WARNING: All Raspberry Pi GPIO pins operate at 3.3V logic levels. GPIO pins are NOT 5V tolerant. Applying 5V to any GPIO pin may permanently damage the board. Use level shifters for 5V devices.
Source code in src/pinviz/boards.py
raspberry_pi_5 ¶
Create a Raspberry Pi 5 board with 40-pin GPIO header.
This function loads the board definition from a JSON configuration file (raspberry_pi_5.json) which specifies pin layout, positions, and metadata. Pin positions are calculated automatically to align with the board's SVG asset.
Pin layout (physical pin numbers): Standard 2x20 header layout: - Left column (odd pins): 1, 3, 5, ..., 39 (top to bottom) - Right column (even pins): 2, 4, 6, ..., 40 (top to bottom)
| RETURNS | DESCRIPTION |
|---|---|
Board
|
Configured Raspberry Pi 5 board with all pins positioned
TYPE:
|
Examples:
>>> board = raspberry_pi_5()
>>> print(board.name)
Raspberry Pi 5
>>> print(len(board.pins))
40
>>> # Get a specific pin by physical number
>>> pin_1 = board.get_pin(1)
>>> print(pin_1.name, pin_1.role)
3V3 PinRole.POWER_3V3
Source code in src/pinviz/boards.py
raspberry_pi_pico ¶
Create a Raspberry Pi Pico board with dual 20-pin GPIO headers.
The Pico has a unique dual-sided layout with 40 pins total: - Top header: pins 1-20 (single row along top edge) - Bottom header: pins 21-40 (single row along bottom edge)
Unlike the standard Raspberry Pi, the Pico uses RP2040 microcontroller with GP0-GP28 GPIO pins instead of BCM numbering.
This function loads the board definition from a JSON configuration file (raspberry_pi_pico.json) which specifies the dual-header layout.
Pin layout (physical pin numbers): - Top header: pins 1-20 (pin 20 on left, pin 1 on right - reversed order) - Bottom header: pins 21-40 (pin 21 on left, pin 40 on right - normal order)
| RETURNS | DESCRIPTION |
|---|---|
Board
|
Configured Raspberry Pi Pico board with all pins positioned
TYPE:
|
Examples:
>>> board = raspberry_pi_pico()
>>> print(board.name)
Raspberry Pi Pico
>>> print(len(board.pins))
40
Note
The Pico operates at 3.3V logic levels. Some pins support 5V input with appropriate voltage dividers. Check the Pico datasheet for specific pin capabilities.
Source code in src/pinviz/boards.py
wemos_d1_mini ¶
Create a Wemos D1 Mini board with 16-pin GPIO header.
The D1 Mini is a compact ESP8266-based board popular for small IoT projects. It has 8 pins on each side (16 total) with D0-D8 pin naming convention.
| RETURNS | DESCRIPTION |
|---|---|
Board
|
Configured Wemos D1 Mini board with all pins positioned
TYPE:
|
Examples: