Does Firmware 0.4.6 have issues with analogRead?

Does Firmware 0.4.6 have issues with analogRead?

Doesn’t matter if I am using Tinker or my own software, everything I try with AnalogRead does not seem to work (A0, A1, A2, A3, A4, A5. Tried several Photons with firmware 0.4.6. I have also tried INPUT, INPUT_PULLUP, INPUT_PULLDOWN). I get one good (above 2000) reading and then everything is around 320, which I assume is just noise.

I have tried lots of different arrangements from voltage dividers, to direct 3V3 connections. I am sure these things worked fine a few weeks ago. Am I doing something wrong (highly likely), or does 0.4.6 have a strange bug that effects the analogRead?

My Photon Software is at http://rocksetta.com

It’s not impossible that there’s a bug. To my knowledge, no changes happened in the GPIO code, yet I’m seeing reports of DAC pins working differently with analogWrite, so potentially analogRead is affected too.

One way to know for sure is to downgrade your firmware by downloading from github releases and flashing with particle CLI.
Then recompile your app in the WebIDE against 0.4.5 and see if the behavior is still the same.

Although that sounds like a lot of fun :grin: , perhaps someone else with a 0.4.6 firmware photon could just check analogRead at A0 or A1 and see if it is working fine for them (even low-0 and high-4096 is better than I am getting). If it works fine for them, then I have screwed up, if not then I can stop bashing my head against the computer screen and wait for an upgrade.

@rocksetta I have an application on Photon with firmware 0.4.6 which does analogRead at A0, A1 & A2. All three pins are connected to soil moisture sensors. I have not seen any problems with the analogRead so far.

Thanks. I thought it was working when I used the Grove photon starter kit. I will try to find out what I have messed up.

Have you checked your supply?
Noisy DC has been causing multiple troubles for other members.
You could try direcly off a USB port if your circuitry doesn’t need more than 500mA otherwise try a well filtered USB supply or - even better - a lab bench supply.

@ScruffR @mdma @mhdevx

One of my students found out that the Tinker on the cloud main IDE page has the problem. As soon as I flash tinker from the Particle App then AnalogRead A0 works. Perhaps the Tinker that is set for the main cloud IDE page could be updated.

The issue is described here

The correct Tinker is located here

Since my software on github (https://github.com/hpssjellis/spark-core-web-page-html-control) is based on the original Tinker. I now have to find out what is different for AnalogRead with the new version of Tinker.

Normally you set the pin mode, with a line of code like

pinMode(A0, INPUT_PULLDOWN);

So the big difference between the new Tinker and the old Tinker… Drum roll…

“YOU DON’T SET THE PINMODE???”

Weird but for analogRead my software now works as long as I do not set the pin Mode.

So the next problem is, what will happen if a pin is set to AnalogWrite and then you try to do an AnalogRead. Is there a way to unSet the PinMode??

That was a fun 10 hours!

Thanks for the heads up. We’ve updated the documentation and Web IDE version to match.

1 Like