Hardware

Schematic:

Improvements:

  • Previously, flashing the firmware required soldering wires directly to the MCU. To simplify things, a dedicated connector has been added in form of 3 test points. Now, the flasher can be connected with pogo pins to quickly flash the new firmware.
  • Changes on connectors.
    •   Micro USB connector has been replaced with modern USB Type-C.
    • A JST 1.25mm connector has been added for the LiPo battery.
  • A proper power mux (TPS2112APWR) has been added instead of using diodes and transistors.
  • Tantalum capacitors are replaced with ceramic.
  • Finally, the problem I couldn't solve in the original version - battery leak has been solved by:
    •   moving the voltage divider after the power switch
    • using 2x100k resistors.

PCB:

Assembled PCB:

As you can see, PCBs are marked v1.0.1. This means I messed up something in the first version. A big lesson learned while working on this simple project is to never trust the default footprints provedided by the software - double check everything before making the order. In the first iteration, footprints for transistors had wrong pinouts.

There is no problem some creative thinking and enamel wire couldn't fix:

Sponsor time 

Once again, thanks PCBway for sponsoring this project and sending me PCBs and the SMD stencil for free.

Firmware

Changes on the firmware side were straight forward:

  • The ch32fun has been added as a git submodule to the repo.
  • The existing C code has been ported to use the new MCU based on examples provided by the dev environment, covering GPIOs, ADC, timer and flash.
  • In addition, the spaghetti code of the business logic has been refactored by using a proper state machine.

CASE

The original case has been re-made in Fusion360 with slight modifications:

  • Switching push buttons from 6x6x7mm to 6x6x4.3mm simplified the desing of button caps. They are no longer hollow. Instead of wrapping around the button, they are idended to be mounted on top of the button. This resulted in more precise 3D prints with no additional cleanup/sanding required.
  • The bottom lid has an updated latching mechanism. Its design is borrowed from TinyPPS' design.

References