My project involves setting 12 voltage levels at 12 analog inputs of a controller.
The required levels are:
0V < L0 < 0.425V < L1 < 1.266V < L2 < 1.961V < L3 < 2.514V < L4 < 3.205V < L5 < 4.027V < L6 < 5V
The analog inputs of the controller use voltage dividers with 15 kOhm to 5V and 15 kOhm to GND.
- Low cost
- Small area
- Pin through
- Voltage levels are fixed (used for initialization of the controller)
- Steady state < 1 s
I investigated a solution with 3x TLV5620 DAC to have 12x 8 bits DAC channels, test results:
- I chose the wrong DAC, this DAC is not able to sink current, so it was not able to reach the levels below L3.
- I can look for a DAC that can sink more current
- I can look for a DAC that can source more current and lower the base level by an additional resistor to GND
The DAC’s I can find are:
So I decided to investigate a different solution:
- PWM (frequency=490Hz)+ RC filter (eg R=1 kOhm, C=47 uF)
This seems feasible for me. Only the capacitor is a bit big.
I can user a smaller capacitor when using a higher PWM frequency. Therefore I was thinking: what would be the best solution when I want to have 12 PWM outputs with fixed duty cycle at high frequency (e.g. 20 kHz). I only need 32 steps resolution.
Is it possible to pre-program a fixed buffer of 32 bits for each voltage level (L0 to L6) and send the bits, bit by bit to a digital output, by using an interrupt routine?
Is it possible to work with 1 interrupt and write 12 digital outputs each cycle? Is it possible to reach 20 kHz? This is the only task the microcontroller has to do.