Hi
I want to do a modification of the project below by adding a glycogen path as well -
https://www.sciencebuddies.org/science- ... l-pancreas
Meaning, controlling 2 motors. When the voltage is lower than a certain threshold (meaning glucose is less) activate the glycogen path and when the voltage is higher than a certain threshold activate the insulin path.
How can the circuit be modified to do this? Can you please help?
Thanks
Achyutan
Artificial Pancreas
Moderators: AmyCowen, kgudger, bfinio, MadelineB, Moderators
Re: Artificial Pancreas
Hello!
The circuit modification may be a bit difficult, but you should be able to essentially copy the setup of the first motor with a different pin (instead of pin 11). The code should be relatively easy. You just need to copy
if(conductivity>threshold){
analogWrite(pumpPin,pumpSpeed); // turn pump on if threshold has not been reached yet
}
else{
digitalWrite(pumpPin,LOW); // turn pump off if threshold has been reached
}
and modify it to be conductivity > threshold, along with replacing pumpPin with your new pumps pin number. Make sure to place it within the void loop().
Good Luck!
The circuit modification may be a bit difficult, but you should be able to essentially copy the setup of the first motor with a different pin (instead of pin 11). The code should be relatively easy. You just need to copy
if(conductivity>threshold){
analogWrite(pumpPin,pumpSpeed); // turn pump on if threshold has not been reached yet
}
else{
digitalWrite(pumpPin,LOW); // turn pump off if threshold has been reached
}
and modify it to be conductivity > threshold, along with replacing pumpPin with your new pumps pin number. Make sure to place it within the void loop().
Good Luck!
-
- 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: Artificial Pancreas
Hi - adding to bth80's comment - the circuit modification is fortunately not that complicated. You just need to duplicate the MOSFET connection to the second pump. See Figure 6 in the project procedure. The MOSFET has 3 pins - going from left to right when facing the MOSFET (so bottom to top in the diagram, since it's rotated 90 degrees): the gate, drain, and source. The gate is connected to an Arduino pin for control, the drain is connected to the pump's negative wire, and the source is connected to ground. So you just need another MOSFET, with the gate connected to a different Arduino pin, the drain connected to the second pump's negative wire, and the source connected to ground. The second pump's positive wire also goes to 5V. In general, it's not a great idea to try and power multiple motors/pumps directly from the Arduino - you should use an external battery pack for that. However, when working properly the modified code should only ever turn on one motor at a time, so it should be OK.