Current Sensors How to select a good one or roll your own.

Electric Motors and Controllers

Re: Current Sensors How to select a good one or roll your ow

Postby HighHopes » Thu Aug 17, 2017 8:35 pm

ahhhh..... github. i been avoiding you for years cause i tend not to work in teams so i do all my revision control myself. but ya, i can see its usefulness.

lets say i wanted to make a change to the schematic you posted in github. you ok if i do that? i don't know how to do this yet in github.. will need to watch some tutorials or something i guess. but, as of this moment, here's how i see it. lets say i downloaded your entire zip folder. then i open my kicad, and decide to make a change. i do that, save it. zip entirety of the folder then upload to github (following tutorial methods so repository will do revision history properly). that sounds something close to the correct method?

anyway.. haven't read enough about the AMC1303 chip yet but i was thinking the schematic you have is shunt resistance referenced to ISOGND (V- is connected to ISOGND). this would be for like measuring the current in IGBT emitter to ground path which is not what we want. we want to measure the phase current in the AC output which is not really referenced to anything, its truly differential (or should be) because this shunt is in the inverter AC output. easy enough... just don't connect ISOGND to V-. but the chip has a power supply which is referenced to ISOGND so now you have a floating measurement (which really is differential) which is good but can the chip do that? or does it have to have V- connected to ISOGND to achieve the datasheet performance. that's what i was thinking when i open your schematic and did first browse through. otherwise, looks good. and i like the voltage divider at the buffer output... gives you some interface option to different voltage level in a pinch. for me, i'll be using a DSP with 3.3V analog in.

also, there's bound to be some voltage transients on the shunt. reading AMC1303 datasheet makes me think it self protects but need to confirm by reading more.
Last edited by HighHopes on Thu Aug 17, 2017 8:37 pm, edited 1 time in total. View post history.
User avatar
HighHopes
10 kW
10 kW
 
Posts: 839
Joined: Thu Mar 28, 2013 6:25 pm

Re: Current Sensors How to select a good one or roll your ow

Postby marcos » Thu Aug 17, 2017 11:03 pm

HighHopes wrote:ahhhh..... github. i been avoiding you for years cause i tend not to work in teams so i do all my revision control myself. but ya, i can see its usefulness.

lets say i wanted to make a change to the schematic you posted in github. you ok if i do that? i don't know how to do this yet in github.. will need to watch some tutorials or something i guess. but, as of this moment, here's how i see it. lets say i downloaded your entire zip folder. then i open my kicad, and decide to make a change. i do that, save it. zip entirety of the folder then upload to github (following tutorial methods so repository will do revision history properly). that sounds something close to the correct method?

Great, I was hoping to get you onboard.

You can skip the tutorials for now. Save them for when you destroy your repository and you need to figure out how to fix it.

About git, its not about zips, you pull entire directories from the remote (online) repository.

A good way to publicly collaborate would be this:
1) Install git on your computer
2) sign up on github.com
3) Once logged in, go to https://github.com/paltatech/current_sensor and fork the repository. There is a fork button around there. It will create a copy of my repository in your github account.
4) Now you can select a directory on your pc, open inside a terminal and run "git clone https://github.com/highhopes/current_sensor.git"
(assuming your username is highhopes)
Now you have a copy of the repository (current files and all its history) in your pc. Steps 1-4 are needed only once. I prefer command line because its very few commands to learn, I don't like GUIs with many buttons, I already have CADs.

5) perform the changes as you wish. To upload to YOUR repository, open the terminal inside the working directory and run these 3 commands
git add .
(there is a ".". This adds files to be commited)
git commit -m'Describe your changes'
git push origin master

Now your changes are in the cloud.
6) If you want me to include your changes in my repository, go to https://github.com/highhopes/current_sensor and create a pull request. It will invite me to pull your commit(s) from your repository.

Its good to make as many step 5) as possible, specially in software when you misplace a stupid colon and the whole thing falls apart and you struggle to find at which point in the history is the error.

This is how it looks like with many people contribute to a project
https://github.com/KiCad/kicad-source-m ... its/master

This is how a lone wolf like us uses git version control
https://github.com/paltatech/VESC-contr ... its/master

HighHopes wrote:anyway.. haven't read enough about the AMC1303 chip yet but i was thinking the schematic you have is shunt resistance referenced to ISOGND (V- is connected to ISOGND). this would be for like measuring the current in IGBT emitter to ground path which is not what we want. we want to measure the phase current in the AC output which is not really referenced to anything, its truly differential (or should be) because this shunt is in the inverter AC output. easy enough... just don't connect ISOGND to V-. but the chip has a power supply which is referenced to ISOGND so now you have a floating measurement (which really is differential) which is good but can the chip do that? or does it have to have V- connected to ISOGND to achieve the datasheet performance. that's what i was thinking when i open your schematic and did first browse through. otherwise, looks good. and i like the voltage divider at the buffer output... gives you some interface option to different voltage level in a pinch. for me, i'll be using a DSP with 3.3V analog in.

also, there's bound to be some voltage transients on the shunt. reading AMC1303 datasheet makes me think it self protects but need to confirm by reading more.


The schematic is intended to be used as a bidirectional current sensor, you can put the shunt in series with the phases and it will measure positive and negative currents. The working principle is a bit odd and I didn't care enough to fully comprehend it, but I know its bidirectional because I tried swapping + with - in a dc bus voltage sensor because of a wiring error, and it worked okay measuring -80v.
This is the circuit I played with.
https://eyrie.io/board/88ebffa8546c4bd0 ... pped=false

ISOGND is called that way because its a kicad built in symbol, quick to place. There could be a better choice of worlds out there, its a reference rather than a ground.

I have to upload some changes, I added a buffer to reconstruct the 20MHz digital signal. If there is long wiring between the adc and the filter, that square wave can get distorted, so a buffer would return it to pristine condition.
marcos
100 W
100 W
 
Posts: 129
Joined: Sat Nov 19, 2016 11:38 pm

Re: Current Sensors How to select a good one or roll your ow

Postby Arlo1 » Tue Aug 22, 2017 10:29 pm

This popped into my inbox from digirip

https://www.digikey.ca/en/product-highl ... YifQ%3D%3D
My Leaf motor controller build. http://endless-sphere.com/forums/viewto ... 27#p963227
My YSR build http://www.youtube.com/watch?v=BRo8r5g4NBg
RC and most types of Lithium batteries you MUST know your individual cell voltages charging and discharging.
Don't keep them were you cant afford smoke or fire!
Never above 4.2v never below 2.7v EVER!!!
HI power controller design. Game Changer
User avatar
Arlo1
100 GW
100 GW
 
Posts: 8449
Joined: Sun Apr 26, 2009 10:36 pm
Location: Nanaimo BC Canada

Re: Current Sensors How to select a good one or roll your ow

Postby fechter » Wed Aug 23, 2017 8:44 am

Arlo1 wrote:This popped into my inbox from digirip

https://www.digikey.ca/en/product-highl ... YifQ%3D%3D


Like a modern version of a LM358. Impressively low supply current.
"One test is worth a thousand opinions"
User avatar
fechter
100 GW
100 GW
 
Posts: 11529
Joined: Sun Dec 31, 2006 3:23 pm
Location: California Bay Area, USA

Re: Current Sensors How to select a good one or roll your ow

Postby marcos » Wed Aug 30, 2017 8:15 am

I took a last stab to the shunt board. Added some wiring harness fault tolerance (fuse, series resistors, clamping diodes, zener) and pushed to the repo.

If I get the time I might send it to fab.
Attachments
board.png
board.png (209.83 KiB) Viewed 604 times
marcos
100 W
100 W
 
Posts: 129
Joined: Sat Nov 19, 2016 11:38 pm

Re: Current Sensors How to select a good one or roll your ow

Postby HighHopes » Thu Aug 31, 2017 11:44 am

the current sensor busbar will be affixed to the IGBT and presumably an insulated mount just before cable connection out to motor. the other end of the PCB has 2 screw holes to secure it to something. that something.. hopefully, is the same thing as the insulated mount just before cable connection. that way the vibration affects both ends of the PCB roughly the same. it looks like you could snap it in half with your bare hands..

do you have this in sim? would be good to see the bode plots.
User avatar
HighHopes
10 kW
10 kW
 
