PicOx - Open Source Motor Controller

For Light Electric Vehicle PMDC Motors - Part 4 ...

March 2008


Disclaimer - This project is in a preliminary state of development, every effort is being put forth to share it's progress, and note issues as they arise... Though theworkshop.ca and parties noted in the development of the PicOx Open Source Controller are held blameless and without liability with regard to how this information is used.

Addendum Dec 4th 2008 - C9 should be a minimum of 200uF if Picaxe 08M processor locks-up intermittently above 50Amps @ 48V, also CURADC output to processor starts to show noise intermittently above 50Amps... either cut trace, disabling current limiting function or revise pcb layout with a pin connector to current sensor and sample current flow externally (away from MosFet switching circuitry).


PicOx Version 1.02c is a working 48V 50A controller with functional current limiting. The PCB layout, schematic and code listed on this page supersedes all previous versions, The software absolutely will only work with this hardware revision.

For the source files of the PCB, schematic and Pbasic code (Express PCB format & JPGs as a single zip), email me for the latest version  frank@theworkshop.ca (please ensure that the message header states "PicOx Ver 1.02c")

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Note, the Fet's and Diode Pairs are positioned such that they are alternating in their orientation relative to each other. The heavy Red Areas that extend off of the PCB are custom fabricated solid copper Buss-Bars.

The thin red pads that have a yellow line on them are surface mounted jumpers, this is NOT a double sided board.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

The Schematic above has several modifications, even relative to the V1.02b files as posted on the ES Forums... (My regrets as it seems I posted prematurely, I guess I was excited...)

