Lebowski's motor controller IC, schematic & setup, new v2.A1

Teh Stork said:
Regarding your equivalent schematics; you're missing the decoupling capacitor in there. This will absorb the energy in the rings. It is the positive and negative rail that bounces.
The decoupling capacitor is the C / L_c combination. The bouncing accross this C, or accross the FET's, is due
to L2 and L4 (the wiring from the battery to the controller)

Teh Stork said:
Remember these inductors are magnetized before you shutoff a switch - try your simulations again with this as initial values.

All this changes is the amplitude of the step that sets of the ringing. The ringing itself, its frequency and
the way it is dampened is determined by (linear) components so this does not change. At least in my understanding of things :D
 
As we are busy anyway, lets continue with my view of gate resistors.
View attachment 3
Going from left to right we have the gate driver, the gate resistor R_g, the wiring inductances of the
connections between the driver IC and FET (L_w1 and L_w2) and then the FET. I only drew the low side driver
but the high side is of course the same. Now the gate side of the FET can be modelled by a capacitor C_g.
Then we get this equivalent:
gate_side_equiv.jpg
This is again one of those LCR circuits that has a certain ringing frequency from the L & C with damping
coming from the R. The main difference with the drain / source side snubber circuit is that on the
gate side the currents are relatively low and it is therefore possible to add a resistor R_g in the signal
path (I mean, you're not going to add a resistor in the drain with all those amp we want there, so an
alternative method is used there by inserting the snubber cap).
The equivalent circuit does not model the Miller plateau but this is not necessary for the gate overshoot we're
interested in.
Again some simulation results:
gate_step.jpg
Here the red curve has a low gate resistance, the yellow an intermediate and the green a high gate resistance.
Again, with no or too small a resistance there's insufficient damping so you get the ringing. What I typically
do is experiment a little with resistor values untill I get the yellow curve. The green curve is slow and is
kind of what ZombieSS found in the china controllers. Note that the red curve goes over the 20V allowed for
a typical FETs gate voltage, instand death and blue smoke territory. For my bicycle (done 250 km so far never
blown a FET) I use NCP5181 gate drivers that have a small built-in gate resistor. I actually have no gate resistor
on my PCB as the built-in resistor already gives me the yellow curve.

Looking again at the circuit in more detail, I deliberately placed the ground at the FET and placed L_w2 inbetween
the FET and the gate driver circuit. This is actually a realistic situation and is specifically mentioned in the
application notes that International Rectifier distributes.

Lets look at the node inbetween L_w2 and the gate driver.
gate_driver_side.jpg
Ignoring the initial spike down (no energy content) we see that the red curve has (the one with the too low
gate resistance) has a big swing down to around -2.5 while the green and yellow only go maybe 100mV below
ground. This swing down is also specified in the spec of the gate driver IC's and is typically not allowed to
be more than about 700 mV below ground. The red curve would blow up the gate driver IC...
 
Well, you're in for some discoveries.

I've let out a fair share of magic smoke - and my understanding is not complete yet. I'm still working on a predictive gate driver that enables the fets to be synched to within nanoseconds (With this, there seriously will be no competition from cheapass chinese controllers - it'll blow them out of the water). You have to take the diode recovery charge into consideration too - and this depends on the current flowing, once more. This, I assure you, sets off bad ringing in my controllers.

I'm on my way back to TH fets, but they are really much harder to switch than PQFN fets. The limit between avalanche and poof is so gray xD It's been a bit to much poof here now, so I'm finishing a charger first.

(BTW: Tested some motorola fets without soft recovery characteristics, I can testify that the irradiation and stuff that modern fets are subjected to makes a difference.)

Just do the test i proposed earlier. And, you have the theory down - so why have full fet leads?

Nice pcb btw ;)
 
diode recovery charge, this is typically modelled by a capacitor.

This charge, or non-linear capacitor that is used to model it, is used
in many radios to do station tuning... If you place an inductor in parallel
to this diode (the variable cap) you can influence the ringing frequency
by changing the biasing voltage of the diode.

If you look at the C_oss graphs in FET specs you'll see that the C_oss goes
down as the drain/source voltage goes up. This is typical for a diode (increased
depletion distance due to higher reverse voltage results in larger plate
distance so lower cap)
 
