Basically, accuracy, speed, cost... A PWM output can be used to produce an an analog output with an RC filter. This basic design will have a ripple voltage at the PWM frequency and large source impedance. The source impedance can be addressed with a voltage follower. The output ripple can be addressed by changing the filter time constant or increasing the PWM frequency. Increasing the filter time constant reduces the ripple but increases the settling time for a specified accuracy. Increasing PWM frequency will reduce the output ripple for a given RC time constant but may reduce the PWM resolution depending on the uP used and clock rate. Also, the accuracy of the filtered PWM output is proportional to the supply voltage and switching levels of the uP. A DAC will provide an accurate analog volt with low source impedance. If the DAC output is ratio-metric, accuracy will be limited by the supply voltage. A DAC with an internal or external reference will address the supply-accuracy issues. The DAC refresh rate is limited by the digital interface but is typically fast. Also the DAC will require more MPU pins. All of these trade-offs (and anything I forgot) need to be considered during the design process. I have used both approaches in multiple designs.
The filtered PWM voltage can be thought as a DC voltage in series with ‘source impedance’. The value may be calculated as the parallel combination of R&C of the RC filter. For transferring voltage between the PWM filter and load (whatever your driving), you want the source impedance to be very low and the load impedance to be very high. This will minimize the PWM filter output error. In effect, the source impedance forms a voltage divider between the source and load impedance. Hope this helps... Have fun.
Great timing, releasing this video, since I were just about to look into a suitable DAC! Just got back into messing about with electronics after 20 years of (almost) purely computer development stuff and sub'd your channel a few weeks ago. Now you've earned yourself another patron, Sir! Kindly keep up the good work, good Sir. Cheers
The CS pin doesn't necessarily need to go to Arduino pin 10. The ~SS pin is only required for that purpose when the ATMEGA is the slave device. When it is the master you can use any pin. This is especially important to remember when you want to use more that one SPI device on the bus.
Am I correct that one should NOT control the brightness of an LED by voltage? So, using a DAC is a bit strange. In order to reduce flickering, increase the PWM frequency, and carefully adjust the on/off ratio/cycle should be the way to go, right?
Cool not sure I've seen a simple DAC instruction video like this. One nice thing I've noticed about this chip/setup is that there are no passive components required (although of course you can include if your specific situation requires)...just hook up MC pins to chip. Cool!
What about a video about how to count pulses? Something where it does with hw interrupt, and add some goodies like having three variables that constantly is updated with pulse count, pulse frequency, and distance between pulses. Many usages for this I think, water counter, electricity counter, speed counter, the list is long. If the thing can remember the pulse count in case of power failure then that will be an extra bonus.
HMM.... I think this may help explain why one type of monitor hurts my eyes and another doesn't. I had assumed it was due to AC vs DC but this makes more sense since they both claim to be using DC. One is probably using PWM to control the brightness and the other is using analog to control the brightness.
Yes, but you will control all of them at the same time, or with a dual chanel chip, you can control 2 different output. Or you can use multiple chip to control multiple led separatly
I don't get it. Why not just use Pins 1 through 5 with analogWrite? Sure it's nice to know how to use a DAC, but that does't seem like the fastest way to me.
For some things it's helpful to have a real analog output. For example, in my case I am using an LCD display and I can't set rhe contrast with PWM because it blink too much. With this DAC, it can display nicely and smoothly