How to get a stable reference voltage?

I’m trying to build a robot using the sparkfun IMU 5DOF. This board includes an accelerometer with ratiometric output and a gyro that does not use ratiometric output. I can use the accelerometer just fine, but when my motors kick in, the voltage to the rest of my circuit drops slightly which screws up my reference voltage, making my gyro useless.

My robot is designed to be powered by ~9V from a battery pack, but I’ve been using an 800 mA wall wart for testing. This voltage feeds both a SN754410 h-bridge for two motors (each of which should draw < 30mA at 9 volts) and a 7805 regulator for the arduino and a few other components. This 5V is dropping slightly when the motors kick in. There is also an MCP1700 3.3v LDO regulator drawing from the 5v that powers the IMU board and is currently also connected to my analog reference (both to increase ADC resolution and to try to stabilize the reference voltage), but this voltage is also dropping enough to screw up my measurements.

What does it take to get a stable reference voltage? I could add an isolated power source just for the IMU and ADC reference, but there must be a better way!

For temperature related stuff I use an LM336-2.5 for a 2.5V reference, they come in other "denominations" too. Pretty damn accurate.

If you have a free A/D input, connect it to the gyros vref output. Then measure rates by comparing the rate outputs against the vref output... it should be (nearly) unaffected by small changes in power supply, since this is the reference the gyro is using internally.

something like...

#define vrefPin 0
#define xratePin 1
#define yratePin 2

int rawX, rawY;

void Gyro(){
 int ref;
 ref = analogRead(vrefPin);
 rawX = analogRead(xratePin)-ref;
 rawY = analogRead(yratePin)-ref;
}

My gut feeling is that your voltages aren't dropping, your ground is rising.

As your motors kick in, the current causes a voltage drop in their ground path causing a slight increase in the "ground" voltage in that path (remember: "There is no such thing as ground").

Consider keeping your motor grounds and analog/digital grounds as separate as possible, right up to the power source.

If you have a free A/D input, connect it to the gyros vref output.
Then measure rates by comparing the rate outputs against the vref output… it should be (nearly) unaffected by small changes in power supply, since this is the reference the gyro is using internally.

something like…

#define vrefPin 0

#define xratePin 1
#define yratePin 2

int rawX, rawY;

void Gyro(){
int ref;
ref = analogRead(vrefPin);
rawX = analogRead(xratePin)-ref;
rawY = analogRead(yratePin)-ref;
}

Of course, THAT’S what that’s for. I had tried reading the voltage off of that, but it didn’t seem that stable, so I ignored it, but that instability might just be the inverse of the ADC reference instability.

I do have one input unused, I’ll have to see about rewiring to make it available…

My gut feeling is that your voltages aren't dropping, your ground is rising.

As your motors kick in, the current causes a voltage drop in their ground path causing a slight increase in the "ground" voltage in that path (remember: "There is no such thing as ground").

Consider keeping your motor grounds and analog/digital grounds as separate as possible, right up to the power source.

I suspected it might be a ground issue too, but shouldn't the regulators compensate for that? It's not that the values are spiking (I could fix that with caps), it's a consistent drop. When the ground gets pulled up, pull up the ground pins on the regulators, and they should increase the output voltage to compensate, unless I'm missing something...

Unfortunately, my SN754410 is on a controller board that doesn't make it particularly easy to isolate things, but I'll see what I can do. I wonder if it would help to add a hunk of metal to sink my ground...

I suspected it might be a ground issue too, but shouldn't the regulators compensate for that? It's not that the values are spiking (I could fix that with caps), it's a consistent drop. When the ground gets pulled up, pull up the ground pins on the regulators, and they should increase the output voltage to compensate, unless I'm missing something...

Regulators only maintain a constant voltage from their output pin to their ground pin. What happens past their own ground pin, they can't control.

I can see the output of your regulators decreasing if you put the "red lead" of your DMM at the regulator output and the "black lead" next to the motor ground, which will tend to rise relative to your digital ground, making it look like the "red lead" is decreasing.

Try moving your "black lead" of your DMM around to a ground closer to the reference and see if it makes a difference to your voltage droop. If not, then I'm wrong and that's not the problem.

