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

Lebowski, when calculating the RC filters for the current sensors, what is the "pi" in the formula in the schematic?

If we are talking RC filter cut-off frequency, what should that value be with respect to f_pwm and other parameters?
 
My guess would be 3.14, and also the formula states: r*c smaller or equal to 1/(2*3.14*f_pwm )

With r*c smaller, this will give you a higher cut-off frequency. So the cut-off frequency of the low pass should be equal or higher than f_pwm.
 
Futterama said:
Lebowski, when calculating the RC filters for the current sensors, what is the "pi" in the formula in the schematic?

This kind of questioning is why I just started studying mathematics the last week (calc/trig/algebra) so I can better understand what the math is actually doing. I can visualize how frequency and time are connected but lack the proper skills to fully explain it, but I only started learning the math last week and have only put about 7 hours into learning so I don't feel too bad if I'm off the mark. Here is the best way I can see the relationship.

Frequency = velocity / wavelength

A sine wave is a plot of a rotating circle. If the circle rotates 1 time per second than it has a freq of 1hz. This can be illustrated by rotating a circular coil inside of a magnetic field, the output will be sinusoidal. This is circular rotation speed also known as angular frequency. How many degrees per second at 1hz = 360.
[youtube]Ohp6Okk_tww[/youtube]

Since we are dealing with circles, pi comes into play, circumference / diameter or 2*radius = 2*pi*r.

Angular frequency is w=2*pi*freq

So to calculate the first order (-3dB) point of a RC low pass filter you use f=1/(2*pi*t).
t= a unit of time which is determined by the RC network so the formula then becomes f=1/(2*pi*RC)

Lebowski solved for RC. Since we know t=RC we can treat them as a single variable and solve for both at the same time, i'm not going to do the work, but the result is his formula.

RC= 1/(2*pi*f)

I hope I got this mostly correct. I tried to break down each component until I could understand it which took me 1.5 hrs to type this. I can visualize the relationship perfectly in my mind but it's very hard to describe. There is relationship between circles, sine waves and triangles. To get a sine wave, imagine uncoiling a spring. When it's all together it's a circle (imagine it has no depth like a slinky does in real life), but as you u pick it up stretching it out it uncoils into a sine wave from a side view.

Even cooler is that if you let the spring hang in free air and stretch it out, then let it go, it will oscillate in a motion that is sinusoidal. The frequency it moves at is it's resonant frequency.

I'm missing one part of the relationship which relates to the right triangle functions (sin/cos/tan) and how it ties into the frequency formulas. Need to think on that a little more.

I am such a nerd.
 
Jeremy, have a look at the imaginary number i (or j for the electrical engineers) and how it is used to solve any circuit made of R,C,L components.

hint: the real and imaginary voltages/currents will form a triangle
 
nieles said:
Jeremy, have a look at the imaginary number i (or j for the electrical engineers) and how it is used to solve any circuit made of R,C,L components.

hint: the real and imaginary voltages/currents will form a triangle

Thanks nieles. Does my above explanation make sense to you?

I found a good explanation of caps and inductors operating by lagging the voltage -90 behind current. This makes more sense now. I was missing reactance +90 and -90, resistance 0 made sense.

Fig 2. at this link makes the relationship make more sense now, I got my triangle.
http://onderwijs1.amc.nl/medfysica/doc/ElectricalResistCapacitInduct.htm

The formulas I'm using all the time are starting to make so much more sense! I'm starting to visualize the mathematical relationships, this is awesome and kinda trippy! I didn't get the chance to take trig or calc in high school. Maybe I'm better off for it because I hated almost all my math teachers because they couldn't answer the questions I needed to understand how things worked, it was mostly just a set of rules one had to follow. I looked up trig the other day and saw SOA CAH TOA and an interactive circle plot showing the relationship with a right angled triangle and it just clicked, took about 2 mins and suddenly the Sin/Cos/Tan all made perfect sense.

I've been obsessed with math for the last week, been watching too many Neil Degrasse Tyson youtube videos and Cosmos. About a month ago I started researching how the physics of a MOSFET work, cool stuff (if your into this sort of thing). I was trying to understand a certain phenomenon I've been seeing when paralleling.
 
@Lebowski - nice work on the adabtable hall analyzer.

Wondering whyvthe change to the Phase Voltage curcuit.
I noticed the manual V2.30 still discusses the older 2k2 divider style.

Will 70 x Max_Bat be enough to limit input on analogue input?
For 100V Bat thats 3 R_mot resitors in series 7k x 3 is 21k

And 22k with 22k divider. So with Mid-point link via 21k to say 10V the mid pint is already a little over 5V.

Also what sampling rate on the analogue inputs do you need to average out the square wave of the Bridge Powee stage.?

