Analogue refresh rate for pressure sensor

Hello,

Can anyone advise please?
I’m making a device that measures pressure in PSI on analog pin, with a different device counting on a digital pin.

I’ve connected up a pressure sensor (5v with a signal wire, advertised at 0.5v-4.5v output on a scale of 0-200 PSI. I’ve connected up to an analogue pin, analog read, then mapped to the range, but whilst using debugger the watch node doesn’t change much if at all. It also throws up some funky signs in the serial box.

The other odd thing is that the debugger works great for the counter on a digital pin, but this stops when the analog pin is used.

I’m just unsure if this is an analog refresh rate issue, or a quirk of the debugger? Or am I asking too much of the genuine Arduino uno?

Thanks everyone, hope your all keeping safe!

I think that your mapping may be wrong. The analog-sensor outputs values in the range 0.0 to 1.0, so you first need to map analog-sensor output to voltage, before you can map voltage to PSI:
Screenshot 2020-06-11 at 14.30.47

This can of course be shortened to:
Screenshot 2020-06-11 at 14.31.09

1 Like

Thanks very much @wayland, definitely more responsive now! I did put a lot of thought into that map believe it or not, certainly learning lots.
Debugger still seems slow, but with a new screen on the way hopefully it’ll project nice. Perfect timing for the new graphics library too.
Thanks again, will let you know how the screen works out.

I got the screen and it outputs great, quite accurate!
Thanks again,

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.