OpHaCo / hoverbot

Hack an Hoverboard to propel your fat robots!
73 stars 16 forks source link

HoverBot : the most affordable smooth and silent two wheels drive control

NOTE: This project is currently abandoned
There is more active development over at https://github.com/NiklasFauth/hoverboard-firmware-hack. We already have a working custom firmware for the hoverboard mainboard, complete with ADC, PPM and Nunchuck control. (See the linked video in the description there)

Project has been done in Amiqual4Home Equipex Creativity Lab - https://amiqual4home.inria.fr/

Description

With hoverbot, you can do some vehicle, chassis :

Hoverboard are chinese low cost products. Low cost spare parts gives meaningful two wheels drive platform.

You don't have to be an electronic master to do it. To have motors working, you just have to connect hoverbot shield. You can either make this shield by yourself or you can get it from (TODO).

With hoverbot you will be able to drive your :

Prerequisities

hardware

Setup

Components Analysis

Refer ifixit for a detailed analysis of hoverboard components. Interesting parts are :

Daughterboard / motherboard communication

Daughterboard can be used either on right/left. So we only bought 1 daughterboard to decode Daughterboard / motherboard exchanged data. We connected the 2 motherboard / daughterboard connectors to a single motherboard. In this case when rotating motherboard, wheels are rotating in two different direction.

Protocol

Probing a logic analyser on daughterboard 4 wire connectors gives some interesting info :

Is it a standard protocol?

Exchanged data

Here are decoded data with UART analyzer in Salae Logic software :

Do not move daughterboard, power motherboard and read decoded data. We can see :

Now let's play with photodiode used in daughterboard contacts :

4 remaining bytes must be decoded : two of these bytes repeats. Rotating daughterboard gives indication :

We can check it is only an angular value applying linear acceleration to daughterboard. In this case angular value do not change.

Speed sensor

In wheels some hall sensors are used to get wheel speed (3 sensors per wheel). On mother board, sensor pulses are filtered using an RC filter. To get speed, we must connect it to hoverbot.

If we trigger a digital output (channel 0) on a rising edge (channel 0) we do not have a clean signal :

With a zoom :

Small oscillation when V=Vdd/2 generates some falling /rising edges. Because of RC time constant, we can get lot of oscillations leading to some false detections. It could be software filtered (either using timer or checking multiple times read value). As I prefer capturing Hall sensor pulses using external interrupt it is better to have an hardware solution. As Teensy MCU does not have any input schmitt trigger we will add it :

After we have a good pulse detection :

hardware

In order to control hoverboard we need an external MCU to :

Different MCU can be used, we could use UART bitbanging libraries... But a nice solution is to use teensy 3.1/3.2 :

software

Prerequisities

Enable 9-Bit UART on Teensy

Edit :

your_arduino_core_folder/hardware/teensy/avr/cores/teensy3/HardwareSerial.h

Uncomment :

#define SERIAL_9BIT_SUPPORT
Add needed libraries

Several libraries are provided in this repo :

If you use arduino IDE, you must create symlinks/shortcuts from these libraries path to Arduino library folder :

ln -s your_folder/hoverbot/hoverbot_embedded_software/teensy_hoverboard/hoverboard arduino_user_path/libraries/
ln -s your_folder/hoverbot/hoverbot_embedded_software/teensy_hoverboard/brushless_hall_sensor arduino_user_path/libraries/
ln -s your_folder/hoverbot/hoverbot_embedded_software/teensy_hoverboard/logger arduino_user_path/libraries/

Then from Arduino IDE add these libraries.

Configure logging level

Edit your_folder/hoverbot/hoverbot_embedded_software/teensy_hoverboard/logger/logger_config.h

and set needed log level (refer your_folder/hoverbot/hoverbot_embedded_software/teensy_hoverboard/logger/README.md)

Arduino sketch

As we saw in our first tests, when same daughterboard is connected to two motherboards/daughterboard connectors :

From that simple code is provided here : Refer code In echoGoForward() function : it reads current angular value from daughterboard to control hoverboard in forward direction.

After testing we can easily :

But we cannot :

We can suppose, closed loop algorithm on motherboard does not support forward / backward mooving when it is not under load.

Interfaces

UART

Hoverboard control over UART can be done running :

python3 your_folder/hoverbot/hoverbot_gateway_software/examples/hoverboard_uart_control/hoverboard_uart_control.py -p TEENSY_PORT

Supported commands :

power_on

power_off

set_speed motor1_value motor2_value

x // Manual keyboard control => hoverbot controlled using numeric pad

SPI

Wifi

BLE

Commands

TODO

Control commands

TODO

ROS

Events

TODO

Hoverbot shield

PCB design

Examples

Racing chair

Issues

References

Next steps