#PWM

The most literal LED lighting dimmer switch in the known universe. #pwm

A brown hotel lighting switch panel with rotary brightness controls labelled PWM. Several unmarked flip switches are also present.
2025-11-12
Great post from Michał Wilczyński about their "journey into creating safe Rust abstractions for the kernel's PWM subsystem, demonstrated with a real world fan controller driver for the RISC-V TH1520 SoC"
https://mwilczynski.dev/posts/bringing-rust-to-the-pwm-subsystem/ #linuxkernel #linux #rust #rustforlinux #pwm #riscv
2025-10-12

Обзор микросхемы DRV8870

DRV8870 - это старая простая микросхема управления коллекторным DC -мотором с токами в обмотках до 3.5 Ампер от компании Texas Instruments. По сути это драйвер H-моста . Причем H-мост встроен прямо внутрь корпуса самой микросхемы. Это полностью интегрированное решение. В этом тексте я произвел обзор микросхемы DRV8870. Посмотрим с какой стороны следует подходить к микросхеме DRV8870.

habr.com/ru/articles/952484/

#DRV8870 #hbridge #hмост #stm32 #DevEBoxSTM32F4XX_M_V30 #STM32F407VGT6 #pwm #TIMER #gpio #18650

Júlio Gardonajcbritobr
2025-09-14

Exemplo de modulação , resolvida com . Modelo que irei transformar em um circuito.

pwm modulation example.

Things overheard on the radio at the airport: "Hey, there was a bird strike on the plane at gate 4." Now I'm curious what the protocol is. #pwm #airport

Simple DIY Electronic Music Projectsdiyelectromusic.com@diyelectromusic.com
2025-08-28

Simple PWM Filter PCB Build Guide

Here are the build notes for my Simple PWM Filter PCB Design. Below you can see it connected to my Pico Touch Board.

Warning! I strongly recommend using old or second hand equipment for your experiments.  I am not responsible for any damage to expensive instruments!

If you are new to electronics and microcontrollers, see the Getting Started pages.

Bill of Materials

  • PWM Audio Filter PCB (GitHub link below)
  • 2x Suitable filter components, for example, per channel:
    • 3x 1KΩ resistors
    • 2x 100nF ceramic capacitor
    • 1x 2u2 electrolytic capacitor
  • Optional: Pin headers
  • Optional: 2x 3.5mm TRS sockets (pcb mounted, see photos for footprint)

Build Steps

Taking a typical “low to high” soldering approach, this is the suggested order of assembly:

  • All resistors.
  • TRS sockets (if used).
  • Disc capacitors.
  • 3-way jumper headers (if used).
  • Electrolytic capacitors.

Here are some build photos.

If the electrolytic capacitors will be bent over, then they should be bent and soldered in place before the header pins.

Testing

I recommend performing the general tests described here: PCBs.

PCB Errata

There are no known issues with this PCB at present.

Enhancements:

  • As previously mentioned it might have been useful to label the left and right channels and use the alternative resistor circuit symbol.
  • It might have been useful to include solder jumpers to allow the simple combining of the left and right inputs and outputs
  • Some additional connection points for an oscilloscope might have been useful too.

Find it on GitHub here.

Sample Applications

Here are some applications to get started with:

Experimenter board

Rather than fixed components, it is possible to solder on round pin header sockets to allow components to be pushed into place. This means that it is fairly easy to experiment with alternative component values to see what difference they make.

When doing this, I only soldered up one channel, but joined the left/right inputs and outputs by adding a solder bridge across the pin headers. I also soldered additional pins to the spare GND connections from the second channel. This allows plenty of pin connections for an oscilloscope.

The connections for components aren’t as tight as they could be, especially for low-wattage components with pretty thin legs.

It might be that just continuing to use solderless breadboard for experiments is simpler, but it was pretty useful to be able to leave oscilloscope connections and the input and output connected whilst experimenting.

Board Manufacturing

These boards are sized to allow them to be ordered in a 2×4 panel if required, and still remain within a 100x100mm footprint. I used jlcpcb’s panel options with v-cuts and it was really quite inexpensive to do.

Closing Thoughts

I’m still not sure I really understand enough analog electronics to get the theory of how a dual-stage filter incorporating a potential divider still works, and any simulation is still not quite matching my theory to experiment.

As has been said, “in theory, theory and practice are the same, in practice they are different”.

