Last weekend we had loads of fun. We got to join most of the parts that comprise the SoapBox’s control and power system and we fired it up. No smoke (this time)! 🙂 As usual, there’s a lot of video for you to watch.
NJay brought the prototype of the power electronics H-bridge he so lovingly hand-crafted for us, and he tested it on site with a small DC motor from a Meccano set. We didn’t want to push too much current so we avoided the 250W trike motor in the beginning. He used his own homebrewed I²C Master console to verify that the bridge was working properly, which Manuel was more than happy to explore.
Then it was time to connect the Freerunner board as the I²C Master and we did a simple up-and-down power cycle with that small motor. Now, the motor is rated for 6V and the battery is supplying over 24V, so we kept this test to around 20% of PWM duty cycle to avoid burning the motor.
Ok, everything seems to be working. It was time to launch the full control program and play with the trike’s joystick. Here the PWM duty cycle limitation was not present, but I figured it was safe to risk it because the motor was not loaded and the joystick would allow us to reduce power if we wanted to. In principle…
By this time is was very apparent that something was wrong; the motor was responding in a very jittery way, and the software got completely locked up. I found some accidental floating point truncation errors in the code, and we repeated the test.
Nope, that won’t fly either. Although the software was behaving a lot more linearly, it still got stuck in a bad place when we pushed the motor to the maximum speed. After some mental review of the situation I decided that the problems where due to electric spiking or induced noise on the I²C bus introduced by the motor. After all, this was a DC brushed motor and it was being driven far beyond it’s specifications; it is only natural to assume it was sparking like crazy on the inside.
We tried the test again after attaching a 100nF capacitor to the motor’s terminals, and yes, it improved a lot, but it was still a bit glitchy. As this point I ignored the looks on their silent faces which screamed “your software is still buggy!” and decided to test with the Trike’s 250W motor. And I’m glad that I did.
See? No more interference, no more I²C bus lost packets and retries, no more software lock-ups or exceptions. It’s this kind of multi-disciplinary problem that makes embedded systems development such a great domain to work in. 😉
Obviously, the software must be made more robust in order to resist I²C losses and errors. But we were quite happy to see the wheel spin at the command of the joystick.
Not bad for a single day’s work (plus ten months of R&D)! 😉 Now we have to build the 2 new power bridges that NJay has redesigned from this initial one, and we’ll be ready to test the full 2-wheel system. Can’t wait for that one!
Oh, and there’s also that minor detail of the motor running backwards, but that’ll be all sorted out when we have the 2 bridges. 🙂
Happy hacking, and see you on the next development sprint!