HackerBox 0116: RISC Is Good
by HackerBoxes in Circuits > Microcontrollers
1029 Views, 1 Favorites, 0 Comments
HackerBox 0116: RISC Is Good

Welcome to HackerBox 0116. Experience how RISC architecture is going to change everything. Experiment with a number of super low-cost microcontrollers from the CH32V003 series of 32-bit RISC-V chips. Assemble the RISC-V Mini Game Console Badge. Configure the Arduino IDE to flash the CH32V003F4P6 Development Board using a WCH-LinkE Mini RISC-V Programmer/Debugger. Leverage breakout PCBs to experiment with tiny eight-pin CH32V003J4M6 chips. Assemble and flash a Colorful Light-Wand Demo featuring addressable RGB LEDs. Build three new full-color SAO designs as well as a Mystery SAO Power Badge. Sample a history of Computer Bulletin Board Systems (BBSs) and explore how this retro technology remains accessible today.
There is a wealth of information for current and prospective members in the HackerBoxes FAQ. Almost all of the non-technical support emails that we receive are already answered there, so we'd really appreciate it if you can take a few minutes to read the FAQ.
Supplies
This Instructable contains information for getting started with HackerBox 0116. The full box contents are listed on the product page for HackerBox 0116 where the box is also available for purchase while supplies last. If you would like to automatically receive a HackerBox like this right in your mailbox each month, you can subscribe at HackerBoxes.com and join the party. Subscription members save at least $15 every month and automatically receive each new HackerBox shipped immediately off the production line.
A soldering iron, solder, and basic assembly tools are generally needed to work on the monthly HackerBox. A computer for running software tools is also required. Have a look at the HackerBox Workshops for tools and supplies along with a wide array of introductory activities and experiments.
The most import thing you will need is a sense of adventure, hacker spirit, patience, and curiosity. Building and experimenting with electronics, while very rewarding, can be tricky, challenging, and even frustrating at times. The goal is progress, not perfection. When you persist and enjoy the adventure, a great deal of satisfaction can be derived from this hobby. Take each step slowly, mind the details, and don't be afraid to ask for help.
WEAR SAFETY GLASSES WHEN SOLDERING, WHEN TRIMMING WIRE LEADS, OR WHEN CUTTING, DRILLING, ETC.
CH32V003 Microcontrollers

The CH32V003 series microcontrollers are industrial-grade, general-purpose microcontrollers from WCH (Jiangsu Qin Heng). The MCUs are based on the QingKe 32-bit RISC-V V2A core adopting the RV32EC instruction set and supporting two levels of interrupt nesting. A variety of implementation factors support low-cost, low-power, and wide operating voltage ranges.
Datasheet: https://www.wch-ic.com/downloads/CH32V003DS0_PDF.html
Reference Manual: https://www.wch-ic.com/downloads/CH32V003RM_PDF.html
The CH32V003 series microcontrollers are available in a number of different variants and packages. In this instance, we'll be working with two of the more common options:
CH32V003J4M6 - in an 8-pin Small-Outline Package (SOP)
CH32V003F4P6 - in a 20-pin Thin-Shrink Small-Outline Package (TSSOP)
Thanks to the low-power and wide operating voltage range support, these MCUs are an excellent choice for battery operated designs... Perfect for an electronic badge!
Flash a First CH32V003 Program

