I'm still working through debugging everything. I found wiring errors in my control box, some wired to the wrong locations and a couple of missing wires to the deadtime control chip.
Once I got the wiring all fixed I ran some tests, these tested inputs and outputs to make sure they functioned correctly. I also tested all the interrupts in my motor control firmwire, the timed interrupts and the external interrupts.
Motor control uses center or symmetric PWM, this is different from the normal edge aligned PWM and prevents all the outputs switching on simultaneously, it staggers them instead. I had previously written to the authors of the leaflabs compiler and they had given me instructions on how to modify the compiler so it does center aligned PWM. Unfortunately the compiler has been updated a number of times since the end of last year, I dug through the new files and managed to figure out myself how to make the modifications. I confirmed this via a high speed oscilloscope.
I had to understand how the deadtime generator worked for my start routines and regen braking routines to work. I again used a high speed PC based oscilloscope to analyse the signals. It behaves as expected.
One of the biggest headaches I've had and the hardest thing to write is all the different driving states and how the motor knows where it is and where its going. This is everything from standstill, to initial acceleration, switch to closed loop control, regen braking, coasting, and stopping.
I had originally done this via many IF statements inside functions triggered by hall sensor interrupts and a timed 10hz interrupt which handles reading the throttle and enable etc. However it became very difficult to manage and draw out in a block diagram.
I decided to re-write these parts again, I made up state matrixes in excel and then used case statements in my functions to switch between cases. It is now clearer and more manageable.
Next I'm working on checking the closed loop functions, there are many parameter in there that are missing, I've ported my code to arduino to do this as its easier to debug via the serial port.
There is also a new arduino out this year with ARM:
http://arduino.cc/blog/2011/09/17/arduino-launches-new-products-in-maker-faire/
It uses a 96Mhz ARM microcontroller, faster than the Maple I am using. The arduino compiler is very similar to Leaflabs so it should be very easy to port my code to Arduino. I'm sticking with the Maple for now as I am far along and the Arduino Due is bigger and won't fit in my control box. Its also very new and the compiler may have errors and items like symmetric PWM might be impossible or difficult to implement on such a new product.
I can see the new Arduino with my 3 phase open source motor control firmware becoming quite popular, all it needs is an open source IGBT or FET driver stage and motor control should become much easier and cheaper!
Bug
Tuesday, September 27, 2011
Monday, September 12, 2011
Long time no update
So I had a long break away from this project, got side tracked on a lot of stuff. But I've cleaned up my workshop and have been back working on it with a view to getting it finished off.
I bought a 3 phase brushless bicycle motor as a test piece for getting everything working as far as electronics and firmware. It has integral hall sensors just like my motor will have so everything should transfer over fine. I have done some more analysis of the honda electronics and tested the high voltage/high current outputs when I drive them with a control signal, they worked as expected.
I completed my ECU firmware to the point where everything is functional, sent dummy signals to check the RPM and road speed functions work etc. The LCD all works as it should.
I finished off my electronics box on sunday, it now has everything in it apart from a fuse holder and a final +12volt power supply feed bulkhead connector. I found one mistake when completing the final wiring.
I now intend to run a test app on each microcontroller and test every input and output to check for errors or problems.
If all is well I might be able to try and run the test motor in 1-2 weeks. I can then optimize my motor drive firmware. It might have a lot of bugs in it so require a lot of debugging work, don't know at this point.
I bought a 3 phase brushless bicycle motor as a test piece for getting everything working as far as electronics and firmware. It has integral hall sensors just like my motor will have so everything should transfer over fine. I have done some more analysis of the honda electronics and tested the high voltage/high current outputs when I drive them with a control signal, they worked as expected.
I completed my ECU firmware to the point where everything is functional, sent dummy signals to check the RPM and road speed functions work etc. The LCD all works as it should.
I finished off my electronics box on sunday, it now has everything in it apart from a fuse holder and a final +12volt power supply feed bulkhead connector. I found one mistake when completing the final wiring.
I now intend to run a test app on each microcontroller and test every input and output to check for errors or problems.
If all is well I might be able to try and run the test motor in 1-2 weeks. I can then optimize my motor drive firmware. It might have a lot of bugs in it so require a lot of debugging work, don't know at this point.
Subscribe to:
Posts (Atom)