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. 





No comments:

Post a Comment