- Have the design, including shapes and dimensions.
- Have the correct gear train.
- Started attaching the servo.
Here is what this blog post encompasses:
- Connect the servo to the gear train.
- Writing the code.
- Constructing the wiring with Arduino, the sensor, and the servo.
- Building the supporting structure in SolidWork.
Since we were working on several things at the same time, it would be confusing to document things in a chronological order. I organized our process in this blog post to make it easier to understand. Bear in mind that not everything is in chronological order. This blog post is not intensively long in terms of text, because most of our time we spent on constructing structures, code writing, and other things that are pretty straight-forward. We also started creating our visual, but since we did not finish completely and have questions to ask Becky, this process will be recorded in future blog posts.
Servo
| Wired Servo |
![]() |
| Glued Servo |
![]() |
| Side view |
The Code
Now, the code really isn't the hardest thing to write. The basic idea is that we want the sensor to read data the whole day. Once it detects someone, it would start the program. After the first step, the sensor would re-detect, making sure that the person is still there, and continue the process. The servo will move a set amount of distance after a certain amount of time. Once the whole process is finished, it will rewind to the original position and start to sense people again. Here is the code.
There are a couple things to mention here. The number we used for value and for position are arbitrary numbers I put down as fillers. Ideally, the number in the while loops for value would be the reading for when someone is standing at the sink to wash hands. The position value should correspond to the number that would make the servo start at the first picture and end at the last. The direction may also reverse, since we are not completely sure which direction it goes yet. The amount of time each step takes is also not definite. We obtained the number by doubling the time that Meredith uses to VERY slowly wash her hands. In this code, we assumed that there were 8 steps in total.
The Arduino
Since our device only requires a sensor as an input and the servo motor as an output, we did not need extensive wiring. In fact, we used the smallest protoboard.
The wiring does seem a little confusing from afar, but it's actually very clear and simple. The whites connects to ports that delivers the command from the code to the devices or vice versa. The greens connects to power sources. The blues connect to ground.
The Supporting Structure
We want to make a box from Delrin to support the whole structure. Things we keep in mind while designing the structure include sturdiness, lightness, and accessibility. The gear train can be secured by two axles through the vertical walls of the Delrin, while the bottom will secure the vertical walls as well as electronic devices. We have considered a bottomless box for lightness, but it would decrease the sturdiness significantly. We also need to secure the servo motor nicely, so that when the motor moves, all of the motion should go toward the gear train, as opposed to moving itself around in the box. We thus used some foam core to find the right measurement.
We want to cut a slit through the front wall for the servo to be secured. This measurement was the most important, since it must be precise to motorize the output gears with the right amount of movement. We eventually decided on a slit that is 0.6 cm wide and 2cm above the hole for the axle.
As for securing, we decided that heat staking would be the best method for all connections, since it is permanent and steady. For our device, sturdiness is favored over reversibility. We also do not need smooth surface, since the device will be hung on a wall, not touching any surface. Here are our drawings in SolidWork.
![]() |
| Bottom. Note the missing corner is a mistake. We did not print a bottom with a missing corner. |
![]() |
| Side walls. The two walls have the same shape. |
Note that we actually use two walls to secure the gear train, because one wall would fail to hold the gear train due to the heavy front. We also wanted to put the electronic devices in between the two walls so that water would not affect them. The two walls will be exactly the same to ensure that everything fits correctly. We did not make the side because we wanted the battery box to be one side and have an open side on the other end for easy access, in case we need to change the code or the wiring. For lightness reason, we also chose the 1/8'' Delrin.
We also drew our indicator.
![]() |
| Rests on the chain. |
![]() |
| Indicate steps. |
The indicator is also secured by heat staking. It also serves as a test piece for the heat staking for walls and bottoms. We were able to print the indicator pieces out and to assemble them.
The length for heat staking is perfect. When we were testing the indicator on the chain, we realized that it would not stay perfectly still. We thus glued it to the chain to maintain precision.















No comments:
Post a Comment