Teh Stork said:
Just do the test i proposed earlier. And, you have the theory down - so why have full fet leads?

I typically bend the legs of the FET's up and screw them to the side of the box. For mounting reasons.

Just realised the above can be explained very differently :shock:
 
i am playing with the data output over the rs232, but i am getting some weird readings.

since i have limited knowledge on programming is have used what i know. this is what i have come up with:

rs232 connector controller => software serial on arduino (pin 10,11) => serial port arduino (pin 0,1) => serialchart on pc

the arduino is loaded with some simple code to send a character to the controller at start-up,read the incoming data, and print it to the serialport connected to the pc at a baud rate of 9600. this is because i can not send an character from the serialchart software. later i will setup some dipswitchens on my breadboard to switch between different data outputs

when i am receiving the data from the throttle 1 i get some weird numbers.. when the throttle is closed i get 128. at half throttle the value is 255, and then i rolls over to 0 and goes to 128 again (full throttle).
 
The data you're getting is correct :D cool that you got this to work !

The data transmitted by the controller IC is 16 bit, I assume you're only looking at the top 8 bits ?

The data transmission routine treats all data as 2's complement, so 8 bits is treated as having a range
of -128 .. 127 . Now if you plot this directly it looks kinda weird cause 0 to 127 goes from the bottom
of the range to the middle, while -1 (which is actually 255) is all the way at the top with -128 at the middle
again.

So what the transmission routine does it inverts the MSB (most significant bit) before sending the data.
This maps -128 .. 127 to 0 .. 255, so now -128 (0 after inverting MSB) is nicely at the bottom, 0 (128 after
inverting MSB) in the middle and 127 (255 after inverting) at the top.

Now, the throttle signal you're looking at has a 0 .. 255 range but the transmission routine doesn't
know this, it still inverts the MSB. So 0 (throttle closed) to 127 (throttle in the middle) become 128 to 255,
128 (also throttle in the middle) to 255 (full throttle) becomes 0 to 127. So what you're seeing is correct.

It doesn't seem to make much sense but once you use regen and look at variable h (combined throttle
signal which is negative for regen) then it all comes together. This variable has a range from -128 (full regen)
via 0 (throttle closed) to 127 (full throttle for max power). Try looking at this variable with throttle coeficients
1, 0 and 0, (it will go from 128 to 255 for throttle close to full). Then if you change the coefficients to
-1, 0 and 0 the data out will range from 128 (throttle closed) to 0 (full regen throttle)

A very interesting variable to look at is phi , especially in combination with hall sensors. This variable will
step through 6 levels when the motor is running very slow and the controller uses the hall information. Then
as you slowly accelerate you will see the transition to the phase information looking like a sawtooth (which
is basically high resolution phase info). When you use sensorless push-start you can use the phi data to see
whether the controller is able to 'catch' or not. If it stays kinda wavy it's not catching (then you need to increase
the y for calculation the control loop parameters). If it catches it will immediately show the sawtooth
waveform when you push-start the motor.
 
i read your last post like 5 times, and i think i am beginning to understand what is going on now :D.

the only thing i do not get, is the 8bit and 16 bit part. or rather how i only get a 8 of the 16 bits. i read the serial data from the controller to a integer (http://arduino.cc/en/Reference/Int) which is a 16bit.

in what range is the actual value (in decimals) transmitted? is this different for different variables?

Niels
 
all data is 16 bit. The controller first transmits the most significant byte as a single character, then the
least significant byte again as a single character. How the Arduino treats this all depends on the program
you wrote for it. Are you asking the Arduino to get a single character from the RS232, or do you ask
it for a string of 2 characters ? You should get two characters (is this the Serial.readBytes() function ?), then
the proper calculation would be:

data = 256*first_character + second_character

I've the feeling you're only using the first character, because you get a nice behavior when you rotate
the throttle. The second_character data would look to be totally unrelated to the throttle position. This is easy
to understand when you think about normal decimal numbers. In decimal for instance 47 is actually
47 = 4 * 10 + 7
What you're doing in your Arduino is only looking at the 4 (so the 10's), if you make the plot using only
the 10's it would still look nice and behave w.r.t. the throttle position as you would expect. If you would
only look at the 1's (so the 7), the throttle data would make no sense at all.

All data is 16 bit and what it actually 'means' depends on the context. The 0..65535 you get with 16 bits means:
0..1 for the raw throttle data
-1..1 for the total throttle data
0..359.99 degrees for the phase
 
Hey Lebowski,

I just read through the entire thread, because it was totally very exciting. It would be nice if I had a hair more understanding of electronics (maybe more like a tuft of hairs), because I realize the conversation is a decent step above me.

That said, I was wondering if there's any other thread where you talk more about your methods (though I realize, as should be, a number of things are under wraps; proprietary). I originally was actually searching your name because I was casually looking up some methods to measure PWM current and I figured you did something more sophisticated than back calculating from the battery current and duty cycle. It's just casual because I won't need to decide for a while, but I was thinking through some methods of verifying the wattage being sent to a PWM fed resistance heater, and I want to test close to the probe.

But I am just asking if you have any other thread, that I somehow missed, with more info about your build design process. My need is pretty common & less complicated than phase measurements (no switching channels), and I'm sure there are more than a few ways of doing it, and perhaps many more suited. So that's why I was just asking if the thread already existed, not to waste your time on something that might not even be relevant for what I end up doing (right now I'm contemplating a MCU, some AVR chip, to calculate the duty cycle and backcalculate the power, but the point here would be independent measurement of the duty cycle to verify against the existing method that the system uses. But I dont really know what I'm doing and this project isn't high on the important list so I'm still musing :p)
 
OK guys I worked for a bit on a file for PCB express. I will try an order with them possibly soon. Here is a board layout I have to mesure if the pin spacing will work for the resistors and caps but I think Im ok. I will make a Fet driver scematic once Im done tweeking this one. Let me know what I should change thanks.
PS I like the 10 pin headder I found my ribbon cable with the click together connectors are very nice to work with and work great! I kept the 6 fet signals on their own header though to keep the signals clean. Oh and on the bottom righ is a 5v regulator.

EDIT changed file to .3 resistor pin spacing. All components will be a nice fit on the board!
 

Attachments

  • Capture Leb2 (800 x 534).jpg
    Capture Leb2 (800 x 534).jpg
    129.5 KB · Views: 2,030
  • Capture  Leb1 (800 x 542).jpg
    Capture Leb1 (800 x 542).jpg
    125.9 KB · Views: 2,030
Ok So I mesured the caps and resistors and found I can not get a 1/4 watt resistor to fin in .25" hole spacing with out a lot of stress on the leads. So I made a new resistor for my cusome components and made the spacing .3 inches The caps should be fine! I also used zombies driver design and made some boards to link up to my brain board design to use a 10 pin ribbon cable and just 2 of the gate signals. 1 hi 1 low for that H bridge. This should make a modular system to wrk with ease! I have expressPCB sending boards now. Once its all proven I will post more.
 

Attachments

  • Capture  .3 resistor.JPG
    Capture .3 resistor.JPG
    132.5 KB · Views: 1,982
Thanks Njay. We will see how much UPS tries to RAPE me & if its not to absurd I will accept them when they show up. Then I will test them asap and post up how it goes! I designed them to work with the driver board with only 2 plugs. I will have to figure out how to reduce the System voltage to 12v to feed it all.
 
OK so I removed the files untill Im done figuring out the rs232 its funny but with the board I made with nieles scematic I got lucky! PURE LUCK is how I got the rs232 to work on the last board I got this board all finished and it would not work. I looked at the old board and found the ground from the transistor for pin 27 was not conected! The pour solder joint made it work when I soldered it properly it quit working. Then I tried the same trick on the new board and still nothing! I looked and looked and found the transistor for pin 28 was partialy shorted from the pin from the rs232 header strait to the board! So.... I did get it working but.... I need to make it right. How do I do that???? I did update the files for LED direction and the gounds to the pins that need it... Its a work in progress!
 

Attachments

  • 020.jpg
    020.jpg
    66.3 KB · Views: 1,871
  • 019.jpg
    019.jpg
    45.2 KB · Views: 1,871
a small suggestion, put the traces on the botomside of the board, and the components on the top side. ofcourse there could be traces on the topside, but keep most of them on the bottom. this way it is easier to do repairs/hacks if it is not working.

