Simple piece of code for simulation sensor inputs of a hoverboard to do basic control of wheels.
Dependencies: WiiNunchuck mbed-dev
This program is inspired by this site:
http://drewspewsmuse.blogspot.co.at/2016/06/how-i-hacked-self-balancing-scooter.html
Here you can get more information of the protocol revervse engineering.
This program uses a Wii nunchuk connected over I2C to controll the speed. Speed is controlled by a closed loop P controller. Feedback is done by counting HALL events from the brushless motor. Some more pictures are available here:
https://github.com/tyler123durden/hoverboard-hardware
Basically you need a serial TX and 3 HALL IRQs per motor side.
Wiring of the board. Gyro boards are not used, input is generated from nucleo board. Motor board has still the HALL connections. Nucleo board just also reads HALL inputs to get speed information for closed loop controll.
utils.h@1:5acd27cb1857, 2016-10-23 (annotated)
- Committer:
- Thomas_H
- Date:
- Sun Oct 23 19:35:14 2016 +0000
- Revision:
- 1:5acd27cb1857
Initial release
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Thomas_H | 1:5acd27cb1857 | 1 | #ifndef UTILS_H |
Thomas_H | 1:5acd27cb1857 | 2 | #define UTILS_H |
Thomas_H | 1:5acd27cb1857 | 3 | |
Thomas_H | 1:5acd27cb1857 | 4 | #include "mbed.h" |
Thomas_H | 1:5acd27cb1857 | 5 | uint16_t crc16_ansi_rev(uint32_t pa_nLen, const uint8_t* pa_pnData, uint16_t pa_nStart); |
Thomas_H | 1:5acd27cb1857 | 6 | |
Thomas_H | 1:5acd27cb1857 | 7 | #endif |