This might make some proper practicing a bit easier.

Kevin

#filter #lpf #pcb #pwm

Simple DIY Electronic Music Projectsdiyelectromusic.com@diyelectromusic.com
2025-08-28

Simple PWM Filter PCB Design

Having spent a bit of time attempting (although I’m not sure I’m succeeding yet) to understand how to get a useful filter for my Pico Touch Board Audio, I thought it would be useful to have a simple template PCB that could be used for a range of PWM low-pass filtering options.

This is my design.

Warning! I strongly recommend using old or second hand equipment for your experiments.  I am not responsible for any damage to expensive instruments!

If you are new to electronics and microcontrollers, see the Getting Started pages.

The Circuit

This is following on from the discussion in Pico Touch Board Audio creating the template for a simple two-stage low-pass filter with an option for including a potential divider resistor to drop the overall voltage too.

I’ve doubled the circuit to allow for stereo in and out if required and have included both 3.5mm TRS sockets and pin jumper headers for both input and output.

It requires no power, being a completely passive filter.

If stereo is not required, then just one of the circuits can be populated – ideally the one connected to the TRS tip.

PCB Design

There isn’t much to this pcb layout really. I was particularly keen to keep the PCB away from specific values of components, so instead used the silkscreen to present a pseudo-circuit diagram to make it clear which components are which.

I’ve also tried to leave enough room for the electrolytic capacitors to allow them to be bent over if required.

Closing Thoughts

With hindsight, I can think of a couple of additions that would have been useful on the silkscreen – labelling which circuit is left and right for example.

And having the boards back, I should have added manual “wavy line” resistor diagrams rather than rectangles, but it is enough for what I need.

And it might have been useful to include some additional test points for connecting an oscilloscope.

Kevin

#filter #lpf #pcb #pwm

STM32Worldstm32world
2025-08-25

STM32 Tutorial #65 - Bit Banging PWM SUPER Optimized

In this Tutorial video we will dive further into timers by using a timer to bit bang PWM on a GPIO where no timer channel is available (such as PC13). We will begin by letting STM32CubeMX generate all the code but then optimize that by creating our own interrupt handler.

youtube.com/watch?v=QHcK3Ani-As

:rss: Qiita - 人気の記事qiita@rss-mstdn.studiofreesia.com
2025-08-23
2025-08-17

I just found this blog post about how to make #music using #pwm on #lego #powerfunctions #motors. not that I want to, but there is quite some technical information in there.

Gets me thinking about building a simple #train motor Forth library. To run on a microcontroller inside your #locomotive to which you connect via wifi ... hmmm ... @f4grx what do you think?!

brickexperimentchannel.wordpre

#afob
#trains

Yonhap Infomax Newsinfomaxkorea
2025-08-11

Hana Securities is expanding its overseas equities business, launching innovative services such as integrated margin trading and asset-backed lending, while targeting both Korean and foreign retail investors to broaden South Korea's equity market base.

en.infomaxai.com/news/articleV

Simple DIY Electronic Music Projectsdiyelectromusic.com@diyelectromusic.com
2025-07-27

Pico Touch Board Audio

I wanted to go back to my Pico Touch Board PCB Design and see if there was a way to make it more stand-alone. The original design was to make it a MIDI controller, but that isn’t the only option.

https://makertube.net/w/tADSyrPrUdR1mx7yKRXZTC

Warning! I strongly recommend using old or second hand equipment for your experiments.  I am not responsible for any damage to expensive instruments!

These are the key Arduino tutorials for the main concepts used in this project:

If you are new to microcontrollers, see the Getting Started pages.

Parts list

  • Pico Touch Board PCB – built
  • Resistors: 1x 220Ω, 1x 1K
  • Capacitor: 1x 100nF ceramic, 1x 22uF electrolytic
  • Breadboard and jumper wires

The Circuit

Most of the GPIO are linked out to the touch pads, but the three analog inputs are still available. They are added on to the header on the right hand side of the board at the top, so we can use one of these as an audio output.

Initially, I thought of connecting it to an 8Ω speaker. If I was using an Arduino then I’d use a 220Ω resistor in series to limit the current to less than 20mA. But as I’m using a Pico, the maximum current has to be a lot less. I seem to recall it is a little complicated, and there are some options, but I have a figure of around 4mA that I tend to work to. It is also running at 3.3V, which means that it would need an in series resistor of 3.3 / 0.004 = 825Ω. This would work, but the speaker will be really quiet!

