DC Motor current to an Analog Input

If this is already covered, my apologies. But, measuring magnetic field strength of DC current is the easiest method with the restraints put on the on the wiring by rule. This can be accomplished with an AMR or GMR or Hall Effect sensor, all available in the DigiKey Catalog. Look in the sensor section. If you then go to the web sites of the mfg., you’ll find application notes to help you determine the exact distance from the center of the wire and angle to the wire to get the 0-125A range, 0-500A range etc…

Low resistance shunts are also allowed in the rules. They must be in the custom circuit box and will require amplifiers to be useful.

We built a very robust current monitor for speed controls. The negative current return wire from the SC to the fuse block is used at the current shunt. 10 G wire has a resistance of about 0.005 Ohms per foot. This gives 50 mV signal when 10 A of current is flowing.

We simply connect a 24G wire from the negative power supply terminal on the SC to our PC board where a simple Rail-to-Rail op amp circuit amplifies the voltage by a factor of 50 to 200 such that the output voltage is 1V=10A. A variable gain of 1-200 on the op-amp allows us to use a shunt wire length of about 0.5 ft to 10 ft (really no upper limit).

We also use a 10Hz low-pass filter on the output of the op-amp to smooth the square-wave current signal to a stable DC voltage.

Our PC board also has a microcontroller that measures the currents on four SCs 5 times a second to generate a “fuse trip warning” that is transmitted to the RC. The uC uses a heat model to estimate the temperature of the 30 A fuse and alerts the RC when the fuse is within 1 second of tripping. The code in the RC then watches for the warning signals (digital inputs) and shuts down the the SCs when they are close to tripping the fuses. We also have a warning on the dashboard that shows which SCs are overheating the fuses.

The uC is also used to measure two shaft speeds via the optical sensors. The speeds are compared and if one is faster than the other the analog error signal output from the uC is used by the RC to slow one motor down. This keeps our robot going straight.

But in the end, we don’t know how useful these little gadgets will be in competition.

*Originally posted by JoeJ *
**Low resistance shunts are also allowed in the rules. They must be in the custom circuit box and will require amplifiers to be useful. **

Let me ask why you would want to add any resistance into the circuit when you can use the resistance that exists there already? (and is required by the laws of FIRST :slight_smile: )

We measure the voltage drop across the small circuit breakers. If I recall they have resistance of abot 5 and 8 milliohm (for 30 and 20 amp breakers respectively), and since they are already present and required you are NOT adding any drops or power-losses to your circuit.

All you have to do is build a difference amplifier with a common-mode input voltage range that includes it’s Vcc rail. (and slighltly above) All this takes is a single OPAmp and 4 resistors.

If anyone is interested, I can share our schematic for this. (in PDF format)

-Quentin

.

I am interested, can you post the pdf?
Thanks!

[quote]*Originally posted by bigqueue *
**

Let me ask why you would want to add any resistance into the circuit when you can use the resistance that exists there already? (and is required by the laws of FIRST :slight_smile: )**

Please read my post again. We are doing essentially the same thing you are: measuring the voltage drop across an already existing component in the system (negative lead to SC). However in our design the shunt resistance will not change (wire has much better resistance stability than the circuit breaker) as much and so the calibration is much more stable. Also, we don’t have to used an expensive differential instrument amplifier and the associated extra wires. The dual channel R-R op-amp from Digikey is only $1.35 and it runs two channels of current sensing. One pot, two resistors and a capacitor make up the rest of the variable-gain amplifier.

I post the hand-sketched circuit diagram.[/quote]





Tim Skloss,
Great design, could I add one suggestion? I know the circuit breakers are designed to trip in .1 seconds once the current reaches 40 amps, but in case of a catestropic failure it could exceed that amount for a very short time. In the unlikely event something happens we’ve added a 5.1 V zener to the output of our sensors as protection for the RC analog inputs.
We actually take our measurements at the outputs of the speed controller and I think our circuit works… we’ll know how well as soon as they allow us time to wire the robot.

