Thursday, April 30, 2015

Final Project Phase 2, Sciborg

We completed a number of tasks this previous week. Our objectives were:

1.     To install a 40 tooth lego gear onto the servo motor
2.     To create an appropriate program and set up the feedback and control input method
3.     To set up a protoboard that connects servo, sensor, and Arduino
4.     To design the indicator component in Solidworks
5.     To design the box in Solidworks

We also ordered a battery holder and created the sciborg line-following proportional control program.

We began the week by revising our method of attaching the lego gear to the servo motor. Previously, we used piano wire. We decided that glue was a better option, as it did not inhibit the range of motion nor did it allow the lego to “wiggle” upon the rotating disk.


Next, we worked to:
1. create an Arduino program to move the indicator across the visual
2. design a box to hold the electronic components and keep the gear train and visual steady.

The Arduino program incorporates the servo program and uses the servo to move the indicator across the visual via the gear train. In the program, the servo is activated while the ultrasonic sensor reads certain values, and maps its position. Delays are added to the servo’s movements to give different waiting periods for specific steps to be fulfilled.
 
We began with a while loop: as long as no one is in front of the sink (ultrasonic sensor reading > 400), the sensor will keep sensing until the condition is fulfilled.

Our next while loop occurs when the ultrasonic sensor reads less than 400, not satisfying the previous while command. Now, the sensor reads a value and waits 5 seconds before reading it again. If the value is still less than 400, this means a person is most likely standing in front of the sink waiting for the program to begin instead of just passing by. This also provides the change to roll up sleeves.

As we have 8 steps to our hand washing process, we needed the servo to move seven times. Knowing that the range of the servo’s motion is limited to ~180 degrees, we chose 175 degrees of total rotation to make the math easier. Now, each step required the servo to turn 25 degrees. The result helped us to further refine the size of our visual. Each step will have a picture 1.75” wide.
With a rotation of 25 degrees for each step, our program was repetitive in nature. We structured every step to delay for a certain amount of time (specific to the step in question), rotated the servo 25 degrees in positive 1 degree increments and updated its position, with a delay of 15ms to keep the servo motor from moving too fast. The variable delays were decided upon by taking the time adults would take to complete the step and multiplying by 2.

The final steps included the servo returning to its original position of pos = 0 from pos = 175 with negative 1 degree increments. The position was updated, and the ultrasonic sensor reading was also reset.

We ordered a small protoboard to connect the circuit:



 We used the A0 and 9 output pins, as well as the 5V and ground terminals.










Our circuit and its electronic components

~

We had previously hoped to create a sub-system of feedback and control which would check to see if the water was turned off at certain points in the process. Due to time and feasibility, we decided to focus our attention on the ultrasonic sensor and viable program.

Alongside this program development, we also brainstormed how our box would look like. This box is intended to have a back, bottom, and front. In front of the front of the box, we will position our lego train and visual. One of the sides of the box will feature the battery pack for easy access, and both the front and back faces of the box will have holes to position the axles of the gear train and hold them steady. The electronic components will fill in the space between the front and back walls, with the exception of servo and the sensor. Servo will be dropped into position via a shaft to hold it in place with the first gear in the train. The ultrasonic sensor will rest beneath the visual.


Using our gear train and visual prototype as a model, we began to construct measurements integral to the box’s function. The axles about which the gears were fastened were 0.7cm in diameter, which helped us create the right sized holes in the delrin a correct distance apart.


We made this piece 4.3 inches high and 45 cm long, to provide enough space for the axle holes and enough length to exceed that of the visual. To this length, we added four small tabs. We then decided to use 1/8” thickness of Delrin. This caused our tabs to be .2” in height and 0.6cm in length. We measured the diameter of the heat-stake to be ~9cm, so we chose 0.6cm so the tab wouldn’t be incompatible with the machine.

To this front piece, we incorporated a 0.6cm channel directly above one of the axle holes. This allows us to lower the servo into place above the first gear in the gear train. The distance between the center of the axle and where the servo meets the Delrin was found to be .94.”


We decided that rather than create another Delrin part to form the back of the box, we would instead use the Solidworks design for the front for the back of the box as well. This decision allowed us to design the bottom of the box.

The bottom of the box features holes in positions and widths that exactly match that of the front/back piece. We plan to insert the 8 tabs into the 8 slots and heat-stake them.




We designed an indicator which deviated from our prototype. Originally, we were using foam core and used vertical cuts to hold the two parts (parallel and perpendicular) of the indicator together. We then thought about how Delrin has low friction, and that it would be more feasible to actually create a tab-in-slot form that we could then heat-stake.
  





We printed these parts out and heat-staked them.


To attach this indicator to the gear system, we glued the piece onto a single lego chain link, which we then incorporated into the entire chain on the gear train system.


Next, we will print out the visual, put the box and electronic components together, and try to get it working!

~~~

Finally, we rewrote our line-following bang-bang control code into one using proportional control

Bang-bang from before:

     

Here, we looked at the bang-bang control program and translated those values into the proportional control program in a form consistent with proportional control.

We used our values of -40 and 220 from the bang-bang control to set our gain for motor 1. By using the minimum and maximum values read by the sensor (540 and 620, respectively), we were able to write linear functions to determine this gain. For example, we started with 620K+B = 220; and 540K+B = -40. Eliminating B, 80K=260, and the gain factor was 3.25 for this motor. Going back to find B yielded 1795, which makes sense because the reading does not start with a value of 0 (why there is a y intercept).

For motor 2, our bang-bang program assigned it one of two values: -48.5 or 228.5. We followed the same process as above and found a gain of 3.4625 and a B value of 1641.25.

With our calculated gains and B values, we were able to assign motor 1 a proportional control method of "reading*3.25-1795" and motor 2 "reading*3.4625-1641.25."




2 comments:

  1. Hi,

    Your project looks like it's really coming along! Your codes were very well annotated, which made it easy to understand what each step was for. Keep up the good work!

    ReplyDelete
  2. I'm really impressed by how detailed your documentation is. It looks like you're very organized, which is important for a project of this length. Keep it up!

    ReplyDelete