Here is the daylight demo of the completed project.  The fingers of the glove on my right hand control each of the spider legs.  In my left hand I have a set of switches to select sound effects and to raise or lower the spider in its gantry.


Here is a nighttime demo from Halloween night.


Here is an indoor video that more clearly shows how the data glove finger and wrist motions control the legs.


I started the project with design of the legs.  I modeled the leg parts in Google SketchUp and printed them with a 3D printer.  A 12V stepper motor is used to drive each of the three joints in each leg.  I prototyped a data-glove by taping resistive flex sensors onto a glove, with two flex sensors in each finger (one per knuckle) and a flex sensor at the wrist to control the spider hip joints.  I designed a custom leg control board around a Microchip 16LF15344 MCU to measure the analog voltages across the flex sensors and translate them into stepper motor positions and subsequently into the phase signals to the stepper motors.  The control board also accepts signals from limit switches that activate at each end of the range of motion of the joint.  The circuit design for the custom boards was created with KiCAD and the PCBs were manufactured by OshPark.
Testing the spider leg design


The body of the spider was modeled with Google Sketchup and printed with a 3D printer.

Google SketchUp design of the spider body.


Here is the assembled spider without its exoskeleton.

Assembled spider without exoskeleton


Once I had the leg prototypes working and the body built, I added remote control using nRF24L01+ RF transceiver modules.  On the data glove end, the RF module plugs into a custom PCB built around a Microchip 16LF15355 MCU which takes the flex sensor measurements and control switch signals and transmits the readings via a SPI interface to the RF module for transmission.

Remote data glove electronics


On the receiving end, another RF transceiver module is plugged into the spider main controller, which is another custom PCB built around a PIC 16LF15355 MCU.  The main controller is responsible for distributing the flex sensor measurements to each leg controller via an I2C interface, distributing the switch signals to the GPIO inputs of a Raspberry Pi to generate sounds, and distributing switch signals to the gantry motor controller to raise and lower the spider in its gantry.  The main controller operates as an I2C master and each leg controller is an I2C slave.  There is also a custom PCB that accepts 12 VDC from the Li-ion battery pack which distributes 12 Volts to the leg motors and 3 Volts to the main controller and leg controllers.  There are seven Pololu 3 VDC step down converters that plug into the power distribution board.

Spider electronics


The circuit designs are fairly simple, as most of the functionality is in code on the PIC MCU, so the components of the circuit design are largely there to support interfaces to the PIC.  All PIC code is written in C.  Following is a summary of the functionality coded on each PIC.


Remote Data Glove Code

The remote data glove code configures each of nine inputs to the PIC as analog inputs to the ADC module.  The inputs are connected as a voltage divider circuit with one leg being the flex sensor and the other leg as a trimmer pot tuned so that the maximum voltage across the flex sensor will be 2 Volts at maximum bend, which is the highest voltage that the PIC can measure.  Three other inputs to the PIC are configured as digital inputs connected to each of the limit switches in the left hand switch grip.  The data glove code is also responsible for configuring and operating the nRF24L01+ RF transceiver module via a SPI interface.  The switch signals are debounced in software using the PIC timer0 and timer2 modules.  At 100 millisecond intervals, the main loop of the PIC code samples the analog ADC inputs and digital switch inputs and sends the measurements to the RF transceiver via SPI to be transmitted to the receiving spider main controller.


Spider Main Controller Code

The spider main controller code is dedicated to receiving measurements from the receiving nRF24L01+ RF transceiver via a SPI interface and distributing the analog measurements to each of six leg controllers via an I2C interface.  The switch measurements are separately distributed to discrete digital outputs: two go to the GPIO inputs of a Raspberry Pi to select sounds to be played and two go to the gantry DC motor control board to raise or lower the spider.


Leg Controller Code

The leg controller code is responsible for receiving the analog measurements and converting them into stepper motor phase signals to operate the leg joints.  Four of the leg controllers are each dedicated to operating two "knuckle" joints of a single leg, while the remaining two leg controllers are dedicated to operating the "hip" joints from a single analog measurement (i.e. all hip joints raise and lower together).  The leg controller code also monitors digital inputs connected to two limit switches: one which trips at full extension of the leg joint, and one which trips at full retraction of the leg joint.  The leg controller code is a state machine which operates in one of three states.  In the initial state, the measurements are repeatedly polled from the I2C buffer to determine the minimum and maximum values received for each joint.  The user must repeatedly extend and retract the fingers of the remote data glove while in this state to record these limits.  One of the digital inputs to each leg controller is connected to a push button switch to signal the end of analog calibration.  Upon detecting closure of this switch, the leg controller code enters the limit switch calibration state.  In this state, the controller generates phase signals to the stepper motors to drive them clockwise until a corresponding limit switch closure is detected, then counterclockwise until the other limit switch closure is detected.  In the process, the relative step positions of each limit are recorded, and the full range of stepper motor positions are mapped to the full range of analog measurements of the data glove.  When this cycle has been completed, the controller moves into its normal operating state.  In this state, the analog measurements are polled from the I2C buffer to determine the difference in steps between the intended stepper motor position and the current stepper motor position.  The stepper motors are then driven the necessary number of steps to bring this difference to zero while applying a simple proportional integral (PI) algorithm to generate smooth operation.


The spider is attached via fishing line to a gantry made from 2x4 studs with a Pololu DC gearmotor driving an axle with pulleys.  Signals from the spider to the gantry motor controller are transmitted via taser wire, which is thin enough to look like spider web filament.

The spider mounted on its gantry with fishing line