Skip to the content
2 layers124.5 × 42.1 mmPianoCH323V, the printed circuit board in 3D

Um piano desenvolvido com o microcontrolador CH32V002

Size
124.5 × 42.1 mm
Copper layers
2
Thickness
1.6 mm
Parts
33
Nets
31
Pads
100
Tracks, vias
178, 0
Pours
1
Routed
Yes
KiCad
KiCad 10.0 (file 20260206)
Created
10 Oct 2026
Updated
10 Oct 2026

Overview

PianoCH323V is an open-source printed circuit board by dquadros, from the dquadros/ch32v_piano repository on GitHub, published under the MIT licence. It is a 2-layer board of 124.5 × 42.1 mm with 33 parts on 31 nets, routed with 178 tracks and 0 vias.

It is built around the S8050. Its parts include 12 resistors, 7 switches, 3 connectors, 2 capacitors and 1 IC. It belongs with the RISC-V boards of this library.

Main components

1

README

README.md

Piano com CH32V002

(english documentation at the end)

Português

A ideia básica deste projeto é usar o PWM de um microcontrolador para tocar uma nota conforme a tecla apertada. A inspiração veio de um kit chinês que utiliza um 555.

Hardware

Eu utilizei um CH32V002A4M6, um microprocessador RISC-V de 32 bits, operando a 48MHz, com 4 kbytes de RAM e 16 kbytes de Flash e encapsulamento SOP16. É uma escolha certamente exagerada para o projeto, mas foi baseada no meu interesse pelo CH32V00x e ter 50 destes chips na gaveta. O CH32V003A4M6, com menos memória, provavelmente seria mais apropriado.

Após algumas experiências, optei por pegar a saída do PWM (uma onda quadrada), passar por um filtro RC e amplificar usando um transistor S8050.

Os botões estão todos ligados a uma única entrada analógica. A tecla apertada é inferida a partir da tensão presente na entrada.

Um trimpot é usado para realizar a afinação e um LED foi acrescentado para o debug.

A alimentação pode ser feita pelo conector de programação ou (no caso da PCI) por um conector micro USB.

Software

O software foi desenvolvido com o ch32vfun, uma infraestrutura de baixo nível (a programação é feita em C, acessando diretamente os registradores do microcontrolador).

No momento em que escrevo isso, a maioria dos exemplos no ch32Vfun é para o CH32V003 e requer ajustes para os demais modelos (como o CH32V002).

A programação do ADC para a leitura dos botões e do trimpot é relativamente simples. O código realiza várias leituras consecutivas para tentar pegar valores estáveis.

A programação do PWM é mais trabalhosa, mas é simples mudar a frequência uma vez feita a iniciação.

No uso normal, o trimpot de afinação é lido somente na iniciação e usado para ajustar todas as notas. Ligando o circuito com uma tela pressionada, entra-se no modo de afinação. Uma nota é tocada continuamente e sua frequência é atualizada periodicamente conforme a posição do trimpot.

Placa de Circuito Impresso

Uma placa foi projetada com o Kicad e está atualmente em produção.

Diretórios

Este repositório possui os seguintes diretórios:

  • Hardware: esquema e projeto da PCI, feito com o Kicad 10
  • Imagens: logotipo usado na PCI e imagem renderizada da PCI
  • Outros: planilha excel para cálculo da programação do PWM
  • Software: fontes e executáveis

English

The basic idea behind this project is to use a microcontroller's PWM to play a note corresponding to the key being pressed. The inspiration came from a Chinese kit that uses a 555 timer.

Hardware

I used a CH32V002A4M6, a 32-bit RISC-V microcontroller operating at 48 MHz with 4 KB of RAM and 16 KB of Flash in an SOP16 package. It is certainly an overkill for the project, but the choice was driven by my interest in the CH32V00x series and the fact that I had 50 of these chips in my drawer. The CH32V003A4M6, which has less memory, would likely have been more appropriate.

After some experimentation, I opted to take the PWM output (a square wave), pass it through an RC filter, and amplify it using an S8050 transistor.

The buttons are all connected to a single analog input. The specific button pressed is determined based on the voltage present at the input.

A trimpot is used for fine-tuning, and an LED has been added for debugging purposes.

Power can be supplied via the programming connector or (in the case of the PCB) via a micro-USB connector.

Software

