Introduction: Bug-Catching Spider in Web, Part 2

This project is a collaboration between  idesigner4 and bhasudha(me), students in the Fall
2012 course Things That Think (CSCI 7000) at The University of Colorado - Boulder.

The story of our bug-catching spider automaton goes like this: A giant evil spider resides
in a big web. One day an unfortunate lady bug gets trapped in the web and the scary
spider pounces on it.

We came up with the idea for this six-week project together and discussed implementation
possibilities at length, particularly with respect to moving the spider and detecting the bug.
For example, although we ended up using IR sensing for bug detection, we considered
several other possibilities including touch sensors and image processing. At that point, the
highly modular and reusable nature of the project components allowed us to build
separately, and we are posting our Instructable as a two-part series.

Part 1, described in this Instructable, shows how to build the following elements:
* The frame to which everything is attached
* The spider web and associated lighting
* The spider mover, which is an XY table beneath the web

Part 2  shows how to build the remaining elements:
* The bug detector
* The bug
* The spider


Readers who would like to build this project should be aware of the following limitations:
The XY table moves nicely under human power, but not with the servos, and we think this
outcome is a result of the materials not being sufficiently rigid. It's possible that adding
another servo to move the lower slider from both sides would be helpful, too. Here are
some alternative Instructables XY tables to try:
Low Cost Hobby Servo XY Table
Internet Arduino-Controlled T-Slot XY Table
DIY CNC Router

Our intent was to be able to display the web in any position, such as leaning against a wall.
For this reason, we used strong magnets on both the spider and the mover. Although this
idea worked well with models during pretesting, the final spider clings too tightly to the
web and doesn't move well. For this reason, we would recommend a different spider /
mover magnetic connection, as well as stronger servos to help overcome drag.

The spider's orientation is fixed. We had discussed using a rotating arm on the spider
mover, with the pivot point toward the front of the spider, but did not build it due to time
limitations. This arm would have allowed the spider to turn as it moved forward along an
arc traced out by the spider mover.

Step 1: Bug Sensing Mechanism

Here is a short video demonstrating how the bug sensing works. The overall mechanism is as follows:
The Arduino controller code interfaces with the IR grid and the motor. The IR grid identifies the position of the bug (the x,y coordinate) (as shown in the top right corner of the video). This X,Y coordinate is then passed to the controller which then decides how much to move the motor along X and Y to reach the bug. The controller code remembers its current position in the grid (current position of the spider) while calculating steps to move in X and Y. The motor and the IR grid are synchronized for timing, by the controller code.



Step 2: Materials Needed

Infrared grid - 10 x 10:
2 x Acrylic base (38 cm x 7 cm  3mm thick )
2 x Small Basswood (40 cm x 2.5 cm 1/8 inch thick)
2 x Big Basswood (38 cm x 8 cm  1/4inch thick)
4 x Solderless Breadboards (830 Tie Points. Board Size: 2.14" x 6.5". Around $7.99 each)
Variable length and colored Jumper wires (22 GA Solid Tinned Copper wire kit contains 4 colors. Around $13.51)
20 x 10K ohm Resistors(Available in packs of 5 or more)
1 x Mini Breadboard ( 170 tie points. Board Size 1.4" x 1.6". Around $3.99 )
20 x IR detectors(Also Known as Infrared Photo transistors Around $0.50 each for 10 plus units ordered)
1 x Arduino Mega (ATmega1280)
6 x wire connectors ( optional component. easy to identify the output wires)
6 x small  metal clips to hold acrylic to the frame

Bug:
1 x Printed circuit Board (417 holes. Around $2.49)
8 x IR Emitter ( pack of 25 costs around $7.95)
Red and Black variable length Jumper wires
Foam sheets(1/4 inch thick)
8 x 220 ohm Resistor (Available in pack of 5. Around $1.19)
Fabric paints ( colors of personal choice)
1 x Spring (Flexibility of the spring depends on the size of the bug)

Spider:
2 x Ball Magnets (1/4 inch diameter. Available in local hardware shop)
1 x rod magnet (any rod shaped . Example: magnetic construction kits)
Basswood ( 1/8 inch thickness)
Foam (1/4 inch thick. Used as a support inside the spider body)
4 x small disc magnets magnets (1/4 inch X 1/16inch neodymium disc magnets)
Thick metal wire (~18 Gauge. Strong enough to support spider legs)
Springs (choice of spring depends on the weight of the spider legs)
Black Pipe cleaners (pack of 25 around $1.19)
Decorative fabric ( Any decorative fabric that appeals to individual aesthetic preference)
2 x  blue beads for eyes ( Any color that feels good to our imagination)


Machines & Tools:
Laser cutter
Devcon weld it - All purpose glue
Wire snipper
Cellophane Tapes
Soldering kit
Snap knife to cut foam
Drill

Step 3: Prototyping

The construction of IR grid is really simple once we have identified the right components.

It is important to experiment with a variety of IR detectors and emitters based on the range required. Factors to consider when choosing IR Detectors:
    1) Testing for Range  - The IR emitter can be placed at increasing distances to test the range. It is observed that matched pairs of IR detectors and emitters are less effective in terms of range when compared to detectors bought alone.
    2) Viewing angle and line of sight - Some of the emitters have very narrow beam and so getting the line of sight becomes really difficult. We may never know if the range was lost or if the line of sight was lost when testing the detectors. Having wide beam emitters and detectors with good view angle will help this situation.


