D21G/PROTO: DAC0 analog output voltage reaches saturation at a count of 71% with about 2.3V (never reaching full range)
- may be default/unchanged AREF seems not to be 3V3, but 2V23?
- I can frequently change voltage (in my example in steps of +/-30 of 0..4095) down to 0V out
- but reaching an integer of about 3000 (2977 to 3007) the output reaches about 2.29V (DVM reading) and gets stuck, will never increase more
- by decrementing below that, the output continues to follow to 0V out
- Independant from the set up AREF I would expect the output to follow 0..4095 more or less uniformly linear?
- setting analogWriteResolution(8) - the output stops at about 187 (also reading 2.29V)
- setting to 10(bit) - the saturation level of 2.27V is reached at int 735
- the limit is close to 71% (sqrt of 1/2 ?) - but AC reading is zero, so this should be solid DC (not PWM or s.th. else?)
- starting with a integer of "max/2" (50%) I get always a 1.578V (1.57..1.58 in 20V) reading which is close to 3.32V/2?
- setting different analogReference(AR_...) seems not to work at all, got same 50% reading of 1.57V at startup
- (Remark: the DVM reading is naturally poor due to the lowest part of the 20V-range (200mV/2V/20V/...), so the real value could be much different, but never ever like 3V3 - the saturation is seen clearly)
Do I need different steps or do I have to change to another order of commands to set up this test?
```
// started with
const int vout_max = 4095;
int vout = vout_max / 2; // to start with
pinMode(DAC0, OUTPUT); //D18
analogWriteResolution(12);
analogReference(AR_DEFAULT); // = Vcc 3V3
analogWrite(DAC0, vout);
... // and later
if( !digitalRead(buttonUpPin)) {
vout += 30;
if (vout > vout_max) vout = vout_max;
analogWrite(DAC0, vout);
SerialUSB.print("vout = "); SerialUSB.println(vout);
} else if ...
```
? a #D21G and #DAC(0) or #analogWrite label would help?
Hi, please refer to https://github.com/Industruino/documentation/blob/master/proto.md#analog-output
You can also use the DAC to play audio as mentioned here https://industruino.com/blog/our-news-1/post/proto-d21g-audio-playback-34
I started to type me question for hours during testing; now, after different tries and reading more pages of arduino.cc
a) It should not say "pinMode()" is not needed - but setting pinMode will destroy the DAC function?!!
My test rountines start with "setAllInputs()"
b) Setting any "analogReference()" will lead to nothing - DAC ref seems to be always 3V3 (Vcc)?
Hopefully that will help others - and we can clarify that a little more into deep?
(After gaining more Karma, I will post some pics :)
BRs Klaus
Your answer
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
Keep Informed
About This Forum
This community is for professionals and enthusiasts of our products and services.
Read GuidelinesQuestion tools
Stats
Asked: 12/13/21, 12:51 AM |
Seen: 1264 times |
Last updated: 12/13/21, 2:51 AM |