Pulse Generator Does The Job With An STM8

When working with hardware, whether a repair or a fresh build, it’s often necessary to test something. Depending on what you’re working with, this can be easy or a total pain if you can’t get the right signal to the right place. To eliminate this frustrating problem, [WilkoL] built a useful pulse generator for use in the lab.

[WilkoL] notes that historically, the job of generating pulses of varying length and frequency would be achieved with a smattering of 555 timers. While this is a perfectly cromulent way to do so, it was desired to take a different approach for the added flexibility modern hardware can offer. The pulse generator is instead built around an STM8 microcontroller; an unusual choice in this era, to be sure. [WilkoL] specified the part for its incredibly low cost, and highly capable timer hardware – perfect for the job.

Combined with an ST7735 TFT LCD screen, and programmed in bare metal for efficiency’s sake, the final project is installed in a project box with controls for frequency and pulse length – no more, no less. Capable of pulse lengths from 250 ns to 90 s, and frequencies from 10 mHz to 2 MHz, it’s a tool that should be comfortable testing everything from servos to mechanical counters.

Of course, if you need to get down to picosecond timescales, an avalanche pulse generator might be more your speed. Video after the break.

16 thoughts on “Pulse Generator Does The Job With An STM8

    1. It is a toy “lab” tool like many DIY projects shown here. Or rather a tool for a very specific task (in this case with those parameters fixed), much more specific than generic (and indeed more expensive) lab equipment.

    2. Covered in the actual write-up. Output impedance is fifty-something ohms (3 outputs of a 74HC14, each with a 150 ohm series resistor, are paralleled). Output levels are fixed at 0 and 3.3 V.

      1. The output impedance of a port-pin on a microcontroller is usually on the order of 30-50 ohms. A small series-resistor (22 or 27 ohms for example) will bring it nicely into the 50 Ohm range. Not accurate, but often close enough.

        From an LSI chip, I expect way less powerful drivers. More like 150 ohms. So significant compared to the intentional 150 series resistance.

      1. Most of the time, the reference manual has much better explanations of how things works than trying to figure out from library. I code in bare metal too as it’ll take me longer to figure out the correct parameters to pass to a library than just read off the reference manual.

        For the rare moments when there are error handling or specific initialization sequence, it would be worth while to see what the library does. You can cheat and use SWD hardware debugger to see the before/after calling the library effect on the peripheral registers. You can also use a source code debugger to trace the library code logic. It is far easier than to understand code with nested #ifdef #else statements.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.