Lurking around AliExpress listings looking for cheap polypod, spider-like chassis to make something interesting out of, I stumbled upon this, for about 10$. The problem: it was “dumb”. All it does is to walk towards one direction, as you can see in the following video from 0:27.
Its default functionality was not good enough for me, however the price and potential were, so I purchased one. After assembling, it became evident that there is a limited space problem and also that the – too hard to replace – motor does not operate with voltages much higher than that of an AA battery. Challenge accepted! The microcontroller of choice for this project, was the ATtiny85 based Adafruit Trinket. It had just enough pins and was small.
Movement in two directions
Out of the box, the motor rotates towards a single direction. So, a half bridge that allows us to reverse the polarity of the motor was needed in order to get it to move to both directions. I did not have any PNP transistors or diodes, so I followed a less conventional approach and made one out of two relays. You can find the schematics and all code involved on the bottom of this page.
Since there is only one motor and all the spider legs are connected, I glued two servos on the sides of the spider in order to allow it to turn. If we want it to turn i.e. clockwise, the right hand side servo moves and elevates the spider. This stops the right side legs from touching the ground, thus allowing movement only from the opposite side, which results in the desired rotational move. This part was a little challenging, since there was not enough space, the motor’s axis was in the way and also the pistons that the inexpensive servos came with, were too short.
Then, the hard part began. The h-bridge, the trinket and the bluetooth module, had to be placed somehow on the spider. The best solution I could come up with was to cut some pieces of plastic, in order to create a base and stack everything on top. After exhaustively working around the practical obstacles, I managed to make it stand in one piece. I would really love input on ways this could be improved.
Powering it up
My initial intention was to use a 9V battery to power the microcontroller, however for reasons beyond my understanding there were problems with that and every time the Trinket would go “crazy” and become unusable. Here, it must be noted that until everything was connected, the board would function perfectly fine when powered up from my battery. I suspect this having to do with me using the Pins 3 and 4 to fire up the transistors, which according to the documentation should be used with caution, since they are involved in the boot up sequence of the chip. I have not worked with ATtiny85 before, so I am completely in dark regarding this issue. My next option was to use a USB power bank and power it up from the USB port. Despite the fact that this allowed the system to operate properly, it was not an acceptable solution since the motor was struggling to keep up with all that weight. So, I stripped down the USB power bank from its casing, keeping what was absolutely necessary. Those few less grammars made a difference and it could finally walk (slowly). This of course is not the optimum solution, so I have already ordered a lightweight 3.7V LiPo battery, which will hopefully let it move even faster.
UPDATE 13/12/2014: OK, two lightweight 280mah LiPo batteries arrived, so now the Trinket is powered by one of them. Additionally, the motor was changed, since the spider was somewhat slow and many times it would stop moving when the AA battery would start to get depleted. So I went to the local electronics shop and bought a small DC motor that should work in higher voltages than the previous and be able to carry all that weight. The problem now was that the new motor was much bigger than the previous one which could snugly fit the spider chassis.
More space was needed, so parts of the plastic were broken to enable the axis of the new bigger motor to reach inside the spider’s gearbox. After some breaking, cutting and gluing, the new motor was in place and the spider much faster than before. Moreover, there is no need for an AA battery anymore and the new motor is powered by another 280mah LiPo battery, leading to a greater decrease of the total weight. You can see the new set up of the motor in the following photos as well as how the new batteries are conveniently placed were the AA battery used to be. You can see it in action in a… dramatic Christmas video, of the spider with the new motor.
The code for this is really simple. I used Arduino’s Software Serial library to get input from the Bluetooth module, since Trinket has no serial RX and TX pins (note that I am only using Bluetooth’s TX, since I do not need to send something back and also there are not enough pins anyway) and Adafruit’s SoftServo Library, built for enabling Trinket to control servo motors. In my GitHutb repository, you can also find some test sketches I used to test each component separately, in case you plan on making something similar. Finally, I have not find time yet to develop my own Android application to control it, so I used the really nice Arduino Bluetooth Controller I found in Play Store.
To conclude, it was a valuable experience trying to work in such a constraining environment while using a new microcontroller, such as the Trinket. If you have any questions or remarks, don’t hesitate to contact me. Below, you find out how my spider robot looks at the moment, its schematics and a video demonstration.