Sampling Internal C-lyte Controller Shunt

wtf

1 µW
Joined
May 23, 2007
Messages
2
I was browsing the "Crystalyte Controllers - Repair and Modification information" thread and saw the information on the shunt for measuring current. Are there any issues with using it to directly interface to an A/D port on a microcontroller (or through an A/D chip to a microcontroller port)? I am thinking about using a Rabbit 4000 series chip for data sampling/display, gps, web interface, etc.
 
Welcome aboard!

You should be able to use the internal shunt for current measurement. That's what the new DrainBrain does.

One issue is the voltage on the shunt is near zero, so the input range of the A/D has to go to zero or slightly below. You can level shift the voltage upward with a diode and a resistor to the +5v if necessary.

Another issue is the voltage across the shunt is like 35mv at maximum, so check what the resolution of the A/D is.

Plan B might be to use an Allegro current sensor, which has a much higher output voltage.
 
I am using two (one per battery) LTC6101 high side transconductance (approx) amplifiers to amplify the 40mV I will be getting, these interface directly to a micros (dsPIC30F2010) analogue input too. Visit the Linear(.com) website there is a load of info on current sensing there. With the shut being at ground (mine are at battery volts) a standard op amp is easy to interface to the shunt giving an amplified output. Look for op amps where the input can go below the negative rail. National(.com) also have many good lessons online as well as lots of good chips to play with. Don't forget TI and IRF (both .com) as well. You can usualy order sample chips online too.

I am all for the practical hands on stuff, please ask any questions here or by PM.
 
Great - thanks for the info! I had seen the info about the Allegro sensor also. It looks like the Rabbit 4000 module uses a TI ADS7870 A/D chip which can be set up for -2 to +2 or 0 to +2 volts input. I'll have to read their doc more closely but it looks like I could do something with it. I typically try to stay out of the analog domain whenever possible, but I know enough to be dangerous :oops:

Should be putting together my first bike over the next few days - rear wheel 48V 5304. I'd like to eventually get some good measurements from it to figure out how small a battery pack I could use for traveling to/from work. Of course, high speed tests are also good for weekends :p
 
wtf said:
I was browsing the "Crystalyte Controllers - Repair and Modification information" thread and saw the information on the shunt for measuring current. Are there any issues with using it to directly interface to an A/D port on a microcontroller (or through an A/D chip to a microcontroller port)? I am thinking about using a Rabbit 4000 series chip for data sampling/display, gps, web interface, etc.

FYI the shunts on the 20A controllers are about 1.6 mOhm, and the 35-40A controllers are around 1.2 mOhm, so that should tell you what shunt voltages you'd be seeing and what your A/D resolution will be like without any amplification.

The shunt sees the PWM waveform, so analog filtering at the very least is required. It's also made from constantan wire, which produces interesting thermocouple / peltier effects with the copper traces on the PCBoard and causes temporary offset errors on the order of ~0.3-0.4 amps after large current swings.

-Justin
 
"The shunt sees the PWM waveform"

It is smoothed (quite a lot) by the bulk capacitors, a small filter after the shunt is still a good idea.
 
maxwell said:
"The shunt sees the PWM waveform"

It is smoothed (quite a lot) by the bulk capacitors, a small filter after the shunt is still a good idea.

The bulk capacitors do well to filter a shunt placed on the battery leads before the controller, but they don't have any filtering effect for the onboard shunt. When the mosfets are in the OFF state, there is zero current through the controller shunt, and when the PWM is in the ON state then the full motor current passes through the shunt.

The filtered version of this signal is equal to the battery current and should be used for amp-hour monitoring. But if you have a fast ADC, it could be interesting to measure the actual voltage peaks across the shunt. That gives the motor current, which tells you how much torque the hub is producing, and what your controller and motor IR losses add up to. From there you can calculate the actual mechanical output power, motor efficiency, and lots of other things that you can't do with just the battery current.

-Justin
 
can you measure current with a multimeter in series with the batteries? i don't want to spend £50 on a drainbrain or wattsup when i just want to know the limits of my batteries.
 
monster said:
can you measure current with a multimeter in series with the batteries? i don't want to spend £50 on a drainbrain or wattsup when i just want to know the limits of my batteries.

Sure, in conjunction with a shunt. I clamped a cheap analog voltmeter and ammeter to my handlebars.
 
i dont really understand how the ampmeter shunt works. something to do with not having the full power running through your meter and back?

could you give me a circuit diagram?
 
monster said:
i dont really understand how the ampmeter shunt works. something to do with not having the full power running through your meter and back?

could you give me a circuit diagram?

The shunt is so simple even a cave-xyster can explain it. The shunt is a piece of metal of known resistance, in this case 50mv at 50 amps. The shunt is in series with a main battery wire. The wires to the ammeter connect to each side of the shunt. The ammeter itself is just a voltmeter with a 50mv scale, measuring the voltage drop across the shunt, thereby measuring the current running through the main battery wires.
 
Back
Top