Thank you NZ Post

Pressies arrived today,  GSM module in blue and the wireless serial modules in yellow.

20130523_192727 (Copy)

Stay tuned


Progress Update – 2nd Attempt

Ok so I already typed out like 1500 words, added pictures and then WordPress went and published a blank entry and wiped all the autosaves assuming that as it was published I was finished with it. Honestly there are no good words to describe this situation. Anyway 2nd attempt

So its been a couple of weeks since the last update and really now most of the big stuff has been done and all that is left is tidying up all the small ends and adding more functionality. For the first time since the guts were ripped out of the stock controller the scooter actually runs without being attached to a plethora of cables and a laptop

Firstly a Joystick has been added to replace some of the original buttons.


Forwards and backwards changes speed modes up and down whilst left and right switch on the indicators. the two buttons on the back switch on the rear taillight (I’m still undecided as to whether Ill put the original headlight back on) and sound the rather wimpy buzzer that was Plega’s excuse for a horn.



These were all wired up and then sealed in a PCB box mounted to the frame with some trusty printed trolley mounts (TPTMs). Cabling from this runs down the side of the frame into the new control box (which has also been mounted with some TPTMs) where before connecting into the MEGA they are passed through a 74C14 hex schmitt trigger

20130521_072529 (Copy)

This was supposed to but doesn’t really fix some of the inadvertent ISR calling issues. Suffice to say it works okish enough that it is usable.

Next up is the replacement horn.

20130521_072644 (Copy)

The original one was so pitiful that I didn’t think that it would be right to have that as the only method of politely asking members of the public to please step aside. Enter a 125dB replacement  with the option of 4 tones, fire, police,  ambulance and air horn. A cut aluminum plate served as a mounting bracket for the horn whilst a printed bracket mounted the controls

20130521_072556 (Copy)

20130521_072619 (Copy)

I quite like the below table from    (No emphasis added)

Snowmobile, Motorcycle 100dB
Power saw at 3′ 110dB
Sandblasting, Loud Rock Concert 115dB
Pain begins 125dB
Pneumatic riveter at 4′ 125dB
Even short term exposure can cause permanent damage – Loudest recommended exposure WITH hearing protection 140dB
Jet engine at 100′ 140dB

