Thursday, May 28, 2015

Week 9 (In Lab) - Calculation Fixes

This week in lab, the team tried to test PlantParent's setting of 50 mL output, but faced the problem of a seemingly non-functioning prototype whenever any double-digit numbers were put into the application. The pump would run for much longer than 7 seconds (the approximate time necessary to reach 50 mL) and be unresponsive to the termination command.

At first, Davina thought that the program may not have been able to handle double-digit numbers, so she spent some time researching the particular function Serial.parseInt() for Arduino. Serial.parseInt(), however, is capable of handling multi-digit numbers, so it was clear that the problem lay elsewhere. 

Parm and Davina realized that there must be a simple calculation error when they tried entering 10 mL into the application and found that the program was responding correctly - the pump just remained on for longer than expected. At this point, the Arduino code was multiplying the integer it received from the controller by 637 milliseconds, since previous testing yielded a standard curve with equation y = 0.126x + 0.512 for seconds per mL, which yields 637 milliseconds for 1 mL. Davina made the mistake of multiplying by 637 outright, rather than multiplying by 126 (the "slope") and then adding 512 to the resultant figure. This difference is highlighted below:


vs.
The first calculation keeps the pump on for about 32 seconds; the second, for about 7.

On the mechanical side of things, the Arduino and relay were put into the cardboard box, which has been sprayed with chalkboard paint for waterproofing and a uniform black color. The configuration is shown in Figure 1 below.

Figure 1. Arduino and relay system inside electrical component box. All cords run out from the box through holes. 





Wednesday, May 27, 2015

Week 8 (Outside Lab) - Flow Rate Testing, Pt. II

At this meeting, the team continued to collect flow rate data and was able to create a standard curve for the end flow rate at one of the outputs. The team measured the time, in seconds, that was necessary for the output to reach volumes of 50 mL, 100 mL, 150 mL, 200 mL, and 250 mL, with three repeated trials for each. This data was put into Google Sheets and used to generate the standard curve shown in Figure 1. The curve is marked as "ideal" because the water level in the tank was kept relatively constant for all trials. The equation for the trendline is y = 0.126x + 0.512, with an R2 value of 0.98.

Figure 1. Ideal standard curve for the time required to reach specified output volumes of water.

Using the standard curve equation, it was calculated that it takes 0.637 seconds to output 1 mL, which translates to 637 milliseconds per mL. This is the number that will go into the Arduino code as the multiplier for how long the pump needs to stay on.

Friday, May 22, 2015

Week 8 (Outside Lab) - Flow Rate Testing

At this meeting, the team started to collect empirical data on the end flow rate of the water as it is pumped. They set up the apparatus without the Arduino and breadboard and PC in between, to make it easier to turn the pump on and off (through plugging and unplugging it, rather than controlling it with the desktop application). One of the two output tubes was directed into a Pyrex glass measuring cup, which has metric measuring lines. When the team was ready, one member plugged in the pump as another member started a timer, and another kept an eye on the water level inside the cup - this third member called out for the timer to stop once the water reached the desired volume.

This process was repeated about ten times, at different volumes (the raw data is shown in Figure 1). In one of the later trials (Trial 9, below), the team realized that the flow rate actually changes depending on how much water is in the water container; when the water is low, the pump outputs a lower flow rate. This is something that will be tested further at the next meeting.

Figure 1. First flow rate data collection

Thursday, May 21, 2015

Week 8 (In Lab) - Pump Modifications

In lab this week, Michelle and Le worked on modifying the pump, while Davina and Parm worked on further documentation of the project's progress, including updating the pages on this blog. The latter two also began to create the final presentation for the project.

Previously, the pump had exhibited unwanted behavior in that it continued to siphon water through the tubing while turned off. The team had conjectured that this was because stopping up one outlet and solely using the other had created a vacuum inside the pump: this meant that air pressure was sufficient to push the water through the whole pump apparatus. To remedy this, Michelle and Le tried several solutions:

  1. Insert tubing system into the previously stopped-up outlet, and keep a small tube in the other outlet for aeration purposes.
    • The tube was too smooth for hot glue to adhere correctly, so it had to be connected with electrical tape instead. This was an extremely weak and unstable connection.
    • This solution was unsuccessful. Water was forced through both outlets rather than just through the one intended.
  2. Put a cap on the water container to seal it off from the air, reducing air pressure on the water around the pump.
    • This was Parm's and Davina's idea, but a cap for the container was hard to come by - they were only able to find a large piece of cardboard in the lab.
    • This seemed like it wouldn't work, since several holes would have to be cut into the cardboard for the tubing and power cord, and this would let in the air anyway.
  3. Use the original design, except make sure the ends of the tubes remain above the level of the pump.
    • This was the simplest solution and the one that ended up working. It turned out that the problem was more related to gravity than to the presence of a vacuum. A diagram of the problem and solution can be seen in Figure 1. 