Some tips that we gathered and/or observed:
    1) If powered from Arduino the detectors are good in terms of range.
    2) Also if resistance is reduced, the emitter is powerful.
    3) For continuous use of IR emitters Pulse Width Modulated emission ( intermittent powerful emission of Infra red instead of continuous emission) should be considered. A heat sink to collect the heat dissipated will also help when using continuous emission.

Prototyping:
- A single emitter and two detectors are used.
- The basic emitter and detector circuits are shown in the pictures below.
- To test two detectors,  the detector circuit should be repeated twice.
- 10K ohm resistor for the detector circuit and a 220 ohm resistor for the emitter circuit are used.
- The circuit is powered from Arduino.
- The Arduino code can be used for prototype testing.
- Using a cellophane tape to mark a straight line in a cardboard to test line of sight comes in really handy.
- Once satisfied with the range, we can be assured that everything works well. Constructing the real IR grid is just few steps away.

Step 4: Building the IR Grid


Construction of the IR grid:
- IR Emitters and Detectors require almost accurate line of sight to work properly.
- The IR detectors should be equally spaced. We had ~ 3.5cm gap between each detector.
- The detectors are mounted in a straight line. We used a laser cutter to drill 3mm holes, horizontally aligned, each 3.5 cm apart in a 0.25 inch basswood. The detectors were plugged into the holes to ensure uniform height of the sensors from the web surface.
- The smaller basswood with holes for detectors is glued to the edge of an acrylic base.
- The breadboard is placed vertically on the acrylic base.
- The bigger basswood contains approximate holes to allow the output wires from each sensor to connect to the Arduino. It also supports the breadboard to stay in place.
- A 10K ohm resistor is used as part of each detector circuit.
- A 220 ohm resistor is used as part of each emitter circuit.
- The IR grid is powered from Arduino.
- The basic IR detector circuit is repeated 10 times across each Axis - X and Y
- Each detector's output pin is connected to one of the Arduino's digital pins to read the value of the sensor
- All breadboards should be connected with the ground and power source.
- A mini breadboard is used to distribute the ground and power connections from Arduino to the breadboards and the bug.
- The small metal clips are screwed to the frame on one and clamp the acrylic base in the other end to hold it in place.
- The Arduino code attached here is the one used by the IR grid. The Arduino code is uploaded as 4 parts as .png. The microcontroller polls the sensors for every 3 seconds to see if there is any emitter in the 10 x 10 area. If there is any positive signal, it is displayed in the screen.

Step 5: Designing the Bug

Our bug is designed as a sassy lady bug :). The bug design plays a critical role in the whole sensing mechanism since the bug has the IR emitters in it. We chose to arrange 4 emitters in a square form as close as possible to each other. This ensured very less probability of missing the line of sight. At least one of the 4 emitters could be detected by a sensor.

1) The basic emitter circuit is repeated 4 times in each soldered piece.
2) The soldered piece should be placed at 90 degrees so that each one faces one of the two axis. The wings of the lady bug carried the emitters.
3) Feel free to let your imagination run wild, depending on how you design your bug!! 
4) The bug is made out of foam completely.
5) The body of the bug is placed on a spring to give a nice wiggling motion to simulate the effect of being caught in the web.

Step 6: Making the Spider

1) The spider is made of laser cut pieces of a 0.25 inch thick basswood.
2) It has a magnetic base that can hold on to the magnets beneath the web.
3) The dimensions of the spider are elaborated on the pictures.
4) But there is no restriction on the size of the spider as long as the magnets on the spider and below the web hold strong to each    other and also have less friction with the acrylic web. 
5) To avoid friction we used a cloth to wrap the tiny magnets. This also reduced scratching the acrylic web to a large extent.
6) Glue the magnets onto the wooden base in order to avoid repulsion or attraction of unnecessary parts.
7) The spider is designed to have small thick metal wires emerging out in the positions of its legs.


Legs of the spider:
1) The legs of the spider are removable.
2) The legs are clamped on to the protruding thick metal wires using tiny rubber washers.
3) The legs are made of springs attached to thick metal wires using pipe cleaners.
4) The pipe cleaners tape the edges of the spring to the metal wires.
5) Also the pipe cleaners are wrapped around to decorate the entire leg to give a hairy look.
6) Springs are used in both the joints in a leg to give a nice wiggling effect.

Other aesthetics:
1) A black cotton fabric is glued on top of the basswood.
2) Two big blue beads gives an evil look to the eyes of the spider.

Step 7: Ideas for Extension

Things we could not get to, due to dearth of time. 

1) Moving Bug 
     The bug sensing mechanism can be reused anywhere to detect any object in an XY Grid. It can also be used to detect movement of the bug by changing the Arduino code to detect specific patterns in the adjacent sensors. A cool extension would be to have the bug also move around the web and have the spider chase it around. 

2) Spider movement:
     We wanted to simulate the movement of the spider more realistically. We did consider other designs like wheels attached to the back of the spider instead of magnets while retaining the magnets on the head of the spider. The rotary motion of the wheels could be used to rotate a cam shaft that will drive the legs of the spider in the appropriate direction.

3) Make it more fun
     To add more fun, We wanted to have the spider shoot a web on the bug once it reaches the bug's location. The bug could also be made to react with sounds, once it gets caught. 


Instructables Design Competition

Participated in the
Instructables Design Competition