Part of hooking all this up meant that the power supply system of the scooter needed to be designed, laid out and then assembled. As the scooter runs off 24v stock either I needed to convert that down to 5v and 12v or just run off one battery and convert 12v down for the parts that need it. This has the advantage of being easier to implement but has the disadvantage of loading the batteries unevenly. I’m not sure how much of a problem this will be in the long run but at the moment it will suffice. I may switch between which battery I draw the 12V off or even buy a 24v to 12v system designed for 24v trucks but that’s all in the future. At the moment I’ve tapped off the battery on the passenger side being the one that actually has a negative terminal with no potential difference to ground and put a couple of 30A connectors in so the whole lot can be disconnected. Ultimately the following will be connected:

  1. A 5V rail for all scooter control stuff in that main box, (2 x Nanos, 1 x Mega, some relays (not all of which will be energized at once) a GPS receiver, a wireless serial transmitter and some other misc components)
  2. Another 5V rail for the GSM module (this draws 2A when transmitting apparently)
  3. Another 5V rail for the Logic side of things on the front headlights
  4. Another 5V rail for the actual LED’s (they way that they are wired up they draw a fair bit of current
  5. A 12V rail for the horn


Not all the regulators have been installed so far as I’m still waiting on some to arrive from china but the box has been mounted (once again with some TPTMs). The missile switch is to power the lot of it on and off.

20130521_072544 (Copy)

All of the cabling to the original scooter controller and the front lights has also been terminated in locking connectors which gets all that going, as well as the connector for the LCD which will display the status and speed etc and the connector for the GPS antenna.


A couple of brackets were printed for the mounting of the GPS antenna and the GSM antenna on the rear handlebar of the trolley. After a trip to Jaycar for some parts ill run the cabling for the GSM antenna down to the control box and mount a connector on the outside for that. Im still waiting on the GSM module from Portugal but once that arrives it will be mounted in some free space in the control box and wired alongside the GPS receiver into the same Nano.

One problem that has been solved was the lack of niceness between the original control board and the Nano that was supposed to be passing the throttle values through to it. To recap: In its original configuration the throttle lever was connected to the original controller with 3 wires, 5V, GND and some form of data line. Putting a Multimeter on this data line revealed that when the throttle was in the neutral position it read 2.5ish volts, at full reverse .5v and at full warp speed ahead 4.5v. I had originally hoped that it would be a simple matter of connecting the output from the throttle lever to an analog pin on the Nano, connecting the input to the controller to a PWM pin and reading the input, mapping it and outputting it. Not the case

When it was wired up as such it had a fit, beepers beeping lights flashing and a complete refusal to do anything. After reading the fault codes an enigmatic “throttle calibration error” was revealed. Calibrating the throttle did nothing to fix this. I ripped the throttle apart (translation unscrewed it from its mounting) and had a look at the components. A hall effect sensor with its output coupled to an amplifier reaffirmed my assumption that the whole thing was analog and so I reasoned that the PWM output was upsetting the scooter. A capacitor / relay combo added to the output didn’t help in smoothing / fixing the problem so I had to go down the digital potentiometer route. Fortunately these had arrived so after hooking it all up and tweaking the code to push the analog readings to the MCP41100 it was all powered on.

20130521_072520 (Copy)


No worky, throttle calibration error… Conceding that it wasnt likely to work in its reworked configuration without being calibrated I went through the calibration routine. Powered off, Powered on, Worky 🙂

After intensive testing confirming that it was all working properly (read “driving it around the lounge for a bit”) I parked it and had another fiddle with the code. End result, sending a value from 0 (flanking speed) to 126 (am I even moving) through the serial port makes the scooter go forward. 127 and 128 exit serial remote control mode and restores control to the hapless victim currently in the scooter. 129 to 255 makes the thing go backwards.

I’ve also been working on wiring up the LED headlights. These had previously been working but just needed to be cased up and have all the cables run and terminated with connectors. 40 RGB LEDs are mounted in a printed case with a PCB for current limiting resistors mounted behind the front panel.

20130521_072702 (Copy)

In the control box the connection for each colour is connected to ground via a mosfet controlled using PWM on an Arduino Leonardo. This gives me the ability to mix whatever colour I like in whatever sequence I like. At the moment 4 modes are programmed to emulate Police, Fire, a Wide Load pilot vehicle, a doctors courtesy light (green flashing) and just plain white for a standard headlight look. A 8 x 2 LCD displays the current state as well as indication whether the LEDs are active both of which are controlled by the black and red buttons (in the photo of the horn controller) above.

The only other area in which work has been made is in the software. Minor updates have been made in the code to reflect each hardware change made but I’ve also been fiddling around with a processing sketch (for computer remote control) as well as an Android application (for mobile remote control). The processing sketch needs a lot of work done on it but the Android app (screenshots below) is pretty much there. Basically this gives me the option via TXT message to emulate any button press on the control panel, to query the state of any of the LEDs, to remotely lock and unlock the scooter as well as locate it using GPS and finally to push throttle values to control the speed remotely. Once the GSM module and wireless serial module arrive ill hook them up to the Nano that handles the GPS module. This will also be connected to the other Nano and the Mega and will handle pass any messages destined to these devices from either TXT or the serial link over to them. The basic idea is that TXT gives me long distance control albeit at a higher cost and much higher latency whilst the wireless serial link will give me shorter distance cheaper lower latency control.





Ultimately if I’m able to work out some solution to control the steering Ill add this as well giving full remote control.

That’s all for now, more when more parts arrive

Scooter control updates and yes there is a lot of room in the back of a Suzuki Swift

Last week a group of us took the opportunity to have a long weekend down at Raurimu. Thankfully the base of the scooter fit in the back of the car so that came down as well so that we could work on the controller hardware and software.

This first photo shows the original controller PCB that was mounted behind the control panel on the handlebars. Originally there were 8 buttons on the control board that were multiplexed into the I/O expander using 5 ports and a connection to GND and 5v. The seven white cables then head from these connection points over to the relays shown a bit further down which emulate button presses. The orange cables are connected to the anode connection for all the status LEDs. These head to the Mega which reads whether they are high or low and therefore which LED’s would have been lit up. The other three headers on the board are for all the control information to the controller in the big black box at the base of the scooter, a connection through to the lighting system and a connection for the throttle, buzzer and key switch to turn the scooter on.


This next board houses several things, firstly the relays to emulate button presses on the right. These are controlled from the Mega via a ULN2803 Darlington array. Moving towards the left we have 2 x Ardnuino Nanos. The first is to go between the throttle and the previously shown scooter control PCB. This will enable us to do custom throttle mappings and also remotely control the throttle via a serial connection. The next Nano across is connected to a Venus GPS receiver (the red board) via a level converter (the yellow board) as the GPS is only 3.3v tolerant. This Nano will take the current position from the GPS and pass it through to a cellular modem to allow remote tracking of the scooter. It also has a connection to the Mega to shut down the scooter if a special command is received via TXT.


This next picture shows the Mega shield, not much to it, just the input and output connections to the scooter control PCB, a connection for a serial LCD, GND and to a relay that will replace the key switch. Also on this we have a header connecting to an arcade joystick and a couple of buttons. Moving the joystick up and down will allow us to shift through the 4 speed settings (a sequential shifter as it were) left and right will switch the indicators and the two buttons will switch the headlights and the horn. All these are connected to hardware interrupts on the Mega.


Once we had all this connected Matt wrote some code that allowed us to go through and check that it was all hooked up properly. Relays were toggled via the serial interface and the LED statuses were passed back via the same. Button presses and joystick movements also correctly triggered the proper relays with the appropriate functions performed by the scooter, i.e it got faster when you shifted up, slower when you shifted down.


The rest of the work on it that weekend was based around troubleshooting code and adding more functionality. A configuration menu was coded allowing you to calibrate the throttle positions and the LCD was connected allowing scooter status to be displayed there.


This week I’ve been working on boxing it all up. After working for about 5 hours on each Tuesday and last night things are about here.




All of the external connectors have been mounted into the ends of the case and all but 3 have been wired up. And yes it still does work. Mostly. A Schmitt trigger was added to the mix to debounce the button and joystick presses although this is still to be connected. The relay replacing the key switch has been added to the same board and this has been confirmed to work by sending either a “RI” command to switch on or an “RO” command via the serial interface to switch off. There are some issues with the Nano that does the throttle pass through in that it plain doesn’t work… The throttle has three connections to the scooter control PCB, GND, 5v and a return signal with a varying voltage depending on the position of the throttle lever. The service manual specifies 0.5v for full reverse, 2.5v for a neutral position and 4.5v for full speed ahead. The Nano sits on that signal line, reads the varying voltages via ADC then outputs the same on another PWM pin. Theoretically this should just pass through whatever is coming in and output it but for some reason whenever you power the scooter on it throws a fit and starts beeping at you. Reading the fault code confirms that it thinks that there is a throttle lever malfunction. Bypassing the Nano and returning to a stock connection resolves this problem.

I’m not sure whether this is a mapping issue in that the Nano isn’t outputting the correct value for any given input value, whether there is some start-up check that the controller does on the throttle (although I’m not sure how this would work considering all the throttle consists of is a hall effect sensor and an op-amp) that is failing or whether it is because the Nano is outputting a PWM signal which is upsetting the scooter controller. I’ve ordered some digital potentiometers to bypass the PWM issue should they be needed but we’ll keep fiddling around with the mapping and setup on the Nano in the meantime. It’s really times like these you need minties a digital oscilloscope 😛