The ten-cent RISC-V CH32V003 lacks native USB, LCD, or contact controller {hardware}. But, CNLohr implements all three with artistic bit-banging methods. The three-digit microlcd is a programmable USB-C dongle with out bodily buttons or USB-C connectors.
USB-C Hooked up to microlcd (📷: CNLohr)
Beforehand, CNLohr created the 1,920-byte rv003usb bootloader. This tiny little bit of code permits you to re-program the USB-less microcontroller over USB. Whereas that functionality is efficacious by itself, you may reuse about 250 strains of the bootloader’s C-code so as to add USB assist to a WCH CH32V003 challenge. By reusing that software program driver, CNLohr can simply re-program the microcontroller and ship updates to show values on the LCD.
Clear LCD is clear (📷: CNLohr)
CNLohr factors out that shows like cheap three-digit seven-segment LCDs use Indium Tin Oxide (ITO) to attain a clear show. ITO is similar materials utilized in touchscreens. So, it appeared doable {that a} show might additionally act as a contact component. Nonetheless, earlier than this characteristic might be realized, CNLohr needed to overcome the problem of driving the LCDs with an MCU that lacked a built-in LCD driver.
Diving LCD segments may be tough since they require AC waveforms. Regardless, CNLohr was in a position to write some meeting code to deal with the timing wanted to attain appropriate indicators from the CH32V003’s digital pins. Try round 5:43 within the challenge video for extra particulars in regards to the driving methodology.
Capturing Contact Values (📷: CNLohr)
The subsequent outlandish activity was utilizing the LCD as a capacitive contact sensor. The LCD module connects to the MCU ADC enter. A intelligent little bit of timing code stops updating the LCD whereas detecting a human finger’s presence. The voltage detected by the ADC correlates to the finger’s distance. Utilizing the ADC as an alternative of a digital pin supplies extra flexibility for figuring out if the person is performing a gesture or a press motion.
You need not bit-big an RGB backlight (📷: X.com/cnlohr)
Within the X thread asserting the video, @thornley_david advised {that a} programmable RGB backlight was the one characteristic lacking within the 3-digit microled. Nonetheless, CNLohr shortly identified that you do not want a customized bit bang routine for that!
microled PCB on panel (📷: CNLohr)
Microlcd’s most costly part is the printed circuit board (PCB). The LCD and MCU make up $0.31 of the invoice of fabric price, however the PCB prices about 10x that! Nonetheless, that extra price turned mandatory as a result of CNLohr needed to implement a USB-C connection with no connector. This requirement means the PCB wants a thickness of 0.6 millimeters and an ENIG (Gold) floor end. The gold end prevents the producer from making use of solder to the “edge” connector.
Try the total challenge video for detailed explanations of how the contact sensor and LCD work. CNLohr additionally supplies a short rationalization of the rv003usb bootloader code. You possibly can obtain the code and KiCad design information from the ch32v003_3digit_lcd_usb GitHub repository.