This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Hacking

Hacking the bike

This won’t necessarily be actually hacking the bike, but rather more advanced upgrades.

1 - Battery Monitoring

The current battery monitor 5 bars is reasonably basic

I have built battery monitors in the past that have a better idea of battery.

I have started this, see Projects Battery Monitor

Purpose:

  • Show more accurate state of charge (SOC)
  • Count battery cycles, allowing for better understanding of longevity of battery
  • Remote viewing - display
  • Remote viewing - Bluetooth/WiFi

Basic

A basic version that just monitors voltage will already be useful. Capturing all data should be good to experiment with.

An interesting idea is to keep track of voltage over time.

Voltage

This is a good start. Nice thing about a bettery monitor is we can watch this over time rather than the instantanious reading. This means we can give you more real world approximation of remaining power

Current

Using a shunt, looses a tiny bit of voltage (usually about 0.1V) and allows you to measure very high currents. This kind of setup of setup is a little more complicated. If I can do it that allows me to not only view the current used but also put into the battery, should allow me to very accurately measure state of charge.

Display

A display can easily be used to show the current information we know about.

Bluetooth/WiFi/LoRa

Radio to connect to WiFi, uploading data. Bluetooth to see on your phone instead of display above. Or LoRa for access to data anywhere LoRa is. Could also use cellular for another cost.

2 - Bluetooth

Far Drive have an Android/iPhone app and Bluetooth dongle

Now technically, this is just a serial to bluetooth dongle - probably taking TTL serial data, some power and creating a bluetooth dongle. It was cheap enough that I just purchased it from China and will play with other connections later.

Installation

Plug to find

Note: The plug is actually connected to a lead that goes into the rear seat, but with only the transmit wire from the controller. I’m assuming this is to allow people to connect bluetooth dongles or similar and read values but not make any changes.

Bluetooth dongle installed

I connected it into the originanl plug, removing the wire to the rear seat, allowing full control.

Serial, Bluetooth, CAN

This connector is serial and power - and is used for this dongle and for direct connection to a windows laptop (although I still can’t source the software).

This bluetooth dongle, is just a regular bluetooth to serial dongle, and you could use others. Even the software on my android phone, picks up other bluetooth serial devices in the area.

Which serial, RS485, RS232, TTL is yet to be checked. I think it is RS485.

Next step will be to find the CAN bus addresses and messages. Some of them are pretty standard I think, such as speed - but not yet sure about voltage, and current.

The Dongle

It is easy to install and easy to use.

Security

Be aware there is ZERO security. If you leave this attached, then anyone with a laptop can change your settings. Use at your own risk.

Serial Protocol

TODO - I will be getting a dump of the data soon to analyse the information. I should then be able to extract the necessary data.

Points of interest

  • Making changes here are temporary until reboot. Save to keep them.
  • Changing things like motor direction - REALLY DOES - so be careful and lots of testing
  • Rated power on this bike, although 5kW is set to 8kW - no idea what effect that has
  • Throttle response from 0 (normal) to 1 (sport) has quite a significant shift. I found sport twitchy and suspect it will use a lot more battery power.
  • The protection voltage is set to turn off at 56 volts, and bakc on 58 volts. This will be worth playing with later, to help me find out how to stop the sudden power off bug when battery is low.

  • Voltage and Current, as well as throttle position are all here
  • I’m going to update my battery monitor to use these, read from here instead to help with capacity.
  • Capacity here seems to be related to voltage - just like the bars up the front, but here we get a whole percentage instead - this too could be easily displayed on my basic battery monitor.
  • Since throttle position is seemingly accurate here - the bug with the display showing speed instead of throttle position is in the display.
  • NOTE: The display is its own device, using the CAN bus (I think) to show speed etc. Not yet sure how to reprogram it, or better yet, replace it. (too hard to see in almost any sun, even with a black windshield).
  • Current - had a lot of fun playing with current, like taking off up a hill, or with my feet down, and watching the current move. Very useful.

I didn’t get any further into looking at what they call curves (I would have called graphs, dials, and curves graphs/charts).

Software

Found a link to the code, yet to be tested

See Also

3 - CAN Bus

CAN bus - the standard vehicle bus

CAN bus, very nice. Need to see what it does and what it provides. Could be ideal for adding devices / hacking.

Connection

  • Colours:
    • CANH = Gold and Silver
    • CANL = Blue and White
  • Connectors:
    • CAN/Speed Indicator
      • Pin 3 / 4 = CANH
      • Pin 4 / 5 = CANL

General Motorbike CAN bus

Questions / TODO

  • CAN, CAN 2 or CAN FD ?

CAN Stuff

4 - HUD

Heads up display

I was thinking of something REALLY simple.

Indicators

Simple LED indicators in the helmet. I think this would be better than an auto canceller with all the complexities.

Battery Indicator

Don’t want it always up, reduce glare etc. Possibly a button to show, or a led that flashes briefly as down to last 25%

5 - Logger

Log everything

To start with logging that includes:

  • Trip
  • Date/Time
  • Battery voltage start/end
  • GPS Location start/end
  • GPS location during
  • Battery voltage during

ESP32

A simple ESP32, that only comes on when the bike is on, would allow for logging of all trip information.

  • GPS - Location
  • Battery - voltage
  • Speed and Distance - can be just GPS

Then when it returns home, leaving it on long enough to reconnect to WiFi and send data. It could also do bluetooth real time.

This could be also a good way of connecting to the HUD

6 - Serial

Documentation shows Serial Port

The documentation talk about a serial port. Look at connection, and check what settings (baud et al) it uses, wheter it is 3.3/5 volt TTL, RS 232, RS 485.

And most importantly, see what it is telling us.

If I can get the software (looks like some Windows software) then I can read all the serial in and out and see what the protocol is.

Bluetooth

The bluetooth dongle, seems to connect to not just my android phone, but my laptop and desktop too. However I can’t seem to connect to it. ie, its probably not a standard Bluetooth profile. I should still be able to connect direct and see.

Windows

I don’t currently have a USB/RS485, ordered

Embedded CPU

The ESP32 I have has a RS485 connection, going to do a capture of all serial data from that. No idea the board rate, but most RS485 uses 115200 unless long distance.