Close

Fix it in Software

A project log for Kubik M0

An easy to build spider robot kit.

dehipudeʃhipu 07/13/2020 at 21:323 Comments

I've been struggling a little bit more with the safe mode problems. Even with the capacitors, the battery simply can't give enough current at startup to handle at the same time the servos twitching, the capacitors charging and the microcontroller requiring that minimum 2.7V. The previous robots worked, because I just happened to use better quality servos that twitched less at startup, but I want this design to work with the crappiest and cheapest servos you can find.

Turns out there have been similar problems with CircuitPython on the SAMD51, and now the bootloader for SAMD51 has a loop that pauses execution until the voltage stabilizes over the required threshold. I could port that to SAMD21 as well, but I found an easier solution, and one that will also improve the life of robot on a single battery — simply lower that threshold. SAMD21 can work with voltage as low as 1.6V. CircuitPython defaults to 2.7V because the boards that use an external flash chip require that voltage for the flash to work properly — but I don't have external flash chip on my robots! So I submitted a pull request that allows to change this threshold in the board definition, and I also lowered it for the #PewPew Standalone and #PewPew M4 boards — they will live longer on battery now!

Testing shows that this solves the problem, so now I have to find another excuse to keep avoiding programming those robots.

Discussions

Bharbour wrote 07/16/2020 at 02:26 point

The inrush current on a stopped or stalled DC motor can be very large, commonly 5X the operating current. It would not surprise me at all of powering up servos would show a big current spike. The inductance of a DC motor is not that large, so the rate of rise would be much faster than a solenoid.

  Are you sure? yes | no

agp.cooper wrote 07/15/2020 at 05:18 point

Looking at the voltage trace it does not look like a servo voltage spike problem.

On power up a solenoid has minimal current consumption. It is on power off that it has a voltage spike.

A rechargable battery in my mind should have absolutely no problem absorbing any voltage spikes from the servos.

I assume that the battery's internal resistance is practically zero (i.e.not some cheap carbon battery)?

It rather looks like a voltage regulator "start-up" problem. I was switching a 7805 for a PROM programmer with no problems. I decided to change to LM317 and to my surprise the voltage settling time was orders of magnitude slower. I was looking at the LM317 as it has a much lower bias current.

Anyway, it may be worth looking into? I am not an expert here.

Regards AlanX

  Are you sure? yes | no

deʃhipu wrote 07/15/2020 at 07:41 point

I am pretty sure the issue is caused by the servos, because with the servo power disconnected (or only six servos connected instead of eight) the problem goes away. Perhaps it's not the motors, perhaps it's the additional capacitors inside the servos, or something like that.

  Are you sure? yes | no