My intention is for the snail bot to run for months in between charges. To accomplish this, I will need to get the current consumption to be very low when the device isn't doing anything.
The motor drivers have very low quiescent current - they are rated at 0uA typical, and 2uA max. The processor is the primary power draw on the board. When not in use, the processor can be put into low-power states, where most functionality is turned off. There is a low-power library for STM32 Arduino, which makes this easy.
I added some quick code to make the processor go into a low-power sleep, Stop 1. According to the datasheet, in this mode the processor should consume in the single microamps. I used a variant of the uCurrent to measure the board's sleep current. Fortunately, I didn't have much to do - it's at 3.4uA. The battery has a capacity of 600 mAh, so in an idealized world, the board would run for 20 years while sleeping! This means that the motor current will dominate the power consumption.
I also measured the current draw when the processor is awake and idle. This came to 1.8mA. Depending on whether the logic is CPU- or IO-bound, there are easy options to reduce the clock speed, which reduces the power consumption. Once I've implemented the snail bot's behavior, I'll spend some time optimizing this.
For this project, I designed a custom PCB. This board will be the brains of the robot.
It uses an STM32G030 processor. Because of the ongoing chip shortage, commonly-used processors aren't available. The STM32G line is relatively new. The processor is pretty nice - it runs at 64MHz, as compared to the 48MHz of the STM32F line (e.g. as found in the common Blue Pill boards). The G030 also has more usable IO pins than the corresponding F-series processor. Since this line is so new, this particular processor was not supported by Arduino or PlatformIO yet. I updated the Arduino board definition to add this support, and wrote a custom board definition for PlatformIO.
I made this PCB somewhat generic, so that I could reuse it for other small robotics projects. It has three L9110 motor drivers, which are bidirectional (H-bridges), and can drive up to 800mA per channel. It supports three switches (or other binary sensors), and three phototransistors (or other analog sensors). It uses standard ARM SWDIO for programming, so it can be programmed e.g. using an STLink. It also has a serial line (UART) broken out.
It uses a single AA-sized LiFePO4 cell (600mAh) for power. This is a newer type of lithium battery. This battery's nominal voltage is 3.3v, with a max of around 3.6v, so no voltage regulator is required. This is beneficial, since I'll want the board to have very low quiescent current draw, so that it can run for months between charges. There is an onboard charging circuit, and a USB-C port.
I designed this board to be assembled by JLCPCB. At time of writing (2021-12), they will populate nearly all of the components - only the programming header, serial port, and battery holder need to be hand-soldered, and these are simple through-hole parts.
The motors, sensors, and switches are connected to the board using JST-ZH connectors. I designed this board to be pretty small, and these connectors are tiny! They're a pain to crimp, and a pain to disconnect, but ideally I shouldn't have to do either of those things very often. Here's the board on a first draft of the base of the snail, with one each of the peripherals attached:
I've tested most of the board's functionality, and it all works. I want to make a few usability tweaks to it, in case I want to order more of them. Next up is finishing the CAD for the body of the robot!
The vision for this project is to have a cute snail robot which crawls around on the fridge. Currently, I'm planning for it to be powered by a rechargeable battery. I would want it to last for roughly a month per charge, at least. I'd like for it to always be in motion, and move very slowly.
I made a prototype of the motion system. For actual locomotion, I'm planning to use a wheel with a TPU tire. To make it look more snail-licteke, it will first extend the head forward, and then move the body forward while retracting the head. The head will move using a crank attached to the wheel. To make this a bit more organic looking, I'll add a slot to the crank, so that there is some dwell time on extension and retraction, following movement 166.
I had some smaller steppers lying around, so I prototyped this movement:
This works well! Some parts need to be tuned - the TPU doesn't grip the fridge all that well, silicone or a softer rubber would probably be better. But, I'm satisfied that this mechanism will work.
The above test uses a small stepper motor, an Elegoo 28byj-48. It's pretty big and heavy, and way overkill for this project. I bought some of these small geared motors. They seem almost ideal for this case, since they're small, low-voltage, and are already geared down to run slowly. Many small motors run at very high RPM, which is the opposite of what we want here.
I was considering two ways for the robot to move. The first, and my preferred method, is for it to always be in very slow motion. The second is for it to periodically move at roughly a snail's pace. For the first method to be practical, I'll need to be able to run the motor for short increments. Regardless of which method I go with, it needs to be pretty quiet so as not to be annoying.
I did a test with the small geared motors. First I verified that I could run them for a short period (~10ms), and that would be enough for the output gear to turn a little, and to have decent torque. This was pretty good, but a bit jerk-y, which could make some noise. So, I tried PWMing the motor at a high frequency (187kHz), and ramping the duty cycle up and down to smooth things out. In thisI ramp the duty cycle up to 37.5% max. It's barely audible with the naked motor (although it will be a bit louder with things connected to the motor). It has pretty good torque, I think that this will work well.
I'm pretty confident that these motors will work, so next I'm going to work on testing the movement mechanism using this motor.