Hi!
I have tested the following code in Arduino Nano and I found its working like a beast. Then I uploaded the same code to Atmega328P PU using "Upload Using Programmer" command and Arduino Uno.
All was working fine in standalone atmega328P except it unable read around 0-62 ohm (0- 0.031 volt).
Standalone Atmega328P treat 62 ohm (0.031 volt) as nothing.
If I continue increasing from 62 ohm to 10K ohm then it start to read from 0 to 1023.
Please note that, checkPot and potValue are global variable.
Things that I'm aware of:
100 nF capacitor with A0 pin.
Several filter capacitor for stabilizing also very close to vcc.
Double reading A0 pin value in a row and using last one.
I'm afraid that the problem is with the bootloader but ignore it because it's just an imagination of my little brain.
I have developed full code and edited and tried hard for freeing from bug and lastly I am satisfied and lastly this is happening with standalone micro-controller.
Now I really need your help badly to rescue myself.
gilshultz:
I see no bypass or bulk capacitance on your schematic, is it possible you forgot to add them?
Hi,
Thanks for your time & consideration.
I just come to know after your concern about bypass or bulk capacitor. I hope I'll use it and will post update here about it.
As I mentioned in post, the same code and diagram worked for me with Arduino Nano, I think it should also work in standalone circuit too, but you know its not.
I just want to know to rectify my diagram or code.
Thanks
And sadly, the issue was not solved.
Initially, I burned the bootloader of (standalone) atmega328p MC using official Arduino IDE Version 1.8.13
Do you think that, it is a problem from bootloader?
If so what differences do I need to change in hardware/software or both?