Posts: 839
Joined: Thu Mar 28, 2013 6:25 pm

Re: Current Sensors How to select a good one or roll your ow

Postby ElectricGod » Thu Aug 31, 2017 1:54 pm

This is a fascinating discussion!

It seems fairly obvious to me how to monitor phase current whether that 1 amp or 1000 amps. The noob speaks. LOL!

Use a shunt of the appropriate amperage and measure the voltage drop across it. This is pretty easy IMHO to display. Use an old analog meter and a diode. You will need 2 per phase to detect both directions of current flow. If the voltage is in the range of the meter, you will see the needle deflect in the direction of current flow for that meter. Amplify or limit as needed to get the needle deflection needed. If you need to log those voltage changes, an ADC will do the trick to make it into 1's and 0's and then you can log all you want. It will of course NEED to be isolated form everything else, but that's an easy thing to resolve.

The other choice of an external winding around the phase wires is 100% isolated and doesn't need a shunt. How does a clamp on amp meter work? That's rhetorical obviously. It's nothing but a coil that gets a voltage induced on it by the current flowing through the wire it is clamped around. That's just a bit of math to figure out the volts per amps ratio. It won't matter if the phase wire has 1 amp or 1000 amps flowing in it the coil doesn't care and the measuring device on the coil just needs to have sufficient range to measure the voltage swing on the coil and be fast enough to react. Typical USB signal analyzers and PC based o-scopes are fast enough for this application.

IMHO...easy peazy.
E-Bike XB-502 (Moped) conversion project
viewtopic.php?f=10&t=83302&p=1222730#p1222730

Currie kick scooter conversion project
viewtopic.php?f=35&t=83830&p=1227407#p1227407

My kick scooter project
viewtopic.php?f=35&t=75177
User avatar
ElectricGod
100 kW
100 kW
 
Posts: 1234
Joined: Sun Nov 01, 2015 5:24 pm

Re: Current Sensors How to select a good one or roll your ow

Postby marcos » Thu Aug 31, 2017 4:18 pm

HighHopes wrote:the current sensor busbar will be affixed to the IGBT and presumably an insulated mount just before cable connection out to motor. the other end of the PCB has 2 screw holes to secure it to something. that something.. hopefully, is the same thing as the insulated mount just before cable connection. that way the vibration affects both ends of the PCB roughly the same. it looks like you could snap it in half with your bare hands..

Those 2 parts are together just for my initial -and quick- testing, and in case someone *really* wants an analog signal coming right from the sensor.

A more sensible use case IMO is to snap the pcb, run the digital wiring towards the controller, and bolt the small board of the right next to the controller
shunt.png


HighHopes wrote:do you have this in sim? would be good to see the bode plots.


I just copied the filter from here, my values are probably outdated
http://www.diyelectriccar.com/forums/sh ... 642p9.html
They are about to use it on a tesla drivetrain that uses delta sigma. 6usec lag is a bit too much though.

Honestly I didn't pay much attention to the analog filter yet, I'm more interested about the digital filtering of this signal.

It seems fairly obvious to me how to monitor phase current whether that 1 amp or 1000 amps.

In theory its very easy. Now get me an ideal, spherical cow and I'll demonstrate how easy it is.
marcos
100 W
100 W
 
Posts: 129
Joined: Sat Nov 19, 2016 11:38 pm

Re: Current Sensors How to select a good one or roll your ow

Postby HighHopes » Fri Sep 01, 2017 7:07 pm

ya, totally agree snap the PCB and make wired connection between sensor and brain board. this cable is going to be noisy.. you should consider, unless you already did and i didn't see it, to have a connection point for cable shield on both ends. weither it gets connected on both ends or not is debate for later but at least the option is there. in some ways, this is a lot like a wired connection to the resolver or encoder measuring the motor position. that signal can be analog or digital (depending on your sensor choice) and its also noisy. this cable is also shielded with termination done in special way. does make you think... if you terminate the shield on the inverter side, where will this connection be made and is there a convenient location to on the PCB that is a good ground (not some skinny trace near the connector to tie the shield to)
Last edited by HighHopes on Fri Sep 01, 2017 7:17 pm, edited 1 time in total. View post history.
User avatar
HighHopes
10 kW
10 kW
 
Posts: 839
Joined: Thu Mar 28, 2013 6:25 pm

Re: Current Sensors How to select a good one or roll your ow

Postby marcos » Fri Sep 01, 2017 8:56 pm

I didn't consider shielding for this. Do you know about a nice shielded connector? The only properly shielded connectors I used are usb, not quite appropriate for this application
marcos
100 W
100 W
 
Posts: 129
Joined: Sat Nov 19, 2016 11:38 pm

Re: Current Sensors How to select a good one or roll your ow

Postby liveforphysics » Fri Sep 01, 2017 9:37 pm

ElectricGod wrote:This is a fascinating discussion!

It seems fairly obvious to me how to monitor phase current whether that 1 amp or 1000 amps. The noob speaks. LOL!

Use a shunt of the appropriate amperage and measure the voltage drop across it. This is pretty easy IMHO to display. Use an old analog meter and a diode. You will need 2 per phase to detect both directions of current flow. If the voltage is in the range of the meter, you will see the needle deflect in the direction of current flow for that meter. Amplify or limit as needed to get the needle deflection needed. If you need to log those voltage changes, an ADC will do the trick to make it into 1's and 0's and then you can log all you want. It will of course NEED to be isolated form everything else, but that's an easy thing to resolve.

The other choice of an external winding around the phase wires is 100% isolated and doesn't need a shunt. How does a clamp on amp meter work? That's rhetorical obviously. It's nothing but a coil that gets a voltage induced on it by the current flowing through the wire it is clamped around. That's just a bit of math to figure out the volts per amps ratio. It won't matter if the phase wire has 1 amp or 1000 amps flowing in it the coil doesn't care and the measuring device on the coil just needs to have sufficient range to measure the voltage swing on the coil and be fast enough to react. Typical USB signal analyzers and PC based o-scopes are fast enough for this application.

IMHO...easy peazy.


It certainly does sound easy. In practice shunts get bulky and noisey, and magnetic sensor cores hold residual magnetic offset drift from the 0amp point.
Each carcinogen vapor exposure includes a dice roll for cancer.

Each mutagen vapor exposure includes a dice roll for reproductive genetic defects in your children.

Each engine start sprays them into a shared atmosphere which includes beings not offered an opportunity to consent accepting these cancer experiences and defective genetics life experiences.

Every post is a free gift to the collective of minds composing the living bleeding edge of LEV development on our spaceship.
User avatar
liveforphysics
100 GW
100 GW
 
Posts: 14363
Joined: Wed Oct 29, 2008 1:48 am
Location: Santa Cruz, CA, USA

Re: Current Sensors How to select a good one or roll your ow

Postby HighHopes » Sat Sep 02, 2017 8:50 am

marcos wrote:The only properly shielded connectors I used are usb, not quite appropriate for this application

the ones i use are gigantic, metal D-sub. lets look around, see what we can find.

another option, and i just put this out there... what if the A/D were on the sensor side and from there it is fiber to brain board? at this power level the gate driver is probably separate from brain board and should be fiber anyway, so its not like introducing fiber would be a unique thing.
User avatar
HighHopes
10 kW
10 kW
 
Posts: 839
Joined: Thu Mar 28, 2013 6:25 pm

Re: Current Sensors How to select a good one or roll your ow

Postby Lebowski » Sat Sep 02, 2017 9:33 am

Shunts have a fundamental limit.... they are limited by their power dissipation.

Since the voltage across a shunt time the current is the dissipation, and you can only tolerate dissipation upto a certain level, you are limited.

A 1000A shunt in practise can maybe generate only 50mV of signal, meaning it will be inaccurate and susceptible to noise. Amplification will be difficult due to the amplifiers noise, bandwidth limitation, magnetic field induced voltages, offset drift etc etc
Last edited by Lebowski on Sat Sep 02, 2017 9:33 am, edited 1 time in total. View post history.
User avatar
Lebowski
1 GW
1 GW
 
Posts: 3076
Joined: Tue Jun 28, 2011 1:38 am
Location: beautiful Zurich, Switzerland

Re: Current Sensors How to select a good one or roll your ow

Postby nieles » Sat Sep 02, 2017 11:39 am

