GSM crankdrive with VESC and Teensy "ForumsController"

Discussions related to motors other than hub motors.
This includes R/C motors, botttom bracket, roller and geared drives.
Post Reply
daenny   1 mW

1 mW
Posts: 15
Joined: Sep 24 2015 1:30pm

GSM crankdrive with VESC and Teensy "ForumsController"

Post by daenny » Oct 10 2016 10:07am

Hi,
This is a repost from the UK pedelec forum, but I thought it might be interesting :
http://www.pedelecs.co.uk/forum/threads ... ion.25787/

So, my latest build is finally mostly complete:

I used for the build a GSM middrive (without internal controller) from Woosh, a VESC open source controller and a Teensy as "CycleAnalyst/ForumsController".
I have built a display based on a 2.2 inch LCD and also module with 5 way joystick for the controls and push throttle-button.
For power I use 12s LiPo (MultiStar 8000mAh 6s x 2 from HobbyKing in a saddle bag). I am an RC enthusiast, so I already had proper balancing chargers and know about the pros and cons of LiPos.
I ran the wires through the frame for a nice a clean build.

The front light is powered via a step-down module and the power can be switched on via the handlebar controls. This is the final bike:
small-2016-10-10 12.33.04.jpg
small-2016-10-10 12.33.04.jpg (83.55 KiB) Viewed 1310 times
In more detail:

I used the VESC (http://vedder.se/2015/01/vesc-open-source-esc/) as controller as it gives complete control over the settings. Via Serial communication I can get the battery current and voltage, board and Mosfet temperature, motor current and RPM.
However, as it is based for electrical skateboards, there is no input for throttles, ebrakes, PAS and displays. It has two available analog/digital pins but also a Serial port.
So I first thought I will add a CycleAnalyst for this and use one of the A2D pins as throttle input. However, then I came across the ForumsController (some info in German: http://www.pedelecforum.de/wiki/doku.ph ... controller) and thought, I can build this myself, and since I need much less functionality, i.e. I can get a lot of data already from the VESC, I basically only need the microcontroller to handle all the e-bike accessories.
The ForumsController code is nice since it already took care of a lot of things, i.e. Voltage cutoff, PID control for the output, PAS, velocity limits, range calculation, different profiles, etc.

I bought a Teensy (a 96mhz "Arduino compatible") board and adapted the ForumsController code to run on it.
I build a simple PCB to which I attached the ebrake, display, throttle and the Serial communication from the VESC. The VESC also provides one 5V 1A output which powers the Teensy and all accessories.
Below an intermediate PCB version and the VESC in a 3D printed case:
small-2016-07-29 20.36.50.jpg
small-2016-07-29 20.36.50.jpg (62.95 KiB) Viewed 1310 times
small-2016-07-29 20.37.05.jpg
small-2016-07-29 20.37.05.jpg (77.35 KiB) Viewed 1310 times
In the final version I changed the JST connectors for USB-C type connectors and wired it up using USB-C cables. I put the VESC and the teensy together in a 3D printed box on the down tube.
small-2016-10-10 12.33.22.jpg
small-2016-10-10 12.33.22.jpg (79.07 KiB) Viewed 1310 times
As a display I did not like the standard display, which is usually used, namely a Nokia 5510 display. There was already a mockup for a colour LCD, so I used the existing code and made it work with the Teensy.
small-2016-07-29 20.36.11.jpg
small-2016-07-29 20.36.11.jpg (63.21 KiB) Viewed 1310 times
small-2016-07-29 20.38.13.jpg
small-2016-07-29 20.38.13.jpg (58.76 KiB) Viewed 1310 times
Some more info on the Display (in German):
http://www.pedelecforum.de/forum/index. ... ost-701276
Video from the display:
https://www.dropbox.com/s/o81ibg4oab30z ... 9.mov?dl=0

As final step I changed the throttle for a 5 way joystick and a push button throttle. I used various resistors to hook all 6 buttons up via a single Analog input. I kept the e-brake on a separate wire, just to have more reliability and I had the spare wire anyway ;) .
small-2016-10-09 18.29.59.jpg
small-2016-10-09 18.29.59.jpg (47.51 KiB) Viewed 1310 times
small-2016-10-09 18.29.52.jpg
small-2016-10-09 18.29.52.jpg (48.71 KiB) Viewed 1310 times
I used a USB 3.0 cable which I wired through the frame. It has 8 wires in total. The display used 6 of the wires, so I had exactly one left for the analog input for the 6 buttons and one for the e-brake. The ground is combined in the display case. I recycled the connectors of these Julet wire harnesses so I have the USB cable go inside the display case and two Julet connectors for the e-brake and the button panel, for which I 3D printed a case. See the button panel below:
small-2016-10-10 12.34.27.jpg
small-2016-10-10 12.34.27.jpg (49.39 KiB) Viewed 1310 times
small-2016-10-10 12.31.21.jpg
small-2016-10-10 12.31.21.jpg (92.34 KiB) Viewed 1310 times
With the 5 way joystick I can increase and decrease the support in 50W steps (up/down) and change the views of the disply (left/right). A center push enters the menu, which then temporarily overwrites up/down and center for selection. The push button on the left is a push throttle, which directly sets the target support for 500W.

I also build a speed sensor. It is simply a Hall switch and a spoke magnet from an old bike computer.
The light can be controlled via the menu, there is a step-down module hidden underneath the front fork. The module has a shutoff input, so the Teensy can switch it on and off (see the display video 2:40)
The module is like this one:
http://www.ebay.co.uk/itm/LM2596HV-DC-D ... SwQItUCR6F

The code can be found on github, it is mostly in English, maybe here and there a German comment/text ;)
https://github.com/daenny/Arduino-Pedelec-Controller

If you have any questions or want some more details (e.g. your German is not sufficient) let me know!
Current build:
GSM Woosh Middrive, with VESC controller, color LCD Display and Teensy ForumsController:
https://endless-sphere.com/forums/viewtopic.php?t=84042

Alex07   100 W

100 W
Posts: 137
Joined: Jun 27 2016 4:00am

Re: GSM crankdrive with VESC and Teensy "ForumsController"

Post by Alex07 » Oct 11 2016 7:04am

Nice use of the ESC, did you use the hall sensors or not ?

Did autodect work easily ? can you modify the controller for higher then 60v ?

daenny   1 mW

1 mW
Posts: 15
Joined: Sep 24 2015 1:30pm

Re: GSM crankdrive with VESC and Teensy "ForumsController"

Post by daenny » Oct 12 2016 7:28pm

yes, I used the Hall sensors. Autodetection worked fine for me. I think it might a tiny bit louder than my old sine controller (BMS Battery S09), but it's hard to tell since I cannot run them at the same time obviously ;).
For getting it to work with 60V you probably would need a redesign and change some parts. There are some people who did this, just search the vedder.se forum for that.
Current build:
GSM Woosh Middrive, with VESC controller, color LCD Display and Teensy ForumsController:
https://endless-sphere.com/forums/viewtopic.php?t=84042

Post Reply