close-circle
Close
0%
0%

XH-M188 Programmable Linear Power Supply

From "Key Press Control" to "Programming Console"!

Similar projects worth following
The XH-M188 is a cheap linear voltage regulator with pushbutton control.

@Elliot Williams contributed code to the HaD project "eForth for cheap STM8S gadgets" for converting this inexpensive device into a programmable power supply.

This HaD project provides instructions, docs, and applications support for STM8EF on the XH-M188.

I found a new example of circuit bending grade electronics engineering in my postbox: the XH-M188. It's advertised as "XH-M188 numerical control voltage regulation module" and it's rated "0-12V 1.5A 18W", and first time I checked there was exactly nothing on Google about this cheap board. Now there it is on HaD ;-)

As expected the board has a STM8S003F3 µC - there was no way to know that for sure, but call it gut-feeling ;-). The GPIOs are all used for either 7S-LED, keys, or the "numerical control" (and one seems to be unconnected). We're lucky though: the LED display can be removed from the socket, exposing 11 GPIOs :-)

I did some experiments with the software that comes with the board:

  • the "numerical control" is just a 4.5 kHz PWM signal with duty cycle setting through "+" and "-" key
  • the control part is indeed analog (LM358 with a TIP142)
  • the display value represents "duty cycle * X". There is no feedback whatsoever.
  • as expected, the ratio of "display value" to "PWM duty-cycle" is constant
  • the output voltage can be adjusted with the help of a trimmer potentiometer
  • the LED multiplex clock is about 16xPWM cycles

Due to an apparent bug in the PMW code every 16th cycle is only about half. This leads to an output ripple with about 280 Hz, and to an offset (which can't be compensated with the trimmer). However, this inaccuracy doesn't really matter since the "voltage reference" is a LM7805.

Due to the bipolar op-amp (LM358) the maximum output voltage is 11.4 V (at the rated supply voltage of 15 V), and the accuracy drops considerable from just below 11V.

All this doesn't mean that the board is good for nothing. At $4.75 it's an inexpensive piece of lab equipment, e.g. for home-brew test automation!

Here is the current project status

All you need for scripting is a serial terminal!

  • 1 × XH-M188 (e.g. AliExpress)
  • 1 × "TTL" serial interface

  • Yes, this project is still alive :-)

    Thomas6 days ago 0 comments

    @Elliot Williams recently updated the GPIO alternative functions initialization in the STM8EF GitHub project, and a the library feature with e4thcom support make it much easier to build applications.

    There is really no reason not to buy this $4.75 device if you need a programmable power supply with low noise :-)

  • Welcome to the XH-M188 Project

    Thomas06/05/2017 at 08:54 10 comments

    Almost everybody on HaD (and in the Maker scene) needs power supplies, and Chinese suppliers are happy to supply as many as you like. Programmable power supplies are also available but they come at a much higher price, with very limited programming features, or in the form of "hardware + C-compiler".

    This project uses Forth as a programming environment for the power supply. Using Forth as a scripting language is easy, and it leads to surprisingly simple and powerful solutions.

    The entry ticket is cheap: the price for the XH-M188 linear power regulator is about $4.75 (including shipping). You'll also need a STM8/STM32 programmer ($2), and "TTL" serial interface ($0.60).

    The Low-Cost Programmable Power Supply is a similar project (warning: more soldering required :-) ).

    Happy hacking!

View all 2 project logs

  • 1
    Step 1

    Retrofit a 90 degree header to ICP pads. Connect a resistor 10K between pin1 and pin3 of the ICP to compensate a PCB layout glitch.

    Alternatively connect your "STLINK V2" programmer's SWIM signal of to pin11 of the 7S-LED display socket (you can remove some of the solder mask near pin6 "NC" of the socket to turn it into GND with a bit of solder). You may need to connect the programmer's NRST signal to pin3 of the ICP reset the STM8S003F3 to factory defaults, then disconnect NRST and program the STM8EF binary. Refer to the project Wiki for details.

View all instructions

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates