Recent Blogposts of ilo lawa nasa

Toy Motor Controller Update: PCB Revision, Menu, Bootloader and Memory Card Support

March 31, 2024, 5:35 a.m. Electronics ilo lawa nasa

It's been more than a year since I've posted any update of this project on this blog. If you know me personally, you should probably have heard that this project has been on-going because I do talk about this project online from time to time. It just happened that I've been too busy to update this blog. Now that I've finally got the time to document the latest progress over these months, as well as the planned future development of this project.

Hardware Revision 3

Photo of Toy Motor Controller Hardware Revision 3

I've revised the hardware. The new hardware update includes:

  • Upgraded microcontroller: STM32G070CBT6. It has more flash and RAM and IOs ports, which allows the end-user to have more space to implement the custom functions
  • Added an external memory card slot
  • Added an extra button
  • New DC-DC regulator. It's a buck-boost converter supporting input voltage range of 1.9V ~ 5.5V
  • Removed built-in pressure sensor
  • Upgraded the 1-pin analog port to a 3-pin GPIO port
    • This GPIO port can support the pressure sensor / analog sensor on an external board
  • Replaced the 3D printed knob cap with an off-the-shelf one. My consumer grade 3D printer simply isn't good enough for printing that

A further revision is pending, which mainly focus on fixing hardware bugs and optimizing the design for small scale production. The pending revision doesn't change the feature set above.

Firmware Development

I've split the firmware into two parts, the bootloader and the app. The bootloader is used for performing firmware upgrade for the app. The app is where pretty much everything happens. The idea is to let the user develop their own custom app to be loaded into this toy motor controller.

The app upgrade file format is a dumb .BIN file. Basically it's just a binary stream to be self-flashed to the app region of the flash. The bootloader would flash as many pages as the size of the .BIN file. The development of the bootloader has just been completed.

The app development is still on-going. The user interface prototype is done with working menu and display. The UART protocol is also working. However, it's currently pretty difficult to develop plugin for this toy motor controller so I need to find a way to make it easier to perform plugin development. I foresee that I'd need to change quite a bit of the codebase for that.

On the app driver side, it's done and tested working except for the external memory card part. However, the existing code that initialize the peripheral is very inefficient (thanks to the auto-generated code of STM32CubeMX). I plan to make it more efficient somehow.

As for external memory card support for the app, I need to implement that. I'm mainly interested in data logging, config import/export and firmware dumping.

Production Plan

I found that it's too much work to manually solder the units for small scale production, especially for SMD soldering, I need to wear the gloves, take out the equipment and material, do the job and perform clean up, which's rather time-consuming. Therefore, I've decided that manual SMD soldering is to be done on only a unit or two for prototyping purpose. After the prototype is verified to work correctly, I'll at least outsource the SMD soldering for small scale production. For the parts with larger pitch, I could still solder that on my own if it isn't economical to outsource in small volume.

In the next revision, I'm gonna put all SMD parts on one side, and parts that can be hand-soldered on the other side.