marcos wrote:I didn't consider shielding for this. Do you know about a nice shielded connector? The only properly shielded connectors I used are usb, not quite appropriate for this application


What about shielded ethernet cable/connector?
nieles
10 kW
10 kW
 
Posts: 615
Joined: Mon Jul 14, 2008 5:39 pm
Location: The Netherlands

Re: Current Sensors How to select a good one or roll your ow

Postby Arlo1 » Sat Sep 02, 2017 11:51 am

nieles wrote:
marcos wrote:I didn't consider shielding for this. Do you know about a nice shielded connector? The only properly shielded connectors I used are usb, not quite appropriate for this application


What about shielded ethernet cable/connector?


Are you guys talking shielding the signals or the actual sensor?
My Leaf motor controller build. http://endless-sphere.com/forums/viewto ... 27#p963227
My YSR build http://www.youtube.com/watch?v=BRo8r5g4NBg
RC and most types of Lithium batteries you MUST know your individual cell voltages charging and discharging.
Don't keep them were you cant afford smoke or fire!
Never above 4.2v never below 2.7v EVER!!!
HI power controller design. Game Changer
User avatar
Arlo1
100 GW
100 GW
 
Posts: 8449
Joined: Sun Apr 26, 2009 10:36 pm
Location: Nanaimo BC Canada

Re: Current Sensors How to select a good one or roll your ow

Postby liveforphysics » Sat Sep 02, 2017 2:29 pm

Lebowski wrote:Shunts have a fundamental limit.... they are limited by their power dissipation.

Since the voltage across a shunt time the current is the dissipation, and you can only tolerate dissipation upto a certain level, you are limited.

A 1000A shunt in practise can maybe generate only 50mV of signal, meaning it will be inaccurate and susceptible to noise. Amplification will be difficult due to the amplifiers noise, bandwidth limitation, magnetic field induced voltages, offset drift etc etc


The power shedding can be solved if you have the space and weight available for it, keep in mind a Tesla model S rear motor phase current is >1800amps and it runs shunts in each phase leg.

What gets nasty is the 0.5v-5v of noise on your shunt as referenced to "ground", relative to the 50mV peak signal.

Fortunately Maxum and a couple other IC mfgs make incredible floating differential signal input op-amps with integrated hardware noise filtering.
Each carcinogen vapor exposure includes a dice roll for cancer.

Each mutagen vapor exposure includes a dice roll for reproductive genetic defects in your children.

Each engine start sprays them into a shared atmosphere which includes beings not offered an opportunity to consent accepting these cancer experiences and defective genetics life experiences.

Every post is a free gift to the collective of minds composing the living bleeding edge of LEV development on our spaceship.
User avatar
liveforphysics
100 GW
100 GW
 
Posts: 14363
Joined: Wed Oct 29, 2008 1:48 am
Location: Santa Cruz, CA, USA

Re: Current Sensors How to select a good one or roll your ow

Postby marcos » Sat Sep 02, 2017 2:39 pm

About fiber, I don't think its necessary here. A single bit error in a 20 khz gate driver pwm signal is catastrophic, I understand the use of fiber. A single bit error in a 20MHz adc is only a least significant bit error, its not much of a problem. Unless it happen very often, but you need a 2v glitch to flip a bit, we can deal with that.

About ethernet connectors, I see them used in the industry, its a shame they have 8 positions and we only need 4. Maybe it could add redundancy, but at 20MHz a redundant wire is a very long stub, so it would need separate buffers and a way to combine the signal at the end. If I find a 4pos connector a would be happier.
marcos
100 W
100 W
 
Posts: 129
Joined: Sat Nov 19, 2016 11:38 pm

Re: Current Sensors How to select a good one or roll your ow

Postby Lebowski » Sun Sep 03, 2017 1:31 am

If you want to use fiber and are worried about bit errors, why not transfer a 1 bit sigma delta bitstream instead of PCM ? Then, at the controller IC side, you can do analog or digital decimation filtering ... keeping in mind the delay and bandwidth of the decimation filter should be not too low.

The isolation chip Arlo1 uses for his battery voltage measuring works this way.
Last edited by Lebowski on Sun Sep 03, 2017 1:32 am, edited 1 time in total. View post history.
User avatar
Lebowski
1 GW
1 GW
 
