Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Analog Input values are incredibly low on PICOW #609

Closed
tyeth opened this issue Jul 30, 2024 · 3 comments
Closed

Analog Input values are incredibly low on PICOW #609

tyeth opened this issue Jul 30, 2024 · 3 comments

Comments

@tyeth
Copy link
Contributor

tyeth commented Jul 30, 2024

A user reported to IO Support that their values for a 2.25v source on any analog input pin on the pico was minimal / unexpectedly small (0.3v).

Testing locally I see a value between 2 and 1023 being detected, and then scaled incorrectly. It returns 0.00 to 0.05.

Changing these lines to include setting a native resolution and scaleAnalogRead here appears to fix the issue (now 2 represents 0.006v and 1023 = 3.287v): src/components/analogIO/Wippersnapper_AnalogIO.cpp#L84

I added to this if block along with a load of logging in branch https://github.com/adafruit/Adafruit_Wippersnapper_Arduino/tree/analogIO-scaling-picow:

#if defined(ARDUINO_ARCH_SAMD)
  analogReadResolution(16);
  _nativeResolution = 12;
#elif defined(ARDUINO_ARCH_ESP32)
  scaleAnalogRead = true;
  _nativeResolution = 13;
#elif defined(ARDUINO_ARCH_RP2040)
  scaleAnalogRead = true;
  _nativeResolution = 10;
#else
  scaleAnalogRead = true;
  _nativeResolution = 10;
#endif

Tagging @brentru who has more of a grasp on this.

Also worth of note is the possibly related older issue #403

@tyeth
Copy link
Contributor Author

tyeth commented Jul 30, 2024

Added PR #610 to test the change

@brentru
Copy link
Member

brentru commented Aug 26, 2024

@tyeth another forum user is having issues with analog read on pico w - https://forums.adafruit.com/viewtopic.php?t=212531

@tyeth
Copy link
Contributor Author

tyeth commented Sep 18, 2024

Closing this as appears to have been solved and released. Feel free to reopen or create a new issue if this still affects you

@tyeth tyeth closed this as completed Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants