beemac
10 kW
Whilst this is slightly TSDZ2 specific as-is - it would be easy to remove (or not use) the TSDZ2 specific torque sensor circuit and use this for almost any ebike....
This project builds on previous work in the 'TSDZ2 wireless project' - adds the torque sensor circuitry I've been working on - and brings it together into a small, self-contained ebike controller.
The 'design specs'
Input voltage 20-80v
Pin compatible with Nano/Nano BLE 33 (BLE 33 allows the use of ANT+ LEV - can reuse the code from the TSDZ2 wireless project).
12v/5v/3.3v regulators (3.3v provided by regulator on the Nano)
UARTs for VESC and Display (or two VESCs)
Support for headless (direct connection of keypad to controller)
Dual brake sensors
Dual throttle inputs (could also be used as PWM throttle outputs)
Dual speedsensor inputs
Dual PAS inputs.
Two extra GPIO/ADC pins on Aux connector.
Switched VBATT available on Display connector
board dimensions 33x63mm (1.3"x2.5") - and about 10mm (0.4") high - tbc
The nano BLE 33 also has a 9 axis Inertial Measurement Unit (IMU) which might be interesting to play with. Crash detection perhaps?
So far the board is untested - so don't get too excited - this is in the early stages...
Software wise, obviously this would be compatible with the Arduino IDE and/or CircuitPython however I've also mashed together the TSDZ2 wireless code, plus the ebike controller part from casainho's OSF and tested with the Android App. So far I've not actually got the ebike part operational as I've not had much time - but I do have all sensors working, the android app connects over bluetooth, you can select assist levels, see the sensor readings in the app etc.
To flash custom bootloaders, you need to have SWDIO/SWCLK soldered on the nano. I've left pads on the board for wire links between the SWDIO/SWCLK pads on the underside of the nano - as otherwise it would be impossible to reach once the nano is soldered into the pin headers. I solder wires to the pads on the underside of the nano, secure with a blob of 2-part epoxy and then you've got a nice secure connection to SWCLK/SWDIO. Once that's done flashing can be done via the SWD connector available on the board. If you only plan to use the Arduino IDE - all that isn't necessary and you can use the USB port on the nano for flashing - but tbh I'd do it anyway just in case as once you've soldered in the nano, you're not getting at the underside!
Next steps:
Take feedback about the circuitry/pcb design - electronics and PCB design are not my forte - to try and eliminate any obvious bugs.
Get a couple of sample boards made to test.
Likely repeat the first steps to get a working board!
Finish off the ebike app part
Stuff the board and a VESC inside a spare TSDZ2 case and see what happens!
I'm using EasyEDA Pro at the moment - I know it's not as good as KiCAD or others - but it makes life a lot easier with the parts and PCB fabrication integration.
Constructive criticism welcome!
This project builds on previous work in the 'TSDZ2 wireless project' - adds the torque sensor circuitry I've been working on - and brings it together into a small, self-contained ebike controller.
The 'design specs'
Input voltage 20-80v
Pin compatible with Nano/Nano BLE 33 (BLE 33 allows the use of ANT+ LEV - can reuse the code from the TSDZ2 wireless project).
12v/5v/3.3v regulators (3.3v provided by regulator on the Nano)
UARTs for VESC and Display (or two VESCs)
Support for headless (direct connection of keypad to controller)
Dual brake sensors
Dual throttle inputs (could also be used as PWM throttle outputs)
Dual speedsensor inputs
Dual PAS inputs.
Two extra GPIO/ADC pins on Aux connector.
Switched VBATT available on Display connector
board dimensions 33x63mm (1.3"x2.5") - and about 10mm (0.4") high - tbc
The nano BLE 33 also has a 9 axis Inertial Measurement Unit (IMU) which might be interesting to play with. Crash detection perhaps?
So far the board is untested - so don't get too excited - this is in the early stages...
Software wise, obviously this would be compatible with the Arduino IDE and/or CircuitPython however I've also mashed together the TSDZ2 wireless code, plus the ebike controller part from casainho's OSF and tested with the Android App. So far I've not actually got the ebike part operational as I've not had much time - but I do have all sensors working, the android app connects over bluetooth, you can select assist levels, see the sensor readings in the app etc.
To flash custom bootloaders, you need to have SWDIO/SWCLK soldered on the nano. I've left pads on the board for wire links between the SWDIO/SWCLK pads on the underside of the nano - as otherwise it would be impossible to reach once the nano is soldered into the pin headers. I solder wires to the pads on the underside of the nano, secure with a blob of 2-part epoxy and then you've got a nice secure connection to SWCLK/SWDIO. Once that's done flashing can be done via the SWD connector available on the board. If you only plan to use the Arduino IDE - all that isn't necessary and you can use the USB port on the nano for flashing - but tbh I'd do it anyway just in case as once you've soldered in the nano, you're not getting at the underside!
Next steps:
Take feedback about the circuitry/pcb design - electronics and PCB design are not my forte - to try and eliminate any obvious bugs.
Get a couple of sample boards made to test.
Likely repeat the first steps to get a working board!
Finish off the ebike app part
Stuff the board and a VESC inside a spare TSDZ2 case and see what happens!
I'm using EasyEDA Pro at the moment - I know it's not as good as KiCAD or others - but it makes life a lot easier with the parts and PCB fabrication integration.
Constructive criticism welcome!
Last edited: