Cheap four-legged insect robot

Similar projects worth following

This is a continuation of the journey started with #Tote to create an affordable walking desktop robot.

What is this?

It's a four-legged walking robot that fits on your desk, can be programmed with an USB cable without installing any special software on your computer, can be built on a budget of less than $30, and that can be easily expanded or modified, to try out new ideas. Those are the basic requirements I have set myself for this. But why?

Why am I doing this?

Because I think that the details about how such robots are able to walk, without crawling or dragging on the floor, are very interesting, and that making a physical robot work is the best possible way of learning about it—fun and rewarding. There is a big hurdle in getting into this—most of the robots you could get are either super-expensive or simple toys with hard-wired gaits. There are now some reasonable kits out there, such as those robots made by Petoi, but I think I can still do better than that in terms of both affordability and removing other barriers.

Why is this hard?

Building a walking quadruped is surprisingly easy—once you know how. You literally just need any microcontroller development board, battery, a bunch of servos, ice cream sticks and hot glue. A few hours of work, and a few weeks of banging your head against a wall while trying to get it all to work, and you are done. That's the easy part.

The challenging part is designing and documenting it all so that it can be repeated or modified and expanded, without wasting time, and with as little frustration as possible, and on a budget. This means I don't only need to get it to work, I need to think about the best ways of getting it to work, and then about the best ways of explaining them.

When will it be finished?

