Coder Social home page Coder Social logo

larsmm / hoverboard-firmware-hack-bbcar Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lucysrausch/hoverboard-firmware-hack

52.0 9.0 18.0 16.84 MB

4-wheel-drive-bobbycar-optimized hoverboard mainboard firmware

C 97.81% Assembly 2.17% Makefile 0.02%

hoverboard-firmware-hack-bbcar's Introduction

DEPRECATED

-----> There is a new, much better version of this firmware: https://github.com/larsmm/hoverboard-firmware-hack-FOC-bbcar <-----

hoverboard-firmware-hack - bobby car edition

This repo contains a 4-wheel-drive-bobbycar-optimized version of the hoverboard mainboard firmware by rene-dev, crinq and NiklasFauth.

bobbycar pic

Features

  • controlled by 2 potis on the steering wheel: 1. forward, 2. break or backward or turbo mode
  • 4 driving modes with different speed, acceleration and features
  • acceleration and breaking ramps, turbo ramp
  • everything else is identical to: https://github.com/NiklasFauth/hoverboard-firmware-hack

Driving modes

You can activate them by holding one or more of the potis while poweron. (km/h @ full 12s battery):

  • Mode 1 - Child: left poti, max speed ~3 km/h, very slow backwards, no turbo
  • Mode 2 - STVO: no poti, max speed ~<6 km/h (verify it), slow backwards, no turbo
  • Mode 3 - Fun: right poti, max speed ~12 km/h, no turbo
  • Mode 4 - Power: both potis, max speed ~22 km/h, with turbo ~29 km/h

After poweron it beeps the mode in 1 to 4 fast beeps. default mode is nr. 2.

Turbo

Field weakening is only availible in mode 4. It can only be activated if you are already at 80% of top speed. To activate it, press the backwards poti to get additional 40% more power. :) Please be very careful, this speed is dangarous.

Power and battery

Peak power is around 34A = 1800W at 12 lithium battery cells. more power does not make much sense. the wheels are not able to get the power onto the ground. cooling of the board is no problem, the wheels will get too hot earlier. you will get around 20 km out of a 8 Ah 12s battery.

Build and flash

  • install Visual Studio Code
  • install PlatformIO IDE within VSCode extension system
  • File --> open folder: hoverboard-firmware-hack-bbcar
  • edit config.h: calibrate battery voltage and poti ranges
  • use "Build", "Upload" and "Serial Monitor" buttons

more info

hoverboard-firmware-hack-bbcar's People

Contributors

crinq avatar larsmm avatar rene-dev avatar tobleminer avatar trilader avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hoverboard-firmware-hack-bbcar's Issues

BEEPS_BACKWARD doesn't work in BBCAR variant

The speed variable doesn't seem to be set in BBCAR variant , therefore the condition -
(BEEPS_BACKWARD && ((speed < -50 && speedAvg < 0) || MultipleTapBrake.b_multipleTap)) - is never met and the car wouldn't beep when reversing. (A condition using cmdR < -50 seems to provide appropriate and safe response )

Hello, teachers, I come from China, I have a question to ask

I in an accidental opportunity discovered that your this firmware is really too good, is extremely good, specially that 4 gears may shift gears I like it very much, but I found a problem in the process of using it, that is, it will shut down automatically after releasing the throttle, but my voltage is normal, and the battery is just full

Front/ back with one mid rest pot (joystick). Possible?

Hi.
I need use in ADC mode (bobby car) mid rest pot (its cheap joystick) only for front and back, no need stearing. Min value is 0, medium ~2000 and max 4400.
Its possible to use one pot for front and back ride?

I see this function in EmanuelFeru but your firmware is better for me.

Thanks,
Kris

platformio build fails

I can't build with given platformio.ini under my linux with PlatformIO 5.0.0.
In following you can see the progress i tried and in the end succeeded to build/flash/use this firmware on real hardware.

It it totally ok for me, if you do not want to "merge" it. I just added this issue here to document for maybe other people to get their compilation running.

It looks like in general adding comments in same line as an action e.g. toolchain-gccarmnoneeabi @ 1.90301.200702 # https://community.platformio.org/t/can-you-update-toolchain-gccarmnoneeabi/12733 does not work, but if i move that comment into next line it is processed correct.

Without modification:

Tool Manager: Installing 1.90301.200702  # https://community.platformio.org/t/can-you-update-toolchain-gccarmnoneeabi/12733
Error: VCS: Unknown repository type 1.90301.200702  

With change platform_packages to use non tagged version:

Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/genericSTM32F103RC.html
PLATFORM: ST STM32 (8.0.0) > STM32F103RC (48k RAM. 256k Flash)
HARDWARE: STM32F103RCT6 72MHz, 48KB RAM, 256KB Flash
DEBUG: Current (stlink) External (blackmagic, jlink, stlink)
PACKAGES: 
 - framework-stm32cube 2.0.200813 
 - tool-ldscripts-ststm32 0.1.0 
 - toolchain-gccarmnoneeabi 1.90301.200702 (9.3.1)
