Skip to content

Commit 226278b

Browse files
authored
Merge pull request #23 from NiklasFauth/master
update master
2 parents 28287b9 + f06ce1f commit 226278b

File tree

7 files changed

+34
-9
lines changed

7 files changed

+34
-9
lines changed

Inc/config.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
// Battery voltage calibration: connect power source. see <How to calibrate>. write value nr 5 to BAT_CALIB_ADC. make and flash firmware. then you can verify voltage on value 6 (devide it by 100.0 to get calibrated voltage).
1818
#define BAT_CALIB_REAL_VOLTAGE 43.0 // input voltage measured by multimeter
19-
#define BAT_CALIB_ADC 1704 // adc-value measured by mainboard (value nr 4 on UART debug output)
19+
#define BAT_CALIB_ADC 1704 // adc-value measured by mainboard (value nr 5 on UART debug output)
2020

2121
#define BAT_NUMBER_OF_CELLS 10 // normal Hoverboard battery: 10s
2222
#define BAT_LOW_LVL1_ENABLE 0 // to beep or not to beep, 1 or 0
@@ -59,12 +59,12 @@
5959

6060
// ###### CONTROL VIA RC REMOTE ######
6161
// left sensor board cable. Channel 1: steering, Channel 2: speed.
62-
//#define CONTROL_PPM // use PPM-Sum as input. disable DEBUG_SERIAL_USART2!
62+
//#define CONTROL_PPM // use PPM-Sum as input. disable CONTROL_SERIAL_USART2!
6363
//#define PPM_NUM_CHANNELS 6 // total number of PPM channels to receive, even if they are not used.
6464

6565
// ###### CONTROL VIA TWO POTENTIOMETERS ######
6666
// ADC-calibration to cover the full poti-range: connect potis to left sensor board cable (0 to 3.3V) (do NOT use the red 15V wire in the cable!). see <How to calibrate>. turn the potis to minimum position, write value 1 to ADC1_MIN and value 2 to ADC2_MIN. turn to maximum position and repeat it for ADC?_MAX. make, flash and test it.
67-
#define CONTROL_ADC // use ADC as input. disable DEBUG_SERIAL_USART2!
67+
#define CONTROL_ADC // use ADC as input. disable CONTROL_SERIAL_USART2!
6868
#define ADC1_MIN 0 // min ADC1-value while poti at minimum-position (0 - 4095)
6969
#define ADC1_MAX 4095 // max ADC1-value while poti at maximum-position (0 - 4095)
7070
#define ADC2_MIN 0 // min ADC2-value while poti at minimum-position (0 - 4095)

README.md

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
This firmware is much better than the old one. tested up to 40A / 60V, no dead board so far :)
2-
31
# hoverboard-firmware-hack
42