Probably never. That doesn't mean it won't be usable. I hope to get it to a point where it can be built by others as soon as possible. But it's one of those projects that are never completely finished, because the context in which they work keeps changing. New parts become available, such as new microcontrollers, sensors or even servos and batteries. Others become obsolete or otherwise hard to obtain. New fabrication techniques, such as laser-cutting or 3D-printing become feasible for an average hobbyist. There might even be new materials on the horizon! And the fastest changes are in the software tools available—a few years ago the only ways you could program a microcontroller was assembly, or maybe, if you were lucky, some limited version of C. Today we have Python code running on them in real time, with a lot of ready libraries, and new capabilities appear every month. I probably won't be able to incorporate it all in the design, but I fully intend to update it as new possibilities emerge.

  • Can We Make It Simpler?

    deʃhipu11/18/2022 at 19:09 0 comments

    I'm pretty much happy with the physical design of this robot by now, but I also like to tinker, so I asked myself if it could be simplified any further? I noticed that 90% of the components on the PCB are dedicated to keeping the LiPO battery happy – the protection circuit and the charging circuit. What if we could use some other type of battery that doesn't require as much babysitting? Alkaline batteries are out, since one that could provide enough current for the servos would be way too heavy, but what about NiMH batteries? They can deliver higher currents than the alkalines, right?

    Since I was ordering some PCBs anyways, I quickly made a modified version of the fluffbug PCB that comes with a 3xAAA battery holder on the back, and without all the protection and charging circuits – external chargers for NiMH batteries are common enough. I also took that opportunity to replace the S2 Mini footprint with a Raspberry Pi Pico footprint – just to see how that would work, especially since there is a version with WiFi now. I also ordered the batteries, and when everything came, I started testing.

    It quickly became obvious, that three AAA NiMH batteries are enough to drive a single 9g servo, but not 8 such servos all at once. Even with a beefy capacitor to smooth the spikes in current, there simply was not enough power. So I replaced the battery holder with a 4xAAA one, and tried again. This works, but the robot is now considerably heavier than before, and can't move as fast. I consider the experiment to be failed, we are better off with the LiPO and all the extra components.

    As a side experiment, since the pi pico doesn't have the limit to only 8 PWM outputs, as the esp32-s2 does, I also got to test the speaker with the fet on an actual WAV file with audiopwmio. I don't know if it's the low-pass filter that I added, or the transistor itself, but the results are disappointing – the audio is barely audible. If I keep the speaker in the future, I will probably use a proper amplifier with it.

    I am still tempted to make a version of the PCB with the LiPO and the pi pico, but to be honest I'm not sure it would actually bring anything new right now.  I might do it to try the SMD versions of the headers and the IDC sockets that I found, and that speaker amplifier, but really I should be focusing on programming, so that the robot actually does something more than just walking forward.

  • Asynchronous Face

    deʃhipu10/13/2022 at 19:13 3 comments

    I had some spare energy after work, so I sat down and implemented that asyncio-based display handling I mentioned previously. It seems to be working pretty well.

    I still need to refactor the walking code, to make some parts of it part of the robot's library, and the rest a separate gait class. Slowly but surely it's getting there.

  • OpenSCAD

    deʃhipu10/03/2022 at 22:21 0 comments

    With the robot mechanically pretty much good enough, the next steps are of course programming and documenting. The latter will require some drawings, so I sat down with OpenSCAD to make a simplified model of the robot, so that I can use it for assembly instructions. Here's a simple animation of the "exploded" view:

  • EasyEDA

    deʃhipu10/02/2022 at 14:18 0 comments

    Because some people seem to have some kind of grudge against Fritzing, I decided to re-do the PCB for Fluffbug in EasyEDA, so that it can be easily ordered from JLC. They don't have all the parts (in particular, all 1kΩ resistors seem to be out of stock for some reason), but you can probably get those from somewhere else.

    The project link is here:

  • asyncio

    deʃhipu10/01/2022 at 18:01 0 comments

    I finally had some time for coding today, first time in a long time, so I decided to rewrite the current gait code using asyncio.

    The gait is still pretty much the same (I fine-tuned it a bit and sped up), and the code still has all those explicit waits everywhere, for the servo to get into position before doing anything else. I want to eventually have a function that would estimate how long it will take the servo to move, and do the waiting automatically for me. It could also do tweening, for more interesting movement profiles. But even with the current explicit waits asyncio is an improvement, because I can now easily add handling the display and/or sensors while walking.

    The code follows:

    Read more »

  • Version Six Assembled

    deʃhipu09/25/2022 at 11:48 0 comments

    The PCBs arrived, and I assembled everything. One thing that didn't work was plugging the S2 Mini into the staggered holes directly - you need headers for solid connection. Oh well. Another problem was the overcurrent protection of the new chip, that triggered whenever all the servos moved. Replacing one of the resistors with a bigger value one fixed this.

    Sadly, I still didn't get the camera module working correctly, even with the new shield. Oh well.

    I used the PCB legs with switches, but I didn't connect them yet.

  • Version 6

    deʃhipu09/16/2022 at 16:19 0 comments

    When I recently started looking for parts to make more of those robots, I had an unpleasant surprise: the battery protection chip that I used, HT3062E, can no longer be easily bought. That is a big problem, so I went to look for another chip instead. Unfortunately, there don't seem to be very many integrated solutions out there – most chips require separate mosfets, which is something I would rather like to avoid. So this time I went for the DW07D, which is for a bit lower current, but should still work. Unfortunately it comes in a different package and requires different connections, so a new PCB design is required.

    I also added a mosfet for the speaker, and some handles at the top of the PCB, to make it easier to attach things to the robot.

  • Maker Faire

    deʃhipu09/15/2022 at 09:14 0 comments

    Fluffbugs went to Hannover last weekend, together with some other bots, game consoles and a bunch of keyboards. We had a table labeled 4/5 Stars, and you could see all our stuff there.

    Since Fluffbug still mostly just walks forward, most of the work was done by the two #Tote robots I also brought. But a lot of people stopped by to see them walking around.

    Afterwards, I had some fixing to do.

    My main Fluffbug now has two new servos, which don't quite match the rest, but I think I like it.

    I also recharged all the batteries.

  • Put a Face to a Robot

    deʃhipu07/29/2022 at 21:11 0 comments

    Everything is better with eyes. Putting goggly eyes on things makes them instantly relatable and cute or creepy. We simply can't remain emotionally neutral to something that looks at us. So I decided that the robots need faces.

    Of course I could have used one of the many Wemos D1 shields available on the market to add an OLED screen, a TFT screen or even just a LED matrix, but where is the fun in that? I recently got a new round screen to work, so I decided to make a shield for it, and to design it so it works well with those robots.

    The back side has a lot of free space for a silkscreen, so what should I put behind a face? Of course!

    This way I can use the spare PCBs without a display to decorate other robots. That was a week ago, now the PCBs have arrived, so I got it all assembled and working:

    My work here is done. Here is the code I used:

    import board
    import displayio
    import busio
    _INIT = (
        b"\xFE\x00"  # Inter Register Enable 1
        b"\xEF\x00"  # Inter Register Enable 2
        b"\xB6\x02\x00\x00"  # DFC S1>S360 source G1>G32 gate
        b'\x36\x01\x48'  # MADCTL
        b'\x3a\x01\x05'  # COLMOD
        b"\xC3\x01\x13"  # PWRCTL2 VREG1A=5.06 VREG1B=0.68
        b"\xC4\x01\x13"  # PWRCTL3 VREG2A=-3.7 VREG2B=0.68
        b"\xC9\x01\x22"  # PWRCTL4
        b'\x21\x00'  # INVON
        b'\x11\x80\x78'  # SLEEPOUT
        b'\x29\x80\x14'  # DISPLAYON
    spi = busio.SPI(clock=board.IO7, MOSI=board.IO11)
    bus = displayio.FourWire(spi, chip_select=board.IO12, baudrate=40_000_000,
            reset=board.IO5, command=board.IO9)
    display = displayio.Display(bus, _INIT, width=240, height=240)
    display.root_group.scale = 6
    display.root_group[1].x = 0
    display.root_group[1].y = 0
    print(" O w O")

    I might come up with something more complex later... 

  • Better Gait

    deʃhipu07/19/2022 at 14:39 0 comments

    I took the robot with me to the EuroPython 2022 conference, hoping that I will have some time during the maker hacking sessions or during the sprints to work on the code further. And I did manage to improve the gait considerably:

    There is of course still a lot of room for improvement. I need to rewrite the code to make it more modular and maybe make use of the async features of CircuitPython. I also need to think about how to move the servos more fluently, possibly along defined motion profiles, to give the robot a more organic look (and put less strain on the servos too).

    Then, I will work on a remote control program for the #PewPew S2 console, to control the robot over WiFi or ESPNow.

View all 24 project logs

Enjoy this project?



James Newton wrote 09/28/2021 at 22:56 point

Where is the source code, PCB files, laser cut, etc...?

  Are you sure? yes | no

deʃhipu wrote 09/29/2021 at 09:58 point

Everything that I made so far I described in the project logs. I'm still working on a version that will be easy to build and properly documented. But for your convenience, I created a repository with the work so far here:

  Are you sure? yes | no

Nopcode00 wrote 09/13/2021 at 20:12 point

Nice job. Do you have any videos of it in motion?

  Are you sure? yes | no

deʃhipu wrote 09/13/2021 at 21:17 point

Thank you. Sadly, I still need to program a gait for it, for now I only have the inverse kinematics. There is, however, a video of its predecessor, Tote:

  Are you sure? yes | no

Nopcode00 wrote 09/13/2021 at 21:44 point

I’ll check it out - thanks. 

  Are you sure? yes | no

Makerfabs wrote 09/06/2021 at 07:35 point

hi @deʃhipu ...lucky day~

  Are you sure? yes | no

deʃhipu wrote 09/06/2021 at 09:06 point

What do you mean? Did I miss something?

  Are you sure? yes | no

Dejan Ristic wrote 07/31/2021 at 20:57 point

Nice! I'm all on board with the affordable desktop robot concept.
Color scheme makes me think of the camel spider. But this one seems much less terrifying luckily.

  Are you sure? yes | no

deʃhipu wrote 07/31/2021 at 21:39 point

Thank you. To be honest, I haven't thought about the looks too much yet — most of the design is dictated by the mechanical requirements right now. There is some room for expression here — shape of the legs, shape of the PCB, etc. I imagine that it could also be made quite terrifying depending on how it moves — if you can reproduce the movement profile of spiders, for example, I bet people would get goosebumps just looking at it walk. The color scheme is probably not final — I had some choice here, so I went with yellow/orange, but the final version will probably be blue, because blue servos are the cheapest.

  Are you sure? yes | no

Dejan Ristic wrote 07/31/2021 at 22:16 point

Well as long as it doesn't bite :D
I also like the minimalism with 4 servos making up the thorax of the spider.
And the forward facing pcb. I'm guessing you can put on a shield with a distance sensor then?

  Are you sure? yes | no

deʃhipu wrote 07/31/2021 at 22:39 point

Yes, the initial plan was to put one of those time-of-flight sensors on it, but of course you could also use that huge ultrasonic sensor if you want your robot to look more steampunk. In fact, I'm even considering an adapter-shield for an #OpenMV 

  Are you sure? yes | no

danjovic wrote 06/12/2021 at 13:56 point

Awesome, specially in yellow!

Have you considered to make the legs out of PCBs?

  Are you sure? yes | no

deʃhipu wrote 06/12/2021 at 14:08 point

Thank you. I have, and in fact the previous versions all had the legs made out of PCBs, however, since the fabs nowaday charge extra for multiple projects in one order, and the leg parts look like multiple projects, this is no longer economically feasible. On the other hand, cheap laser-cutting services mean that you can get enough legs for three robots for less than the PCB, and it gets even cheaper in bulk.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates