Make a really cool animated Spider, which moves on its own power, while its eyes light up in red for an extra scary effect!
For this project, you’ll need a mechanical spider toy. We used a spider 3D puzzle, due to its simple design and low cost. Also, you will need a motor, LEDs, and a Silego GreenPAK chip.
The particular unit we chose had enough space to mount a DC motor and some additional gears inside. This unit also has very nice perforated eyes. The plan is to mount red LEDs behind the eyes, in order to make the toy more attractive. To control these functions, you’ll use a Silego SLG46580 GreenPAK chip. In addition to the various flexible and programmable analog and digital resources that make up devices in the GreenPAK family, this particular chip has four built-in low dropout regulators (LDOs), one of which will be used to drive the DC motor.
Step 1: You Have to Assemble the Mechanical Parts.
After the basic assembly, you can upgrade it with some additional plastic gears. The gears form a transmission, which is needed to slow down the final gear rotation speed, because the speed on the DC motor might be too fast. Using double-sided sticky tape, mounted the motor inside the spider model.
Step 2: Fix Scary Eyes
Next, glue the two red LEDs on the eye plate of the model. The last steps to finish the eye plate include soldering the wires and covering everything with black matte lacquer to direct light from LEDs, while also avoiding illumination of the internals of the spider.
Step 3: GreenPAK Design
Now for the GreenPAK side of the design. We wanted the spider to do a sequence of movements and displays on the LEDs when a button is pressed. This way, it will softly light up its red eyes (under control of a ramping PWM), then it will move a few steps, stop, move once again, and softly turn the LED eyes off. The design inside the programmable GreenPAK device consists of three parts: a timer that sets the operation cycle, the PWM controller for lighting the LEDs, and the LDO controller for providing the regulated voltage for the DC motor.
After a high-level signal appears on PIN2 (Start), the signal is de-bounced (in case a physical button is used) with a 40ms delay. The signal from this de-bounce filter passes through a rising-edge detector, and feeds a falling-edge delay that produces a 4.34s long pulse. On the rising edge of this pulse, a PWM controller starts ramping up the duty cycle, to gradually increase the illumination on the LEDs. The LDO controller has an enable input which allows it to be turned on and turned off under control of either internal or external signals. While the pulse is available, the 542ms period generator starts its operation, which clocks a ripple counter. The output of the ripple counter is decoded with a 3-bit Look Up Table (LUT3), which is a programmable logic element that can have a user-selectable output for each of the eight combinations of its three inputs. The truth table for the LUT is configured in such way that it will split a 4.34s timer period into eight sub-periods, each 542ms long.
During the first sub-period, the LEDs are turned on and the LDO is turned off. During the second and third sub-periods, the LDO is turned on, which drives the motor, causing the spider to move. This is followed by two periods where the spider stops moving. The spider will then move for two more periods. And during the last period, the LDO is turned off, causing the spider to stop, and the LEDs will turn off by ramping down the duty cycle on the PWM.
Note that the SLG46580 does not have a PWM controller, which is why we used two counters and additional logic to replace it (similar to Silego’s application note AN-1117).
Step 4: Test the Design
After assembling everything together, we wired the motor and the LEDs to the GreenPAK development board and tested the design.
Watch the video as the result of this small ans easy project. The video shows the development process, and the resulting behavior of the spider.