Or are you expexting some analogue filtering?

On a tangent... could the third Current sensor be used for Bus current ro the Battery?
Or can the use of just 2 phase current and PWM ratio be used to work it out accurately.
Wondering if it xould be reported on the CAN .messages.


7C
 
7circle said:
@Lebowski - nice work on the adabtable hall analyzer.

Wondering whyvthe change to the Phase Voltage curcuit.
saves a capacitor,less pulling of the midpoint.
I noticed the manual V2.30 still discusses the older 2k2 divider style.
oops, my bad
Will 70 x Max_Bat be enough to limit input on analogue input?
For 100V Bat thats 3 R_mot resitors in series 7k x 3 is 21k
The idea was to have about 3 to 5 mA in those resistors
And 22k with 22k divider. So with Mid-point link via 21k to say 10V the mid pint is already a little over 5V.

Also what sampling rate on the analogue inputs do you need to average out the square wave of the Bridge Powee stage.?
The algorithm doesn't sample the motor voltages, it looks at the 3 motor phase currents
Or are you expexting some analogue filtering?

On a tangent... could the third Current sensor be used for Bus current ro the Battery?
no
Or can the use of just 2 phase current and PWM ratio be used to work it out accurately.
that what it does now, for the battery current limiter function it calculates the battery current based on phase currents and PWM ratios
Wondering if it xould be reported on the CAN .messages.


7C
 
Lebowski, I can only get my motor spinning in toneless with recovery mode. In the other 2 modes, the chip won't leave drive_0 even when check for motor standstill is disabled. So do the controller need the input on pins 5,7 and 8 to work in HF tone and non-recovery toneless mode?
 
Futterama said:
Lebowski, I can only get my motor spinning in toneless with recovery mode. In the other 2 modes, the chip won't leave drive_0 even when check for motor standstill is disabled. So do the controller need the input on pins 5,7 and 8 to work in HF tone and non-recovery toneless mode?
the standstill disabled only works in recovery (thats why this menu is called 'recovery only'). In the other modes it looks at the motor voltages on the pins you mention.

what may work is a combination of a small resistor divider to put 2.5 V on all 3 pins to fool the chip, or maybe just putting a motor standsill voltage of 2.5 or higher in the misc menu.

For hf i am getting the feeling the autocomplketed current setting are not ideal, i would now set the fixed hf part at 25% of max phase amps, the proportional factor to .5 and the phase current in drive 2 to half the max phase current... make sure the motor force current is high enough and for hf you need to run the current sensor gain calibration.
 
Lebowski said:
or maybe just putting a motor standsill voltage of 2.5 or higher in the misc menu.
If I enter 2 or anything above, I'll end up in the erpm menu and the setting won't be saved.

Code:
########################################
#   (c)opyright 2014, B.M. Putter      #
#   Adliswil, Switzerland              #
#   bmp72@hotmail.com                  #
#                                      #
#  version 2.21                        #
#  experimental, use at your own risk  #
########################################


0) mode: Toneless, with recovery
a) PWM parameters
b) current settings
c) throttle setup
d) erpm limits
e) battery
f) current sensor calibration
g) control loop coefficients
h) filter bandwidths
i) FOC motor impedance
j) CAN setup
k) recovery only
l) miscellaneous
z) store parameters in ROM for motor use

------> l
a) autocomplete

b) motor standstill voltage threshold: 1.98 V
c) low side pulsing in drive 0: enabled
d) low side pulsing rate: 20 Hz
e) low side pulsing width: 20 usec
f) wiggle range: 9 deg
g) wiggle rate: 99 Hz
h) minimum # of cycles going from drive 2 to 3: 1000
i) number of cycles going from drive 3 to 2, HF only: 200

z) return to main menu

------> b
new value -> 2

a) erpm limit, forward: 99.97 k-erpm
b) erpm limit, reverse: 19.98 k-erpm
c) accept direction change below: 75 erpm
d) transition erpm drive 2 -> 3: 976 erpm
e) transition erpm drive 3 -> 2: 488 erpm

z) return to main menu

------>
 
Futterama said:
How is the erpms measured using the PWM output from the chip (see the scope shot in my thread)?
you cant really as the pwm is a fixed frequency... what you can try is to filter the pwm signal with a 2khz RC filter so see the sine content.
or you look at the system variable for phi_int with the rs232 realtime data out.

about the resistive divider, you can try to fool the chip as mentioned earlier, no need to add all the diodes and power resistors for this.
 
Lebowski said:
or you look at the system variable for phi_int with the rs232 realtime data out.
I have tried, but I just can't get anything meaningful out. When the databytes are sent so close to each other, I can't sync them when trying to print something human readable at the same time as receiving the data.

How do you use the debug output from the RS232?
 