TypeError: Tried to lookup Dir '.' as a File.:
  File "/home/user/.platformio/penv/lib/python2.7/site-packages/platformio/builder/main.py", line 169:
    env.SConscript("$BUILD_SCRIPT")
  File "/home/user/.platformio/packages/tool-scons/script/../engine/SCons/Script/SConscript.py", line 541:
    return _SConscript(self.fs, *files, **subst_kw)
  File "/home/user/.platformio/packages/tool-scons/script/../engine/SCons/Script/SConscript.py", line 250:
    exec _file_ in call_stack[-1].globals
  File "/home/user/.platformio/platforms/ststm32/builder/main.py", line 99:
    target_elf = env.BuildProgram()
  File "/home/user/.platformio/packages/tool-scons/script/../engine/SCons/Environment.py", line 224:
    return self.method(*nargs, **kwargs)
  File "/home/user/.platformio/penv/lib/python2.7/site-packages/platformio/builder/tools/platformio.py", line 61:
    env.ProcessProgramDeps()
  File "/home/user/.platformio/packages/tool-scons/script/../engine/SCons/Environment.py", line 224:
    return self.method(*nargs, **kwargs)
  File "/home/user/.platformio/penv/lib/python2.7/site-packages/platformio/builder/tools/platformio.py", line 124:
    env.ProcessFlags(env.get("BUILD_FLAGS"))
  File "/home/user/.platformio/packages/tool-scons/script/../engine/SCons/Environment.py", line 224:
    return self.method(*nargs, **kwargs)
  File "/home/user/.platformio/penv/lib/python2.7/site-packages/platformio/builder/tools/platformio.py", line 222:
    env.Append(**env.ParseFlagsExtended(flags))
  File "/home/user/.platformio/packages/tool-scons/script/../engine/SCons/Environment.py", line 224:
    return self.method(*nargs, **kwargs)
  File "/home/user/.platformio/penv/lib/python2.7/site-packages/platformio/builder/tools/platformio.py", line 185:
    for key, value in env.ParseFlags(str(raw)).items():
  File "/home/user/.platformio/packages/tool-scons/script/../engine/SCons/Environment.py", line 810:
    do_parse(arg)
  File "/home/user/.platformio/packages/tool-scons/script/../engine/SCons/Environment.py", line 739:
    dict['LIBS'].append(self.fs.File(arg))
  File "/home/user/.platformio/packages/tool-scons/script/../engine/SCons/Node/FS.py", line 1404:
    return self._lookup(name, directory, File, create)
  File "/home/user/.platformio/packages/tool-scons/script/../engine/SCons/Node/FS.py", line 1383:
    return root._lookup_abs(p, fsclass, create)
  File "/home/user/.platformio/packages/tool-scons/script/../engine/SCons/Node/FS.py", line 2403:
    result.must_be_same(klass)
  File "/home/user/.platformio/packages/tool-scons/script/../engine/SCons/Node/FS.py", line 652:
    (self.__class__.__name__, self.get_internal_path(), klass.__name__))

Additional cleaned up comments in build_flags and use of board_build.ldscript:

Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/genericSTM32F103RC.html
PLATFORM: ST STM32 (8.0.0) > STM32F103RC (48k RAM. 256k Flash)
HARDWARE: STM32F103RCT6 72MHz, 48KB RAM, 256KB Flash
DEBUG: Current (stlink) External (blackmagic, jlink, stlink)
PACKAGES: 
 - framework-stm32cube 2.0.200813 
 - tool-ldscripts-ststm32 0.1.0 
 - toolchain-gccarmnoneeabi 1.90301.200702 (9.3.1)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 11 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio/build/VARIANT_BBCAR/src/bldc.o
Compiling .pio/build/VARIANT_BBCAR/src/comms.o
Compiling .pio/build/VARIANT_BBCAR/src/control.o
Compiling .pio/build/VARIANT_BBCAR/src/main.o
Compiling .pio/build/VARIANT_BBCAR/src/setup.o
Compiling .pio/build/VARIANT_BBCAR/src/stm32f1xx_it.o
Compiling .pio/build/VARIANT_BBCAR/src/syscalls.o
Compiling .pio/build/VARIANT_BBCAR/src/system_stm32f1xx.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_hal.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_hal_adc.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_hal_adc_ex.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_hal_can.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_hal_cec.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_hal_cortex.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_hal_crc.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_hal_dac.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_hal_dac_ex.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_hal_dma.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_hal_eth.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_hal_flash.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_hal_flash_ex.o                                                                                                                                            ==
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_hal_gpio.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_hal_gpio_ex.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_hal_hcd.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_hal_i2c.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_hal_i2s.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_hal_irda.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_hal_iwdg.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_hal_mmc.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_hal_nand.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_hal_nor.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_hal_pccard.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_hal_pcd.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_hal_pcd_ex.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_hal_pwr.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_hal_rcc.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_hal_rcc_ex.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_hal_rtc.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_hal_rtc_ex.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_hal_sd.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_hal_smartcard.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_hal_spi.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_hal_spi_ex.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_hal_sram.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_hal_tim.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_hal_tim_ex.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_hal_uart.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_hal_usart.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_hal_wwdg.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_ll_adc.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_ll_crc.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_ll_dac.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_ll_dma.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_ll_exti.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_ll_fsmc.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_ll_gpio.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_ll_i2c.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_ll_pwr.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_ll_rcc.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_ll_rtc.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_ll_sdmmc.o                                                                                                                                                ==
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_ll_spi.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_ll_tim.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_ll_usart.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_ll_usb.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkHALDriver/Src/stm32f1xx_ll_utils.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkCMSISDevice/gcc/startup_stm32f103xb.o
Compiling .pio/build/VARIANT_BBCAR/FrameworkCMSISDevice/system_stm32f1xx.o
Archiving .pio/build/VARIANT_BBCAR/libFrameworkCMSISDevice.a
Indexing .pio/build/VARIANT_BBCAR/libFrameworkCMSISDevice.a
Archiving .pio/build/VARIANT_BBCAR/libFrameworkHALDriver.a
Indexing .pio/build/VARIANT_BBCAR/libFrameworkHALDriver.a
Linking .pio/build/VARIANT_BBCAR/firmware.elf
Building .pio/build/VARIANT_BBCAR/firmware.bin
Checking size .pio/build/VARIANT_BBCAR/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   3.0% (used 1484 bytes from 49152 bytes)
Flash: [=         ]  11.5% (used 30208 bytes from 262144 bytes)

And here is my final platformio.ini

; PlatformIO Project Configuration File2
; http://docs.platformio.org/page/projectconf.html

[platformio]
include_dir = Inc
src_dir     = Src



[env:VARIANT_BBCAR]
platform        = ststm32
framework       = stm32cube
board           = genericSTM32F103RC
; debug_tool      = jlink
; upload_protocol = jlink
debug_tool      = stlink
upload_protocol = stlink

platform_packages = 
    toolchain-gccarmnoneeabi

; Serial Port settings (make sure the COM port is correct)
monitor_port    = COM3
monitor_speed   = 38400


board_build.ldscript=./STM32F103RCTx_FLASH.ld

build_flags =
    -DUSE_HAL_DRIVER
    -DSTM32F103xE
    -Wl,-u,_printf_float
    -Wno-comment
    -Wno-parentheses
    -fsingle-precision-constant
    -g -ggdb
    -D VARIANT_BBCAR
    -O2

Piepen nach einschalten und keine Funktion

Hallo Lars.

Ich habe versucht dein Programm zu flashen (Hardwareanpassung ist auch erfolgt), aber scheinbar klappt es nicht richtig.

Der fehler den ich gleich beschreibe ist auch beim Versuch mit "hoverboard-firmware-hack-FOC" aufgetreten.
Desweiteren habe ich Ich hoffe du kannst mir weiter helfen.

Ich habe das Programm in Visual Studio Code wie folgt angepasst:
Zeile Wert
18. 39.8 V
21. 10 Zellen
67. 350
68. 1100
69. 350
70. 1100

und kompiliere - Von dort uploaden konnte ich leider schon nicht, weil mir mein ST-Link V2 dort nicht angezeigt wird und eine Fehlermeldung kommt, dass keine Verbindung aufgebaut werden konnte.

Ich habe dann in der STM32 Link Utility die Sperre aufgehoben und die erstellte .bin datei geflasht. Danach wird sie wird im "Device Memory" auch angezeigt, daher gehe ich davon aus, dass der Upload geklappt hat.

Nun zur Fehlerbeschreibung (mit Versorgungsspannung ca. 41V aufgeladenener Akku)

Sobald ich den "EIN"-Taster drücke beginnt ein piepen "tüdelüt,tüdelüt,tüdelüt", usw.
Wenn ich in der STM32 Link Utility die Verbindung trenne kommt ein "tüdeldididi" und eine rote LED leuchtet -> nach ca. 25 sec. geht die Platine wieder in den Zustand, wie beim "EIN" tasten.

In beiden Situationen ist keinerlei Funktion festzustellen. Selst das "AUS" tasten geht nicht.
Ich hoffe du kannst mit meiner Fehlerbeschreibung etwas anfangen und mir evtl. weiter helfen.
Auf den Github-Seiten von NiklasFauth und EmanuelFeru habe ich leider keine Lösung finden können.

Beste Grüße aus dem Harz, Niels

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.