Best of luck!

Steve Alaniz

“What good is technology if you can’t abuse it?” - Ted Forth

Measuring the current across the circuit breakers could be a good idea. I must give that some thought. I don’t like to measure the current on the low side of the circuit because that must change the ground reference of the victor. It all depends on how much resistance is being added. If you are measuring the difference in existing wires, the is not likely to be a problem.

The rules specificially state that you cannot modify the current path to the victors with the exception of adding insignificant resistances to measure the current.

Here is what I posted in a different forum on measuring the current.

The easiest on-board current measuring system is a PCB trace in series with the power to the Victor.

1.5oz copper clad PCB has a resistance of approximately 0.7milliohms per square. 1.5oz copper is the weight of the copper you get from a custom circuit board from AP Circuits (www.apc.com).

To measure the current, you measure the voltage drop across the copper trace. TI sells the INA169 through digikey. This chip is designed to provide a ground referenced voltage (0-x volts) from a voltage across a current sensing resistor. Gain is controlled by a single resistor.

Example:
With a 1" wide by 5" long patch of 1.5 oz copper, the final resistance is 3.5milliohms.
In order to see overcurrent conditions lets set 100A=5v output.
This requires a gain resistor for the INA169 of about 14Kohm.
The little breakers open around 30Amps or when we measure 1v out of the INA169.

For those of you concerned about power/voltage loses, we measured 125mV @ 30A across the copper I described above. This equates to 3watts of power. This is approximately the same loss as 5" of the 10awg wire. If you are really concerned, use 8awg wire instead of 10awg and keep the wire lengths as short as possible. The smaller the wire, the shorter the length.

Our custom circuit box includes two of the current shunts described above on one circuit board. A second circuit board is stacked above the shunts. The second board includes the INA169’s, a PIC16F877, a 4 channel digital to analog converter to send analog commands to the robot controller. A connector for the Gyro (We scale and filter the gyro data before sending it to the robot controller) Connectors for the optical sensors, and 8 digital outputs to the digital inputs on the robot controller for digital commands. All of our high speed control code runs in the PIC16F877 (100x faster than robot controller) and commands are passed through the digital and analog inputs.

[quote]*Originally posted by s_alaniz *
**Tim Skloss,
Great design, could I add one suggestion? I know the circuit breakers are designed to trip in .1 seconds once the current reaches 40 amps, but in case of a catestropic failure it could exceed that amount for a very short time. In the unlikely event something happens we’ve added a 5.1 V zener to the output of our sensors as protection for the RC analog inputs.
We actually take our measurements at the outputs of the speed controller and I think our circuit works… we’ll know how well as soon as they allow us time to wire the robot.


Actually, we use a 5V regulator on the PC board to power the op-amp. This accomplishes the same thing. Besides, the uC that we feed the current signal into has built-in zeners.

Good comment! Always good to be safe!**[/quote]

Tim oops! Just re-read you’re first post. I guess you’re not using the analog inputs the same way we are. never mind! Quick question, do you use two or four opticals for phase/direction of your drive shafts? (I assume you’re not using “tank” drive since constant motor speed would prevent you from turning.)
Last question, HOW did you get your team to STOP rebuilding and give you time to put all this stuff on the robot? We’re STILL waiting for them to give us time to wire up the electronics (Oh we need electronics? Sure there’s a 6 inch square section we left for you. How long do you need it for? We can give you 30 minutes…I HOPE you chasis guys are reading this!!!) Sorry I digress.

Best wishes

Steve Alaniz

“You’re saying we can look forward to robots behaving badly and demanding higher salaries…” - Sally Forth

[quote]*Originally posted by s_alaniz *
**Tim oops! Just re-read you’re first post. I guess you’re not using the analog inputs the same way we are. never mind! Quick question, do you use two or four opticals for phase/direction of your drive shafts? (I assume you’re not using “tank” drive since constant motor speed would prevent you from turning.)
Last question, HOW did you get your team to STOP rebuilding and give you time to put all this stuff on the robot? We’re STILL waiting for them to give us time to wire up the electronics (Oh we need electronics? Sure there’s a 6 inch square section we left for you. How long do you need it for? We can give you 30 minutes…I HOPE you chasis guys are reading this!!!) Sorry I digress.


Yes, we are using 1-stick tank drive. The shaft-sync is only used when the RC knows it’s supposed to be going straight (x-axis at neutral).

The SC currents are being read by an on-board microcontroller that has analog inputs. The uC runs a heat model to predict when the fuses will trip. We tested each fuse and found some fuses to take TWICE as long to trip–these are now on our tank drive drill motors. Even at 100 amps of current, the fuses took about 0.5 to 1 second to trip. The RC can respond faster than that to stop the excessive current by shutting down the SC and sounding an alarm on the dashboard. The alarm resets when the control input is relaxed.

Our robot is in modular sections that can be easily removed for modification by the special functions’ teams. Right now we have a bare chassis and drive train (plus all controls and pneumatics) that is used for driver training while the grabber and ball collector teams are finishing their sections.

I feel your pain… what I would give for just 5 extra more pounds of weight limit!!!**[/quote]

*Originally posted by s_alaniz *
**
Last question, HOW did you get your team to STOP rebuilding and give you time to put all this stuff on the robot?

**

Well, we just held back the controls and didn’t give them a “real” way to power/control their motors. When left with just shorting them across the batteries, they understood the “power” we had over them…and they gave us a little respect. (and time :smiley: )

Actually, it is tough…and you are NOT along in this problem…

-Quentin

We decided we did not have the time and people to properlly develop these devices for this competition, but we will continue to work on them and post the results for next years competition. I had originally abandoned the idea of shunts because of FIRST’s tight control on wiring safety. We decided that we would run one wire from each of our four drive motors through the project box and use the resistance in 5" of the #10 conductor. It then occured to us that extending wires out of the project box did not violate the rules. Therfore, we could use the entire length of the black conductor from each motor speed controller and apply the 0-5vdc (0-100Amps) against thermal models on the 30Amp thermals and collectively against the 60 amp main breaker. We are thniking of applying the 0-5vdc directly to an RC circuit for the thermal model. We are open to suggestions. We have less than half of the technical people we had last year, so we are short on the most important resources, people. We have also not recieved any of the materials from Small Parts that we really needed.

*Originally posted by junkyarddawg *
**We decided we did not have the time and people to properlly develop these devices for this competition, but we will continue to work on them and post the results for next years competition. I had originally abandoned the idea of shunts because of FIRST’s tight control on wiring safety. We decided that we would run one wire from each of our four drive motors through the project box and use the resistance in 5" of the #10 conductor. It then occured to us that extending wires out of the project box did not violate the rules. Therfore, we could use the entire length of the black conductor from each motor speed controller and apply the 0-5vdc (0-100Amps) against thermal models on the 30Amp thermals and collectively against the 60 amp main breaker. We are thniking of applying the 0-5vdc directly to an RC circuit for the thermal model. We are open to suggestions. We have less than half of the technical people we had last year, so we are short on the most important resources, people. We have also not recieved any of the materials from Small Parts that we really needed. **

Well, you might try measuring across the breaker itself. We do it, and it works real nice…and it makes the wiring nice and short. (you do have to build a “Y” connection at one end of the breaker though…but this is no big deal)

-Quentin

*Originally posted by junkyarddawg *
**It then occured to us that extending wires out of the project box did not violate the rules. Therfore, we could use the entire length of the black conductor from each motor speed controller and apply the 0-5vdc (0-100Amps) against thermal models on the 30Amp thermals and collectively against the 60 amp main breaker. **


That’s what we do. It only requires one wire and can be screwed using a ring terminal directly on the SC.