Futterama said:
Lebowski said:
or you look at the system variable for phi_int with the rs232 realtime data out.
I have tried, but I just can't get anything meaningful out. When the databytes are sent so close to each other, I can't sync them when trying to print something human readable at the same time as receiving the data.

How do you use the debug output from the RS232?
i plot real time running graphs using a small labview program. If you run linux you can find labview 6.1 for free on the internet, this is what I use...

another method is to receive the data with your terminal program and lookmat the data in hex format.... though nothing beats a running graph :D
 
Futterama said:
Maybe you could share your wisdom? I have labview installed on Ubuntu, but have no clue how to use it.
labview is a programming language tailored for equipment control.
first thing, if you're using a usb-rs232 cable, is to add the cable to the list of ports.
the program to do this is visaconf, which can be started like this:
Code:
run these command lines:
export VXIPNPPATH=/usr/local/vxipnp
sudo chmod 666 /dev/ttyUSB0
sudo chmod 666 /usr/local/vxipnp

to show unknown dependencies:
sudo  ldd /usr/local/vxipnp/linux/NIvisa/visaconf

to add:
sudo gedit /etc/ld.so.conf
add lines:
/usr/local/vxipnp/linux/lib
/usr/local/cvirte/lib
to process, run:
sudo ldconfig

run visaconf with:
sudo /usr/local/vxipnp/linux/NIvisa/visaconf
add the ttyUSB0 as instrument 5 (it has some funny name, copy from the others)

i'll post the labview program tomorrow, it's getting late...
 
Lebowski said:
Had a very interesting day yesterday, I figured out an improvement to the HF tone at standstill... What I've done till now is that the controller measures
the three motor inductors. When for an inductor there is a strong field going through the stator tooth the indutance is lowered as the iron is near saturation.
Measuring the inductance values however does not tell you whether the field in the stator tooth is N-S or S-N, meaning it tells you which coils to power
to make the motor turn but is doesn't give you the polarity to make it turn forward. So, measuring inductance values gives you 0 to 180 degree information
but it doesn't give full 0-360 degree info like you really want. Only having 0-180 infor means you need to bring the motor in a fixed position before you
start and need to keep track of the rotor at all times (so you know whether or not to add 180 degrees to the 0-180). 0-360 though means you don't
need to do that as you can always get the correct phase.

So, yesterday I got it to give 0-360 information ! I do this by measuring not the inductor values but by measuring the inductor non-linearity. Last weeks
work on using two controllers to run one motor made me realise how much current is actually necessary to match the magnetic field of the motor magnets.
For my big scooter motor (rated at 100A) you actually need to put 700 A through it to match the strength of the fixed magnets. If you want to measure
inductor non-linearity you need to change the field over a few % of the fixed magnets field, meaning it takes in the order of 20A or more, not the measely 2A
I used so far. i had the algorithm for 0-360 info ready to go, but with 2A I didn't see any signal coming out. Because of last weeks experiments
I realised I needed a lot more Amps, so I tried it again with 15A and hey presto, results !

At this rate I'll never have time to start on my lipo BMS and charger, now I'll need to upgrade the controller IC to include the newfound HF method...

Awesome! Real sensorless startup from 0 rpm without going backwards by mistake (and no need for jerky alignment)! Only a few others have figured this out with signal injection :) Have you played around with the frequency of the HF tone? The optimal tone freq varies from motor to motor....there is a resonant frequency where you don't need a lot of amps to measure the non-linearity (above 20kHz usally)...might want it adjustable.

Interesting you need 700A to matched the strength of the fixed magnets. People don't seem to realize how amazing neodymium is. Take a look at this:

pic.PNG
 
Lebowski said:
Futterama said:
Maybe you could share your wisdom? I have labview installed on Ubuntu, but have no clue how to use it.
labview is a programming language tailored for equipment control.
first thing, if you're using a usb-rs232 cable, is to add the cable to the list of ports.
the program to do this is visaconf, which can be started like this:
Code:
run these command lines:
export VXIPNPPATH=/usr/local/vxipnp
sudo chmod 666 /dev/ttyUSB0
sudo chmod 666 /usr/local/vxipnp

to show unknown dependencies:
sudo  ldd /usr/local/vxipnp/linux/NIvisa/visaconf

to add:
sudo gedit /etc/ld.so.conf
add lines:
/usr/local/vxipnp/linux/lib
/usr/local/cvirte/lib
to process, run:
sudo ldconfig

run visaconf with:
sudo /usr/local/vxipnp/linux/NIvisa/visaconf
add the ttyUSB0 as instrument 5 (it has some funny name, copy from the others)

i'll post the labview program tomorrow, it's getting late...
 

Attachments

  • variable_viewer.vi.zip
    27.7 KB · Views: 27
Back
Top