As this is a hobbyist project, making profit is not and will never be the primary objective, just like other electronic projects that I work on. (To whoever proposing commercializing this project, particularly a certain close internet friend of mine coming from CIS, fuck you! As if I'd want to keep hustling off the clock! :P)

The main objective of this project is for me to learn and to share the tech that might be useful for others. There's no solid release schedule for this project. Tentatively I hope that I can get the first batch out by the end of this year, probably in a scale of <20 units. I'll make another blogpost of this project again when the time comes.

If I can complete this project, the firmware will be released under an FOSS license.

Toy Motor Controller Update: Mechanical Case and New Revision

July 31, 2022, 5:55 a.m. Electronics ilo lawa nasa

So, I've been working on the Toy Motor Controller. Over the past weeks, I have designed the mechanical case, revised the PCB and worked on the firmware. This device is still a work-in-progress.

Mechanical Case

The mechanical case consists of front cover, back cover, a couple of knob caps, a button and a power slider switch. The battery tray is affixed to the back of the top cover using a couple of screws via a couple of screw holes that comes with the tray.

It's the first mechanical case that I've ever designed in my life. I'm glad that it's working. And I'm happy that I can finally put the 3D printer that I've got into good use. :D

Here is some photo showing the mechanical case of the second revision of PCB:

Photos showing the front view, side view and back view of Toy Motor Controller

Second Revision of PCB

I have revised the PCB design. Compared with previous revision, now that it has the following feature:

  • More compact
  • Wider input voltage range. Previous revision: 1.85-5.5V. Current revision: 1.4-5.5V
  • Dual motor output port. Previously it only had one output port.

After spending hours of time, I have assembled a unit of this revision of PCB. I found that it does have minor issues, including a couple of capacitor footprints are having the size that's slightly off, and some silk mark issues. But they aren't anything critical so I can get away without fixing them for now. :P

Here's a photo showing the difference between the previous revision and the current revision:

Photos showing the front view, side view and back view of Toy Motor Controller

Firmware Development Updates

As for the firmware development, the driver code is mostly completed. Now that it's time for me to implement the actual feature on top of the driver code that I've written.

I've also tested the hardware using the driver code. At this stage, there's no evidence of existence of major defect in electronic design.


With the current development status, both the mechanical and electronic design seems to be working fine. I believe that I can go ahead and assemble 4-5 units of this device.

Due to the minimal ordering quantity of the PCB, I've got a few extra PCBs. I'm gonna find a time to purchase the components and solder them onto the extra PCBs.

This time over, I'm gonna purchase solder paste stencils as well. It took me hours to fix issues associated with putting incorrect amount of paste in my previously assembled units. I'd rather to spend an extra few dollars on getting stencils so that I can apply the exact amount of paste needed to avoid running into this problem again.

I don't think that this device would have any good amount of demand. I'll be using this 4-5 units to evaluate the demand and see if I should outsource the assembly or if I should continue to do the assembly on my own. I've done the math. Apparently it's well worth the cost outsourcing the assembly if the demand is >20 units per batch.

That's it!

That's it for the update on this project. I'll update you guys whenever there's any news. See you soon! :)

New Project: Toy Motor Controller

June 5, 2022, 2:33 p.m. Electronics ilo lawa nasa

Hello guys! I haven't been blogging about the projects that I've been working on for quite a while.

Here's new a project that I have been working on for a bit longer than a month. It's a toy motor controller.

Photo of Toy Motor Controller


This Toy Motor Controller is designed to be used for modifying existing motorized toys so that they'd be more fun to play with. For example, the motor of fishing game toy or penguin dash toy can be attached to this toy motor controller so that their motor can run at different motor speed, optionally with randomized movement pattern. It also supports reading external sensors so that the end-user can develop their own firmware to control the motor based on the sensor readings.


  • Microcontroller: STM32G030F6P6
  • Power input: AAx2 battery or DC Jack w/ power switch
  • Dual encoders with push button
  • A dedicated push button
  • Dual 3-digit seven segment LEDs
  • LED stripe display composed of 15x 0603 LEDs
  • Motor driving port - Can be used for driving any motor that meets the voltage and current requirement
  • External analog sensor port
  • Air pressure sensor
  • Motor current sensor for feedback control
  • UART port mainly for interfacing with computer
  • SWD debug port

Completed Task Items

  • First revision of hardware design
  • Assembly of the first prototype unit, which's mostly working
  • Test firmware for testing the hardware design

Task Items to be Worked on

  • Mechanical case - to be printed using 3D printer
  • Revision of hardware design for fixing the following issues:
    • Removal of known useless hardware feature that I've added to the first revision of PCB just in case
    • Mitigating voltage regulator transient output voltage drop upon the motor starts
    • Perhaps adding an additional motor driving port
  • The actual firmware. Currently we've only got the test firmware working, which isn't good for anything other than testing hardware feature
  • Production and distribution

Expected Production Volume

Based on my previous experience with the demand of my products, the expected demand for this project for its life time would be 10-50 units. I'll try to optimize the design for small volume production, including looking for parts that can be ordered in small volume, designing it in a way that I wouldn't have to spend too much time doing assembly even if I have to do it on my own, etc.

Future of

I kind of feel bad of starting a new project before completing the previous ones. It isn't uncommon for hobbyist projects tho. At least the completion rate of my projects is still higher than most fellow hobbyists.

After this project, I think I'll revamp my website for a little bit to make it less formal and more personal. Then I'll try getting back to my previous projects that I haven't finish (the clock and the portable game console).