Artificial Pancreas Model issue

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

Moderators: kgudger, bfinio, MadelineB, Moderators

Post Reply
NirJal1222
Posts: 4
Joined: Mon May 19, 2025 6:39 am
Occupation: Student

Artificial Pancreas Model issue

Post by NirJal1222 »

Hi,

I built the project for a school science fair. It turns on and off properly. However,
I am having two issues with the project.

1. The serial monitor tool shows a different value than the multimeter when the sensors are connected. It generally has a higher value.

2. The voltage on the multimeter drops the instant the pump is disconnected. For example, it will read 1.15 volts while connected and running, and will drop to 0.95 when pump is disconnected.

I appreciate any help. I am barely a novice with Arduino.

Thank you
bfinio
Expert
Posts: 964
Joined: Mon Aug 12, 2013 2:41 pm
Occupation: Lead Staff Scientist, Science Buddies
Project Question: Expert
Project Due Date: n/a
Project Status: Not applicable

Re: Artificial Pancreas Model issue

Post by bfinio »

Hi,

1. The serial monitor is not printing out the voltage, which is why those numbers don't match. The Arduino uses something called an analog to digital converter (ADC) to convert a real-world "analog" voltage (the voltage you measure with your multimeter, which will have a range of roughly 0 to 5 volts) to a "digital" number that you can use in a computer program. However, that digital number does not have a range of 0-5, it has a range of 0-1023 (0 corresponding to 0 volts, 1023 corresponding to 5 volts). To convert the ADC reading to voltage you would use the equation:

Voltage = 5 x ADC reading / 1023

And that should more closely match what you're seeing on your multimeter.

2. The pump draws a lot of power when it is on and this can cause other voltages in the circuit to fluctuate a bit. If the code is behaving as expected otherwise you do not need to worry about it too much. One way to improve this would be to use external power for the pump instead of powering it directly from the Arduino. We cover how to do that in this video: https://youtu.be/To3DKP99-1U?si=Ix9Vw_qFpXHqgb4f

3. This is a somewhat advanced project, if you are totally new to using Arduino we recommend doing the first few tutorials on our How to Use an Arduino page: https://www.sciencebuddies.org/science- ... an-arduino

Hope that helps!
NirJal1222
Posts: 4
Joined: Mon May 19, 2025 6:39 am
Occupation: Student

Re: Artificial Pancreas Model issue

Post by NirJal1222 »

Hello,

Thank you for answering quickly with help. I appreciate it. I will do what you advised me. I do have one more issue I would like help with. The pump turns on and it turns off once the threshold is met. However, when I add more distilled water to simulate increasing blood sugar level as shown in your video, the pump does not restart. The readings do the opposite. It drops instead of rise with the addition of the distilled water.

Thank you.
bfinio
Expert
Posts: 964
Joined: Mon Aug 12, 2013 2:41 pm
Occupation: Lead Staff Scientist, Science Buddies
Project Question: Expert
Project Due Date: n/a
Project Status: Not applicable

Re: Artificial Pancreas Model issue

Post by bfinio »

Hi - have you tried pouring slowly and stirring as you add the distilled water? Pouring the water in too quickly could disturb the conductivity sensor or cause the conducivity to be unevently distributed throughout the container of water, resulting in strange readings.
NirJal1222
Posts: 4
Joined: Mon May 19, 2025 6:39 am
Occupation: Student

Re: Artificial Pancreas Model issue

Post by NirJal1222 »

I haven't done it that way! I will try it now and update you. Thank you so much Dr.!


I also wanted to clarify in regards to serial write. It will give me readings in the 300s while the multimeter will give me a voltage reading equivalent in the 200s after the conversion.
bfinio
Expert
Posts: 964
Joined: Mon Aug 12, 2013 2:41 pm
Occupation: Lead Staff Scientist, Science Buddies
Project Question: Expert
Project Due Date: n/a
Project Status: Not applicable

Re: Artificial Pancreas Model issue

Post by bfinio »

Hi - this may again be related to power issues, since the pump draws a lot of power it can cause the Arduino's voltage to drop (it won't output exactly 5V) which can in turn affect the analog readings since they use the 5 volts as a reference. You can read about options to use a different (and potentially more stable) reference voltage here: https://docs.arduino.cc/language-refere ... Reference/ but that is overkill for this project. The code will turn the pump on/off based on the analogRead value, not what your multimeter says, so ultimately the serial print values are what you care about since they're what you'll use to set the on/off threshold. If they don't match the multimeter values correctly even after conversion that is OK.
NirJal1222
Posts: 4
Joined: Mon May 19, 2025 6:39 am
Occupation: Student

Re: Artificial Pancreas Model issue

Post by NirJal1222 »

You're the best!!!! Thank you so much!!!!
Post Reply

Return to “Grades 9-12: Physical Science”