Index

MicroWorks 30B4 board

  1. Datasheets 30B4
    1. STM32F103
      1. ADC
      2. STM32 EEPROM
    2. MPU6050
      1. DMA
      2. Issue communications
        1. 01
    3. MPU6050 freq
  2. firmware motor control
  3. Implementations with MicroWorks 30B4 board
  4. Links to sellers

MicroWorks 500W 30km/h motor

  1. BEMF measurements

Flash and Debug STM32

  1. Eclipse IDE and JTAG
  2. Unlock STM32F103 with JTAG
  3. Flash firmware using Bluetooth
    1. STM32F103C6T8 bootloader
    2. ZS-040 Bluetooth module
      1. HC-06 hc01.comV2.0
  4. Serial Port Bluetooth
  5. Serial Port Plot
  6. SM32F103C8T6 use 128kbytes flash

FOC

  1. Observer
  2. Shane Colton documentation and firmware
    1. Firmware
    2. Part 1: Field-Oriented
    3. Part 2: Field-Oriented
    4. Sensorless Pneu Scooter - part 1
    5. Sensorless Pneu Scooter - part 2
    6. Sensorless Pneu Scooter - part 3
  3. Texas Instruments videos
  4. Chinese controllers code

Balance controller

  1. Chinese balance group reference design
  2. Kerry D. Wong -- A Self-Balancing Robot
    1. A Self-Balancing Robot – I
    2. A Self-Balancing Robot – II
    3. A Self-Balancing Robot – III
  3. Self balance bicycle
  4. PID
  5. LQR
    1. Stages of development of the robot-balancer
  6. PID and LQR, MATLAB
  7. Steve Brunton videos

Mechanical parts

  1. Pedals

Various

  1. C language for critical systems
  2. Hall effect sensor placement
  3. The brilliant idea of slow rotating motors
    1. Why does the Torquemax rotate so slowly and so forcefully
  4. Finding Motor Phase-Sensor Combinations

Clipping

  1. Hackaday - 2017.05.07 - opensource firmware for hoverboards

MicroWorks 30B4 board


This 30B4 board from MicroWorks is really "clean" and simple, which makes it very good for repair and hacking. The STM32F103 microcontroller, the USART bluetooth module, the MPU6050 chip for measuring the angle, the ACS712 current sensors, the IR2184s mosfets drivers, all of them are very well know from OpenSource Arduino world!! They are also cheap (which makes also the board cheap!!), easy to find on Ebay and easy to unsolder/repair and there are many documentation, circuit examples.
Also the bluetooth communication data is well known and thanks to that there are a few apps available, including OpenSource ones like the EGG app.

This boards works with MicroWorks 500W 30km/h motor.

Picture of the board (missing some headers plastic parts, the microcontroller and the bluetooth module):

images/3-1.png

Schematic


• Seller MicroWorks: http://microworks.en.alibaba.com/
• Product page: http://wholesaler.alibaba.com/product-detail/2016-balance-scooter-controller-Motherboard-with_60376493987.html
• Simplified schematic, designed on KiCAD: https://github.com/EGG-electric-unicycle/electronics-gen2_boards/raw/master/MicroWorks_30B4/MicroWorks_30B4.sch.png
• Sources on github: https://github.com/EGG-electric-unicycle/electronics-gen2_boards
Active component list:• 1x ASM1117 3.3v Linear Voltage regulator for 3.3v on Invensense 6050 and STM32
• 2x ACS712ELCTR-05B-T (+-5 amps max) ma Hall Current Sensor on 2 separate Phases - To measure phase current
• 3x IR2184s Gate Driver for Half Bridge. Built in fixed Deadband 1 for each N-Fet Pair
• 2x XL7005A SMPS Max 80v input Output can be adjusted 1 is used to produce 15-20v for Gate driver IC's The other most likely produces 5-12v for Current sensors or maybe just the 1117 to produce 3.3v with minimal losses.
• 1x Invensense MPU6050 (needs no introduction) 6Axis Accel/Gyro with nifity build in filtering
• 1x STM32F103C8T6 ARM microcontroller

Header pins


The next pictures show the labels according to the previous schematic.

images/3-2.png
images/3-3.png

Bluetooth / UART signals


The board is always sending data about the board voltage, motor speed, motor current, etc. The baud rate is 115200 bits/s.
Please see the MOD and Arduino firmware to understand that data that is sent: MicroWorks-30B4-controller-board-RGB-LED-strip
The data is sent every 200ms, as shown on next oscilloscope screenshots:
images/3-4.png
images/3-5.png
images/3-6.png
images/3-7.png

Max temperature protection


When the temperature achieve 65ºC, the EUC will make 2 quick beeps and tilt back the pedals. Here is a screenshot showing the app and the temperature on that situation:
images/3-8.png
There is no temperature sensor on the board. I believe the system uses the temperature value returned by the MPU6050.
The STM32F103 also have an internal temperature sensor but seems this sensor would need to be calibrated on production line.

UART Bluetooth protocol information


START sequence: 0x18 0x5A 0x5A 0x5A 0x5A 0x55 0xAA
The next following 12 bytes will contain the following data, and calculate the real value:
Voltage = signed 16bit int, real value = value / 100.0 (ie 188C = 6284 / 100 = 62.84V)
Speed = signed 16 bit int, real value = value / 100.0 * 3.6
Trip = signed/unsigned 32 bit int, real value = value / 1000.0 (kilometers)
Current = signed 16 bit in, real value = value / 100.0 (A)
Temperature = signed 16bit int, real value = value / 340.0 + 36.53 (Celsius)
Unknown: 0x0 (this value sometimes is 0, 1 or 2)
END sequence: 0x0 0xff 0xfe 0x0

Commands:
• Beep: Vibrate during five seconds: "b"
• Vibrate during five seconds: ",bbbbbbbbb"
• Ride mode - Madden: "hb"
• Ride mode - Comfort: "fb"
• Ride mode - Comfort: "sb"
• Horizontal alignment: ",cycycy"
• View current: "m"
• Check temperature: "n" - looks like it could be continuously send to the wheel at some point, but I haven't figured out the logic which does it at least yet
NOTE: all the bytes sent in the commands should have a delay of 500ms between each of them.

Thanks to esaj for documenting the protocol: http://forum.electricunicycle.org/topic/870-gotwaykingsong-protocol-reverse-engineering/#comment-9039


Firmware programming over Bluetooth

The STM32 boot0 pin is connected to 3.3V with a pullup resistor, this means that the code that boots at reset time is the firmware. The same boot0 pin connected to the the UART Bluetooth module header, with label "BO" and this means that the module can enable the flash programming by connecting this pin to GND. If the firmware have a command to reset the STM32, it will reset to STM32 bootloader and the firmware can be then programmed by bluetooth.
NOTE: Original firmware have Serial Wire Debug (SWD) disabled and so to enable it, just connect the boot0 pin to GND and use SWD to erase the STM and it will then be ready to be flashed and debugged.


Battery voltage and power


When the power available is 20% or less, the board will beep (even when the motor is stopped).
Some of the following values were measured and others were extrapolated.
click meclick me
Voltage (v)Battery state of charge (%)
< 53.00
53.010
54.120
56.230
57.740
59.150
60.560
61.770
62.880
63.990
65100