Dealing with Diabetes - Developing an Artificial Pancreas - Pump Help
Moderators: kgudger, bfinio, MadelineB, Moderators
-
- Posts: 6
- Joined: Mon Dec 04, 2023 10:40 am
- Occupation: Student
Re: Dealing with Diabetes - Developing an Artificial Pancreas - Pump Help
When I put the original code, I only see random numbers come up. Its usually just random numbers that start with the digit 3. The numbers never reach the threshold. I can send you a picture of what I see if you need it.
-
- Expert
- Posts: 761
- Joined: Mon Aug 12, 2013 2:41 pm
- Occupation: Science Buddies Staff
- Project Question: Expert
- Project Due Date: n/a
- Project Status: Not applicable
Re: Dealing with Diabetes - Developing an Artificial Pancreas - Pump Help
Ok - we've established that your pump is wired properly and the serial monitor is working. If you are seeing "random" numbers then that indicates that something may be wrong with how your sensor is set up. If you are seeing three-digit numbers that start with 3, meaning the values are all in the 300's, and your threshold value is set to 923, then the pump will never turn on, since 300 is less than 923.
How did you arrive at the threshold value of 923? What minimum and maximum values did you get earlier in the procedure during the calibration process for steps 5 and 6? The threshold value you choose should be in between those two values.
How did you arrive at the threshold value of 923? What minimum and maximum values did you get earlier in the procedure during the calibration process for steps 5 and 6? The threshold value you choose should be in between those two values.
-
- Expert
- Posts: 761
- Joined: Mon Aug 12, 2013 2:41 pm
- Occupation: Science Buddies Staff
- Project Question: Expert
- Project Due Date: n/a
- Project Status: Not applicable
Re: Dealing with Diabetes - Developing an Artificial Pancreas - Pump Help
Also, I think we need to clarify an important misconception based on your comment "The numbers never reach the threshold." The sensor reading should start high and go down, not the other way around. Meaning, it should start out ABOVE the threshold value you choose, and then according to the if statement if(conductivity>threshold), the pump will turn on from the command analogWrite(pumpPin,pumpSpeed). Once the sensor reading drops below the threshold, then condition in the if statement is no longer true, so the else part of the if/else statement will execute instead, turning the pump off with the digitalWrite(pumpPin,LOW) command.
-
- Posts: 6
- Joined: Mon Dec 04, 2023 10:40 am
- Occupation: Student
Re: Dealing with Diabetes - Developing an Artificial Pancreas - Pump Help
I had taken the readings of my multimeter again, and got a more accurate reading. My numbers came from between 205 and 1023
-
- Posts: 6
- Joined: Mon Dec 04, 2023 10:40 am
- Occupation: Student
Re: Dealing with Diabetes - Developing an Artificial Pancreas - Pump Help
The serial moniter is showing numbers that are lower than my threshold, and the pump never stops. My biggest concern is gathering all the data, since my project is due tomorrow
-
- Expert
- Posts: 761
- Joined: Mon Aug 12, 2013 2:41 pm
- Occupation: Science Buddies Staff
- Project Question: Expert
- Project Due Date: n/a
- Project Status: Not applicable
Re: Dealing with Diabetes - Developing an Artificial Pancreas - Pump Help
Hi,
I did not see your post until this morning, so I am not sure if it will be too late if your project is due today. As a last resort, if you cannot get automatic control working for the pump, you could control the pump manually by watching the value on the serial monitor and disconnecting one of the pump's alligator clips when it reaches your threshold.
To clarify about the pump never stopping, you have re-uploaded the original code where the if/else statement is NOT commented out, correct?
I did not see your post until this morning, so I am not sure if it will be too late if your project is due today. As a last resort, if you cannot get automatic control working for the pump, you could control the pump manually by watching the value on the serial monitor and disconnecting one of the pump's alligator clips when it reaches your threshold.
To clarify about the pump never stopping, you have re-uploaded the original code where the if/else statement is NOT commented out, correct?
-
- Posts: 6
- Joined: Mon Dec 04, 2023 10:40 am
- Occupation: Student
Re: Dealing with Diabetes - Developing an Artificial Pancreas - Pump Help
Yes, I had uploaded the original code with the If/Else not commented out. Even if I stop it manually, how would I record my data? Wouldn't that mean that the project had failed?
-
- Expert
- Posts: 761
- Joined: Mon Aug 12, 2013 2:41 pm
- Occupation: Science Buddies Staff
- Project Question: Expert
- Project Due Date: n/a
- Project Status: Not applicable
Re: Dealing with Diabetes - Developing an Artificial Pancreas - Pump Help
This is a bit of a workaround, but you could either set up your phone to take a video of your computer screen, or use a screen recorder program, and take a video of the serial monitor. You could then play the video back to extract SOME of the data (time stamps and sensor readings) and graph them. It would be difficult to get every single data point, but you could get enough to make a graph.
Going back to the beginning of our discussion a bit, do you have prior experience with an Arduino or is this your first Arduino project? Either way, did you follow any of our intro to Arduino tutorials before trying this project? Information like this helps us make our resources better for our users.
Going back to the beginning of our discussion a bit, do you have prior experience with an Arduino or is this your first Arduino project? Either way, did you follow any of our intro to Arduino tutorials before trying this project? Information like this helps us make our resources better for our users.
Re: Dealing with Diabetes - Developing an Artificial Pancreas - Pump Help
Hi I'm having an issue with the code that you provided where the pump is always running. My pump is not running at all. I've attached a picture of my board and arduino.
I've also included the different mosfets I purchased thinking that it was the issue.
I've also included the different mosfets I purchased thinking that it was the issue.
Re: Dealing with Diabetes - Developing an Artificial Pancreas - Pump Help
Nevermind I got it. thanks