Close
0%
0%

Wee Bug

Fluffbug but smaller

Similar projects worth following

While digging through my drawers, I stumbled upon a bag of sub-micro servos I bought a few years ago from HobbyKing for the #Pony Bot, but never used in the end, because they had wrong connectors. Turns out there are HK-282A servos with 1.25mm-pitch JST connectors and HK-282AS, with 1mm-pitch unidentified connectors. In any case, the Pony Bot is on hold indefinitely for now, until I can find the energy to actually program a gait for it, so I thought that maybe I can use those tiny servos for something else: make a tiny version of the #Fluffbug robot. That would also have the advantage of not needing to write a new gait code, since the one already written for Fluffbug should work.

So I went ahead and started to design a Fluffbug, but with everything smaller.

  • Wee Display

    deʃhipu12/15/2023 at 17:52 0 comments

    A while ago I made a display shield (mask?) for the Wee Bug, but because it needs additional pins to talk to the microcontroller, it only works with the Waveshare Mini boards, and not the Xiao or QtPy boards, that don't have those extra pins. But then I found this tiny 0.66" OLED screen in my drawer, and thought "wait a minute, this display can use I2C for communication, and I already have an I2C bus for the accelerometer on the robot, so it would need no extra pins". All I need is a breakout board for it. Oh, and the tiny little issue of the reset circuit.

    What reset circuit, you ask? Well, I happen to know from experience, that those display will not work correctly when you just switch them on and start sending them data. They need to be restarted, physically, with the RST pin, a short moment after being powered on. I'm not entirely sure why, and why this isn't built into the chip's initialization, but that's how it is. If you don't do that restart, they will just keep displaying random pixels, ignoring any update commands.

    Normally I solve this in software. I have a GPIO pin connected to RST, and I wiggle it as a part of the display initialization. Easy enough. But in this case I don't have an extra pin to spare. So I need something else to wiggle the pin for me. A reset circuit.

    As always, as the first thing I went to Adafruit's excellent documentation, and looked at the schematics of their own display modules using similar displays. Sure enough, they had their reset circuits on them, in the form of an APX803L40 chip. Neat, just a single chip doing what I wanted, and I was afraid I would have to muck about with transistors and capacitors and resistors and diodes and who knows what else. The only problem is that the schematic didn't specify what threshold voltage should the chip have, so I ordered the 3.3V (because that's the voltage I will use to power the display) and 2.5V (because that's the 2/3 of the final voltage) versions. Then I quickly made a PCB and since it was so small, ordered it from OSHPark.

    When it arrived a few weeks later (free shipping from US is slooooow), I quickly soldered it up and tested. I immediately realized that I forgot to add the pull-up resistors on the I2C bus, but that's fine since the robot already has them, for the accelerometer. But even with those, it didn't show up on the I2C bus scans. What's wrong?

    At the time I was quite sick, and I didn't have the energy for too much experimenting. I just verified that it still didn't show up when I replaced the reset chip with a pull-up resistor, but didn't pursue it further. It went into a drawer.

    This week I felt better, and I decided to give it another look. I went over the schematic and compared it with examples of modules I found online. One difference between my schematic and the Adafruit one is that I didn't break out the RST pin, and I didn't include the pull-up resistor they have on it. A quick bodge job to add that resistor didn't help. Hmm. Another difference is that I didn't ground the unused pins. But the datasheet didn't say they have to be grounded... I tried another bodge to ground all those pins, and still nothing.

    What else could be wrong? I still suspected the reset circuit, so I desoldered the reset chip, and put a pull-up resistor in its place. And suddenly it showed up on the I2C scan! Turns out I need both the CE pin pulled low, and the RST pulled high. Of course the display wouldn't work like that, since it didn't get its reset after power up. So I once more put the reset chip in there, *and* added the pull-up resistor, while *at the same time* having CE connected to GND. That was it, that made it all work.

    It certainly took me more time than it should, but I have an animated eye working on the robot now.

  • 1mm and 1.25mm Versions

    deʃhipu12/12/2023 at 17:29 0 comments

    The 2g servos I'm using for weebug come in three different connectors: the traditional 2.54mm pitch servo plug, a 1.25mm pitch jst plug, and a 1mm pitch plug. I think the traditional plug is way too big for this kind of robot, so that leaves us with two versions: the 1.25mm and 1mm. I started with the bigger one initially, because that's what I had in my drawer, and I used through-hole sockets for them for the same reason. But when I later wanted to switch to SMD sockets, I found that all 1.25mm socket are for some reason unreasonably large, with big additional structural elements added on both sides. I switched to 1mm sockets because they were tiny in comparison. So all recent versions of the weebug use the 1mm sockets.

    I still had two early versions using the 1.25mm servos, and I wanted to upgrade them to the newer PCB. So I did a quick replacement to the through-hole sockets in the design, nudged aside some of the traces that got in the way on the back side, and added a footprint for the smaller battery holder, so that I can use either one. Oh, and I ordered it with yellow soldermask and black silkscreen, so that the danger stripes look how they should:

    I transplanted the legs from one of the old bots, and it works. I just have to update the code to account for the change of which servo goes to which pin.

    In other news, I'm still investigating servo power issues. No definitive conclusions yet, but I'm leaning towards ditching the boost converter and putting the servos back on direct battery power. Together with using reasonable quality of batteries, that should help.

  • Not All Batteries are Created Equal

    deʃhipu12/01/2023 at 18:08 0 comments

    With the new PCB in version 6.0 I switched to the bigger 16340 battery that I originally used in #Fluffbug, thinking that the extra weight is not so great, and extra capacity will be useful. Also those batteries are much easier to find, since they are commonly used in vapers. And incidentally, with version 6.0 I started to have problems with power. The robot would work on a fully charged battery for maybe half a minute, and then the servos would get all shaky, and soon the protection circuit would kick in and shut the power down.

    I initially thought the shaky servos are because those small 2g servos come in two versions: 3.7V and 5V, and maybe I got the 5V ones this time. So I made a PCB version 6.1 where I added a boost converter to give the servos consistent 5V voltage. It didn't make any difference, though, the servos were still shaky. I tried added capacitors everywhere I could, but that didn't solve the issue.

    On a hunch, I made a professional adapter out of a paperclip, and inserted the previous 14250 battery. Suddenly all the power problems went away, the servos are no longer shaky (both with the boost converter and without). Interesting. So I went looking for a 16340 battery from a different batch, and lo and behold, the power problems are also gone. It was the battery all along.

    Turns out that you really have to be careful where you get your batteries, because they differ not only in capacity (by the way, don't believe in what they print on them, a battery with that capacity would need to be four times bigger with this chemistry), but also in their C-rating, which is basically how much current you can draw from it at once.

    You need to somehow find a "reputable" source for your batteries, which is a bit of a problem, because obviously this is a lemon market. Out of curiosity, I also tried a battery removed from a vaper that I found on a sidewalk. Turns out that it performs really well, despite being a no-name thing. I guess the manufacturer of those devices found a trusted source.

    So if you really want to save on the battery, check your sidewalk for a free one. You will also save the environment from being poisoned with toxic lithium.

  • Add Some Fluff

    deʃhipu10/24/2023 at 14:33 0 comments

    I intentionally make my robots minimal in terms of additional aesthetics, to make them easier to make and customize for others. But sometimes you just want to have some fun, so when I saw this bunny-shaped ipods case, I knew what I need to do:

    It's just the right say to fit the Wee Bug's body inside, minus the battery. I just had to dremel two large holes in the bottom for the legs, and replace the battery holder with a more traditional pouch lipo battery.

    I also glued some small magnets to the lid and the case, to make the lid stay closed more firmly. As the microcontroller, this time I used a Waveshare RP2040 Zero board, so I have a bunch of extra pins at the bottom, that are not used by the servos. I added some wires to them, to potentially make use of them later. I think I will need at least one pin for an infrared remote control sensor, because that board doesn't have wifi for control. I have some sensors that look like small black eyes, so that should work pretty well. In the mean time I used a single goggly eye, just for some added character.

    While obviously this is a custom job, I think that ipod cases are a standardized and common enough thing for other people to be able to do similar things with them. It's a bit of shame that I couldn't keep the standard and replaceable battery.

  • Balancing

    deʃhipu10/14/2023 at 19:10 0 comments

    I had some time for coding at the hackerspace this week, so I wrote simple code for balancing to test the accelerometer. It goes something like this:

    import robot
    import time
    import lis3dh
    import busio
    import board
    
    
    i2c = busio.I2C(sda=board.D4, scl=board.D5, frequency=600000)
    accel = lis3dh.LIS3DH(i2c)
    height=20
    
    tilt = 0
    while True:
        x, y, z = accel.get()
        if x > 500:
            tilt = min(tilt + 20, tilt + 1)
        if x < -500:
            tilt = max(tilt - 20, tilt - 1)
        for leg in robot.LEGS:
            if leg.left:
                leg.move(0, height - tilt)
            else:
                leg.move(0, height + tilt)
        time.sleep(0.05)

    Even for simple code like this, the effect is pretty cool:

     Of course to make it useful, it has to also work in the other axis, and be integrated with the walking algorithm and others. I have some ideas about how to do it, though, so stay tuned.

  • A Display

    deʃhipu10/13/2023 at 20:47 0 comments

    There are many different microcontroller boards that you can use with Wee Bug, from the Seeedstudio Xaio, through Adafruit QtPy, to Waveshare Zero boards. They all have the power pins in the same places (sometimes mirrored), and the GPIO pins are flexible enough to be used in the roles they need in the robot. But the Zero is particularly interesting, because they have four additional pins at the bottom of the board, that could be used by an additional board connected on top. Like, for instance, a display. It so happens I was working on getting one display to work, and I needed to make a breakout board for it, so I thought why not, and made it a shield, or maybe a "face shield", for the Wee Bug.

    And since the other display I was recently playing with has the exact same footprint, I made the breakout in a shape that fits both of them. At a whim, I also added a footprint for the 1.8" ST7735 display on the other side, just because I could.

    Of course the next step is to make it display something interesting. I already experimented with eyes, and the closeup of a single monstrous eye that Adafruit demos do is a bit too monstrous to my tastes, so for now I went with the GIF animation I made for the #Astro-chan Badge. I plant to eventually re-draw the same character I used on the silkscreen on earlier prototypes, and animate it to make it look like it's controlling the robot from the inside, but of course that is much more work than it seems, so it will take a while.

    The practical advantage of having a display on a CircuitPython-programmed robot is the fact that you no longer need to explain how to connect to the USB console, so you can see error messages. People can just read the errors from the screen.

  • Version 6.0

    deʃhipu09/30/2023 at 21:10 0 comments

    That last prototype I mentioned in the last log finally arrived on Friday:

    And I got it all assembled and programmed today:

    I also have the camera and the accelerometer working, though I don't really do anything interesting with them yet. You can see that I re-used the servos that already had the cables shortened to the right lengths, so as to not be an unholy mess of wires, but if I didn't, I could tuck all the extra cables under the microcontroller board, plenty of space there. There is also a WiFi antenna hidden under the battery – the Xiao ESP32-S3 Sense board I used here comes with an external antenna.

    The bigger battery and longer legs work fine – the servos are easily strong enough to take it, and the hind legs don't need to move so high that they would collide with the battery.

    I'm really happy with it, and now I should be focusing on the software side of things, making the movements smoother, making use of that camera and accelerometer, and generally teaching it more tricks.

    I also want to try it with boards that are more or less compatible with Xiao, like the Adafruit QtPy, or Waveshare Zero. The latter will stick out a bit, and will need to be inserted up-side-down, but the extra pins could be useful for a display shield.

  • A String of Prototypes

    deʃhipu09/20/2023 at 17:23 0 comments

    The first Weebug was just a quick hack to see if it will work. It turned out to work even better than Fluffbug, so I made a second one, this time trying to make it look cool, and cleaning up the design. But if I want to do workshops with this eventually, I need to make it easily manufacturable and as easy to assemble as possible. So I made another prototype, with the same PCB art, but with an RP2040 chip instead of the unobtainium SAMD21.

    That was also a test for the JLCPCB assembly services, a test of the new leg design, and a test of the 1mm servo plugs, that are physically much smaller than the 1.2mm ones, at least in the SMD version. The results are... mixed. The assembly service works as advertised and is very nice, but now I have five assembled boards I paid for that I have no use for – I will explain why shortly. I also had to pay the customs duty on the package, because with shipping it went over the threshold, so it got more expensive than I anticipated. I think that in the future I will prefer assembling the prototypes by hand myself, even if that means I have to make a separate order at LCSC for the parts.

    What didn't work so great are the servo sockets, and that's mostly because of my own mistakes. First of all, I placed them too close to the servo mounting holes. There is enough clearance for the servos themselves, but not for the head of the screw that holds them in place. I had to break out my hot air gun and move the sockets slightly in on their footprints to make everything fit. Of course I can't expect anyone else building the robot to do that, so I can't give out or sell those boards. The second mistake is even more stupid. I swapped the signal and ground pins on the sockets. I was able to test the robot by carefully swapping those wires on the servos (the contacts in the plug are easy to remove and swap), but again, I can't expect anyone else to do that.

    And of course there is still the continuing problem of cable management, for which the only solution I found so far is to open each servo, desolder the wires, cut them to the right size from that side, and solder them back and reassemble each servo. The result is very clean and aesthetically pleasing, but it's a bit too much fiddly work for a workshop, and I can't do it for every servo in every kit.

    So that's a partial success. I definitely learned a lot, but there is some unnecessary waste in there...

    I also decided that putting a bare chip on my boards doesn't always make sense. It's great when I need a lot of GPIOs, for example for a display or camera, but otherwise using a development board is both less work, and, in at least in case of the rp2040 and esp32 boards, cheaper – when I'm not assembling them myself, anyways.

    In the mean time, I got my hands on the Seeedstudio Xiao ESP32-S3 Sense devboard, and I was greatly impressed. Not only is it blazing fast and has loads of memory and flash, but it even comes with a tiny little camera and microphone module, perfect for a robot like this. And it's still in the Xiao form factor. So I made another prototype, this time specifically for this Xiao board:

    It even includes battery recharging chip, though to use it you have to solder to some pads on the back of the board. That is what pushed me towards soldering the Xiao board directly to the PCB instead of using a socket. In hindsight, I think it was a mistake. For convenience, I made through-hole contacts on the back where those pads are, so they are easy to solder this way, but it would be much nicer to have the devboard removable. Oh, and I got the servo sockets right this time: the signals are correct, and I moved them out of the way of the screws. I had to move some electronic components under the battery holder, which made it later very annoying to debug my battery problems, but oh well.

    But I didn't avoid mistakes completely this time either. The DW07D chip I use for protecting the battery didn't work correctly this time, even though it worked in all the previous...

    Read more »

  • New Body in Action

    deʃhipu08/26/2023 at 22:53 0 comments

    As always, the PCBs arrived from JLCPCB, so I went ahead and assembled one. I had some fun soldering the accelerometer chip – it's QFN, but it was lying in my drawer for a few years, and apparently some of the pads got oxidized. Only after I went over them with a hot iron and flux, the soldered correctly. Good thing I decided to test the chip before I soldered the battery holder, because the chip is underneath it, and it would be a pain to have to desolder the holder first. Also, I was afraid that the THT servo sockets will be hard to solder on both sides of the PCB, but turns out they are far away from each other enough to not interfere with soldering. Phew. I still don't think I could make a fab do this, so if I ever decide to do a workshop with this robot, I will have to switch to SMD sockets.

    After it was all soldered, the UF2 bootloader flashed, and CircuitPython firmware uploaded, it was time to assemble the legs. And here's the first mistake: I made those long slots in the PCB hoping that I will be able to stuff at least some of the servo cables in there, to make it look a little cleaner. But I didn't anticipate how small this PCB is, and the cables simply don't fit in there. Oh well. If I ever make another version, I will remove the slots, leaving only the parts necessary for servo mounting. That will also make routing of the traces easier.

    With the legs connected, the servos zeroed and the initial leg positions calibrated, I copied some of the old code for walking (the SAMD21 build of CircuitPython doesn't include async functionality that my newer code uses), and it walks. I just had to change the order in which the legs are initialized, so the right timers get assigned to their PWMs. However, I found further mistakes.

    First of all, the switch that switches between walking and battery charging is reversed, so the labels are wrong. Not such a big deal, I suppose, and I could easily enough fix it by swapping the labels.

    I also thought that I made a second mistake, connecting the USB power so that it powered the servos, but that was just a mistake in soldering the shottky diode in reverse. After flipping it, the servos are now correctly only powered from the battery, so I can program the robot when it's switched to charging mode, without worrying about it making random movements.

    The next steps now may involve using the accelerometer for interesting things, doing something about the cables (I need to open one servo and see if I can easily shorten the cable from that side), and seeing if I can enable async on this build, possibly at the cost of disabling some of the built-in modules that I'm not using.

  • New Body

    deʃhipu08/18/2023 at 23:34 0 comments

    I couldn't sleep last night, and when I can't sleep I design PCBs. This time I decided to get back to this little cute robot and make a new PCB for its body. The original one was kinda slapped together without much deliberation, just to make it look like its bigger brother #Fluffbug but fit the small servo sockets. This time I decided to do it properly.

    First of all, I want some solution for the cable management. I can't use IDC plugs like with Fluffbug, because the wires those little servos use are so thin! But I also don't want to have to re-crimp the plugs after cutting the wires to the right size. So I decided to compromise by adding slots to the PCB under the servos, where you can hide excess wires. Hopefully they are large enough to fit all of them.

    Second thing is to give up on the Xiao board, and use a discrete microcontroller chip right on the board. That lets me use all the pins, makes the whole thing smaller, and, if you assemble it yourself, also cheaper. It has the downside that you can't easily replace the code by changing the modules. Oh well.

    And finally, the most visible change is to add some visual bling. This robot looks a little bit like a crab, and I could have leaned into it, but while I personally think crabs are incredibly cute, many people don't agree with me, especially the ones with some arachnophobia. So I decided to make it look like a mech from an anime movie or game instead, by adding a picture of a pilot on the front of the PCB.

    Last, but not least, I added an accelerometer chip in there, so that we can have some sensors to react to. The board should arrive in a week or so, and I will probably take some time assembling it. I will keep you updated.

View all 15 project logs

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

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