mirror of
https://github.com/EFeru/hoverboard-firmware-hack-FOC.git
synced 2025-08-04 18:14:28 +02:00
Updated Variant USART (markdown)
@@ -1,19 +1,36 @@
|
|||||||
This variant can be used to control the board from another board(e.g. Arduino, ESP32, ESP8266,RASPBERRY PI) or a computer via a serial protocol.<br />
|
This variant can be used to control the board from another board(e.g. Arduino, ESP32, ESP8266,RASPBERRY PI) or a computer via a serial protocol.<br />
|
||||||
The example [Arduino sketch](https://github.com/EmanuelFeru/hoverboard-firmware-hack-FOC/blob/master/Arduino/hoverserial/hoverserial.ino) will send commands and process the feedback.<br />
|
The example [Arduino sketch](https://github.com/EmanuelFeru/hoverboard-firmware-hack-FOC/blob/master/Arduino/hoverserial/hoverserial.ino) will send commands and process the feedback.<br />
|
||||||
Those commands are send as binary frames with following structure:<br />
|
|
||||||
- Start frame : 0xABCD as unsigned int16
|
|
||||||
- Steer : -1000 to 1000 as signed int16
|
|
||||||
- Speed : -1000 to 1000 as signed int16
|
|
||||||
- Checksum : XOR checksum as unsigned int16
|
|
||||||
|
|
||||||
The FOC firmware will discard frames that are not starting with proper start frame and not ending with correct checksum.<br />
|
You can also test this variant with following [Web Tool](https://candas1.github.io/Hoverboard-Web-Serial-Control/), it let's you control the board and trace feedback values.
|
||||||
A timeout will be triggered if no correct frame is received during the time specified with parameter SERIAL_TIMEOUT in config.h (160ms by default).<br />
|
|
||||||
|
|
||||||
## Wiring:
|
## Wiring:
|
||||||
* Connect blue wire to RX, green wire to TX and black wire to GND of Arduino on right sensor cable(shorter)
|
* Connect blue wire to RX, green wire to TX and black wire to GND of Arduino on right sensor cable(shorter)
|
||||||
|
|
||||||
⚠ Red wire from sensor cable delivers 15v !!!
|
⚠ Red wire from sensor cable delivers 15v !!!
|
||||||
|
|
||||||
|
## Input:
|
||||||
|
Those commands are send as binary frames with following structure:<br />
|
||||||
|
- Start frame(unsigned int16) : 0xABCD
|
||||||
|
- Steer(signed int16) : Steer or Brake(hovercar) with range -1000 to 1000
|
||||||
|
- Speed(signed int16) : Speed or Throttle(hovercar) with range -1000 to 1000
|
||||||
|
- Checksum(unsigned int16) : XOR checksum
|
||||||
|
|
||||||
|
The FOC firmware will discard frames that are not starting with proper start frame and not ending with correct checksum.<br />
|
||||||
|
A timeout will be triggered if no correct frame is received during the time specified with parameter SERIAL_TIMEOUT in config.h (160ms by default).<br />
|
||||||
|
|
||||||
|
## Feedback:
|
||||||
|
Following information is sent back to arduino:
|
||||||
|
- Start frame(unsigned int16) : 0xABCD
|
||||||
|
- Cmd1(signed int16) : Steer or Brake(hovercar) after normalizing and mixing
|
||||||
|
- Cmd2(signed int16): Speed or Throttle(hovercar) after normalizing and mixing
|
||||||
|
- SpeedR(signed int16) : Measured right wheel speed
|
||||||
|
- SpeedL(signed int16) : Measured left wheel speed
|
||||||
|
- Battery Voltage(signed int16) : Calibrated Battery Voltage *100
|
||||||
|
- Temperature(signed int16) : Temperature in °C *10
|
||||||
|
- Led(unsigned int16) : used to control the leds on the sideboard
|
||||||
|
- Checksum(unsigned int16) : XOR checksum
|
||||||
|
|
||||||
|
|
||||||
## Calibration:
|
## Calibration:
|
||||||
[Calibration](https://github.com/EmanuelFeru/hoverboard-firmware-hack-FOC/wiki/Calibration) is not required with USART control, but can be done if you use an input devices(e.g. Joystick or Throttle handle) on the Arduino and are not taking care of calibration center value and min/max range there.
|
[Calibration](https://github.com/EmanuelFeru/hoverboard-firmware-hack-FOC/wiki/Calibration) is not required with USART control, but can be done if you use an input devices(e.g. Joystick or Throttle handle) on the Arduino and are not taking care of calibration center value and min/max range there.
|
||||||
## Troubleshooting:
|
## Troubleshooting:
|
||||||
|
Reference in New Issue
Block a user