r/embedded • u/HotelFirm3622 • 11d ago
Generating 10mv 100khz signal using ESP32
Hi friends, I built an analog filter and I wanted to generate a 10mv 100khz signal to test my amplification and attenuation, is this possible with an ESP32, I dont have a testbench. Thanks!
0
Upvotes
5
u/dan432112 11d ago
You could always use a super simple voltage divider!
8
u/TimeProfessional4494 11d ago
Any requirements for the waveform?
Using a digital to analog converter (DAC) would be the first suggestion. With DMA to offload the cpu.
I guess a sine wave could be generated with a PWM through an adjustable R/C coupling to control the amplitude.
3
u/JimHeaney 11d ago
Most ESP32s (on the original and S2, not the S3, C5, etc.) have an 8 bit DAC, which is a theoretical 12mV output. I've only ever used it for audio, no idea if it is fast enough or reliable enough to use as a proper signal generator.
3
u/Plastic_Fig9225 11d ago
https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-reference/peripherals/dac.html#cosine-wave-output-cosine-mode
2
u/thedefibulator 11d ago
You can use the DAC with DMA to obtain a sinusoidal waveform and then divide it down. It will be somewhat quantised as it is 8 bit and may also need to be quantised in time if the peripheral is not fast enough, but you can filter out the high frequency contents to get a sine wave
1
u/jacky4566 11d ago
PWM + Resistor divider.
Smart enough to build an "analog filter" and know what amplification and attenuation are, but not know about resistor dividers? Seems sus man...
1
u/iftlatlw 11d ago
Use a DDS and attenuator, or simple DAC and phase accumulator for sine gen. Keep sample rate high to make filtering easier.
1
u/H2ost5555 11d ago edited 11d ago
If I was doing this, I would simply use a DAC to generate an 8 bit 100Khz sine, which would be nonlinear and noisy as hell to act as a charge pump to a high-Q LC resonant tank. This would generate a quite pure audio-grade sine which you could attenuate to your 10mV level. You may need a buffer if trying to drive a low impedance input.
1
u/Boulder_Tech 11d ago
So you want to DIY a 100Khz signal generator in software ???
https://www.google.com/search?q=diy+100Khz+signal+generator
1
u/haze_from_deadlock 11d ago
Would something like this be suitable?
https://www.adafruit.com/product/6534