So I ditched that idea (there is a software reason too, but I’ll talk about that in a moment) and went straight to a PWM output with a low-pass filter to try to give me some vaguely useful as a line-out signal.

I’ve not done the calculations, but instead went a bit “hand-wavy”, combing a 1K and 220Ω resistor to drop the voltage, along with a 100nF capacitor. I’ve also added a 22uF capacitor to remove the DC bias.

That seems to give me something useful, but as you can see from the trace below of a square wave PWM output, there is a lot of room for improvement!

Update

Ok, so going back and doing this semi-properly as per my notes from Arduino PWM Output Filter Circuit, I can see that the 1K and 220Ω resistors can be treated as a 180Ω equivalent (take them as two in parallel) for the filter circuit, which means a cut-off of around 8kHz which ought to be pretty good….

But reducing a 3V3 signal to around 20% leaves for quite a low level of audio – around 660mV peak to peak. It would probably be better to aim for a reduction of around a half.

Using a 1K and 500Ω resistor would be an equivalent resistance of 333Ω, so putting that into a low pass filter calculator gives a cut-off frequency of around 5kHz for a 100nF capacitor.

Weirdly the only thing that really seems to improve things is to raise that capacitor value to 1uF. My calculation would suggest a cut-off frequency of around 480Hz which is pretty small for an audio signal. But it seems to work.

The PWM frequency I was seeing was coming in at around 120kHz so should be plenty high enough to get filtered out. In the Circuitpython code, it is apparently chosen to support the number of bits required at the base clock frequency whilst being inaudible. For the RP2040 running at 125MHz, and with the chosen 10 bit resolution (more here) this is:

  • 125,000,000 / 1024 = 122,070 Hz

A 5kHz (or even 8kHz) cut-off I thought ought to be fine, but Davide Bucci on Mastodon explained for me:

“120kHz is 25 times 4.7kHz, that is about 1.4 decades and with a first-order filter you have a tad less than 30dB of attenuation, that is not a lot. A signal at 3.3V peak to peak at 120kHz becomes about 100 mV on the output after the filter.”

So switching to 1uF, as Davide explains: “if you put 1µF, you are indeed filtering a decade lower, therefore you gain 20dB in the attenuation and the 100mV become 10mV, much less noticeable.”

The alternative is to repeat the 1K+100nF stage and add a second order filter which also seems to work pretty well.

The final circuit that works fine for me at present, will be on of the following.

The first is less components but assumes that the frequencies won’t go much about ~1KHz or so. That is ok for my current setup but would limit the audio range a fair bit.

This is the output of the two-stage filter. It is so much better!

The Code

I wanted to stick with Circuitpython, so my initial thought was to use simpleio.tone() to generate a tone based on a frequency from an IO pin. However, this has the problem that the code is blocking whilst the tone is playing which isn’t very useful.

Instead I went straight to synthio. It turns out that using synthio was actually a lot easier than the “simple” simpleio…

Here is the basic code to generate an ASR-shaped square wave on a PWM audio output on GPIO 28 based on the touch pads as input.

import board
import touchio
import synthio
import audiopwmio
from adafruit_debouncer import Debouncer, Button

audio = audiopwmio.PWMAudioOut(board.GP28)
synth = synthio.Synthesizer(sample_rate=22050)
audio.play(synth)
synth.envelope = synthio.Envelope(attack_time=0.1, release_time=0.6, sustain_level=1.0)

touchpins = [
board.GP2, board.GP3, board.GP4, board.GP5,
board.GP6, board.GP7, board.GP8, board.GP9,
board.GP10, board.GP11, board.GP12, board.GP13,
board.GP14, board.GP15, board.GP16, board.GP17,
board.GP18, board.GP19, board.GP20, board.GP21, board.GP22
]

THRESHOLD = 1000
touchpads = []
for pin in touchpins:
t = touchio.TouchIn(pin)
t.threshold = t.raw_value + THRESHOLD
touchpads.append(Button(t, value_when_pressed=True))

while True:
for i in range (len(touchpads)):
t = touchpads[i]
t.update()

if t.rose:
synth.press(60+i)

if t.fell:
synth.release(60+i)

I did experiment with overclocking the Pico to give double the PWM frequency, using

