I am using an Arduino Giga, and I wasn't sure whether this should go on the Giga section of the forum or this one, but I figured that I was playing with setting up sensors and this deals with sensor values.
I am working on coding my Arduino, and I am going to be using a 5 PSI pressure sensor. It runs from 0 PSI at 0.5 V to 5 PSI at 4.5 V. I am planning to use a logic level converter to drop this down to 3.3V for the Giga to read.
I was playing around to see how long it will take the Giga to run a float calculation using an equation (if you're wondering, it came out to anywhere from 22–211 microseconds, though I would estimate most came back around 50 microseconds, and I am appreciating the faster processor so that it doesn't take milliseconds), and I was using an empty pin because I will be using a pin to read sensor data anyways, using 102.3 as the low and 920.7 as the high. For kicks, I printed the output of the calculation, and I got a value other than 0.
I was also playing around with setting up the USB as a mass storage device, and one of the tutorials that I found is a data logger and it does an analogue read of an analogue pin. I was also playing around with using the WiFi to set the internal time and create file names using another set of code. I didn't think much of it at the time, but I didn't delete the logs and ended up with 900 data points.
When the data logging first started for each log, the value for the empty pin initially read an average of ~142 (range 139–148), then dropped to an average of ~89 (range 83–95) for the second read, and then to an average of ~65 (range 63–73) for the subsequent reads. The data logger code reads the value of the pin every 10 milliseconds, and it doesn't use pinMode to identify the pin as an input. These frequent reads are about 2/3 of the value that I was expecting.
I increased the read intervals to 100 milliseconds, I am now getting a value of between 1–3 from my conversion equation (the 1 is not unexpected, as I have a round() function as part of the equation), so I am wondering if my analogue minimum value is still slightly off.
This might just be the margin for error in the calculations, but does anybody have any ideas about what is going on here?
The formula is part of my research, so I don't want to share it just yet.I am more interested in knowing what is going on with the analogRead() values being this low and if I should be concerned than I am about whether or not I am doing the math right.
18 posts - 5 participants