I have attached the C code we use in our PIC uController. Feel free to use it for ideas. If you would like to use uCs in future applications, I reccommend CCSInfo (www.ccsinfo.com). They have a great C compiler for PICs that is very easy to use. You can get their hobby kit for $189 that includes the compiler, manuals and a very high quality chip programmer. I have used it for 2 years to make imbedded controllers for all kinds of projects.

m3auto1c.txt (7.89 KB)


m3auto1c.txt (7.89 KB)

*Originally posted by Tim Skloss *
**

**

Let me ask why you would want to add any resistance into the circuit when you can use the resistance that exists there already? (and is required by the laws of FIRST :slight_smile: )**

Please read my post again. We are doing essentially the same thing you are: measuring the voltage drop across an already existing component in the system (negative lead to SC). However in our design the shunt resistance will not change (wire has much better resistance stability than the circuit breaker) as much and so the calibration is much more stable. Also, we don’t have to used an expensive differential instrument amplifier and the associated extra wires. The dual channel R-R op-amp from Digikey is only $1.35 and it runs two channels of current sensing. One pot, two resistors and a capacitor make up the rest of the variable-gain amplifier.

I post the hand-sketched circuit diagram.

I don’t use any sort of expensive amplifier…it is a fairly run of the mill opamp made into a difference amplifier using 4 resistors.

The only tricky thing is choosing an opamp which will sense up near its rails…and that isn’t really needed given the resostor dividers.

The old CA3130 works fine…but Digikey stopped selling it, so I had to go with a newer National device.

I will upload the schematic when I get home.

No pots, no calibration…(accurate enough for the stuff we are doing here with FIRST)

-Quentin**

OK, Finally figured out how to post this. This is our scheme for current sensing. we were able to “calibrate” our wires since the Maxim chip gives us a very accurate way of calculating backwards. We havn’t actually tested it on the robot but we were able to get very good readings from last years robot’s arm. I think a .22uf cap would have been a better choice but in the end we’re getting more information than we need. We’ll know tomorrow just how good this works. We’re monitoring 6 motors and using the Analog inputs on the RC.
I hope to have our PC etching process laid out on our WP soon… (if you want to see a picture of Dean Kamen in his cowboy hat, check our site! http://www.leopards57.com/)

Best Wishes

Steve Alaniz

“Yeah those robots are cool, but if you can’t play Nintendo on them, what good are they?” - Hilary Forth





I am attaching a PDF file of the schematics for our Motor Monitor (current monitor) circuit. This circuit simply measures the voltage across the circuit breakers with a simple one OP-AMP difference amplifier, amplifies (and filters) it and then sends it to the robot controller A/D analog input port.

We mounted the FIRST circuit breaker terminal block to the top of our custom circuit box, and this makes the wiring very short and easy to manage. (and since we are fighting the weight problem right now :frowning: , all the weight we can save helps! :slight_smile: )

Please feel free to use this, but please try to give team 811 credit if you find it useful. (NOTE: We also have a PCB file made for this and will share it if you would like…and being made at ExpressPCB, it is inexpensive at $59.00 for three PCB fabs)

Enjoy, :slight_smile:
-Quentin

motor_monitor.pdf (32.1 KB)


motor_monitor.pdf (32.1 KB)

Could you please post the PCB files as well? Oh yeah I’m not sure which types of capacitors and resitors to use so i would also apreciate if you guys could post the part numbers…

Thanks!

Eugene

*Originally posted by Eugene *
**Could you please post the PCB files as well? Oh yeah I’m not sure which types of capacitors and resitors to use so i would also apreciate if you guys could post the part numbers…

Thanks!

Eugene **

Ok…here you go. This is a ZIP file with schematics (PDF and Orcad file), ExpressPCB file and Bill of Materials (generally with Digikey Part numbers)

In order to use the ExpressPCB file, you will have to go to www.expresspcb.com and download the free design software.

Have fun!
-Quentin

PS: The Bill of Materials is for the entire custom circuit box, so it includes things like fuses, terminal blocks and the box itself that are NOT on the board!

custom_circuit.zip (63.7 KB)


custom_circuit.zip (63.7 KB)