microcontroller.cpu.frequency = 250_000_000

But although this did double the PWM frequency to around 244kHz, it didn’t seem to make much difference for the filtered signal.

Battery Power

One last thing I wanted to explore was if it was possible to power the touchboard with batteries. I left in a number of power options, so for this one I’m using the 5V/GND pin header. I’ve included a couple of capacitors for smoothing, and need to add the 1N5817 diode as shown below.

This requires the following additional components:

  • 1x 1N5817 Schottky diode.
  • 1x 100nF ceramic capacitor.
  • 1x 47uF electrolytic capacitor.
  • Jumper wires.
  • 3 or 4 battery box.

The 5V/GND header pins connect to the Raspberry Pi Pico’s VSYS pin via the Schottky diode. The 1N5817 has a typical voltage drop of 0.45V, so combined with the Raspberry Pi’s accepted input voltage of 1.8V to 5.5V this means that ideally two or three AA batteries (at 1.5V each) would work. Four 1.2V rechargeables might be an option too.

It might be possible to get away with four 1.5V AAs, but that would give an input voltage of just over 5.5V, so I think that is probably pushing things too far. It might be a good use for some spent AAs though that are no longer reading a full 1.5V…

One of the downsides of battery power is that the touch works best when your fingers are at the same GND potential as the board. It works best if the GND pin of the (unpopulated) barrel jack is touched when using the board.

Closing Thoughts

With hindsight it would have been useful to have included a simple PWM output stage on the original board, but it is relatively straight forward to add one.

It might even be worth me making an add-on board that will connect to the header pins of the power and analog pins containing the simple passive filter components.

What is pretty impressive though, is how easy it is to use synthio with Circuitpython.

Kevin

#circuitpython #pwm #raspberryPiPico #synthio #touch

2025-07-22
2025-07-12

A Brain Transplant for a Philips Smart Lamp.

As the saying goes, modern problems require modern solutions. When the modern problem is that your smart light is being hijacked by the neighbors, [Wjen]’s modern solution is to reverse engineer and replace the mainboard.

wejn.org/2024/12/reversing-phi

#diy #esp32 #light #driver #reverse #engineer #artist #media #smartlight #pwm #functions #progamming #zigbee #protocol #tech #maker #art #news

[ImageSource: Wjen]

The light in question is a Phillips Hue Ambiance, and [Wjen]’s excellently-documented six part series takes us through the process of creating a replacement light driver. It’s a good read, including reverse-engineering the PWM functions to get the lights to dim exactly like stock, and a dive into the Zigbee protocol so his rebuild light could still talk to the Philips Hue hub.

The firmware [Wjen] wrote for the ESP32C6 he chose to use for this project is on GitHub, with the PCB in a second repo.

<https://github.com/wejn/e32wamb>

<https://github.com/wejn/e32wamb-pcb/>
Gerald Schneiderschneidr@makertube.net
2025-07-12

Dimming shift registers using PWM on an Arduino

makertube.net/w/aqVHdb1nPbwxQP

Anime of Japananime@wakoka.com
2025-07-06

wacoca.com/anime/1864394/ 🪸7月システム手帳・バレットジャーナル:アフタヌーンティー|July Bullet Journal Setup: Tea Time #手帳デコ #コラージュ #pwm #bujo #shorts #2025Summer #2025SummerAnime #2025年夏開始の新作アニメ #Anime #BULLET/BULLETバレット/バレット #アニメ #新作アニメ

🪸7月システム手帳・バレットジャーナル:アフタヌーンティー|July Bullet Journal Setup: Tea Time #手帳デコ #コラージュ #pwm #bujo #shorts
2025-06-23

@boggo
A little bit, but not in a track or livecoding gig yet.

Until now, I found to be sufficient and it works for sawtooth waves too! We could explore the new functionalities in a new track or jam.

Also, I love layering notes, minimally detuned, for effects. It is one of my favorite sounds for sure. 🙂

STM32Worldstm32world
2025-06-16

Timer Input Capture

In this video we'll be revisiting timers. In a much earlier video we were using Timer Input Capture to decode rotary encoders. In this video we will be using input capture mode to measure frequency and duty cycle of a pulse width moduleated input.

youtube.com/watch?v=9HpiXjB3kkc

Client Info

Server: https://mastodon.social
Version: 2025.07
Repository: https://github.com/cyevgeniy/lmst