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!
Vasco Névoa
December 7, 2011
Other progress made in this iteration that I forgot to mention:
- NJay fixed an I²C bug that prevented the Freerunner to boot when connected to the H-bridge.
Lessons learned:
- Python, like all loosely-typed languages I suppose, has its own idiosyncrasies when it comes to dealing with math; we have to “cast” a variable into a floating point type by adding a “.0″ during initialization or even add a “* 1.0″ to make sure it doesn’t get truncated into an integer.
Vasco Névoa
December 7, 2011
Oh, and some regress also happened in this iteration:
- I burned the DC-DC converter that feeds the freerunner and the joystick YET AGAIN!!! ugh…. well, NJay is going to add a diode to prevent me from connecting it wrong ever again.
But I wasn’t the only one to get the power polarity switched…. NJay also got to inadvertently test the power bridge resilience in case of polarity inversion of the power source.
And it withstood the test just fine with just a little warming up!!!!! Hoooray for NJay’s power bridge design!
Njay
December 9, 2011
You still forgot to mention that part where an I2C bus signal tiny pad came loose from the free-runner PCB and we had to solder a wire on an even smaller tiny connector pad to reach that essential signal again…. twice
Vasco Névoa
December 9, 2011
heheheh…. sorry, I was the victim of a selective memory episode. You’re right, and I thank your patience and soldering skills for getting me out of that hole!!!
Njay
December 9, 2011
Well, it was you who soldered it the 2nd time, so I guess your skills’re better than mine