Ah, so you're suggesting that parts of my ground are higher than others. That could be, I suppose...

I haven't done much checking of the voltages with a meter while the motors are running (it's difficult to test the contacts while the robot is trying to run away from you), I've figured out that my reference voltage was changing mostly based on debugging data coming off the USB connection. I did check my voltages to verify, but I probably only used the ground at the ftdi header (for convenience). I've been using my meter mostly for continuity testing while the power is disconnected.

Sweet. I implemented both of those changes and it made a huge difference. Rerouting my ground traces to isolate the analog circuitry from the motor driver with the 5V regulator in the middle gave me almost 8 ohms from one end to the other.

I now get clean enough data from the gyro to make my robot stand for a few seconds using only that data. Now I have to add the accelerometer data back in and figure out this kalman filter stuff…

Hi all,

I believe I have the same problem (on a much simpler robot). I'm pretty new to electronics so please bare with me.

I have an arduino also running two motors using a SN754410 h-bridge. I also have connected a Sharp GP2Y0A21YK IR Range Finder to the arduino. This is all done on a breadboard sitting on top of the chasis. When no motors are running, i get a very clean and consistent read on the sensor. Once I enable the motors, I see the readings gradually get worse until I get a false positive that an object is in range. This happens within a couple seconds of the motors running.

I don't think I'm able to implement Mike Rice's solution with this Sharp sensor. Please correct me if I'm wrong.

And pardon my newbiness, but I don't understand RuggedCircuits solution. How would I isolate the motor grounds from the IR sensor ground? Does the hunk-o-metal solution actually work?

Thanks in advance!

I should also mention, I’m using a breadboard power supply, like the one shown in this tutorial:

http://www.sparkfun.com/commerce/tutorial_info.php?tutorials_id=57

First off you need to read this:- http://www.thebox.myzen.co.uk/Tutorial/De-coupling.html

If you then can't get enough isolation with the various decoupling techniques you should then have a totally septate supply for the motors and control them using an opto isolator:- http://www.google.co.uk/url?q=http://en.wikipedia.org/wiki/Opto-isolator&ei=xZkPS--6BNC14Qa9pdyFBA&sa=X&oi=spellmeleon_result&resnum=1&ct=result&ved=0CAcQhgIwAA&usg=AFQjCNHJC2qDUuhQf0rlcQGP9TLkBImR6w

Thanks Grumpy_Mike,

I will carefully read the tutorial... it looks very useful for this issue. If these techniques don't work out for me, is this the type of optoisolator that would work for the IC's I'm using?

http://www.sparkfun.com/commerce/product_info.php?products_id=314

Yes that would do. For what you want almost any sort of opto would suffice as you are only using it at low speeds (for electronics that is).

I spent some time this weekend attempting to decouple my components with caps, with no success. I suspect I'm doing something obviously wrong, since I've found other similar robots on the web which don't seem to do anything too complicated to get it working.

https://sites.google.com/a/divinechildhighschool.org/electronics/Home/final-projects-fall-2008/self-driving-car

http://letsmakerobots.com/node/1736

I think I have to change my wiring around... the 4 grounds coming out of my h-bridge (currently going to the GND rail in various places) should probably go to a single ground line which should have a decoupling cap between it and the motor V+ line. Am I thinking along the right lines?

Or perhaps I need to add decoupling caps between the lines going from the h-bridge to the motor? between the 2 leads to each motor?

Maybe in both places? Any advice or tips are greatly appreciated.

I've tried adding caps everywhere i can think of, but i'll keep trying. Between V+ and GND to the arduino, between V+ and GND to the sensor, all over the h-bridge, around the voltage regulator, along the rails of the breadboard. At one point i had a bout 20 caps of various sizes on the darn thing!

As per your tutorial, I tried adding a resistor in series with Vin to the h-bridge or sensor but that prevents them from working for some reason... (here's where you should roll your eyes)

I'll also try the inductor or choke method and then the opto-isolator next, as soon as i get those parts.

I may have to go with separate power supply's to run the motor and the IR sensor. Would you suggest having a single battery connected to 2 voltage regulators (with caps), or 2 separate batteries? Again sorry if this is a silly question.