Converting an Arduino PWM Output to a DAC Output

  Рет қаралды 111,988

ForceTronics

ForceTronics

Күн бұрын

Пікірлер: 56
@ami6packs
@ami6packs 6 жыл бұрын
Probably the best tutorial on how to get a DAC output from a pwm signal. Very nicely explained and i liked how you represent a square wave as sum of DC input + sine waves.
@p_mouse8676
@p_mouse8676 4 жыл бұрын
Higher order filters will let you use higher sine-wave frequencies with the same pwm frequency. Passive it's possible to make a 2nd order filter with a Q=0.5 . With a single opamp it's possible to go up to a 3rd order (4th is technically possible but a little complicated) with a Q=0.707. (Max bandwidth)
@wi_zeus6798
@wi_zeus6798 6 жыл бұрын
Wow, I am really amazed by the in-deph approach! I appreciate it a lot. Nice video!
@marcelmougenot
@marcelmougenot 3 жыл бұрын
Thank you very much! This is the best explanation that I found on the internet! Your lesson will be very useful for my master degrees!
@AmanSinghal-ny3ik
@AmanSinghal-ny3ik Ай бұрын
instead of a sallen key filter what would happen if i use a rc or an LC low pass filter
@ForceTronics
@ForceTronics Ай бұрын
Depending on your application using a passive RC or LC low pass filter would work. But you're going to see some attenuation for the DC or low frequency signal that you're trying to pass through the filter. You're also going to see a much longer roll-off at your cutoff frequency for the signals you're trying to keep out
@AmanSinghal-ny3ik
@AmanSinghal-ny3ik Ай бұрын
@@ForceTronics Aah i see , and also if i am using to use that voltage to "load" something i'm guessing that would affect the output voltage , it may not be a clean flat line it might get choppy . Because in case of an op-amp the output impedance is low so that voltage will actually be able to drive atleast a mosfet or something .
@odissey2
@odissey2 2 жыл бұрын
I believe that Multiple Feedback topology LPF would work better than Sallen type. The Sallen filter has a direct path of the signal to the output, which shall bleed through. This is a known issue of the S-K topology, limiting its attenuation in the MHz+ region.
@brianwong6195
@brianwong6195 3 жыл бұрын
The Vpk-pk on the scope, is that reading your voltage ripple in your DAC output? 160mV. What would a good way to reduce the ripple?
@bramSDASCL1759
@bramSDASCL1759 Жыл бұрын
thank you,, great video
@ForceTronics
@ForceTronics Жыл бұрын
You are welcome!
@leobitencourt4719
@leobitencourt4719 23 күн бұрын
I believe this is called a PDM (Pulse Density Modulation), correct me if I'm wrong
@ForceTronics
@ForceTronics 22 күн бұрын
Pulse density modulation that's the first time I've heard that. I was trained on the term pulse width modulation or pwm. Thanks for the comment
@leobitencourt4719
@leobitencourt4719 22 күн бұрын
@@ForceTronics as far as I know the PWM is a special case of the PDM, but the PWM is much more famous since it's simpler
@pradityaromansyah
@pradityaromansyah 5 жыл бұрын
HELP I want to use Buck Converter Module Arduino with input PWM signal. But, the input of the Buck Converter is a potensiometer. thank you
@bilalghanem4113
@bilalghanem4113 3 жыл бұрын
How do you even get PWM fron pin 4 which is not able to give PWM (it doesn't have a ~ sign). Im trying to generate an ECG signal using arduino, any help?
@ForceTronics
@ForceTronics 3 жыл бұрын
What you see in the video is what I used. If I recall ecg signals are fairly precise and low amplitude. I would not recommend using a PWM signal. I would recommend using a dedicated DAC I that is 14 but or better. If you need it to be low amplitude you probably need some type of divider circuit
@workethicrecords5901
@workethicrecords5901 6 жыл бұрын
I noticed you declared pin 10 in your code, but didn't seem to use it anywhere else, or in your example. Is it important for something internally?
@SopanKotbagi
@SopanKotbagi 3 жыл бұрын
no, it's not. it's just the part of the code which generates a 50% PWM wave on the true PWM pin as shown by him on the oscilloscope the first time. you can delete all code related to pin 10 and the sine wave would still be generated on pin 4
@baltofarlander2618
@baltofarlander2618 Жыл бұрын
How do I change capacitor and resistor values in order to achieve higher cut-off frequency?
@baltofarlander2618
@baltofarlander2618 Жыл бұрын
EDIT: Know I know lmao
@stefanb.933
@stefanb.933 Жыл бұрын
Hello. how can the signal from the dac be downloaded on a 4 ohm coil?
@ForceTronics
@ForceTronics Жыл бұрын
No dac's are low power devices and would not have enough current to drive a waveform through a load with that little resistance. You would need an amplifier between the dac and the low impedance load. If you're trying to drive a stepper motor you should look at an h bridge circuit not a dac.
@stefanb.933
@stefanb.933 Жыл бұрын
What amplifier do you recommend between the dac and the low impedance load?
@ForceTronics
@ForceTronics Жыл бұрын
I don't have amplifier model numbers or specs memorized so you will need to do the research
@stefanb.933
@stefanb.933 Жыл бұрын
thank you. I would be happy if you make such a clip in the future. the idea is to be able to listen to the signal from the dac in the speaker, but it should be the same signal and not distorted. I tried with lm386, with a transistor and I didn't succeed ....
@michaelkeller7920
@michaelkeller7920 4 жыл бұрын
What version of Microcap are you using?
@oropeiro
@oropeiro 5 жыл бұрын
hi,can i vary the widths of the spwm(with same step) to change the amplitude of the output voltage,with the analoge read input as a feedback?
@ForceTronics
@ForceTronics 5 жыл бұрын
Yeah sure. Just make the measurement after the filtering
@oropeiro
@oropeiro 5 жыл бұрын
@@ForceTronics thank you for answer man,i got it..
@KrishneilGarib
@KrishneilGarib 6 жыл бұрын
After converting it to a DAC how can you turn it into a proper sine wave with negative voltage peaks? (so where the 127.5 was added to the function we would want this to be at zero instead) but I am not sure how to actually use the output to get it negative. Any help?
@ForceTronics
@ForceTronics 6 жыл бұрын
Two approaches comes to mind. You could use the method presented in this video but you would need to find a microcontroller or other IC that can generate a differential (positive and negative) PWM signal. You would then need to pass it through an active filter with an op amp that has a negative and positive power supply. Note that the filter needs to be designed to allow the frequency of the sinewave to pass but attenuates the frequency elements of the PWM signal. Or you can buy an off the shelf DAC chip with a differential output. Note that such a DAC IC will also require a negative and positive power supply.
@KrishneilGarib
@KrishneilGarib 6 жыл бұрын
@@ForceTronics thanks so much for the detailed reply! If I was to find an off the shelf differential DAC IC, but the only had one main power supply, what would be the easiest method to convert/split this into seperate positive and negative rails to use?
@ForceTronics
@ForceTronics 6 жыл бұрын
Here is a link that might help: www.newelectronics.co.uk/electronics-technology/the-best-way-to-generate-a-negative-voltage-for-your-system/167618/
@liron28
@liron28 4 жыл бұрын
can i control the output voltage ? like change it from 1v to 2v ,5v etcetera V=I*R i want to change the V while R ramaine constante so I will change
@ForceTronics
@ForceTronics 4 жыл бұрын
Yes that is what a DAC is used for, vary a voltage level. Note that DACs are low current devices so they are meant to control high impedance devices.
@yaqoobs.j.557
@yaqoobs.j.557 6 жыл бұрын
In your code who frequency used? I want 31KHz what I worke to do this?
@hukzero8227
@hukzero8227 6 жыл бұрын
انا بعرف كتب و احصل ع PWM
@michelligata9439
@michelligata9439 4 жыл бұрын
Hei, do you by any chance have any idea how to implement sine-wave generator in Arduino Uno using MATLAB simulink? i dont want to use the Analog pin, well Arduino Uno does not have DAC.
@amienmarzuqhilman5677
@amienmarzuqhilman5677 4 жыл бұрын
I have the same problem
@amrelkomy3474
@amrelkomy3474 6 жыл бұрын
hello sir can you explain how the analogue output voltage swings between the positive and negative half cycles while the Arduino PWM is in positive half cycle only?
@ForceTronics
@ForceTronics 6 жыл бұрын
With this example circuit you should get a DC level with a low amplitude sinewave. The frequency of sinewave will match that of PWM signal. The phases of the signal should be about the same, but depends on specs of op amp you use
@tientran007
@tientran007 6 жыл бұрын
How to pwm sine 50HZ feedback volt AC ( 12vDC to 220vAC)?
@ForceTronics
@ForceTronics 6 жыл бұрын
You are asking about inverter design and that is an area I don't have direct experience with so I am not the right person to give a DC to AC inverter tutorial.
@ghafoorsamadi2870
@ghafoorsamadi2870 6 жыл бұрын
Hi, very nice video, I like to know how can we use this signal for DC AC inverter cause we need two signals for - and + in DC AC inveter please.
@ForceTronics
@ForceTronics 6 жыл бұрын
Hello, I am glad you like the video. You are asking about inverter design and that is an area I don't have direct experience with so I am not the right person to give a DC to AC inverter tutorial.
@kaoshavoc
@kaoshavoc 9 ай бұрын
Awesome vid. Wouldnt have of 255 bunary be 127 even. Since 0 is whwre it really starts it has an offset if one conpared to hiw we tging if numbers. So it should be 256/2 = 128 then minus the 1 offset because 0 is a value in code even though in life we see 0 as absense of value.
@ForceTronics
@ForceTronics 9 ай бұрын
Yes you are correct, great catch!
@kaoshavoc
@kaoshavoc 9 ай бұрын
@@ForceTronics I have made that one off error sooooo many times. I am not sure I will ever stop making the error completly LOL.
@MitsuZer0G
@MitsuZer0G 5 жыл бұрын
Why didn't you use a simple RC low pass filter?
@ForceTronics
@ForceTronics 5 жыл бұрын
You can use a simple passive RC filter but they suck for two reasons. First they have a gradual rolloff so your AC ripple on the resulting DC level will be larger in amplitude. Active filters have less loss or the op amp compensates for loss so the resulting DC signal better matches the PWM value.
@DavidLeeMenefee
@DavidLeeMenefee 6 жыл бұрын
Nice video. Thumbs up...PEACE
@SpacePortArcade
@SpacePortArcade 2 жыл бұрын
Why bother configuring the PWM frequency if you're bit-banging?
@htwt
@htwt 4 жыл бұрын
Easy way: LTC2644
Tips on Improving ADC Measurement Accuracy and Resolution Part 2
27:50
СИНИЙ ИНЕЙ УЖЕ ВЫШЕЛ!❄️
01:01
DO$HIK
Рет қаралды 3,3 МЛН
Quilt Challenge, No Skills, Just Luck#Funnyfamily #Partygames #Funny
00:32
Family Games Media
Рет қаралды 55 МЛН
Analog output from PWM and a low-pass filter
14:13
nLab
Рет қаралды 12 М.
Going Beyond Arduino # 10: PWM D-to-A vs R2R Ladder D-to-A
14:32
Craig Hollinger
Рет қаралды 20 М.
How to use a Rotary Encoder with an Arduino - CODE EXPLAINED!
21:11
12-bit DAC Arduino MCP4725 How To Use It - Stable Voltage Reffrence
11:21
Teensy Audio without the Shield - Using ADC, DAC, DUAL PWM
10:30
Gadget Reboot
Рет қаралды 20 М.
Arduino - Analogue Outputs
12:25
The Machine Shop
Рет қаралды 11 М.
Using the ESP32 DAC - Voltages, Waveforms & Sounds
34:46
DroneBot Workshop
Рет қаралды 86 М.
Unique Projects with Digital Potentiometers
53:23
DroneBot Workshop
Рет қаралды 54 М.