I am planning to assemble custom, high current driver based on IR2104 drivers.
Now I am looking for proper current sensing solution and I wonder if hall-effect based sensors can be used? Like for example ACS714.
This kind of sensors are biderctional, hence it provide values with middle point of +2.5V. I’ve seen offsetting procedure in current sensing class so it should work, right?
What you think about such design?
Hi, and welcome mtok!
I think it is a cool idea to use such an IC! I have to think about it some more, but at first glance I think this could be an easier way to implement inline current sensing without having to worry so much about common mode problems in your op-amps.
Looking at the datasheet I wonder if there are faster ones. The 5us rise-time could be 100x-1000x slower than your FETs, if you have fast ones. My gut feeling is that this is too slow.
In terms of the offsetting, it would be real nice if there were such an IC that let you set the output range or mid-point. A 2.5V mid-point is really not what you want for most modern MCU’s ADCs. If not you can always add a simple voltage divider to bring the level where you need it.
I am designing something similar and have decided on ACS780xLR which is similar except currents up to 100A since I need a high powered board. According to @Antun_Skuric this type of sensors should work with inline current sense. One thing you need to consider is the sensor is 5V and your logic is probably 3.3V so you will need to solve that. If your logic is 5V you should probably be fine, I guess. I have not tested yet, this is only from memory. Let me know if yours work I am interested to see how it goes, and I’ll let you know if mine worked, too.
I m sure you’ve done your homework on the IR2104 driver, however just pointing out this is a very slow driver. Combined with the delay of the mosfet you are probably looking into well over 1us total delay, which may limit your custom driver upper frequency limit. For example the TI’s DRV8302 which is more or less “classic” has 25ns rise and fall time, and propagation delay is negligible, while the infineon’s times are more close to 1us which is limiting your frequency when you combine it with a mosfet. Yes, the infineon handles 10 times the TI’s voltage, it’s a different driver, that is true, but something to keep in mind. Also are you looking for high current or high voltage driver? DRV8302 integrated driver can deliver close to 2A current to a mosfet, what currents are you looking for and what mosfets you will pair up? I am just curious because I’m doing something similar.
Wow! Did not expect such active community here- you’re all very responsive
After reading your comments (thanks both @Valentine @runger) I have impression I did not do my research right (I already ordered bunch of components tho …).
My goal is to drive motor with 24-36V and around ~50A peak. My second goal is to make it as cheap as possible- that’s why IR2104 was preferred option. Mosfets i picked are IRFB3607PBF which -again- are not the fastest ones.
I think I need to start my desing over then.
But before that, just out of my curiosity I will give a shoot to my original design and see what happens - will let you know about the results. (Disclaimer: I am a hobbyist, so I do not have full featured lab, so if something goes wrong I am able to diagnose it only with a multimeter and cheap 200kHz oscilloscope substitute).
In regards to current sensing - I think I will go with shunts but - as I want to assemble all except mosfets on breadboard - do you recommend some amplifier in DIP packages?
BOM concerning, IR2104 is about $2,76 on mouser retail, 3x is about $8. An integrated 3x driver DRV8303DCAR is only $4,15, and also the integrated driver contains the current shunt sense op-amps, etc. Isn’t your discrete solution a lot more expensive?
You will need something like LT1999 Bidirectional Current Sense Amplifier. It’s not quite a DIP package but look for something similar in a package that could be put on a breadboard, I assume you use a breadboard.
For sure you should do that, if you have already ordered parts.
Chances are good that you will get commutation happening, and you will learn a lot.
My first attempt was far more ridiculous, yours is professional by comparison. I wired up a MCU via an “inverter” made from 6 BJT transistors to a motor I scrounged from an old HDD.
Guess what --> it moved the motor, and quite smoothly and silently, though with no torque and almost no speed at all.
If you want to make a cheap cheap ESC I recommend looking at how all the (quadcopter) drone ESCs are built up. There’s 4-in-1 ESCs (so 4 complete drivers + FETs) which sell for about $20 (or this one), or better ones for a little more.
They all use drivers from Fortior Tech which cost <$1, and can do 6-PWM or 3-PWM. I assume they won’t be as good as a TI driver, certainly they don’t have all the features, but the drone ESCs work just fine.
Add to this a sensor and you can do FOC. Add some current sensing, and you’ll have a cool but cheap design, I think.
So… After wiring it up, burning my finger (mosfet short) and blowing up one capacitor … it works, I mean - kind of
This is is done using open loop example on esp32. Probably there’s some obvious thing that I am missing in this configuration- can you have a short look what I can do wrong?
Code is here https://gist.github.com/mlodzianck/27a73a54b40c83d6ef6b59437cf80781#file-open_loop_esp32-ino
and motor I am using is https://botland.store/brushless-bldc-motors/2870-brushless-motor-redox-brushless-bbl-500-950-2210011000281.html
I see it as rather good starting point event it is not spinning (taking into account my lack of experience).
I will check out stuff you two recommended. Thanks for the support!
This is awesome! Great work. Questions, I looked into the code.
- Why are you using current limit instead of voltage limit?
- This motor looks more like a 7 pair motor, not 11 pair motor, perhaps that’s why it’s so jerky? Can you double check the number of magnets, and divide by two to get the pole pairs. It’s very hard to tell from the video but if you post a close-up I can count the magnets, or you can count them yourself. Do you have the specs?
Edit: I searched online, here is a picture from bottom up,
You can count, see the magnets are 14, divide by 2, that gives you 7 pole pairs. Still hard to see but I am pretty sure.
One more question, how do you know the phase resistance is 0.6 O, I could not find any reference?
These types of motors with 7 pole pairs and about 10A current are about 0.1 O, give or take 0.05 O.
Can you try in line 6 of your code
// BLDCMotor( pp number , phase resistance) BLDCMotor motor = BLDCMotor( 7, 0.1 );
and see if it makes a difference?
I measured it with component checker- it gave me this value. But this is apparently resistance of two coils in series so one is close to value you pointed.
That is actually something inherited from open loop example from repo.
And of course it is! . Value of 11 was copy-paste error.
Checked and motor still does not spin. It is still jerky and torque is smaller than before.
Tomorrow I will do some more testing- i plan to check each module separately . I am using PWM on input and checking output- previously it gave me nice PWM output up to Vd (12v in my case) but I checked it only with 1kHz frequency. Since you @Valentine pointed slowness of gate driver i will check it also with higher freqs.
Just had time to check it and it looks very promising- will check it definitely.
I don’t think so. What kind of wire would have such resistance ? A very thin, long wire.
What you measured was the contact-resistance of your instrument.
Yeah, it has to be said, there are 2 problems to getting reliable readings from the phases:
- the contact is very unreliable if you just touch the multimeter to the wires - the “bouncing” contact will prevent a reliable reading. And the oxidation that is often present on the leads will prevent a proper contact in the first place. And if your fingers are touching the leads or probe-ends they’ll affect the reading.
- The low-ohm windings are too small resistance for cheap multimeters. If you have a precision instrument this will be no problem, but I have only cheap ones and they aren’t great at low resistances.
That said, it isn’t so hard either to measure (at least the higher ohm windings): just wedge the leads somewhere tightly and scratch them a bit as you tightly push the probes against them (or roll the leads a bit in the alligator clips if you’re using those). If the value settles you should be ok (IMHO). And 0.1Ω should be within the capacity of even a cheaper multimeter.
That is not the way to do it. The proper way is to use the “4-lead” method. Expensive multimeters have this option, but there is a cheap way to do it yourself.
Set your lab powersupply to a current-limit of 1 Amp. Connect the unknown low-value resistor to it. Then you take your cheap multimeter, set it to 200 mV DC and measure the voltage on the leads of the unnknown resistor. 1 mV corresponds to 1 mOhm. Some powersupplies don’t like going down to near 0 V, so you would need another resistor in series with the unnknown one, but my cheap Chinese powersupply thinks it’s OK.
Thank you @Jan_Donker @runger for hints about measuring resistance. Currently I am doing my experiments with 0.1.
Also as posted yesterday I did checks on each phase module and turned out one IR2104 was broken and gave no output for its phase.
Using same tool for debugging hardware I checked whole setup and it seems to be working fine.
But after connecting motor it still does not spin
I am still playing with this setup- will let you know if I progress.
Yep ! 6 LED’s blinking. Many Arduino owners stop at 1 LED blinking, so you are ahead of the pack They seem to be blinking at random. It would be even better to see some kind of rotation.
Here’s how it spins with 1rad speed.
(Realtime video speed).
For me blues and reds diodes are spinning. Should it look different?
Ok after some further investigation i ran out of ideas. I think i cannot progress without help.
I was experimenting with coil resistance, PWM frequency, even changing poles number. Always same result - jerky spin or no spin at all with motor oscillations.
Setting low speed and attaching oscilloscope substitute between two phases without a load reveals nice PWM (+ and - Vdd).
What I can do wrong? Should I drop completely this driver and start designing/buy new one? Should I switch to something more accurate than esp32? Should I add encoder/sensor to close the loop?
Any advice highly appreciated