The software was developed using ch32vfun, a low-level framework (programming is done in C, directly accessing the microcontroller's registers).

At the time of writing, most ch32vfun examples are designed for the CH32V003 and require adjustments for other models (such as the CH32V002).

Programming the ADC to read the buttons and the trimpot is relatively straightforward. The code performs several consecutive readings to obtain stable values.

Programming the PWM is more involved, though changing the frequency is simple once initialization is complete.

During normal operation, the tuning trimpot is read only at startup and is used to adjust all notes. Powering on the circuit while a key is pressed enters tuning mode; a note plays continuously, and its frequency is periodically updated based on the trimpot's position.

Printed Circuit Board

I used Kicad to design a PCB, it is currently in production.

Directories

This repository contains the following directories:

  • Hardware: schematic and PCB design, created with KiCad 10
  • Images: logo used on the PCB and a rendered image of the PCB
  • Other: Excel spreadsheet for calculating PWM settings
  • Software: source code and executables

Parts

33
QtyValueFootprintReferences
7SW_PushButton_Switch_THT:SW_PUSH-12mmSW1, SW2, SW3, SW4, SW5, SW6, SW7
4, , ,
3100kResistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_HorizontalR3, R4, R6
31kResistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_HorizontalR1, R2, R12
1100kPotentiometer_THT:Potentiometer_Runtron_RM-063_HorizontalRV1
1100nFCapacitor_THT:C_Disc_D4.3mm_W1.9mm_P5.00mmC2
1100uFCapacitor_THT:CP_Radial_D5.0mm_P2.50mmC1
112kResistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_HorizontalR10
1220kResistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_HorizontalR5
122kResistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_HorizontalR9
133kResistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_HorizontalR8
14.7kResistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_HorizontalR11
147kResistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_HorizontalR7
1CH32V002A4M6Package_SO:SOP-16_4.55x10.3mm_P1.27mmU1
1LEDLED_THT:LED_D3.0mmD1
1LOGOLOGOG***
1PGMConnector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_HorizontalJ3
1S8050Package_TO_SOT_THT:TO-92_InlineQ1
1SPKConnector_PinHeader_2.54mm:PinHeader_1x02_P2.54mm_HorizontalJ1
1USB_B_MicroConnector_USB:USB_Micro-B_Wuerth_629105150521_CircularHolesJ2

Similar boards

  • 2 layers60 × 40 mmHASwitchPlate, the printed circuit board in 3D

    HASwitchPlate

    aderusha/HASwitchPlate

    LCD touchscreen for Home Automation

    16 parts738MIT
  • 10 layers224.5 × 160 mmHaasoscope pro adc fpga board, the printed circuit board in 3D

    Haasoscope pro adc fpga board

    drandyhaas/HaasoscopePro

    Affordable 2 GHz 3.2 GS/s 12 bit open-source open-hardware expandable USB real-time oscilloscope

    586 parts485MIT
  • 4 layers74 × 104 mmBeepy, the printed circuit board in 3D

    Beepy

    sqfmi/beepy-hardware

    Beepy Hardware

    160 parts348MIT
  • 2 layers189.5 × 204.9 mmSmartSpin2k Panelized, the printed circuit board in 3D

    SmartSpin2k Panelized

    doudar/SmartSpin2k

    Transform your spin bike into a Smart Trainer!

    749 parts292GPL-2.0
  • 2 layers13.7 × 21.4 mmZ2m partner, the printed circuit board in 3D

    Z2m partner

    smarthomefans/z2m_partner

    Hardware module for iobroker.zigbee

    52 parts186
  • 4 layers43 × 49 mmEsppdp, the printed circuit board in 3D

    Esppdp

    Spritetm/esppdp

    ESP32-based PDP11 simulator, based onSimH

    55 parts141
  • 2 layers85 × 56 mmHB RF ETH, the printed circuit board in 3D

    HB RF ETH

    alexreinert/PCB

    Some of my PCBs

    96 parts104

Questions

How big is the PianoCH323V PCB?

It measures 124.5 × 42.1 mm and has 2 copper layers, 1.6 mm thick.

What parts does the PianoCH323V use?

33 parts, built around the S8050. 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.

Where can I download the PianoCH323V KiCad files?

From the dquadros/ch32v_piano repository on GitHub, at the commit this page was made from: the board is hardware/PianoCH323V.kicad_pcb and its schematic hardware/PianoCH323V.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the PianoCH323V design in my own project?

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).