Figure 1. Diagram showing how position of tubing affects movement of water when pump is off.

Wednesday, May 20, 2015

Week 7 (Outside Lab) - Insulation & Electrical Box

The team used this time to complete insulation of the relay with electrical tape, which is shown in Figure 1.

Figure 1. Relay completely insulated with electrical tape. 
The team also began construction of the box that will house all electrical components. This is basically a small cardboard box with three holes in it for cords that need to connect to external components. The box used, unmodified, is shown in Figure 2.

Figure 2. Cardboard box to be used for electrical component housing.
On Side 1 (shown in Figure 3), there is one hole for the power cord to plug into the wall outlet. On Side 2 (also in Figure 3), there are two holes: one for the USB cord from the Arduino to a computer, and one for the power cord running to the pump and water container. All holes have a slit running from the hole to the top of the cardboard, which allows insertion of the cords without threading everything through the holes.

Figure 3. Sides 1 and 2 of box after holes and slits have been cut for power cords. 


Friday, May 15, 2015

Week 7 (Outside Lab) - Fixing Software & Modifications

During this time, the team was able to figure out the likely source of the coding error, and also encountered an unexpected mechanical problem with the pump. The details of each operation are laid out below:
  • To figure out what was going wrong, Davina hooked the Arduino back up to a simple LED circuit and used the LED as a visual indicator of code function. This works directly with the PlantParent control application because the application is functionally identical to an application that controls blink-time of an LED. Previously, some cursory tests with an LED had revealed that it behaved in accordance to the actual settings on the computer; this made no sense, because due to the electrical system's wiring error, the programming should have been set up to make the LED behave in reverse of the settings. 
    • The problem that Davina identified was that the on, off, and corresponding delay statements were mixed up and used the wrong integers sent from the computer application. This resulted in the on-times and off-times being switched. The error is highlighted in Figure 1 below. 
Figure 1. Mixup of on ("LOW") and off ("HIGH") statements in Arduino code, and subsequent solution.
    • This was also probably the source of the inability to terminate the program - which is what had been happening. Since the termination command simply breaks the on-off loop, the program reverts back to the first setting of the output pin. While it was mixed up, the first setting was on, so clicking "Cancel" made the pump run indefinitely instead of turning it off. 
    • There had also been a mix-up of the variable names in the Qt application, which Davina had fixed on Wednesday, but had previously been compensating for the error above. This was something like a triple-negative sort of logic that got reduced to a double-negative, and is now down to one negative as it should be. 
  • The team found that while at least partially immersed in water, the pump would continue to deliver water through the plastic tubing even when unplugged. This was very confusing at first, but eventually Michelle realized that in blocking one hole and using the other as the single output, the team had essentially created a vacuum inside the pump, which allowed the water to flow through without any mechanical impetus other than air pressure. 

Thursday, May 14, 2015

Week 7 (In Lab) - Soldering Relay System

Figure 1. Relay with soldered wires. Black tubing: hot wire on pump side. Yellow tubing: 5V input from Arduino. Green tubing: ground on Arduino. Uninsulated connection: hot wire on plug side.
In lab this week, the team was able to solder all wires directly to the relay, eliminating the need for alligator clips. This was advantageous to the project for two reasons: 1) soldering provides more secure connections all around (the team was having some trouble with electrical tape coming off and some connections coming undone), and 2) soldering decreases the overall system length by about two feet of cords, making it much easier to fit inside a single container. 

Three of the connections were partially insulated with heat shrink tubing. Additional insulation with electrical tape (as well as complete insulation for the fourth connection) is needed. The lack of heat shrink tubing on the fourth connection was not intentional and should not be purposely replicated if this project were to be repeated. Figure 1 shows the relay with all soldered wires.