I am currently using an Arduino NANO v3.0 to monitor temperatures in increments of 0.25 deg C with a Type K thermocouple. That is working well. I need to identify a 0.5 deg C stall in the temperature rise that lasts for 0.5 seconds or longer. Our current data input rate is 18 temperature samples per second. I am looking for 8 consecutive samples all within 0.5 seconds. I then want to freeze my 4 digit-7 segment display and activate a relay.
By example with temperatures Degree C:
70.00,70.50,71.25,71.25,71.50,71.25,71.50,71.50,71.25,71.50,72.00,72.50,72.75,73.25,74.00 74.75
After weeks of research, attempting to write a program ourselves, we still cannot locate or create a software program that will perform these two tasks. We can input and display the actual temperature easily. We, however, cannot use the input data to identify the temperature stall.
Is this possible on an Arduino NANO v3.0? Can you reference a source we can use to develop this program?
Yes, of course that is possible, with any Arduino.
Please post your best programming attempt (using code tags), explain what your program is supposed to do, and describe what went wrong, with real data examples.
Please read and follow the instructions in the "How to use this forum" post, at the head of every forum topic.
Here is my first idea to approach the problem. You will need a state variable and perhaps a sample counter. (See Arduino State Machine example).
Start a timer, set state to "not stalled"
Get a data point
Check for stall condition
If not stalled, reset timer, set state variable to "not stalled", back to 2.
If stall condition met and state is "stall", calculate elapsed time since timer start
If state is "stall" and 0.5 seconds has elapsed, take stall actions
if 0.5 seconds has not passed, set state to "stall", back to 2.