You already have all these theories and now create a sketch and execute it in your Arduino UNO. Observe the result and then adjust your codes as needed.
Hi, @backflip
Can I suggest you stop over thinking and get a UNO and start programming.
That is basically the best way for you to answer your questions.
I can guarantee your coding will fail many times, do not be afraid to fail, fail and learn.
Put your mental strength into EXPERIMENTING with different techniques.
Build your project in stages, not all at once.
Tom..
Microchip bought Atmel a number of years ago. They have rebranded the documentation and possibly made some changes in it.
Thank you. I made a copy of that. I think I need to be able to find such information myself. Google helped me to find the same information on this link:
https://github.com/DarkSector/AVR/blob/master/asm/include/m328Pdef.inc
Is this website the right source to find such reference information?
Thank you. For a beginner it can be hard to learn the right terms to search for. This search provided a lot of useful information.
Thank you for this advise. I have found some information about this RA4M1 chip here:
https://www.renesas.com/us/en/document/mah/renesas-ra4m1-group-users-manual-hardware
I agree, that it is a much more powerful chip. It do also have more functions and this manual got 1454 pages. When I look the documentation of the 328P, it looks a bit like the microprocessor boards I made software for 35 years ago. So this is not that hard for me to get used to. Therefore I am a bit reluctant to start at the more advanced level with this R4. But perhaps I should start with the R4 later on, when I see the need for that. I do also see much more knowledge and descriptions on the internet about code for the 328p.
I know that more bits and speed by an AD-converter do not automatically mean higher quality in use. Noise on the signal is a very significant issue with AD-converters. Furthermore I estimate, that my requirements for the AD-converter is not that high.
Does this make sense for you?
This is about the 328P controller.
I have read, that the default value for the ADC clock prescaler is 128, and therefor you will have a clock frequency of 16 MHz/128= 125 kHz. According to some sources, you can increase this ADC clock frequency to 1 MHz without adding that much noise to the signal.
I have tried to look for reported measurement data to reveal a change in noise by changing this clock frequency, but I have not found that. Do you know about that?
I did not find a procedure to change this clock frequency, but I guess you will make sure, that no conversion is in progress before you change this frequency, and then you want to keep the other values in the ADC Control and Status Register A and change the prescaler value as you want. I made a copy from the hardware doc here:
Is this the way to do it, or should you look for some predefined global symbols in play here, that you should honor?
Check out
Accuracy with various prescalers
here:
At the link below, under the section heading "Accuracy with various prescalers" there is a crude test of the ADC performance with different pre-scale values.
The take-away is that the ADC works pretty well up to a pre-scale value of 16, an 8x speed up over the "normal" value of 128, and then degrades significantly.
Thanks. Yes - it do. I am still learning C++ and this 0X seems to mean that the following is a HEX byte value. & and | is boolean byte operators for AND and OR.
Thanks. I finally got an Arduino Nano, and I have made the first small test programs running. I have possibly got an older Nano, because I had to spend some time to be able to upload programs to it. In the IDE, I had to set the Processor to "ATmega328P (Old Bootloader)". The default Processor was "ATmega328P".
I noticed, that an electrolytic capacitor to the 5 V supply near the Arduino reduces the noise level of the analog input signal. At the moment the 5 V supply is via the USB cable.
Probably a clone
I got this error message, when I try this:
'ADSCRA' was not declared in this scope
Do I need to include some library, to make the compiler know these names?
Yes, you are right.
Loom at the part of the datasheet that you posted in post #34. The register is ADCSRA.
Thank you. Now it works.
I hope I made the prescaler code right.
I have tried to read a value at about 2.5 V. I see the value can change between 3 adjacent values. It is the same with a prescaler value of 128 and 16. I might have to try some more, to be sure that the prescaler did change.
I have now tried to set the prescaler at several values down to 2, that provide an ADC clock frequency of 8 MHz. When I do that, I cannot see any noise on the reading. However, a significant quantization error is there. At 8 MHz when I change the analog input voltage, the readings I see is changed in steps to some few preferred values.
Therefore it do become somewhat more difficult to evaluate the influence of changing the prescaler value. You need to try out a large amount of input values
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.