Monday, November 1, 2010

Pneu Scooter: Singapore Edition

Sorry for the cliffhanger ending to the Can I Finish Pneu Scooter in Three Weeks quintilogy. The truth is, I probably never had a chance, but if I didn't try then I wouldn't have made any progress until basically winter break. Instead, I got most of it done and decided at the last minute to stuff the whole thing into my suitcase (which was still only 47lbs) and take it to Singapore.

Oh yeah, I'm in Singapore!

I'm here on a month-long visit to the Singapore University of Technology and Design (Established in collaboration with MIT). If you're familiar with Singapore's universities...well, you've probably still never heard of SUTD. It's a brand new endeavor; an attempt to build a university focused on design, in a broad sense. The first entering freshman class will be in 2012, at an interim campus until the shiny new campus near the airport is completed. For now, though, we're at the interim interim campus, the third and fourth floor of a primary school.

I'm actually staying at NUS, since SUTD doesn't have any student housing yet. One of the first things we did was check out the NUS electric vehicle workshop:

The frame in the foreground is a work-in-progress three-wheel, two-seat, road-worthy electric vehicle. The two bubbly-looking cars in the background competed in the Shell Eco-marathon, and the one on the left (I think) won the Asia competition in Kuala Lumpur.

I should warn you that I am the worst tourist ever. Most of my pictures are of workshops, parts, stores, aluminum, or some combination of those nouns, such as "aluminum stores." Here is my one and only touristy picture from the entire trip so far:

And it's not even a good picture.

I mentioned that the SUTD interim interim campus is the third and fourth floor of a primary school. For obvious safety reasons, primary schools don't have fabrication equipment, so one of our tasks here is to create an interim interim shop. That is, a prototype of a "fabrication cell," a more-or-less self-contained design and fabrication space with modern rapid prototyping tools as well as the standard set of hand and power tools. The space in question was introduced to us as "the shed," which I thought was a little odd.

Oh, now I get it.

The shed, or as I've started calling it, Gecko Works, is a great place to escape from the faculty offices and actually do some hands-on work. Or at least, it will be, once we stock it with the essential machine tools. For now, it at least has tables, desks, an assortment of hand tools, and most importantly, air-con. In the weeks to come, we will be setting up a benchtop CNC mill and lathe, MIG and TIG welders, a drill press, horizontal and vertical bandsaws, grinders and sanders, and various other small tools. This is my first experience with actually outfitting a shop space from scratch, so I'm having fun.

Shop space is one component of making stuff. Another is parts (and raw materials). I figured the best way to get motivated to find parts and raw materials sources in Singapore would be to intentionally leave a few of the critical pieces I would need to finish Pneu Scooter in Cambridge. Actually, I just forgot a lot of stuff. So, some of the last two weeks has been spent tracking down good places to get stuff.

First of all, Hobby King still works in Singapore. In fact, it might work better, since much of their shipments pass through Singapore anyway on their way to the US. This takes care of things like radios, brushless motors, ESCs, wire, and of course, cheap lithium-polymer batteries. It was those that I was particularly after, since airline regulations (justifiably) prohibit me from traveling with homemade lithium-ion battery packs. So, I ordered up some of the "long" Turnigy batteries that I've been eying for scooter use ever since they were released.

At 111Wh (22.2V @ 5Ah) and $51.26 each, these batteries represent one of the best values on the market ($462/kWh). If only lithium polymer didn't have such dramatic failure modes, I would totally use these for everything. And they fit so nicely into Pneu Scooter's battery bay. Maybe some day I will overcome my fear of fiery death and use these permanently.

I also neglected to bring any polarized connectors with me, but luckily Singapore has at least two serious RC hobby stores, Rotor Hobby and Singapore Hobby Supplies. Don't expect Hobby King-like deals, though; the prices are on-par with what you would pay at a hobby store in the US (i.e. really freaking overpriced).

During my random scouting, I also stumbled upon an electric bike store. Since Singapore is closer to the source of mysterious Chinese brushless e-bike controllers, I should not have been surprised to find some in little baggies here:

I almost don't want to know what's inside.

In the same general area, I also found a very good, if oddly-named, hardware store:

And there's the (in)famous Sim Lim Square electronics tower, full of pushy salespeople trying to sell you mobile phones. It's kinda like a really big Radio Shack. Buried in there, though, are some decent electronics supply shops, where I was able to get soldering equipment, connectors, etc.

