Part 3 (VESC)

As mentioned in part 2, the second controller (Greentime) was also not suitable for my application.
By searching for esc number three, we went over the VESC, wich is a open source / hardware speed controller primarily developed for electric longboards.
With features like 120A peak current, software to setup all parameters via USB and regenerative braking, to just mention a few. Cost is around 80 Euro/USD for the parts only.
At the time I started ordering the parts, hardware version 4.7 was the latest. Compared to all the chinese controllers, the vesc is really small, wich doesnt makes soldering easy. Especially the driverchip (DRV8302) is difficult to solder because of its groundplane underneath. A good hot air station with heatbed is highly recommended.
However, the mosfets were easy to solder by using a big soldering iron.

After all parts were placed, the STM needs to be flashed next. For this I want to refer to the instructions by B. Vedder:

Sadly, the board is a bit too small for my taste because the mounting holes are poorly placed. Also I dont wanted to just place it into a case, but rather build something to dissipate the heat from the mosfets. Therefore I milled a clamp out of an aluminium block wich presses the fets with some thermal pads against the aluminium case.

Here you can see the mentioned Fischer aluminiumcase from Reichelt: DPL 1-1, KOH-1160, KOL 1/160 ME

The 8 AWG siliconwires actually seem a bit oversized.

Directly next to the ESC, I soldered two 1000uF 63V capacitors.

In one side of the case I made some holes and slots for (from left to right) batterycable, mini usb socket, various switches and cables, tuchelsocket for hallsensors, motorwires.

Unfortunately the VESC didn't had a secondary adc input in version 4.7 to connect my brake switch directly to is. So I took the Attiny 13 and build a small controller board, wich takes the throttle signal and the brake switch and combines it to one single analog signal. So now if no brake or accelerator is pressed the output signal sits at 50%, wich can be configured in the bldc-tool. Because the attiny runs at 5V a voltage divider is needed to limit the voltage to the adc's maximum of 3.3V. Also an opamp is used as a low pass filter for smoothing the pwm of the attiny.
Here the circuit and code for the attiny:
Edit 4-22-2016: This circuit doesnt work as needed. The LM358 isn't a rail-to-rail opamp which in this case would be needed because of the 5V supply. I did change the design so that the voltage divider is between the attiny and a first buffer. The new circuit can be found, as well as some other changes somewhere here.

The pcb is not the most beautiful looking one I did with pcb routing, but is was fast and works.

And so I finally was able to mount the controller back to the cart. Later I sealed the holes for the cables with some silicone.

Unlike the Greentime controller, the VESC did not has something like an on/off switch. But because of the power this machine has, an emergency stop was vital for me. So I used a break-switch directly between ESC and the batteries positive terminal. But because of its missing antispark feature, I'm not going to use it as an on/off switch for normal use.

And so it was again ready to be driven. I had and have to do some more tweaking of the VESC parameters.

Part 4