Skip to content
View in the app

A better way to browse. Learn more.

Pedelecs Electric Bike Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

GSM middrive, with VESC and Teensy "ForumsController" conversion

Featured Replies

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:

 

2016-10-1012_33_04.thumb.jpg.e58efd956f542a9fba05833e9cd35510.jpg

 

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.php?id=elektrotechnik:forumscontroller) 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:

2016-07-2920_36_50.thumb.jpg.8f9e453708f477418449ebc744c7ec3f.jpg 2016-07-2920_37_05.thumb.jpg.7c0941f584f0de3178e55a4d7bc9c889.jpg

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.

2016-10-1012_33_22.thumb.jpg.b3f3b1fcf6b354ed4c9f3898551c5c1b.jpg

 

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.

2016-07-2920_36_11.thumb.jpg.ff0a53276f87f69bdf87acce112f27df.jpg 2016-07-2920_38_13.thumb.jpg.1cb8a52bc175750d5108bf037b7652de.jpg

 

Some more info on the Display (in German):

http://www.pedelecforum.de/forum/index.php?threads/forumscontroller-eine-display-diskussion.16947/page-8#post-701276

Video from the display:

https://www.dropbox.com/s/o81ibg4oab30zgj/2016-07-29 19.21.39.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 ;) .

2016-10-0918_29_59.thumb.jpg.d64db6607ef5a73976dcd13eeb2bed47.jpg 2016-10-0918_29_52.thumb.jpg.c6cf21fa364297a50e034ec13cdf3227.jpg

 

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:

 

2016-10-1012_34_27.thumb.jpg.868fade4fbfa83686c4e68867c9a857a.jpg 2016-10-1012_31_00.thumb.jpg.29977ab168efbf0dea1b0fd97cbc757d.jpg

 

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-DC-Buck-Converter-5V-60V-to-1-25V-26V-Power-Module-48V-to-3V-5V-12V-/321512279591?hash=item4adba00e27:g:fr4AAOSwQItUCR6F

 

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!

  • 5 months later...

Hi Daenny,

 

Nice I found your post, I was planning similar setup, have already GSM middrive, next looking forward for VESC... in my understanding you use curently available version 4, have you done any changes/adaptations on controller side?

And why 32 bit Teensy instead of Atmega?

Edited by parasole

  • Author

Hi,

I use the VESC 4.12 with the latest BLDC firmware.

I did a quite somechanges to get the ForumsController code running on the Teensy, they are all on my github link in my initial post.

 

I used a Teensy because:

- Multiple UART RX/TX (so you do not need to unplug the VESC while programming the Teensy), and more flexible other pins (all are Analog and Digital)

- More space, the Nano is on its limit with the ForumsController code.

- I wanted the colour LCD display. It's now connected directly to the Teensy, I do not know if the atmega's are fast enough and have enough space for it.

- Faster, 96MHz vs 16 or 32MHz on the atmega's. I could run the PID control loop at 1Khz, if I would want to (which does not make sense, but it's fast enough for it ;) ).

 

I have biked now around 800km with this setup, and all is still working fine :)

Thanks for your reply Daenny, clear enough, will try to move forward by using your setup...

Hi Daenny,

looking down to your display code, is it on porpose or pinout mistake?

 

#define TFT_CS 10

#define TFT_RST 10

  • Author
No that's actually on purpose. It saves a pin and therefore a cable that runs through the frame. You need to give the LCD library all pins, so that is why I defined them. but one of them does not need to be connected, I think it's CS which I pulled to ground if I remember correctly. This of course only works when you only have one SPI connection

Thanks, clear, assume CS is used for selecting between display or SD card reader, which is not required... One more question, looks like you are not using analog throttle, instead one button for power boost when required?

Otherwise PAS sensor is the main input for the bike to ride?

  • Author
Yes indeed. CS is for selecting between different SPI devices, and since I only have one it's always the LCD. I ditched the throttle eventually, the PAS with the option to quickly change in 50W steps is usually more than enough. And in the rare case that you want to quickly overtake someone or make the traffic light, the boost button is nice.
  • 6 months later...

Hi Johan,

 

there is no real diagram to share about, I gathered every thing from Daniel explanation over here and on pedelecforum.de forum (home for FC)...

In my case it is almost the same as Daniel describe except that I am not using Teensy, instead I did a small PCB and attached to it the controller soldered to an adapter PCB. I am using same controller as in Teensy so fully used Daniel code, the difference is in programming the controller which I did by using Jlink... Then FC takes all the signals like brake, control switches, speed and PAS sensors and communicate with VESC over serial as well it takes the power supply from there... If you are around Stockholm then you are free to come over and see my setup...

Edited by parasole

  • 2 years later...

Hi there,

 

I know it's an old thread but I love the idea of this project. I have bought a vesc and manufacture a custom made ebike kit. My issue is that I would like to implement this on my VESC so I can get a PAS sensor, however I am a big noob at programming or understanding codes. Is there a step by step tutorial (for noobies :D) that I could understand ?

If not, would one of you accept to assist me ?

 

thanks in advance guys !

 

 

P.S. : here is a picture of the bike

 

VELOTHOMAS.thumb.jpg.37d14540f4f28bdfd8409ae5b922d442.jpg

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...
Background Picker
Customize Layout

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.