bellahenkel / Soil-Sensing-Device

A Low-Cost Soil Sensing Project developed at Twin Cities Engineering, Minnesota State University, Mankato
BSD 3-Clause "New" or "Revised" License
3 stars 0 forks source link

Moved functions from example to src files #21

Closed aufdenkampe closed 7 months ago

aufdenkampe commented 8 months ago

Created an AlphasenseCO2 class within the src/co2_sensor.h and src/co2_sensor.cpp files, and added class methods by copying code from functions in the original example sketch.

I then revised the new example sketch (renamed to examples/getValuesCO2/getValuesCO2.ino) to construct an instance of the AlphasenseCO2 class and use it's two methods/functions.

It compiles, but I don't know if it works with a real sensor! @bellahenkel, try it out!

bellahenkel commented 8 months ago

@aufdenkampe After trying everything from getting a new usb-c cable to restarting my computer to trying to just download a simple sketch from Arduino IDE, I continued to get that same error over and over. And then suddenly, for a reason I cannot figure out, it's suddenly started to work again! I was able to run this sketch on the Mayfly and it is printing results correctly.

Screenshot 2023-11-10 at 11 57 12 AM

I am still unsure what was causing that connection error, nor what to do if it happens again, but for now I will consider this a successful test!

aufdenkampe commented 7 months ago

@bellahenkel, yay! I'm really glad you got it to work, and also really sorry that the fix was unexplainable. The results indeed look good!

Can you copy/paste those results into a csv and commit them to the repo, in the same folder as the example? We'll analyze those results to understand warm up and stabilization times. It would be useful to do the sketch from a cold start, where the sensor is at room temperature and has been fully powered off until the sketch starts.

aufdenkampe commented 7 months ago

@bellahenkel, thanks for that cold start data. A time plot looks very interesting. First, it tells us that the stabilization time is somewhere between 200 to 350 seconds. That's way less time than the manual states.

image

I wonder if it takes longer if the sensor is cold?

Second, zooming in shows that the variability is cyclic, with a period of 6 to 8 seconds. Could that be due to breathing nearby?

image

Could you see if putting the sensor in a plastic bag causes the signal to get smoother?

If we really wanted to see the effects of indoor air, you could filling a trashbag with outside air, then bringing it inside, slipping the sensor inside it (and tying it closed with a twist tie, string, or tap) and try another cold start measurement.

aufdenkampe commented 7 months ago

I think this is ready to merge with main!