i still don't get it why i got it working, and you only get it working with hacks. when i have the time i will make an other board an check there is no "luck" involved with my board:)

would there be interest in a professionally made pcb for the controller chip? (no power stage). PCB's would cost 6.50 usd excl. shipping if i order 10 of them.
 
nieles said:
a small suggestion, put the traces on the botomside of the board, and the components on the top side. ofcourse there could be traces on the topside, but keep most of them on the bottom. this way it is easier to do repairs/hacks if it is not working.

i still don't get it why i got it working, and you only get it working with hacks. when i have the time i will make an other board an check there is no "luck" involved with my board:)

would there be interest in a professionally made pcb for the controller chip? (no power stage). PCB's would cost 6.50 usd excl. shipping if i order 10 of them.
Im heading in the direction in getting a good working board so we can all use it to drive what ever we want. I just looked at lebowskis manual again and I think I might have it figured out. Your different transistors threw me for a loop so I had to work back from them...
I want traces on both sides of the board it works nice and makes it far more compact!
 
nieles said:
would there be interest in a professionally made pcb for the controller chip? (no power stage). PCB's would cost 6.50 usd excl. shipping if i order 10 of them.

Yes, I'd have a couple for sure. I have a modular design drawn up for a separate controller board/power board arrangement, but have been too busy with a couple of other projects lately to get the boards made.
 
Looking at Arlo's board from a few posts earlier the RS232 bit with the transistors seems totally messed up.

It looks like pins 27 and 28 have been interchanged as far as the transistor schematic goes (in the PCB
the two resistors to gnd with the base of the transistor in the middle is on pin 28 while it should be on
pin 27). Also the PCB makes me believe the transistors have the base on one side instead of in the middle ?
The 2N3904's you want to use Arlo have the base in the middle. Anyway, I would swap for bog standard
BC547's or something like that with the standard EBC layout.

I plan to design a PCB which includes the stuff around the controller IC (like on Arlo's board) and including
the power supply (the bit which makes 17V and 5V from the high battery voltage). Would there be interest
in such a board ? The PCB maker I use is quite expensive though, It would come down to probably
something like $25 for an 8x10 cm board. It would also need a programmed 12F617. First I want to see
though how far I can push the 6 FET design I have now and I want to get started with the next version
of the program which (hopefully) will include sensorless startup under heavy load.
 
Lebowski said:
I want to get started with the next versionof the program which (hopefully) will include sensorless startup under heavy load.

extreemly cool! this will be the most usefull feature of a good controller IMO.

Jeremy Harris said:
Yes, I'd have a couple for sure. I have a modular design drawn up for a separate controller board/power board arrangement, but have been too busy with a couple of other projects lately to get the boards made.

i didnt know lebowski also was planning making a board like i want to do (with just the controller). go with one of his boards, i do not want to take anthing away from him, just here to build an awsome controller.
 
I need to find the time to draw up my own board and get them made, I'm desperately wanting to experiment with this controller now but haven't gotten very far on my schematic which I link to ExpressPCB to make sure I don't make any errors when laying traces. Guess I need to start chipping away at it one day at a time. Should go faster now that I created a custom component for that spcific PIC.
 
OK so I fixed it properly. Lebowski you were right the RX and tx was backwards and I had to re design the whole section. I tried it on my board and it works with the 2n3904 transistors. Over the next few morning coffees I will finish editing the layout and post the file again for anyone who wants it.
 

Attachments

  • Capture fixed rs232 (800 x 528).jpg
    Capture fixed rs232 (800 x 528).jpg
    126.1 KB · Views: 1,707
Nice, it means you can now also continue with adding the power stage.

I actually am happy you guys are making PCBs, gives me more time to develop
the software further :) plus I see it as a vote of confidence and also it shows me
there is interest in the controller

For people that are not so electronics savy I still plan to make `official` PCBs but
for now I'm building a high power 6 FET and after that want to continue programming,
so the next version of my PCB will have to wait a bit.
 
Waiting :)!

[That's an excited, but patient exclamation point. Not an impatient one]

Edit: But, I'm not sure why you'd use an expensive PCB maker when there are quality ones that would be much cheaper than $20/board. Is it just your location?
 
Back
Top