In fact, the only thing that I find sorely, horribly, frustratingly missing is a place to buy raw freaking material in small quantities. We are so totally spoiled by McMaster-Carr and Online Metals in the US that I haven't ever really considered where I would go to find aluminum chunks elsewhere. The concept of web stores in general is lacking here. Mostly, you go to a tiny shop with aisles just big enough to shuffle sideways through and annoy the owner until you get what you want. I actually found a shop like this specifically for aluminum:

It was closed...

I was seeking some 1/4" thick plate from which to make the part of Pneu Scooter that attaches the Razor scooter neck to the custom deck. You know, the bane of BWD. I wanted serious overkill plate stock this time, instead of sheet metal. I went back to Teck Cheong Aluminum during business hours to find that they would only sell aluminum in standard-length stock, i.e. 20-foot bars. So, I did what any reasonable person would do...

I accidentally the whole aluminum bar.

Pound for pound (all 30 of them), it's actually a very reasonable deal @ $1.81/lb. Compare this to the nearest product at Online Metals ($3.25/lb) or McMaster ($6.42/lb). Only, you have to buy enough aluminum to last through the next two zombie apocalypses. Oh well.

Back to Pneu Scooter.

Before I get to finishing the front fork and building my aluminum fortress, though, there were some lingering controller issues to be worked out. And even before that, some battery wiring. I decided to try something new: a precharging circuit for the controller. I am a bit tired of arc eroding my connectors (BWD's first connector had almost no metal left when I replaced it). The problem is that extremely high discharge 10-12S battery packs and oversized bus capacitors on the controller lead to major inrush current. There are all sorts of tricks for limiting inrush current, but precharging the capacitors through a resistor is one I'm familiar with from the Cap Kart.

Rather than putting a bulky contactor on the scooter, I opted for a two-connector system. They share the same positive lead, but one has a negative lead which passes through a 47Ω power resistor:

The precharge resistor.

The resistor is sized so that the precharge circuit can actually power-up the logic stuff (microcontroller, XBee radio) but it would have an unpleasant time trying to drive the motor. I found a wonderful back-to-back configuration for the Deans connectors that made wiring very simple, which you can see on the right-hand side of this photo with the controller, fuse, and precharge circuit:

The order of operations for power-up would be to plug in the precharge connector, followed shortly by the main connector. It's not necessarily user-friendly, but it will limit progressive connector destruction. In the process of wiring everything up, I came up with a simple plan for waterproofing which will probably have to wait until I'm back in Cambridge. 

Here's the part where I complain about motor controllers and how they are impossibly frustrating to build and how I should just buy one, and then realize that the ones I could buy for a reasonable price all suck in one way or another and that I am simply doomed to troubleshooting my hardware because it's still ultimately more effective. (Sound familiar? I went through the same cycle with BWD's 3ph Duo, which ultimately became a fairly reliable controller. I probably just need to stop complaining and accept the fact that hardware will cut you.)

The problem I was having back in Cambridge was that the program on the STM32 chip would spontaneously stop running, but the PWM peripheral would keep going with its last state. This is particularly bad for a brushless motor, since it just locks the drive up. At speed, this would be disastrous for both human and hardware. To take care of the safety aspect, I added a watchdog timer that resets everything if the control loop fails to run. This doesn't really address the root of the problem, just the symptom. 

As it turns out, much of the problem went away simply by actually setting the Hall effect sensor timing properly. (It was left in a state of "close enough" before, which was actually almost 45º off.) I still don't think this solves the problem, but it does point to possible avenues of further exploration. Is it sensor glitching? Is it the speed estimator? Do I need to add some more error handling? All possibilities. For now, it at least runs up to full speed and survives the less-frequent watchdog resets without destroying itself:


The motor itself seems quite capable and efficient. At 33V, 100% throttle, with the timing set correctly for sinusoidal commutation, it only draws 1A no-load. Also, the external Hall effect sensors seem to be doing their job quite nicely, despite the imprecisely-cut magnet strips. In general, the subsystems all seem to be working well. 

I'm hoping the remaining problems are pure software, and not some horrible hardware-triggered software glitch. Even so, it'll take a few more controller tests and tweaks before I'm confident enough to road test it.  But, I do plan to keep working on it a bit here for the simple reason that, unlike Cambridge in November, it's hot here and I can actually ride it outside....maybe.


  1. Your lucky, hobbyking does not even work in Hong Kong!!! I have no clue what's going on!

  2. Many of the packages I receive from them are from the Hong Kong warehouse. Maybe they are "for export only?" That sucks, though.

    Their express shipping goes through Singapore Post, so I don't understand why it takes the same amount of time to get to my address in Singapore as it does to get to the US. But, at least I get it eventually.