Sunday, January 27, 2013

ScooterPuter Integration

When I went to put everything together, the display code turned out to still hog too much latency and cpu.  So very quickly I found that I needed to lower the priority of the display code.

After that I tested the whole thing, and it did not have as much power as the old controller had.  The issue is that the PWM Amp would turn off fairly quickly at full power (i.e. before the scooter could even get up to speed).


I had selected 30a 24v dual half-bridge PWM Amp, which seems like plenty.  However 1st pass did not have enough power transferred to the motor.
Some measurements indicated that the motor was lower resistance than expected, and run at a much lower voltage than expected.  So 400w (the motor size) is 40a @ 10v, but 80a @ 5v for low speed operation (since back EMF raises the voltage).

Rewiring for second pass allowed contacts to touch causing 1 pwm amp to explode.  (audible pop, magic smoke escaped).  I realized I could use ½ bridge instead of full bridge to double the power, then add the third ½ bridge for 3x the current of the original system.   70a should allow for plenty of power


After everything worked there was still the issue of putting it all tightly together.  Although everything was tightly packed, there was so little space for wire bends that it created stress on the system.
System was sufficiently complicated that it took a couple of hours to remember what did what, so final packaging awaits more time.


Result
Latency (caused by display) stays under 100ms in all cases.  This limits ability for digital current limiting, but the PWM Amp is supposed to do this anyway.  To limit current, I added software smoothing of voltage command.  This caused smoother accelerations and limited large current surges.


ScooterPuter Software Development




Since I knew this would take a lot of work, first I built a hardware in the loop simulator.

I used Proto Shield for the leds, pots resistors etc.
Add all the Analog Inputs necessary
Speed control
Tortoise/Rabbit control- moderates speed control for indoor vs outdoor use.
Use LED’s for information
Power +
Power –
Loop timing

This allowed me to get all of the code working without blowing anything up.
I also took the time to setup configuration control.

I used TortoiseSVN & ssh & existing Ubuntu server.  Took a bit to setup, but works.
Allows use of throw-away code.  I Checked in each working change, then I try new ideas and throw it away if it doesn't work.

However, it turns out its easier to check into Google code than you own Ubuntu server!


Right away I ran into problems with the Display Shield.  It was meant for pretty graphics, not useful work.  I had to write my own 7 segment display.

I also found out that the driver code for the display locks out interrupts way to long.  It was bad enough, it affected the HIL simulator.  It also affected the A/D converter.  I tweaked the driver code to minimize the lock-out time.  I tried various other tricks (like nested interrupts) but the Arduino did not support them. 


 

ScooterPuter Design Notes

Just the notes please....

Seeeduino Mega
I chose the Seeeduino Mega because I was concerned about how much I/O the base model had.  It turned out this was a great choice because the base model is really limited.


Compatible with Arduino shields.
Has tons more digital output/input lines
Easy to control more than one shield.
Has 4x memory (128k vs 32k)
Real application has a lot more code than “demo” app.

Even doing a simple project, like my remote/relay project, you run out of I/O.  With the mega there is so much I/O that its no problem.  Turns out that the extra PWM out really makes a difference.

Arduino's use PWM for any output, and also for periodic tasks.  If you want a "fine" control you have to tweak the PWM.  Since the PWM timers are also used for the delay, this quickly becomes a problem.

Not a problem with the Mega, it has more of everything.


Display Shield
Color LCD display
Comes with software
Just remapped pins (because its Shield #2) and it worked.
A lot of fairly difficult soldering (has a bunch of really fine pitched soldering).
But worked 1st time
Shield did not have pass-through (for stacking) but was kit, so it was easy to just use the right connectors.
http://www.nkcelectronics.com/rgb-lcd-shield-for-arduino-65k-color-k65.html


Proto Board
Comes with stacking sockets (some of which I used for other Shields)
Use proto board to remap pins to allow Relay Shield to stack on top of display shield.
Proto board also drove the external PWM amp
Used proto board for system simulator.

Motor PWM Amplifier
Used Robot Power 30a Simple-H PWM Amp
Robot Power specializes in PWM Amps for combat robots.  (These motors are similar in size to the 400w mobility motors).
400w motor, is 20a @ 20v
Board has two half bridges
Because Combat Robots reverse directions rapidly.


Relay Shield
Cheap and really isolates output.
Has limitation of slow switching (vs ssr)
Board layout not rigged for stacked shields
What's with this?  Relay board uses only most of the Digital I/O.  Have to de-solder the stacked pins (some 30 pins) and replace with sockets.  Also have to tie power to Arduino bus.
For so much time saving, its very cost effective.



Sunday, January 20, 2013

ScooterPuter

Mobility Scooter

I end up spending a lot of time fixing Mobility scooters.  In part because I could (I had worked for a year on motor controllers), in part because I could use the result.  The biggest benefit was a substantially increased understanding of how they work

Here are some pictures:
The HIL simulator:

The pre-packing project:

Parts:
Seeeduino Mega ($43)
Relay shield ($20)
RGB LCD Shield for Arduino 65K color KIT($20)
RobotPower Simple-h Bridge ($50)

source:
http://code.google.com/p/scooterputer/