Candas1 / Hoverboard-Web-Serial-Control

19 stars 14 forks source link

Hoverboard-Web-Serial-Control

Web tool to control hoverboard, log and plot output data through a simple webpage.
The tool doesn't need installation and is accessible via this link.
https://candas1.github.io/Hoverboard-Web-Serial-Control/

It works with USART serial protocol and USART DEBUG in following firmware:
https://github.com/EmanuelFeru/hoverboard-firmware-hack-FOC

The APIs are only supported on chromium based browsers like Chrome or Edge.

From a computer, you can use both WEB Serial API and WEB Bluetooth API.
From mobile, only WEB Bluetooth API is supported (not supported on IOS).

APIs

WEB Serial API:

The tool is using Web Serial API to connect to the hoverboard through a COM port of your PC(FTDI,Bluetooth 2.0,...).
Select the required baud rate, click on connect button, and select the COM port corresponding to your FTDI/Bluetooth 2.0 device(e.g. HC-05).

WEB Bluetooth API:

The tool is using Web Bluetooth API to connect to Bluetooth BLE devices (e.g. AT-09, HM-10...).
Make sure you configured your BLE device with the right baud rate. Click on connect button and select the right BLE device.

Serial over Classic bluetooth is not supported by this API yet but might be implemented in the future.

Terminal

This view let's you visualize incoming Ascii and Binary messages:

If stats are enabled, you can visualize following information:

image

In Ascii mode, commands can also be sent (can be used with debug protocol of FOC firmware)

Receive - Ascii:

If hoverboard is communicating through ASCII Serial debug (parameter DEBUG_SERIAL_USARTX should be enabled), messages in following format will be parsed and displayed in the log and in the chart.
in1:345 in2:1337 cmdR:0 cmdL:0 BatADC:0 BatV:0 TempADC:0 Temp:0\n
Other messages (first word not containing ':' ) will be simply displayed in the log.

Receive - Binary:

For use when parameter FEEDBACK_SERIAL_USARTX is enabled in FOC Firmware.
Feedback is received through this Binary Serial Protocol.

Messages are being parsed and checksum is validated to discard transmission errors.
Parsed data is displayed in the log and in the graph.

Chart

This view let's you visualize a plot of received values:

If subplots are enabled, each value will be visualized on a different axis.

image

Control

This view will display a virtual RC remote to control the hoverboard if you use variant USART or IBUS.
You can use the mixer setting to assign the desired joystick.

image

Protocol - Usart:

For use when parameter CONTROL_SERIAL_USARTX is enabled in FOC Firmware, with the USART variant or DUAL INPUTS.
It will not work with parameter SIDEBOARD_SERIAL_USARTX as it's a different protocol(See Hovercar protocol).
The tool sends binary commands to control the hoverboard (Speed/steer) via the virtual controller with this Binary Serial Protocol.

Protocol - Hovercar:

For use when parameter SIDEBOARD_SERIAL_USARTX is enabled in FOC Firmware, with the Hovercar variant, USART variant, or DUAL INPUTS.
The tool sends binary commands to control the hoverboard via the virtual controller with this Binary Serial Protocol:

Protocol - Ibus:

For use with the IBUS variant or DUAL INPUTS of FOC firmware.
The tool sends Flysky Ibus frames to control the hoverboard via the virtual controller:

Please note that FOC firmware is only using joytick values.

This mode is not working with BLE yet because of limitation of message size (20 bytes). It will probably be fixed when Chrome team implements Exchange MTU

TODO