Dealing with Diabetes - Developing an Artificial Pancreas - Pump Help

Ask questions about projects relating to: aerodynamics or hydrodynamics, astronomy, chemistry, electricity, electronics, physics, or engineering

Moderators: kgudger, bfinio, MadelineB, Moderators

aliyahhhhhhhrrrrrr
Posts: 6
Joined: Mon Dec 04, 2023 10:40 am
Occupation: Student

Re: Dealing with Diabetes - Developing an Artificial Pancreas - Pump Help

Post by aliyahhhhhhhrrrrrr »

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.
bfinio
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

Post by bfinio »

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.
bfinio
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

Post by bfinio »

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.
aliyahhhhhhhrrrrrr
Posts: 6
Joined: Mon Dec 04, 2023 10:40 am
Occupation: Student

Re: Dealing with Diabetes - Developing an Artificial Pancreas - Pump Help

Post by aliyahhhhhhhrrrrrr »

I had taken the readings of my multimeter again, and got a more accurate reading. My numbers came from between 205 and 1023
aliyahhhhhhhrrrrrr
Posts: 6
Joined: Mon Dec 04, 2023 10:40 am
Occupation: Student

Re: Dealing with Diabetes - Developing an Artificial Pancreas - Pump Help

Post by aliyahhhhhhhrrrrrr »

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
bfinio
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

Post by bfinio »

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?
aliyahhhhhhhrrrrrr
Posts: 6
Joined: Mon Dec 04, 2023 10:40 am
Occupation: Student

Re: Dealing with Diabetes - Developing an Artificial Pancreas - Pump Help

Post by aliyahhhhhhhrrrrrr »

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?
bfinio
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

Post by bfinio »

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.
acuze104
Posts: 2
Joined: Sat Dec 30, 2023 3:09 pm
Occupation: Parent

Re: Dealing with Diabetes - Developing an Artificial Pancreas - Pump Help

Post by acuze104 »

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.
acuze104
Posts: 2
Joined: Sat Dec 30, 2023 3:09 pm
Occupation: Parent

Re: Dealing with Diabetes - Developing an Artificial Pancreas - Pump Help

Post by acuze104 »

Nevermind I got it. thanks
Locked

Return to “Grades 9-12: Physical Science”