This initial exercise will require two modules as shown here. We'll also need three female-female jumper wires.
We'll be using the WCH-LinkE Mini RISC-V Programmer/Debugger module to program the target which will be the CH32V003F4P6 RISC-V Development Board.
WCH-LinkE Mini RISC-V Programmer/Debugger
Connect the USB-C port of the WCH-LinkE module to your PC. The red POWER LED will come on. The blue MODE LED next to that should be off indicating "RISC-V Mode" which is what we want. If the blue MODE LED is illuminated, that indicates "ARM Mode" which is not what we want. To toggle out of ARM mode, remove the USB cable and then reinsert it while holding down the ModeS button. Powering up the WCH-LinkE module while holding the ModeS button will toggle the module between RISC-V and ARM mode. Again, we want RISC-V Mode which is indicated by the blue LED being off. The IAP (In App Programming) Button is only used to reprogram the WCH-LinkE itself, so let's leave that alone for now.
CH32V003F4P6 RISC-V Development Board
Connect the USB-C port of the Development Board to your PC. The green Power LED on the Development Board will illuminate. There is also a red LED which is connected to PD1 (SWD/SWIO). That red LED will flicker while the chip is being programmed over the SWD line.
After verifying that the Development Board powers up (green LED), let's solder the header pins. Disconnect the USB power. Place headers for the two longer rows of pins (11 pins each) such that the pins are on the bottom of the board, POINTING DOWN (on the opposite side from the components and USB connector). Solder the pins into place. Solder three remaining header pins onto the short end of the development board with the three pins POINTING UP (on the same side as the components and the USB connector). This configuration allows the module to be inserted into a solderless breadboard.
Connect the WCH-LinkE programmer to the CH32V003F4P6 Development Board
Disconnect USB power from both modules. Use three female-female jumper wires to connect the GND, 3V3, and SWD pins of the WCH-LinkE module respectively to the G, V, and SWD pins at the short end of the Development Board.
Connect USB power to only the WCH-LinkE module which will cause the module's red power LED to light up, while the blue mode LED should still be off. Now, the CH32V003F4P6 development board will also power up since 3V3 is being applied across its V and G pins. The green power LED on the Development Board will now illuminate.
Configure the Arduino IDE
Install the Arduino IDE, if necessary.
Follow the instructions on this repository to setup CH32 board support. It will lead you through adding a URL for "Additional Boards Managers" and then installing under the Arduino IDE Boards Manager.
Grab the ch32_hello.ino sketch file attached below.
Open the sketch in the IDE
Select: Tools > Board > CH32 MCU EVT Boards > CH32V00x
Select: Tools > Port > [appropriate USB option]
Program the sketch to the board. During the download, the red LED connected to PD1 (SWD/SWIO) on the Development Board will flicker.
Confirm the Hello World UART Output
Remove the SWD wire between the two modules (leaving the other two in place).
Use the wire to connect the TX pin of the Development Board to the RXD pin of the WCH-LinkE.
Open the IDE Serial Monitor and switch to 9600 baud.
You should see "Hello World" output repeatedly to the Serial Monitor.
Downloads
CH32V003J4M6 SOP-8 Breakout

The SOP-8 package of the CH32V003J4M6 MCU variant is the easiest one to hand solder. With the three included MCUs and the three SOP-8 breakout PCBs, you get a few bites at the apple. With one (or maybe all three) of these, you can experiment with the CH32V003 MCU using a solderless breadboard.
Solder the MCU chip onto the tiny breakout PCB being sure to align the pin one indicator according to the marking on the PCB.
Snap off two 4-pin sections of header pins and solder them to the breakout PCB as shown. It can help with alignment to set the header pins into the breadboard for soldering, but be careful not to melt the breakboard.
Colorful Light-Wand Demo

Solder a 4-pin section of header pins to the INPUT side of the eight-pixel addressable RGB LED module. There is no need to solder pins to the OUTPUT side.
Use the black solderless breadboard and some of the pre-formed jumpers to wire up the circuit shown above.
For a review of using solderless breadboards and how to map schematic nets onto jumper wire connections, check out the first four steps of the HackerBox Basics Workshop Guide.
Grab the fire.hex binary file attached below. The c source code file is also attached if you want to study that. Both files were originally published in this project by arduinocelentano.
On a Windows box, the WCH-LinkUtility can be used to upload the hex-file to the microcontroller.
- Tap the "Hit Connect to WCH-Link" icon in the utility
- The Operation Result Window should show "Succeed to connect"
- Tap the "Query Chip" icon
- The Operation Result Window should show "Succeed"
- Open the fire.hex file
- Select Target > Program
There is also an open-source upload tool minichlink developed by Charles Lohr (CNLohr), which runs on Windows, Mac, and Linux.
There is also an upload tool rvprog, which is a Python-based, platform-independent, open-source command-line tool.
Additional Useful Tools...
CNLohr's ch32fun is an open source development environment for the CH32V family of MCUs
An online guide for setting up the MounRiver Studio IDE (available for Windows, macOS, and Linux)
Some examples and videos using the MounRiver Studio IDE
An online guide for setting up the PlatformIO Toolchain
CH32V003 RISC-V Mini Game Console

This Mini Game Console from wagiminator (Stefan Wagner) utilizes the CH32V003J4M6 32-bit RISC-V microcontroller.
The included PCBA is based on Stefan's published v1.1 Gerber files. The MCU and the eight small components on the back of the PCB are pre-soldered. Thank you JLCPCB!
We suggest the following order for mounting the remaining components:
- SMD Slide Switch (orient such that component pins align with PCB pads)
- MLT-5030 SMD buzzer (orient such that component pins align with PCB pads)
- Five SMD Tactile Pushbuttons (orient such that component pins align with PCB pads)
- SMD CR2032 Coin Cell Holder (note +/- orientation)
- Male Header Pins (3) for Programming
- SSD1306 I2C OLED Display Module
There is an extra CR2032 Coin Cell provided with the Mystery SAO Power Badge.
Precompiled hex files for various games can be found in the software folder of the main project repository linked above.
As presented in the last step, the WCH-LinkUtility (or one of the other upload tools) can be used to burn the hex file to the target MCU through the WCH-LinkE Mini RISC-V programmer/debugger module.
DOES IT BADGE?
Sure does! Thread the string-loop of the black keychain through one of the upper corner holes of the Mini Game Console. Then push the metal ring of the keychain through the string-loop and pull it snug. Clip the lanyard onto the metal ring.
The Simple Add-On (SAO)

