The most literal LED lighting dimmer switch in the known universe. #pwm
The most literal LED lighting dimmer switch in the known universe. #pwm
Обзор микросхемы DRV8870
DRV8870 - это старая простая микросхема управления коллекторным DC -мотором с токами в обмотках до 3.5 Ампер от компании Texas Instruments. По сути это драйвер H-моста . Причем H-мост встроен прямо внутрь корпуса самой микросхемы. Это полностью интегрированное решение. В этом тексте я произвел обзор микросхемы DRV8870. Посмотрим с какой стороны следует подходить к микросхеме DRV8870.
https://habr.com/ru/articles/952484/
#DRV8870 #hbridge #hмост #stm32 #DevEBoxSTM32F4XX_M_V30 #STM32F407VGT6 #pwm #TIMER #gpio #18650
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
Build Steps
Taking a typical “low to high” soldering approach, this is the suggested order of assembly:
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:
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
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
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.
#STM32 #GettingStarted #Tutorial #STM32CubeIDE #STM32CubeMX #Timer #PWM #BitBang #STM32World
gpiozero、smbus、python3-serialを使ってRaspberryPi5のGPIOを色々と触ってみたメモ
https://qiita.com/Inoue_Minoru/items/3ec0c815a2bc77a4ae16?utm_campaign=popular_items&utm_medium=feed&utm_source=popular_items
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?!
https://brickexperimentchannel.wordpress.com/2023/05/06/music-with-lego-motors-pwm/
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.
#YonhapInfomax #HanaSecurities #OverseasEquities #MarginLending #PWM #USTreasuries #Economics #FinancialMarkets #Banking #Securities #Bonds #StockMarket
https://en.infomaxai.com/news/articleView.html?idxno=76448
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
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:
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:
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
Show HN: My GPU Fan Saga – A DIY ATX Fan Controller
https://shafq.at/my-gpu-fan-saga.html
#ycombinator #firmware #hardware #tech #pwm #attiny85 #fan
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.
https://wejn.org/2024/12/reversing-philips-hue-light-driver/
#diy #esp32 #light #driver #reverse #engineer #artist #media #smartlight #pwm #functions #progamming #zigbee #protocol #tech #maker #art #news
Dimming shift registers using PWM on an Arduino
Pixel 10 Pro: novità display, ma PWM ancora deludente
#AffaticamentoOculare #Android #DisplayOLED #Pixel10Pro #Pixel10ProXL #PWM #Smartphone #TechNews
https://www.ceotech.it/pixel-10-pro-novita-display-ma-pwm-ancora-deludente/
https://www.wacoca.com/anime/1864394/ 🪸7月システム手帳・バレットジャーナル:アフタヌーンティー|July Bullet Journal Setup: Tea Time #手帳デコ #コラージュ #pwm #bujo #shorts #2025Summer #2025SummerAnime #2025年夏開始の新作アニメ #Anime #BULLET/BULLETバレット/バレット #アニメ #新作アニメ
@boggo
A little bit, but not in a track or livecoding gig yet.
Until now, I found #fm 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 #pwm effects. It is one of my favorite sounds for sure. 🙂
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.
#STM32 #GettingStarted #Tutorial #STM32CubeIDE #STM32CubeMX #PWM #Timer #InputCapture #STM32World
Portland International Jetport - Portland, United States
https://en.wikipedia.org/wiki/Portland_International_Jetport
https://www.openstreetmap.org/#map=13/43.646198/-70.309303
#KPWM #PWM #Portland #UnitedStates #airport #aviation #avgeeks #GIS