Midterm Part 2
Installation: Everything else
Last week’s post detailed how we started the construction for our spooky Halloween installation. This week we proceeded to install the motors, test the programming, and finish our project. We had two HS-311 motors, which we tested loosely against the cloth and it didn’t seem to have much strength. We ordered two stronger ones (ref. DS3218) in case we needed more torque. According to the Amazon reviews, these were much stronger and resilient, being used primarily for RC cars.
Now came the fun part: How would we attach the motors with the props on to the frame? It was impossible to test the motors without having them installed: we needed to test how much force they could apply against our leather canvas. We tried several positions for the head and the hands, until we found one we were satisfied with.
To print or not to print...
After several tests and placing blocks of wood against the frame and attaching the motors in a variety of different ways (glue gun, tape, zip ties, you name it), we came upon a problem. David Rios made us realize that unless the motors were firmly installed against the frame they wouldn’t we able to produce the full force we needed.
After a while of scratching our heads and looking into different DIY ways of setting the motors correctly, Jake Sherwood suggested we should look for a 3D printed solution. Blessed be Jake Sherwood. I immediately came across a free 3D model I could print right away. (model .stl file here). Even better, it worked with both of my servos without any modification.
It took us about 7 hours to print three servo brackets in a Ultimaker 2+ available on the ITP floor. After printing there was residue, so we had to sand them down and use a motor tool to open the holes where we would tie the servo motors.
3D printed brackets for motors
Installing the elements into the frame
Motors and props
With the brackets printed, we could now attach them to our frame. Since we needed the hands and skull to be more centered, we used pieces of scrap wood to locate the motor brackets closer to the center of the canvas.
Once we were pleased with everything we proceeded with hammering and gluing down the parts, taking into account the distance to the arduino, the ultrasound sensor, and other elements.
Installing this sensor was the most time-consuming element of the whole project. This sensor brought us a lot of trouble, it’s distance detection was difficult to regulate. After listening to several people, it seems as if this low-cost sensor is not precise nor easy to work with.
In any case, we soldered some cables on to each pin to be able to extend it’s reach. Now we had to choose where to install it so it would achieve it’s purpose: detecting to people so we could scare the shit out of them. I’ll talk about the programming ahead.
For the sensor to work correctly it needs to have both beacons uncovered. In other words, there was no way we could get away with hooking it up to the backframe. If we installed the sensor on the top pf the frame we would miss shorter people, or we would have to locate the frame closer to the ground. Neither idea was appealing.
We decided to install our spooky frame on a table , with out sensor installed on the front underside side of the table, with a black cloth covering the wiring below the tabletop. This allowed the sensor to detect objects directly in front of it, about 4 ft. off the ground, making our skull lash out only when someone is in passing right in front of the table.
Coding the terror
The schematic for this project is simple. On one side we have The Arduino connected through USB to a computer. It’s digital pins 11 and 12 are for the trig and echo pins of the ultrasound sensor. It’s digital pins 2,3 and 4 are for controlling each of the servos.
The Arduino, sensor, and motors all share a common ground. The servos however are connected to an independent 5V power source.
As I said previously, we assigned the variables for each of the used arduino pins. We also determined which motor would control which prop. We made several tests with a potentiometer to manually detect which was the initial and final position for each motor in each prop. We found that a 60 degree change between each position achieved the desired effect. In the initial position, you would not be able to see anything pressing against the canvas. In the final position, the props would be totally pressed against the canvas.
While fiddling around with the sensor we found a couple of functions which were useful to debug the distance in centimeters and inches (functions found here).
We established several states determined by the distance detected by the sensor. If the sensor detected anything closer than 25 inches, it would activate state 1. If the detection occured between 25 in and 50 in, state 2 would activate. State 3 would activate if anything was detected farther than that. The closer you get, the faster the motors would move the props against the canvas.
Thanks for reading!