3+
![](https://raw.githubusercontent.com/NiklasFauth/hoverboard-firmware-hack/master/docs/pictures/armchair.gif) ![](https://raw.githubusercontent.com/NiklasFauth/hoverboard-firmware-hack/master/docs/pictures/bobbycar.gif)
4+
![](https://raw.githubusercontent.com/NiklasFauth/hoverboard-firmware-hack/master/docs/pictures/transpotter.gif) ![](https://raw.githubusercontent.com/NiklasFauth/hoverboard-firmware-hack/master/docs/pictures/chair.gif)
5+
6+
57
This repo contains open source firmware for generic Hoverboard Mainboards.
68
The firmware you can find here allows you to use your Hoverboard Hardware (like the Mainboard, Motors and Battery) for cool projects like driving armchairs, person-tracking transportation robots and every other application you can imagine that requires controlling the Motors.
79

@@ -10,6 +12,15 @@ https://media.ccc.de/v/gpn18-95-howto-moving-objects
1012

1113
---
1214

15+
## Build Instructions
16+
17+
Here are detailed build instructions for some finished projects.
18+
If possible, a prebuild firmware release is available for these usecases, so you don't need to compile the firmware yourself
19+
20+
TranspOtter: https://github.com/NiklasFauth/hoverboard-firmware-hack/wiki/Build-Instruction:-TranspOtter
21+
22+
---
23+
1324
## Hardware
1425
![otter](https://raw.githubusercontent.com/NiklasFauth/hoverboard-firmware-hack/master/pinout.png)
1526

@@ -22,7 +33,9 @@ http://vocke.tv/lib/exe/fetch.php?media=20150722_hoverboard_sch.pdf
2233
---
2334

2435
## Flashing
25-
To build the firmware, just type "make". Make sure you have specified your gcc-arm-none-eabi binary (version 7 works, there is a version that does not!) location in the Makefile ("PREFIX = ..."). Right to the STM32, there is a debugging header with GND, 3V3, SWDIO and SWCLK. Connect GND, SWDIO and SWCLK to your SWD programmer, like the ST-Link found on many STM devboards.
36+
To build the firmware, just type "make". Make sure you have specified your gcc-arm-none-eabi binary location in the Makefile ("PREFIX = ...") (version 7 works, there is a version that does not!) (if the ons in linux repos do not work, use the official version: https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads). Right to the STM32, there is a debugging header with GND, 3V3, SWDIO and SWCLK. Connect GND, SWDIO and SWCLK to your SWD programmer, like the ST-Link found on many STM devboards.
37+
38+
Do not power the mainboard from the 3.3V of your programmer! This has already killed multiple mainboards.
2639

2740
Make sure you hold the powerbutton or connect a jumper to the power button pins while flashing the firmware, as the STM might release the power latch and switches itself off during flashing. Battery > 36V have to be connected while flashing.
2841

@@ -46,6 +59,10 @@ Then you can simply flash the firmware:
4659
```
4760
st-flash --reset write build/hover.bin 0x8000000
4861
```
62+
or
63+
```
64+
openocd -f interface/stlink-v2.cfg -f target/stm32f1x.cfg -c flash "write_image erase build/hover.bin 0x8000000"
65+
```
4966

5067
---
5168
## Troubleshooting
@@ -56,7 +73,7 @@ If the motors do something, but don't rotate smooth and quietly, try to use an a
5673

5774
Nunchuck not working: Use the right one of the 2 types of nunchucks. Use i2c pullups.
5875

59-
Nunchuck or PPM working bad: The i2c bus and PPM signal are very sensitive to emv distortions of the motor controller. They get stronger the faster you are. Keep cables short, use shielded cable, use ferrits, stabalize voltage in nunchuck or reviever, add i2c pullups. To many errors leads to very high accelerations which triggers the protection board within the battery to shut everything down.
76+
Nunchuck or PPM working bad: The i2c bus and PPM signal are very sensitive to emv distortions of the motor controller. They get stronger the faster you are. Keep cables short, use shielded cable, use ferrits, stabilize voltage in nunchuck or reviever, add i2c pullups. To many errors leads to very high accelerations which triggers the protection board within the battery to shut everything down.
6077

6178
Most robust way for input is to use the ADC and potis. It works well even on 1m unshielded cable. Solder ~100k Ohm resistors between ADC-inputs and gnd directly on the mainboard. Use potis as pullups to 3.3V.
6279

@@ -67,8 +84,16 @@ Most robust way for input is to use the ADC and potis. It works well even on 1m
6784

6885
Have a look at the config.h in the Inc directory. That's where you configure to firmware to match your project.
6986
Currently supported: Wii Nunchuck, analog potentiometer and PPM-Sum signal from a RC remote.
87+
A good example of control via UART, eg. from an Arduino or raspberryPi, can be found here:
88+
https://github.com/p-h-a-i-l/hoverboard-firmware-hack
89+
7090
If you need additional features like a boost button, have a look at the while(1) loop in the main.c
7191

92+
### Additional Hardware
93+
94+
* [breakout/interconnect boards](https://github.com/Jan--Henrik/hoverboard-breakout) Breakout/Interconnection boards for hoverboard hacking.
95+
7296
### Projects based on it
7397
* [bobbycar-optimized firmware](https://github.com/larsmm/hoverboard-firmware-hack-bbcar) based on this one with driving modes, acceleration ramps and some other features
7498
* [wheel chair](https://github.com/Lahorde/steer_speed_ctrl) controlled with a joystick or using a CC2650 sensortag to control it over bluetooth with pitch/roll.
99+
* [TranspOtterNG](https://github.com/Jan--Henrik/transpOtterNG) TranspOtter is an open source semi self driving transportation platform based on hoverboard hardware

Src/comms.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ void setScopeChannel(uint8_t ch, int16_t val) {
2525
}
2626

2727
void consoleScope() {
28-
#if defined DEBUG_SERIAL_SERVOTERM && defined DEBUG_SERIAL_USART3
28+
#if defined DEBUG_SERIAL_SERVOTERM && (defined DEBUG_SERIAL_USART2 || defined DEBUG_SERIAL_USART3)
2929
uart_buf[0] = 0xff;
3030
uart_buf[1] = CLAMP(ch_buf[0]+127, 0, 255);
3131
uart_buf[2] = CLAMP(ch_buf[1]+127, 0, 255);
@@ -45,7 +45,7 @@ void consoleScope() {
4545
}
4646
#endif
4747

48-
#if defined DEBUG_SERIAL_ASCII && defined DEBUG_SERIAL_USART3
48+
#if defined DEBUG_SERIAL_ASCII && (defined DEBUG_SERIAL_USART2 || defined DEBUG_SERIAL_USART3)
4949
memset(uart_buf, 0, sizeof(uart_buf));
5050
sprintf(uart_buf, "1:%i 2:%i 3:%i 4:%i 5:%i 6:%i 7:%i 8:%i\r\n", ch_buf[0], ch_buf[1], ch_buf[2], ch_buf[3], ch_buf[4], ch_buf[5], ch_buf[6], ch_buf[7]);
5151

docs/pictures/armchair.gif

3.68 MB
Loading

docs/pictures/bobbycar.gif

3.32 MB
Loading

docs/pictures/chair.gif

3.84 MB
Loading

docs/pictures/transpotter.gif

5.25 MB
Loading

0 commit comments

Comments
 (0)