zinahe said:
Hi all,
First of all thanks for the incredible work by
mxlemming and everyone who contributed to this project. I'm not sure if this thread is still active but I wanted to ask a few questions:
1. The github repo consists of a number of folders (R2 Outputs, R2.1 Outputs, R2.2 Outputs V0.5 Outputs) which made it difficult to locate the latest gbr files. I also saw that there was a mention of V0.6 somewhere in the discussions. Is the repo up-to-date with the latest design and which are the files one should be using, let say to order from JLCPCB ?
2. I understand the schematics utilizes two types of MOSFETs (Q1-Q6 of CRSS037N10N and Q7-Q12 of IPT015N10N5). And unfortunately due to the semi-conductor crunch we are in at the moment, the CRSS037N10Ns are not available at the moment. I tired to search replacement and the best match I could find are
these. Any suggestions ?
[Edit]
3. Now that external current sensing amplifiers are used, is there any particular peripheral requirement that ties the design to STM32F303? The firmware should be updated and the MCU pin-outs should map correctly, of-course.
[/Edit]
Cheers,
Hi Zinahe,
Nice to see the interest in this project. To your questions directly first...
1) The PCBs as ordered are on commit 96fb25afc07f31bedd5439b9273e76e75e7277ba from 16th December 2020. Since that, I made a few improvements, but there are no further GERBER files made, and I have not ordered further boards. If you are actually going to order some, I would recommend you recreate the gerbers from the project files since there are probably a lot of missing components from JLCPCB 9 months later. The current "latest greatest" is master branch at commit 0894c6b28ff915d71f7fb4fb8f169e0d44fd1a05
2) The IPT015N10 MOSFETs are massively preferred over the TO263 options if you want to push more than about 50A. The TOLL FETs are far superior in switching and current capacity. On Semi FDBL0200N100 is the optimal TOLL choice if you can get it. If you are happy with the TO263s, you might try the CR Micro CRSS028N10, which JLC currently have 900 of or HSH15810 which they have 600 of. Many FETs will work, with chinese brand ones you roll a dice to some extent, but I found the CR Micro ones seemed to work every bit as well as the Infineon and TI ones I tried. Take care that 1) Rds on is <5mohm for decent power capability (the TOLL fets are about 1.5mohm) and most importantly the ratio of Ciss to Crss is >100.
3) You need as a bare minimum, assuming you have external opamps:
3 independent ADCs, or an ADC with sufficient speed to sample 3 current channels sequentially in <about 60 clock cycles. The ADC must be triggerable by the advanced control timer, and you will have to implement your own ADC conversion functions if you swap chips.
The STM Advanced control Timer 1 (they basically all have this)
Timer with capability of PWM input for RC, and the analog throttle in also runs off that for running the slow loop interrupt at 50Hz with a 50Hx PPM in or 20Hz without.
An FPU. If you want to run FOC without an FPU, look at stancecoke's project which in many ways is more advanced than mine (integration with screens etc) though the hardware choice of that project limits how good/tight the control can ever be.
You do not need a timer for the hall sensors. Initially I intended this, but in the end found this was not helpful (in fact noise on the hall sensors makes the timer solution nearly non functional)
There are some unused peripherals e.g. USB is not implemented, and probably never will be (if I make another board I will drop an external USB-serial chip on it since the STM USB drivers are a semi proprietary crock of crap).
The F303 is optimal, one day I will get round to porting the code to F405 and L433.
The only pin for pin drop in replacement chip is the L433, which has one super fast, very well behaved ADC, and again I never got round to porting the code.
Now... Should you do this?
The power stage I believe is pretty good. It switches very cleanly and fast and is capable of quite a lump of current for its size.
The analog stage is also pretty good, with the external amps it's nice and clean, with the internal ones... it works well enough for ebike application, but you can actually hear the noise the analog sampling injects into the control loop coming backout of the motor at standstill. It's a white noise hiss, nothing serious, quieter than BLDC commutation.
The software is much less good. It runs FOC in hall sensor mode only; I made recently the sensorless branch but it is basically an academic exercise for me. The code is far from professional or enterprise, and it still has a lot of magic numbers in it that I occasionally go around sniping.
Against that, it seems pretty robust, I have done the better part of 1000km on my ebike and now the only time it ever trips is when a wire falls out or something shorts. Efficiency is decent.
I have no plan to carry this forward to some world leading ESC thing, I am currently thoroughly employed in making scientific equipment that pays far more than I can ever foresee from making ebike controllers, so this remains my toy that I use to learn electronics and embedded programming.
You are absolutely welcome to use it, bits of it, fork it, contribute code (though I won't tolerate proliferation of abstraction and 200 header file "professional developer" blumpf) build and sell them commercially... whatever, but if it breaks... you can keep both pieces. I'll gladly help out via forum posts up to a point.
Good luck whatever you do!