
LEDx16 board
tardate/LittleArduinoProjects
a collection of "Little Electronic & Arduino Projects", most involving electronics or an Arduino in one way or another!

An implementation of Pong in assembly (pic-as) running on a PIC16F18346
Asm pong is an open-source printed circuit board by tecknet-gg, from the tecknet-gg/asm-pong repository on GitHub, published under the MIT licence. It is a 2-layer board of 98.3 × 95.3 mm with 52 parts on 59 nets, routed with 433 tracks and 53 vias.
It is built around the 74HC595. Its parts include 20 resistors, 9 capacitors, 7 ICs, 4 connectors and 2 switches. It belongs with the PIC boards of this library.
Basically what the subheading said! The classic game of pong implemented in assembly, running on a PIC16F18346 based console(-ish).
The PIC16F18346 console boasts a whopping 2KB of RAM, and a massive 28KB of flash memory, clocked at a blazing 32MHz! The game is displayed on a 128x64px OLED screen, with the player paddles being controlled by two potentiometers. Scores are displayed on two dedicated seven segment displays, with the sound effects being generated by a singular active buzzer. The console uses 3.3V, supplied by a regulated (up to 6V) power supply. Also features a dedicated ICSP header for easy programming using a PICkit3 or similar.
The detailed bill of materials file can be found under pcb/production/bom.csv. All the components were sourced from AliExpress besides the PIC, since LCSC has much better pricing for the same. The table is reproduced below for convenience.
[!Note] The capacitor and resistor pricing is the entire bundle price, including all the required values for this project.
| Item | Quantity | Description | Price | Source |
|---|---|---|---|---|
| PIC16F18346-I/P | 1 | Microcontroller | £1.81 | LCSC |
| 100nF Ceramic Capacitor | 7 | Decoupling capacitor | £1.93 | AliExpress |
| 1µF Electrolytic Capacitor | 2 | Bulk capacitor | £1.96 | AliExpress |
| SSD1306 | 1 | OLED screen | £2.33 | AliExpress |
| SN74HC595 | 2 | Shift registers | £0.80 | AliExpress |
| LD-3161-AS | 2 | Seven-segment display | £2.33 | AliExpress |
| Tactile Buttons | 2 | Push buttons | £1.16 | AliExpress |
| RV09 Potentiometers | 2 | Potentiometers | £1.08 | AliExpress |
| Buzzer | 1 | Active buzzer | £1.80 | AliExpress |
| 2N2222 NPN | 1 | Buzzer transistor | £1.00 | AliExpress |
| 1N4148 Diode | 1 | Flyback diode | £1.00 | AliExpress |
| Knurled Metal Tone Knob | 2 | Potentiometer knob | £2.01 | AliExpress |
| MCP1700-3302E/TO | 1 | 3.3V LDO | £2.39 | AliExpress |
| DC Power Barrel | 1 | VIN input | £1.00 | AliExpress |
| 220Ω THT Resistor | 16 | Current limiting | £2.69 | AliExpress |
| 10kΩ THT Resistor | 3 | RC/MCLR pull-up | £2.69 | AliExpress |
| 1kΩ THT Resistor | 1 | Transistor base resistor | £2.69 | AliExpress |
| PICkit 3 | 1 | ICSP programmer | £14.19 | AliExpress |
| PCB | 5 | Custom PCB | ~ | pcb/production |
PCB production files can be found under pcb/production. Board is under 100x100mm, so should cost less than $5 for five boards from either PCBWay or JLCPCB. I personally sourced them from JLC. All components are THT, so they should be very easy to solder. Follow the component references as given by the schematic pdf. Its a straightforward assembly, there isn't much else to say!
The case can be found in the case directory. The taper angle is 15º, so I would recommend printing the model angled at 15º such that the top face is parallel to the bed, with ironing turned on for the best finish. PLA is the recommended material.
With the case printed, the PCB mounts using the M2 mounting holes. No extra hardware needed, it just slots into the case. The case also has small indents in the bottom for rubbery grips. Just fill the indents with hot-glue, then overfill the indent very slightly to make a rubber grip.
If you would like to make your own changes to the source code, you'll obviously have to recompile to get the new .hex! To get you started on that, here are a few recommendations.
First, I would lean towards using VSCode over MPLABX IDE. VSCode does require a fair bit more setup, over MPLABX, which is just plug and play, but in my opinion, the overall developer experience is worth that effort, since you get access to all of VSCode's quality of life features.
If you end up using VSCode, you'll need to install the MPLAB extension pack. Using the MCC that comes installed with this pack, you can configure your config bits and such. With that, you then set the compiler to PIC Assembly (PIC-AS/XC8). I would also then recommend you make a custom build task in .vscode/task.json, similar to this:
{
"version": "2.0.0",
"tasks": [
{
"label": "Build PIC HEX",
"type": "shell",
"command": "cmake --build _build/asm-pong/default && cp $(find out -name '*.hex' | head -n 1) out/output.hex",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [],
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared",
"showReuseMessage": false,
"clear": false
}
}
]
}Hitting the build shortcut will then produce the output.hex that you can then flash.
If you choose to go down the MPLABX IDE, all the build tasks and such should work natively without any setup. You also have easier access to the simulators and such.
To flash the firmware to the PIC, you need to use the ICSP header. The easiest way to flash the firmware is with a PICkit3 or above, and the MPLAB IPE Software (you may have to install the PIC16F1xxxx pack manually).
[!NOTE] MPLAB IPE support for legacy PICkits (2 and 3) was dropped after v6.20. These PICkits are cheaper to purchase, and work just fine for this use case. To use with MPLAB IPE, install v6.20 or prior. My PIC was flashed with a PICkit3 using MPLAB IPE v6.00. Alternatively, you can use a terminal utility like
ipecmd,pkcmd-lxor similar.
[!NOTE] You can also flash the PIC by bit banging the ICSP protocol on another microcontroller. You do not need a level shifting circuit since Low Voltage Programming should be supported by the PIC16F18346. This has NOT been verified.
Assuming you're using a PICkit with MPLAB IPE, select the PIC16F18346 under devices, and your tool in the tool selection menu. If the software isn't detecting your PICkit, unplug it, hold down the button, then plug it back in, keeping the button pressed for a few more seconds. Then double check if is being detected as connected to a port on your system information panel. Once you have it connected, enable the advanced mode (under Settings > Advanced Mode). With this enabled, you should see various settings appear on the sidebar. Go to the power setting, and tick the box saying "Power target circuit from PIC". Ensure the PIC16F18346 (and the console by extension), is powered by 3.3V before proceeding.
[!NOTE] If you can't see the PIC under the device options, you probably don't have the pack installed and linked. Download the pack here. Locate the
.mchp_packsdirectory, and drop the file in there.
[!WARNING] If you fail to check "Power target circuit from PIC", you may damage either the PICkit, or the PIC itself. Double check this setting is enabled, and read the output logs as the PICkit connects to the PIC.
With all that setup, plug in the PICkit's headers into the ICSP header on the board. The top pin of the header (pin closest to the screen) is MCLR. Match that with the pinout of your PICkit. Now download and load the .hex file into the IPE, and click program. Et voila, you should have a fully programmed PIC!
[!NOTE] If you see glitchy behaviour, or the screen not starting up, make sure the PCB is disconnected from the programmer. When the headers are still connected, it behaves oddly. After that, hit the reset button to re-boot the PIC.
A demo video of an entire game being played out can be found on my YouTube channel. Here is a picture of the completed build!
| Qty | Value | Footprint | References |
|---|---|---|---|
| 8 | 330 | Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_Horizontal | R4, R6, R8, R10, R12, R14, R16, R18 |
| 7 | 100nF | Capacitor_THT:C_Disc_D5.0mm_W2.5mm_P5.00mm | C1, C2, C3, C4, C5, C6, C7 |
| 6 | 330Ω | Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_Horizontal | R5, R7, R9, R13, R15, R17 |
| 4 | MountingHole | MountingHole:MountingHole_2.2mm_M2 | H1, H2, H3, H4 |
| 3 | 10kΩ | Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_Horizontal | R1, R2, R19 |
| 2 | 1uF | Capacitor_THT:C_Radial_D4.0mm_H7.0mm_P1.50mm | C8, C9 |
| 2 | 220Ω | Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_Horizontal | R3, R11 |
| 2 | 74HC595 | Package_DIP:DIP-16_W7.62mm_Socket_LongPads | U2, U4 |
| 2 | R_Potentiometer | Potentiometer_THT:Potentiometer_Alps_RK09K_Single_Vertical | Paddle1, Paddle2 |
| 1 | 1kΩ | Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_Horizontal | R20 |
| 1 | 2N2222 | Package_TO_SOT_THT:TO-92_Inline_Wide | Q1 |
| 1 | Buzzer | Buzzer_Beeper:Buzzer_12x9.5RM7.6 | BZ1 |
| 1 | D_Small | Diode_THT:D_DO-35_SOD27_P7.62mm_Horizontal | D1 |
| 1 | Debug 1 | Connector_PinHeader_2.54mm:PinHeader_2x02_P2.54mm_Vertical | J2 |
| 1 | Debug 2 | Connector_PinHeader_2.54mm:PinHeader_2x02_P2.54mm_Vertical | J3 |
| 1 | ICSP | Connector_PinHeader_2.54mm:PinHeader_1x06_P2.54mm_Vertical | J1 |
| 1 | LOGO | LOGO | G*** |
| 1 | MCP1700x-330xxTO | Package_TO_SOT_THT:TO-92_Inline | U7 |
| 1 | PIC16F18346-P | Package_DIP:DIP-20_W7.62mm_Socket | U1 |
| 1 | Power | Connector_BarrelJack:BarrelJack_Horizontal | P1 |
| 1 | RESET | Button_Switch_THT:SW_PUSH-12mm | SW2 |
| 1 | SCORE 1 | Display_7Segment:0.36in 3161AS | U3 |
| 1 | SCORE 2 | Display_7Segment:0.36in 3161AS | U5 |
| 1 | SSD1306 | Connector_PinSocket_2.54mm:PinSocket_1x07_P2.54mm_Vertical | U6 |
| 1 | START | Button_Switch_THT:SW_PUSH-12mm | SW1 |

tardate/LittleArduinoProjects
a collection of "Little Electronic & Arduino Projects", most involving electronics or an Arduino in one way or another!

ChrisChrisLoLo/beyblock20
The magnetic, modular, 20-key macropad that can join together to form an ortholinear board

slu4coder/Minimal-64x4-Home-Computer
My DIY TTL home computer with VGA and PS/2 and 4x the processing power of a Commodore C64 or Apple II.

electroniceel/protoboard
Advanced protoboard layout with 1.27mm pitch for smd parts

TobleMiner/DC-UPS
A small DC UPS, designed to keep small appliances like consumer network equipment running during power outages



It measures 98.3 × 95.3 mm and has 2 copper layers, 1.6 mm thick.
52 parts, built around the 74HC595. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.
From the tecknet-gg/asm-pong repository on GitHub, at the commit this page was made from: the board is pcb/pcb.kicad_pcb and its schematic pcb/pcb.kicad_sch. PCBKit opens the board in the browser, with nothing to install.
Its repository publishes it under the MIT licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).