Posts: 3076
Joined: Tue Jun 28, 2011 1:38 am
Location: beautiful Zurich, Switzerland

Re: Current Sensors How to select a good one or roll your ow

Postby liveforphysics » Sun Sep 03, 2017 10:32 pm

Lebowski wrote:If you want to use fiber and are worried about bit errors, why not transfer a 1 bit sigma delta bitstream instead of PCM ? Then, at the controller IC side, you can do analog or digital decimation filtering ... keeping in mind the delay and bandwidth of the decimation filter should be not too low.

The isolation chip Arlo1 uses for his battery voltage measuring works this way.


The Melexis chips do that onboard in hardware, and measure the field on 3 axis and hardware integrate a current value and spit it out digitally. All in a single tiny IC.
Each carcinogen vapor exposure includes a dice roll for cancer.

Each mutagen vapor exposure includes a dice roll for reproductive genetic defects in your children.

Each engine start sprays them into a shared atmosphere which includes beings not offered an opportunity to consent accepting these cancer experiences and defective genetics life experiences.

Every post is a free gift to the collective of minds composing the living bleeding edge of LEV development on our spaceship.
User avatar
liveforphysics
100 GW
100 GW
 
Posts: 14363
Joined: Wed Oct 29, 2008 1:48 am
Location: Santa Cruz, CA, USA

Re: Current Sensors How to select a good one or roll your ow

Postby Arlo1 » Mon Sep 04, 2017 12:17 am

liveforphysics wrote:
Lebowski wrote:If you want to use fiber and are worried about bit errors, why not transfer a 1 bit sigma delta bitstream instead of PCM ? Then, at the controller IC side, you can do analog or digital decimation filtering ... keeping in mind the delay and bandwidth of the decimation filter should be not too low.

The isolation chip Arlo1 uses for his battery voltage measuring works this way.


The Melexis chips do that onboard in hardware, and measure the field on 3 axis and hardware integrate a current value and spit it out digitally. All in a single tiny IC.

The Melexis chips I am using are analog out.
My Leaf motor controller build. http://endless-sphere.com/forums/viewto ... 27#p963227
My YSR build http://www.youtube.com/watch?v=BRo8r5g4NBg
RC and most types of Lithium batteries you MUST know your individual cell voltages charging and discharging.
Don't keep them were you cant afford smoke or fire!
Never above 4.2v never below 2.7v EVER!!!
HI power controller design. Game Changer
User avatar
Arlo1
100 GW
100 GW
 
Posts: 8449
Joined: Sun Apr 26, 2009 10:36 pm
Location: Nanaimo BC Canada

Re: Current Sensors How to select a good one or roll your ow

Postby marcos » Mon Sep 04, 2017 5:41 am

Here is the schematic of the circuit I proposed
Attachments
current_sensor.pdf
(207.45 KiB) Downloaded 47 times
marcos
100 W
100 W
 
Posts: 129
Joined: Sat Nov 19, 2016 11:38 pm

Re: Current Sensors How to select a good one or roll your ow

Postby Lebowski » Mon Sep 04, 2017 11:58 am

Watch out for the 'buffer to restore signal' ISI (inter symbol interference)
User avatar
Lebowski
1 GW
1 GW
 
Posts: 3076
Joined: Tue Jun 28, 2011 1:38 am
Location: beautiful Zurich, Switzerland

Re: Current Sensors How to select a good one or roll your ow

Postby marcos » Mon Sep 04, 2017 3:26 pm

Lebowski wrote:Watch out for the 'buffer to restore signal' ISI (inter symbol interference)

Yes, thanks. Its not easy to restore the signal, I'm only using the delta sigma but I should also use the clk as a latch to re-sync and eliminate the duty cycle offset, signal roundness, the group delay of the frequencies, etc. I was planning on just put termination resistors, twist the wires and maybe try a couple of resistor values and caps to get a reasonable eye diagram before the buffer.

Any over the top effort in an analog solution is wasting time that should be spent on the actual digital filtering implementation imo.
marcos
100 W
100 W
 
Posts: 129
Joined: Sat Nov 19, 2016 11:38 pm

Previous

Return to Motor Technology

Who is online

Users browsing this forum: No registered users and 5 guests