build your very own Lebowski controller !

Lebowski said:
Futterama said:
Lebowski, why do you have a 10Ω resistor from 5V to AVDD?
This is as recommended in the 30F datasheet, it gives some filtering to provide a cleaner AVDD (the supply for the analog parts in the controller IC like the ADC's)
Thanks, I looked for an explanation in the datasheet, but did not find it. Do you know how much current is going through the resistor? I would like to use a 0603 SMD resistor if possible but the limit for that is around 100mA.
 
When searching Google for the AVDD vs. resistor question, it's the same as you said, it's a lowpass filter to filter out digital noise from the supply. But with the current draw, you get a voltage drop across the resistor, and if you then use AVDD as voltage reference internal in the PIC, you will compare ADC results to a non-stable/non-optimal voltage (the voltage drop is dependent on the current draw). That's why it is advisable to use the Vref pin(s) as reference, since these draw very little current and can then be filtered well with lower voltage drop, to get an overall better voltage reference for more accurate ADC measurements.
There was also a suggestion to replace the resistor with a ferrite bead that would filter out RF.

http://www.microchip.com/forums/m619135.aspx
http://dics.voicecontrol.ro/process_mails/arata_discutia/146875/The_dilemma_is:_to_ten_ohm_or_not_to_ten_ohm.html

So could your controller IC be even better/more accurate with another solution than using the 10Ω resistor?

Edit: Ferrite beads can be found with very little DC resistance even with a small SMD footprint like the one below, 4mΩ DC resistance (very low voltage drop for AVDD) and 25Ω for frequencies at 100MHz.
http://www.digikey.dk/product-detail/en/FBMJ2125HS250NT/587-1767-1-ND/1147092
 
Lebowski said:
With the new v2.21 I added recovery to the chip. When running in this mode the entire path between the motor phase voltages and the chips ADCs CAN be omitted, IF ALSO THE CHECK FOR MOTOR STANDSTILL AT STARTUP IS DISABLED.
How will the controller act when requesting reverse without the resistors at pins 5,6 and 8? Doesn't it look for voltages here to determine when the motor is running slow enough for putting it into reverse?
 
Futterama said:
Lebowski said:
With the new v2.21 I added recovery to the chip. When running in this mode the entire path between the motor phase voltages and the chips ADCs CAN be omitted, IF ALSO THE CHECK FOR MOTOR STANDSTILL AT STARTUP IS DISABLED.
How will the controller act when requesting reverse without the resistors at pins 5,6 and 8? Doesn't it look for voltages here to determine when the motor is running slow enough for putting it into reverse?
No, it doesn't look at these pins for that...
 
I've been really busy on other things at the moment as I'm about to move back to the US than back to South Sudan, but I did end up getting 10 boards most of which are most of the way populated. I'll have to put the skid steer on the back burner because I won't have the time, but I will bring a few boards to the US to play with. Maybe try and get an Ebike going in South Sudan. Lebowski I'll send you a PM about getting some chips from you. Just a couple of quick questions.

Would it be possible to switch the 4115 for a 4110 on the power supply? I just happen to have a lot.

Is there a minimum input voltage for the power supply? Would this work at 24v forgetting the inefficiencies?

Cheers
 
24V is really low, I tested down to about 60V and wouldn't go lower than that. A 4110 would work instead of a 4115, if you stay below 100V of course. Based on the type of driving etc, at the moment the v2.21 is the most advanced and easy to use, but for proper torque at standstill I would recommend the old v1.21 with the hall sensors. I keep upgrading the v2, but am not satisfied yet with the performance of the HF tone algorithm so for torque at standstill use the old v1. If torque at standstill is no issue I would recommend v2.
 
Lebowski said:
24V is really low, I tested down to about 60V and wouldn't go lower than that. A 4110 would work instead of a 4115, if you stay below 100V of course. Based on the type of driving etc, at the moment the v2.21 is the most advanced and easy to use, but for proper torque at standstill I would recommend the old v1.21 with the hall sensors. I keep upgrading the v2, but am not satisfied yet with the performance of the HF tone algorithm so for torque at standstill use the old v1. If torque at standstill is no issue I would recommend v2.

I might not understand what is being said here. Can your controller design be used with a 48v battery pack?
 
The controller will work at 48V, the only thing affected by this is the power supply. I haven't tested it at these low voltages. I imagine the 1.5mH inductor must be reduced, I would try 470uH for 48V. I haven't tested this though so cannot be sure it'll be OK.

ps. i can probably upload a second program for the 12f617 that does work for low voltages (24 to 48) and the schematic as is, all that needs changing i think is the pulse width for the 4115 / 4110
 
Hi Lebowski,

Lebowski said:
Based on the type of driving etc, at the moment the v2.21 is the most advanced and easy to use, but for proper torque at standstill I would recommend the old v1.21 with the hall sensors. I keep upgrading the v2, but am not satisfied yet with the performance of the HF tone algorithm so for torque at standstill use the old v1. If torque at standstill is no issue I would recommend v2.
BigMoose said:
Two nice things about the sin/cos sensor:
    * It gets the position sensing element out of the stator heat flux
    * It allows precise timing advance with the right controller just like a timing map in an IC ECM
Luke said:
Yes sir it does. We did it mainly for the heat reason you mentioned, as hall melting failure was our demise at the last race event, as well as a previous race.

The second reason you mentioned wasn't really something we were needing for this application, but WOW! It just make it silky smooth, no more chug-chug-chug at low RPM's as each hall sensor latches and tells the fets to switch the next coil on, it's just silky now, you can make the motor spin so slowly you can barely see it moving at all, and it's just perfectly smooth with no torque ripple noticed at all now. Really feels like electric power should feel at all RPM's rather than little bumps of torque pulses when you're at low speeds.

It directly takes the Sine/Cosine input from the encoder. I think it's good to 0.25deg rotor position if I'm not mistaken. The halls were good to 6deg resolution (10 poles, 3 halls on 120deg spacing)
It might work better, and be easier to set-up if you specified specific sin/cos sensor(s)? It should be pretty easy to build external sensor modules? All it requires is a disc, the sensors and a housing to protect it from dirt and debris plus an attachment to the motor shaft (set screws or a key). Probably 6-8mm in thickness.

You could add a menu with something like the following options:

  • Use external sin/cos sensor module for start-up Y/N:
    Choose sin/cos sensor sensor type (choose from the list you specified above):
    Initialize timing map (eliminate the requirement to manually align the external sensors with the motor).
Using one of these would even simplify the set-up of motors with existing internal sensors because if it has a sensor from your list, it would eliminate all of the sensor specific set-up requirements.
 
You can get a hall sensor chip that is set/programmed for the end of the motor shaft and produce a hall type output I have a few of them in my hands for swapping into zero motors. This will also get the hall sensors out of the heat and I have ridden both this type and the sine/cosine and can not tell the difference.
 
Hi Arlo,

Arlo1 said:
You can get a hall sensor chip that is set/programmed for the end of the motor shaft and produce a hall type output I have a few of them in my hands for swapping into zero motors. This will also get the hall sensors out of the heat and I have ridden both this type and the sine/cosine and can not tell the difference.
My main idea is that I think that (particularly for use at start-up) a completely external sensor module will work (if it is connected to the motor shaft), and if properly implemented has some substantial advantages. I was trying to convey three points about that idea and Halls vs sine/cosine might be required for one of them:
Mitch said:
You could add a menu with something like the following options:
Use external sin/cos sensor module for start-up Y/N:
1. Using external sensor modules for start-up would be easier for Lebowski to implement and would probably work better than a completely sensorless mode.
Mitch said:
Choose sin/cos sensor sensor type (choose from the list you specified above):
2. If there was a small list of supported sensors it would simplify set-up/configuration, even when used with motors that already have internal sensors.
BigMoose said:
Two nice things about the sin/cos sensor:
* It gets the position sensing element out of the stator heat flux
* It allows precise timing advance with the right controller just like a timing map in an IC ECM
Mitch said:
Initialize timing map (eliminate the requirement to manually align the external sensors with the motor)
3. If the controller can create a timing map when it's initialized that would eliminate the requirement to manually align the external sensors with the motor. BigMoose's statement implies that sin/cos sensors would be required for that?

I considered improved control (if any) due to using sin/cos sensors, as compared to halls a potential fringe benefit of this idea, not central to it.

Thanks for your input!
 
Since a few people asked me I've decided to upgrade the v2 and to add hall sensor support.
As v2 uses one of the (v1's) hall sensor pins for battery voltage measurement this hall sensor
pin will move to another location, I haven't yet decided which pin
but I will upgrade the schematic and KiCad files when the location is known.

I will implement the auto-learning different from v1 as Arlo had problems there to get it working. What I will do is to make
an option to select hall sensor learning. When starting up in motor mode, if the chip sees this learning activated it will go to the
sensorless mode with wiggle start. This mode has been able to start every motor I've tried under the condition there's
no mechanical load on the motor. Once the motor is running the learning algorithm will build a relationship between the state of
the 3 hall sensor pins and the electrical phase of the (running) motor. Pressing setup will save the phase / hall sensor
relationship in ROM and automatically de-activate the hall sensor learning. The next time the chip is powered up in motor
mode the chip will see the leaning is switched off and will go to normal hall sensor running (using the previously stored
hall/phase relationship).

The hall sensor running will of course only be used at low rpm, the chip will transition to sensorless FOC for high rpm.

The algorithm I have in mind is very cool and will actually be able to tell you how many hall states it sees (should be 6 out of 8 for
3 hall sensors, 4 out of 8 for 2 sensors and 2 out of 8 for one sensor) and how high the reliability (for each of the 8 posibilities) is.
Another cool thing will be that it will also run motors with only 1 or 2 hall sensors (but more clunky that with 3 sensors of course),
so if one of your sensors blows you can re-calibrate the hall positions and continue to use the motor without replacing the sensors.
 
MitchJi said:
Hi Arlo,

Arlo1 said:
You can get a hall sensor chip that is set/programmed for the end of the motor shaft and produce a hall type output I have a few of them in my hands for swapping into zero motors. This will also get the hall sensors out of the heat and I have ridden both this type and the sine/cosine and can not tell the difference.
My main idea is that I think that (particularly for use at start-up) a completely external sensor module will work (if it is connected to the motor shaft), and if properly implemented has some substantial advantages. I was trying to convey three points about that idea and Halls vs sine/cosine might be required for one of them:
Mitch said:
You could add a menu with something like the following options:
Use external sin/cos sensor module for start-up Y/N:
1. Using external sensor modules for start-up would be easier for Lebowski to implement and would probably work better than a completely sensorless mode.
Mitch said:
Choose sin/cos sensor sensor type (choose from the list you specified above):
2. If there was a small list of supported sensors it would simplify set-up/configuration, even when used with motors that already have internal sensors.
BigMoose said:
Two nice things about the sin/cos sensor:
* It gets the position sensing element out of the stator heat flux
* It allows precise timing advance with the right controller just like a timing map in an IC ECM
Mitch said:
Initialize timing map (eliminate the requirement to manually align the external sensors with the motor)
3. If the controller can create a timing map when it's initialized that would eliminate the requirement to manually align the external sensors with the motor. BigMoose's statement implies that sin/cos sensors would be required for that?

I considered improved control (if any) due to using sin/cos sensors, as compared to halls a potential fringe benefit of this idea, not central to it.

Thanks for your input!

Lebowski, quick question:
Tuning issues aside, is your controller already capable to use a sin/cos encoder instead of the halls? I only found the suggestions on this page
cue http://www.diyelectriccar.com/forums/showthread.php/toyota-ipm-motor-controller-design-details-87535.html?p=442001#post442001 :)
MGR + Prius power electronics + your controller seems very appealing for a small car conversion :D
 
Lebowski said:
No, there is no input for sin/cos encoders. Don't know how they work, I don't have one to play with and no-one (except Luke) uses them,
I use one two and its only because it came with the motor/controller combo I used for my bike.
 
They are also used on some powerchair motors. The one I have here:
http://www.endless-sphere.com/forums/viewtopic.php?f=30&t=32838
uses them, but I have no controller that can handle that, so I installed 3 regular hall sensors 120 degrees apart in a triangle around the stator. I think there's another member here that also has some of these type of motors.

If your controller *did* handle sin/cos, that'd be one more reason for me to save up for one once people are selling them completed. :)


As for how they work, AFAIK it's got two linear sensors (90 degrees apart, IIRC) and a magnet ring with some number of poles, and the sensors output a sinewave and a cosinewave, and the frequency would just go up or down as the motor spins faster or slower. The relationship between the two would change when the motor changes directions.

I think it's used on this type of motor because it would probably be more precise in position/direction detection than 3 hall sensors would be, at very very low speeds and direction changes.
 
I'm curious about the values for several components that are not specified in the BOM.
This would be Q1, and Q2 mainly. Are these not specified because of the different potential RS-232 voltage levels that they might work with?
Perhaps you could specify two or three alternatives like ( this one for 5 V signals) ( this one for USB ) ( that one for 12 V signals )...

There are some capacitators as well, and one resistor ( R84? ) specified as 0 ohms?

Gearheads like myself struggle with the electrons... :roll:

Thanks!
Chris
:mrgreen:
 
Q1 and Q2 are general purpose type npn transistors. Something like the BC547 or BC550. These should be good upto 30V, so can deal with RS232 voltages directly (+- 15V if I remember correctly, allthough most modern USB<->RS232 converter cables are 5V)

regarding R84, this is the gate resistor of a FET in the powersupply. I found it all works fine with 0 Ohm (so a wire short) but typically 10 Ohm is used. So, you can choose to short it like I did or put a 10 Ohm resistor there...
 
Back
Top