Electric bug build
Bug
Sunday, November 27, 2011
Motor running... sorta
I have my test motor running in simple trapezoidal commutation, next is FOV control.
Friday, November 18, 2011
Electronics work
I have the firmware in a position where to continue I need to actually hook up the electronics and try turning a motor, so I started mounting my control box to the master honda electronics.
In order to do this I had to make sure any loose ends were tied up, I found the DC-DC converter didn't have the correct inputs from my electronics. I had to experiment with powering up the DC-DC converter which eventually I got working. It required a +12 feed from the ignition, high voltage input and the last thing is a 12 volt lead acid battery which has to be hooked to the output of the DC-DC converter for it to function.
Tuesday, October 4, 2011
More debugging
So its taken me longer than I thought to debug, I'm having to re-write large portions of the code. One of my problems is I referenced multiple sources for the basis of my code. This led to errors between the various parts. I am now using a single reference.
I'm finally getting real numbers out of my 3 PWM pins for the motor control. This has allowed me to run speed checks using an oscilloscope, the bad news is the total control loop takes 157 microseconds now, it needs to be somewhere around 50-70 microseconds. I discovered that sine/cosine calculations take a long time even on the ARM cpu, so I'm probably going to have to use a lookup table.
This should speed things up a lot and knock off around 100 microseconds from the code.
I'm finally getting real numbers out of my 3 PWM pins for the motor control. This has allowed me to run speed checks using an oscilloscope, the bad news is the total control loop takes 157 microseconds now, it needs to be somewhere around 50-70 microseconds. I discovered that sine/cosine calculations take a long time even on the ARM cpu, so I'm probably going to have to use a lookup table.
This should speed things up a lot and knock off around 100 microseconds from the code.
Tuesday, September 27, 2011
Debugging
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!
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!
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.
Sunday, February 27, 2011
LCD screen and firmware
I've almost finished all the motor drive firmware, I only have the regen part of the motor firmware to write. I'm also about 50% of the way through the EV main control firmware for the vehicle and LCD screen, it gives me info like battery voltage, current, watt/hours used, watt/hours left, road speed, motor temperature etc.
Control box
Here is a pic of the control box I'm working on. It has the maple for motor control and an arduino for the main EV functions and driving the LCD screen on the dashboard.
Subscribe to:
Posts (Atom)