The most significant is the swap of the Throttle and Current ADC Lines between physical legs 3 & 6, as reflected on the PCB and code as well. The addition of a simple passive Low-Pass Filter on the CurADC Line (Leg 6 of U2) specifically R2 & C11. The removal of the original R2 as a pull-down resistor on the Gate Driver output and the addition of better voltage filtering to the logic stage (per Schematic.

The PCB Parts placement Mask also has all the proper part ID#'s relative to the schematic to make assembly quicker and less error prone.

 

;PicOx Ver 1.02c Mar 13/08 frank@theworkshop.ca

SYMBOL CurAvg = b0
SYMBOL LCDAvg = b1
SYMBOL ThrottleADC = b2
SYMBOL CurADC = b3
SYMBOL CurAmps = b4
SYMBOL PWMMark = w6
SYMBOL ZeroCurMark = 124
SYMBOL CurLim = 25
Pause 10000
main:

for LCDAvg = 0 to 10
CurAmps = 0
readadc 4, ThrottleADC
readadc 1, CurADC
if CurADC < ZeroCurMark then
CurAMPS = ZeroCurMark - Curadc * 5
endif
PWMMark = ThrottleADC - 44 * 16 / 10
if CurAmps => CurLim then
PWMMark = 0
endif
pwmout 2,66,PWMMark
CurAvg = CurAvg + CurAMPS
Next LCDAvg
gosub LCD
goto main

LCD:
CurAvg = CurAvg / 10
sertxd ("ThrottleADC " , #ThrottleADC,  "     |     CurrentADC ", #CurADC, "  |  Current ", #CurAvg, cr, lf)
CurAvg = 0
return

end

 

The code above is functional in that it is tight, offers usable feed-back for calibration, reliably performs ADC functions on the throttle, and current sensor, and averages the current calculations that can be read on an LCD screen in real-time , or stored as a log onto a PC for detailed analysis after testing or usage.

Every PicOx will have to be calibrated due to the variability of Throttle Hall Effect Sensors, Current Hall Effect Sensors and how their configured, as well as the current limit that is being applied to the motor you choose to use.

In the case above between 4 different Hall throttles, the idle or "off" position was marginally different ranging from 44 (currently being used) through to 53. To use as few lines as possible the lowest stable ADC value is actually used in the PWMMark calculation.

The Current ADC constant is defined at the top of the code as 124, but is not likely to be exactly that value if the UGN3503 was replaced with an identical part and similarly has to be changed, the CurADC to CurAMPS conversion was a piece of cake as each ADC step equates to 5Amps almost exactly against a DMM and Analog amp meter to 20 Amps. (you can count on destroying at least one DMM in the calibration process so use your cheapest one).

Note that as the current rises to the motor, the ADC drops down to 123, 122 etc, if the sensor as oriented 180 degrees relative to it's current position the CurADC would rise.

The current limiting that seems the most effective turned out to be the simplest (listed above), when CurAmps is greater than CurLim, shut her down with a PWMMark = to Zero...

I spent several hours reading over PID (Proportional Integral Derivative) control paradigms and application notes that had math that nearly made my head explode...

The underlying idea slowly is making sense but the PicAxe 08M processor may be a little too much of a light weight to handle it effectively.

The LCD sub is called after 10 iterations of the basic ADC/PWM loop and displays an averaged Current measurement that tracks quite nicely to the slow analog meter and the RMS DMM before it when up in smoke.

The PAUSE 10000 is used to keep the logic idle for the 5 seconds that the "Pre-Charge/Soft Start" switch is held at start-up and to suppress any motor jumping if the Mains switch is not cleanly flick on.

If the motor is randomly firing-up at full speed, your ThrottleADC and/or CurADC is NOT calibrated, or the PWMMark equation may need to be rescaled, to accommodate a valid range of 0 thru 266.

 

 

 

 

 

The image to the right is the data log of the final run from today... The Throttle ADC & Current ADC values are the 10th as was read at the time the data is transmitted, while the Current is the average of the 10 ADC read and PWM calculations.

Given the example of CurrADC @ 99, 124 less 99 equals 25 times 5 Amps equates to 125Amps at a given brief instant while for 7 or 8 of the remaining pulses The PWM would have been dropped to Zero.

Even assuming a 20% error factor the instantaneous current could be between 104 and 150Amps.

 

 

 

As extreme as this may seem, the Averaged current was tested at a consistent 75 Amps for approx 5 seconds before the breaker popped.

 

 

 

 

Since the PCB had to be modified, and the previous board had lots of wasted space, the PCB was designed to use the old case that was cannibalized from a YK42-x controller.

As well the FET/Diode pair placement had to be reworked to accommodate less space and reside along a single wall of the controller for additional cooling.

This config will be extended into the PicOx Ver 2.xx controller that will start development next week.

Eric C. in L.A has been kind enough to send up a massive Alum Box that is identical to one that he will be using on an electric motorcycle he has built.

 

 

 

 

The image to the right  foreshadows how we increasingly we will survive as the 21st century progresses.

A 4 ft length of 1/2" dia water pipe may be able to make 20 or more controller hi-current busses.

 

 

 

 

 

 

 

 

 

 

The FET Drain tabs are soldered along their tops to the copper rail, and there is no grease or insulators between the screws, the tabs or the copper buss.

The diode pairs are fully insulated from the Alum block.

 

 

 

 

 

 

 

 

 

 

The halves are assembled and tested for continuity and short circuits (where they should be and shouldn't).

The Alum block draws heat from the backs of the Diode Pairs, and face of the FET's but is completely isolated from either.

 

 

 

 

 

 

 

 

 

 

This just looks cool....

I liken it to a hi pressure fuel rail on a hyper efficient Diesel engine.

 

 

 

 

 

 

 

 

 

 

The drain connections of the FETS are fed directly to the Diode Pairs via the AWG#14 girders shown to the right.

The idea is that there is as much cross sectional area for current to flow as possible.

 

 

 

 

 

 

 

 

 

 

The V+ Bat and Bat Grd lines are similarly heavy copper that is carefully soldered to the PCB and anchored securely over a Capacitor.

My greatest fear would have been that the PCB foil would start to delaminate before the solder would flow, so I used a small butane torch to pre-heat the copper busses and tinned them with solder just as they were applied to the PCB and the remaining soldering was done with a 25W iron.

Since this worked so well the PicOc V2.xx will have heavier busses that run the entire length of the power rail of the PCB.

The yellow heat shrink sleeves are to isolate the Buss bars from traces that had to pass under them.

 

 

 

 

Assembled and in-circuit.

Hook-up is considerably better with the exception of the Bat ground positioned directly below the Mtr Grd tab, other wise a substantial improvement over the previous board that was a hassle to screw terminals that were all in-line and adjacent to each other.

Note that the Bare torroid simply hangs in the slot cut for it and is positioned over the UGN3503 Hall sensor and glued into place.

 

 

 

 

 

 

 

This shot is of a spring time 52cm dump of snow, that came within 36 hours of a 30 cm dump of snow, that was followed by another 10 cm of snow...

Oh, Big fucking surprise! it's snowing right now...

It seems that this has been the case since mid November with the exception of a brief thaw in January and a period of -25 to -30C when it was too cold to snow..

 

 

 

 

 

 

This is the only waveform on this page and it is of a reasonable clean sharp gate drive of the Fets at 15V 1/3rd throttle.

 

 

 

 

 

 

 

 

 

 

 

 

 

This patch is the RC Low-Pass filter to suppress noise from the CurADC line to the processor.

At 36V 20 Amps the PicAxe started resetting again but the ground plane was not the issue.

The Schematic and PCB above have this modification appended.

 

 

 

 

 

 

 

 

 

Test Bench...

 

 

 

 

 

 

 

 

 

 

 

 

 

The battery bank totals 48V via 4 x 12V 17Ahr SLA cells.

The batteries are in good health and were fully charger just prior to testing this version of the controller.

As stated on the previous page the Pre-Charge/Soft Start control box has been very handy and worked like a charm.

 

 

 

 

 

 

 

This is a MY1020 1200watt motor that is rated at 48V 25Amps if you take Unite Motor Co. at their word.

Do-Not try to hold the vice-grips while running a "Locked Rotor" test...

At 1/3rd throttle the motor started to lever the bench backwards almost dumping the laptop, batteries and scope to the floor.

 

 

 

 

 

 

 

 

The grey specks on the bench top are shavings that have been chewed off of the Shaft.

Even with the Vice-Grips securely clamped onto the shaft, the relentless grinding of the Current-limiting when over 20 Amps will work the teeth of the pliers loose in about 60 seconds.

 

 

 

 

 

 

 

 

 

The PCB fits quite snug in the YK42-x case, and is isolated from the base via a slab of styrene foam.

The top has to be drilled out to accommodate the Tall Capacitors and the ends will have to have slots cut for the power rails and cabling.

 

 

 

 

 

 

 

So in closing the objective that was laid out in Part 1 of the PicOx has been successfully met...

A functional equivalent to the YK42-x controller, but with Analog to digital conversion for the throttle and current sensing, as well as a software programmable current limiting feature.

The absolute specs as tested against a "Locked-Rotor" worst case scenario is 48V @ 75 Amps no current limiting for 5 Sec, Repetitive 48V 50 Amp cycles of approx 10 seconds (or when the breaker would pop), and 3 cycles of 48V 25Amp Current limiting for 60 seconds each.

Total "On-time" of bench testing was approx 2 hrs over the course of the day.

 

 

PicOx (Open Source Digital Motor Controller), 2, 3, 4


Back to Energy

Disclaimer (an unfortunate necessity)
All Rights Reserved theworkshop.ca © December 04, 2008