Wednesday, March 9, 2016

Modifications to a kids' electric scooter

Last summer my mother-in-law found an kids' electric scooter in the free section of a local thrift store. It was lacking a seat and a battery. Back then I quickly made a new seat by laminating sheets of polyethylene plastic together, and also hacked up a battery from my airplane lithium batteries and a DC-DC buck regulator. It was driven almost daily throughout the summer, until it had to be taken inside in the fall.

It was obviously not really designed to be an outside toy, as was evident from the decay of all the decal stickers from just one summer outside. We don't have the space play with it inside though, so it shall remain an outside toy. However, while I had it in for the winter I decided to clean the whole thing. It was already dirty from the thrift shop in addition to a summers worth of daily play. I took the whole thing to pieces and washed everything carefully. This made it look almost band new, but I also wanted to update some functionality.

The scooter originally just ran current through a foot pedal switch directly from the battery to the motor. This is quite hard for the transmission as there is a huge torque spike when the pedal is pressed. It also requires connecting and disconnecting quite large DC currents through an inductive load. This has left quite clear marks on the contact surfaces inside the pedal. Without any speed regulation, the scooter runs slow uphill and fast downhill. Finally, there is no reverse implemented, which together with the rather large turning radius causes problems in tight corners.

I wanted to address all of the problems through an electric speed controller. The speed controller can either limit the current through the motor to an acceptable level, or it can start the motor up more slowly. In both cases limiting the amount of torque through the transmission. Also proper driving of the motor ensures that current is continuous and hence no arcing will occur. Finally, implementing velocity feedback control allows the scooter to run at constant velocity.

I didn't want to add any sensors to read the motor velocity, so I had to do some reading on sensorless motor velocity feedback control. The main idea is that when the motor is turning without current flowing, the motor acts as a generator producing a voltage proportional to the velocity. The only downside is that in order to measure the velocity, we have to cut power to the motor and wait some time for the magnetic energy in the motor to dissipate. The time it takes for the energy to dissipate is also strongly dependent upon the velocity of the motor (which could be used as a secondary velocity measurement as well).

After some bread boarding of the technique I designed and etched a PCB to put everything on. To keep things simple I implemented the drive using a single N-channel MOSFET, while the reverse function is achieved through a DPDT relay. I went with a silicon diode for the freewheel diode instead of a Schottky one. This is a trade-off between efficiency and the time the motor takes to demagnetize. A Schottky diode would be more efficient, but it would take some time longer for the magnetic energy in the motor to dissipate than with a silicon diode. Also, I had silicon diodes capable of handling the current already lying around. The layout of the motor controller is shown in the figure below, while the schematic is available here.

Layout of the motor controller, view from the top side. Nothing special. Mixed through-hole and surface mount components. Footprint of the relay coil drive transistor is inverted... So don't use this layout directly. I had to bodge the part upside down, as I was too lazy to re-do the board.
These new features also needed new interfaces. As the electronics will be running even if the pedal is not pressed, a power switch needed to be installed. Although the electronics could be designed to be very very low power, just the concept of an ignition key is cool which my oldest son found very exciting.

My oldest son showing the position where he wants the ignition lock to be mounted.

The ignition lock in position.
As the scooter will have a new reverse feature, a switch is needed to choose the direction. The switch also includes an indicator light to show when the ignition is turned on.

Direction switch mounted. My son in the background supervising my work.
What was also lacking previously was any kind of fuse. This would not really be a problem if the only components in the system are a lead-acid battery and a motor, but with the buck converter and a lithium-ion battery there was a non-zero probability of an electrical fire. In fact, the lithium battery was never really meant to be anything else than a quick hack to get it going, but I never got into replacing it with something better suited. For this upgrade, however, I got a sealed lead-acid battery and added a 5A circuit breaker. 5A should be enough for normal operation, but also low enough to protect the battery and the wiring.

Connecting power wires. The black block at the back is the 5A circuit breaker. The reset button of the circuit breaker is accessible through the underside of the scooter.

A better view of the inside compartment, showing the speed controller board. The motor is just dangling from the wires for testing. The off-white part in the compartment is the gearbox to which the motor connects.

Flashing the software. The speed controller is seen dangling from the wires. The scooter is too large to comfortably fit in my hobby room, so all of this was done in the living room and on the dinner table.
Taking it for a test spin. Works great!
The biggest requests by my son still has are to get flashing lights and a police siren. So those will be up next. He also wants a speedometer, which I think I'll do some time later using a 128x64 graphics LCD module I've had waiting to be purposed for something.

No comments:

Post a Comment