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
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.
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
I quite like the below table from http://www.gcaudio.com/resources/howtos/loudness.html (No emphasis added)
|Power saw at 3′||110dB|
|Sandblasting, Loud Rock Concert||115dB|
|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:
- 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)
- Another 5V rail for the GSM module (this draws 2A when transmitting apparently)
- Another 5V rail for the Logic side of things on the front headlights
- Another 5V rail for the actual LED’s (they way that they are wired up they draw a fair bit of current
- 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.
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.
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.
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