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 😛