From Hackaday, Introducing the Badge Add-On presents the SAO concept for putting small PCB badges onto regular-sized PCB badges. Badges needed their own little badges for just a bit of extra flair. The SAO "standard" employs a simple 2x3 pin header connection and "is supported by tens of thousands of badges, and all of the people who are spending their free time designing electronic conference badges are using this standard." Also check out Simple Add-Ons (SAO) by Twinkle Twinkie.
HackerBoxes have featured SAOs a few times in the past...
There may still be limited availability of those boxes should you find yourself craving even more SAOs!
Three New HackerBox SAOs

This year, we have three new HackerBox SAOs...
- Nexus-1 BitHead S.A.O.
- Spacewalker S.A.O.
- Guy Fawkes "Hack The Planet" S.A.O.
The eight LEDs are electrically interchangeable, however we recommend the following placement:
- Two RGB (clear) LEDs for the BitHead Skull
- Two red LEDs for the Spacewalker
- Then whichever of the remaining LEDs you like for Guy Fawkes
There are markings on the back side of these three SAOs that indicate how to orient the LED pins and the SAO header (key notch UP). Look at the photos above, double check the PCB markings, and DFIU.
Mystery SAO Power Badge

SAOs do not have their own power supply since they are intended to plug onto a larger badge and feed from it like a parasite. Over the years, we've presented around nine or ten different solutions for powering SAOs.
Inspired by the popularity of the Mystery HighRollerCon Duck SAO from HackerBox 0104, we're featuring the Mystery HackerBox SAO Power Badge. Each HackerBox 0116 includes a randomly selected SAO Power Badge from our five favorites shown above.
Each badge also includes a randomly selected lanyard from our three most recent designs shown above.
Follow the relevant assembly notes below for whichever badge you receive...
SAO Totem Extender
- Video
- Powers up to three SAOs
- Solder the slide switch onto the back side of the totem
- Solder the coin cell clip onto the back side of the totem
- Solder the Male SAO header onto the back side of the totem
- Orient the keying notch upwards (towards the lanyard hole)
- Solder Three Female SAO headers (NOTCH UP) onto the front of the totem
- Orient the three keying tabs upwards (towards the lanyard hole)
Galactic Power Badge
- Video (from Jamie's Hack Shack)
- Solder the 10 Ohm resistor (marked with "100")
- Solder the power switch
- Solder the coin cell clip
- Note the orientation markings on the PCB
- Place seven clear 3mm LEDs
- Orient short pin toward the flat side on the PCB marking
- Place the female 3x2 SAO header on the front of the PCB
- Orient the keying tab upwards (towards the lanyard hole)
Cyber Power Badge (Three Color Variants)
- Video
- Solder the two power switches
- Solder the two coin cell clips
- Note the orientation markings on the PCB
- Solder the five RGB flashing LEDs
- Note the pin orientation markings on the PCB
- Mount the female 3x2 SAO header on the front of the PCB
- Orient the keying tab upwards (towards the lanyard hole)
Attention - A Note About SAO Headers
Sometimes, the six holes of a brand new female SAO header are very snug. It is a good idea to insert a set of male header pins into the connector four or five times to loosen the plastic a little. This helps to prevent an overly-grabby SAO port from ripping the connector from the back of an SAOs while it is being unplugged.
1990s BBS Software

The Serial Port (a virtual museum that highlights tech history of all types, both physical and digital ) explores a BBS platform called Impulse that was popular with underground boards in the 1990s.
A bulletin board system (BBS) is a computer server running software that allows users to connect to the system using a terminal program. Once logged in, the user performs functions such as uploading and downloading software and data, reading news and bulletins, and exchanging messages with other users through public message boards and sometimes via direct chatting. In the early 1980s, message networks such as FidoNet were developed to provide services such as NetMail, which is similar to internet-based email. (Wikipedia)
Related Resources
Video: BBS: The Documentary
Video: Back to the BBS
The Telnet BBS Guide lists both Dial-Up and Telnet accessible BBSs all over the world
Make, Fix, Repeat...

"A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects." - Robert A. Heinlein
We hope you are enjoying this month's HackerBox adventures into electronics, computer technology, and hacker culture. We aim to curate a challenging and rewarding experience of learning through experimentation and exploration. Thank you for joining us on this journey.
Reach out and share your success in the comments below. Email support@hackerboxes.com anytime with questions or whenever you need some help.
Hungry for more? Surf over to HackerBoxes.com and join us as a monthly HackerBox subscription member. You'll get a cool box of hackable gear delivered right to your mailbox every month and you'll enjoy a generous member discount.
Please consider sharing this free Instructable with others who may be interested in learning about these subjects. Word of mouth advertising is the greatest compliment that we can receive. We sincerely appreciate your support.