Problem Maker
Problem Maker is a hardware project built around an STC15W204S(8051) microcontroller, an LCD, and a rotary encoder. It generates math problems using + − × ÷ with numbers up to 100, and lets you input answers by spinning the encoder.
I built this mainly as a learning project and as a way to help my little brother practice math using something physical instead of worksheets.
Supplies
Electronics
- STC15W204S microcontroller
- HD44780 16*2 LCD
- Breadboard (for testing)
- Wires
- RA11131121 rocker switch(for power)
- Encoder with Push Button
Power
- 5V power supply or 3 AAA batteries
Programming
- USB to TTL convertor
- SDCC compiler
- A text editor or programming software
- Stcgal installed
- Linux computer
Optional
- Potentiometer for LCD contrast
- A case for final project like mine (I will have the STL files here)
- 4 Screws for lid
Programming the STC15W204S Microcontroller
I wrote a program in C for the MCU, and you can download it below. There’s also a header file I made that has all the special registers (SFRs) for the microcontroller, so you don’t have to look at the datasheet and make it yourself.
Here’s what the program does:
- Start-up:
- Sets up the timers and interrupts so everything runs smoothly.
- Math Problems:
- The device asks you 10 math questions.
- A timer keeps track of how long you take to answer each one.
- Show Results:
- At the end, it shows your score and total time.
- Then it goes back to the main menu, so you can try again.
Making the Electronics and Programming the MCU
Set up the Microcontroller
- Place your STC15W204S on a breadboard.
- Connect GND to GND and VCC to 5V.
- No external crystal is needed because the STC15W204S has an internal oscillator.
Connect the LCD
- Use a 16×2 HD44780-compatible LCD.
- Connect VCC to 5V and GND to GND.
- Connect RS, E, and D4–D7 pins to the MCU GPIOs (you can pick which pins you want, just make sure the code matches. You can see the pins I used in the schematic above).
- Connect a 10kΩ potentiometer or a resistor to V0 to adjust the LCD contrast.
Connect the Rotary Encoder
- Connect CLK and DT pins, and the pushbutton if it has one, to three MCU GPIO pins.
- Connect GND and VCC if your encoder needs power.
- If your encoder has a pushbutton, connect it to another GPIO pin.
Connect the USB-to-TTL Adapter (for programming)
- Adapter TXD goes to MCU RXD.
- Adapter RXD goes to MCU TXD.
- GND goes to GND.
- Leave VCC from the adapter unconnected if your MCU is powered separately, or connect it if your adapter can safely supply 5V.
Connect the USB-to-TTL adapter and open terminal to program the code into the MCU.
Programming
- In the terminal, type:
Then program it with:
It should output a bunch of information and end with something like “Complete!”
If it doesn’t, make sure the MCU is connected and you are using the correct USB port.
Power It Up
- Make sure everything shares a common ground.
- Power the STC15W204S with 5V.
- If the LCD shows a blank screen or lines change your contrast setting.
Polishing and Finishing Up
1. Move from Breadboard to PCB
- Once everything works on the breadboard, transfer your STC15W204S, LCD, and rotary encoder to a small PCB or just use wires and tape like I did.
- Keep components spaced nicely — leave room for wires and headers.
- Label pins or draw a small diagram to avoid confusion when soldering.
- Solder the circuit together
3. Wire Management
- Use short wires where possible.
- Route power and ground lines first, then data and signal lines.
- You can use heat-shrink tubing or small cable ties to keep wires tidy.
4. Enclosure / Case
- Take the STL file down below and download it
- Use a slicer to slice the file and get a .gcode file to print the model
- After printing take the bottom box and put all electronics and battery packs into it.
- Screw in the encoder and push the switch in
- Make sure none of the wires are short-circuiting and attach the LCD onto the top cover
- Connect all the wires and put the top cover onto the rectangular spacer and put it under the cover
- Lastly put the box under the covers and screw them all together
Tip: If the screws aren't going in, use a lighter to heat the screw then screw it in while it is still hot so that it can melt the surrounding area.
If you don't have a 3D printer you can use a cardboard box or a can and use that instead.
5. Final Check
- Plug in power, spin the encoder, and make sure the LCD shows problems correctly.
- Make any last tweaks before closing the case fully.
Congratulations!
You have finished Problem Maker and can now show it off and practice math with it!
Please comment if you have anything to say!
If you want all the files and the more technical stuff I have a GitHub repo here:
https://github.com/BohanXu-74/Problem-Maker