Does anyone know of a way to handle sensor errors?
I've added a picture of the serial monitor.
Those erroneous readings going from 41.00 down to 2 are not actually occuring. It should just read 41.00. Temperature changes are gradual and slow for the thing I am measuring.
I have the sensor connected using I2C and I am using the Adafruit_BMP085 library. I am just using bmp.readTemperature() to get the temperature from the sensor, and then simple mean averaging 30 readings - nothing special.
One thing to note is that this had worked for some time, many months. Its just lately the readings are very erroneous as you can see. I wantes to introduce some code or some I2C error handling to ensure sensor readings are accurate.
Oops... warning: when multiple problems are observed, start looking for loose wiring, bad power, interference: cellphone nearby? Fluorescent lightning? Bad AC grounding, poor wall-wart.
30 readings for averaging seems an overkill. I usually use a rolling average of 10 (or less) values. For things you know will not change fast, you can compare raw with average and toss the value if too far off... be careful to implement a max time to toss!
Did you just find this problem after writing a mass of code?
If you wrote you code in stages, you should have a piece of code that JUST reads the 085 and puts the results on the IDE monitor.
If you haven't, then forget your master code for the present, and write some code, or use the library examples, to establish if you are communicating properly with the device.
This is called getting back to basics in troubleshooting and developing code in stages, each stage needing to work correctly before combining with other code stages.
Thanks.. Tom....
PS, For the moment do not cut your existing master code back, write fresh code for the 085.
If you're using modules as distinct from raw chips, don't the modules have pullups on them? If so, I think there's a chance that if they both have resistors, and you now have 2 sets in parallel, the resulting value is unsuitable.
Ive just disabled the temperature sensor, and just the rtc is doing weird stuff. I think the battery may just be dead or a bad module. I will replace and get back...
I think the rtc module might be hogging, or draghing down the scl sda lines, causing the bmp180 to loose connection and report 0 back or an error (not sure).