SparkFun Forums 

Where electronics enthusiasts find answers.

Have a good idea for a new product for SFE or Olimex? Let us know!
User avatar
By sparky
Hello All,

We've been playing with the ADXRS401 gyro for a bit now and have experienced some interesting phenomena that I'm hoping some of you can explain...

The ADXRS series has a nice 2.5V reference pin. It's uber-regulated and should be dead on. Hooking up a cheapo multimeter, I get just that - 2.5V, dead-on, ok cool.

Attaching this 2.5V to a PIC, I run an ADC on the voltage. To my mistification, I get all sorts of variances. Usually lower, like 498/1024 = 2.43V. Why is this? I believe it's a current issue.

The maximum recommended input impedance for the PIC 16F88 is 2.5kOhm. The ADXRS401 has a datasheet spec for the 2.5V reference called "Load Drive to Ground" which is 200uA at 2.5V. I assume this translates to a 2.5V/0.0002A = 12.5kOhm output impedance. Therefore, we've violated the PIC's ADC input impedance. Simply put, the ADXRS is not pumping out enough juice to correctly and repeatably charge up the internal capacitor that is the PIC's Analog to Digital Converter. I am even close to being on track here?

Okay, so after four blissful years of EE training, if you didn't have the word OpAmp burned into your brain, you were probably sleeping the entire time. Well it turns out, I was sleeping...

Question 1) How would I hookup an opamp to be used only as a current source / signal buffer? I don't want to amplify the signal, I just what the 2.5V reference pin (and other ADXRS pins) to have enough current to be correctly read by the PIC's ADC.

Question 2) How do I hook up a simple opamp circuit for small amplification of the ADXRS signal? All the opamp examples I remember are for 100-1000x amplification. This would saturate the ADC immediately. I am looking for a 2-3x amplification.

I really appreciate any ideas or links you can point me to,
By SOI_Sentinel
Ok, you're getting this from a BSME who dabbles in everything :D

I see two possibilities. One, Voltage Follower. Threre will be a SLIGHT offset, but it should be minimal. ... lower.html

Special purpose VF amp example

Two, take your readings and look at it. Standard ADCs are notorious for having some drift in their readings. Usually you find that they are averaged across many readings. Part of the reason I've used a lot of Sigma-Delta (or is that D-S, I never remember) ADC's in my learning with my Cypress PSoC invention board (ah... reprogrammability). You may only get 10-200sps, but they're oversampled by the hardware design at 64x-256x depending on varation. Heck, I have some uber hardware versions sitting in my sample box that do 100ksps at 24 bit resolution (expensive buggers).

Other possible causes: System noise, Vref to your PIC isn't the most accurate.

Forgot Question 2:

I'm thinking you might like to use a dual op-amp differential amplifier/instrumentation amplifier. ... de110.html

The three op amp version's probably best, as you can buffer both signals then. I use a 2 op-amp topology in my PSoC designs, but it has less CMRR.

These would let you hook up the REF to one side, the signal to the other, ang get a full swing (± 5V or whatever) signal off your gyro. (I'm going to test this on my Gyration MG100's sometime soon for my own projects). If you're not worrying about temperature range changes, this will also "auto center" your gyro readings without any processor time required.
Here's a simple and cost effective way to do it... using a Microchip op-amp no less:

It uses a dual op-amp, low offset voltage and very low power. The amplifier is also inexpensive as well.
By SOI_Sentinel

The only issue I see with that design is that you are comparing the center voltage Vref to the acceleration signal, which may be higher or lower than Vref. He's basically looking for a way to turn 1.2V to 3.8V (or whatever the full range is) into 0-5V (or ±5V if the ADC can take it, can't remember) and get an accurate relationship to the Vref from the ADXL.

Here's another page where they've done the full interface (in text, no diagrams) . It's for the accelerometers, but it's the same effect. They mention referencing the voltage follower to Vref so that they get a swing of 0.5V to 4.5V. I just woke up, so my mind isn't quite locking onto how to reference the opamp to Vref instead of ground...


Nevermind, looks like they just used their own voltage divider reference... ... age009.png
User avatar
By sparky
Nice! You've both proven the value of the support forum.

Indeed - I knew it should be something as simply as the mps-design example - thanks! Nice website btw, your own?

The CMU.EDU example is bascially the answer to both questions. It's voltage follower and then a mild amplifier. The author claims:
Vout = 2 * Vin - 2.5V

which is very close to what I need. But what happens when the ADXL outputs a voltage lower than 2.5V? (ie, at -1g you'll see 2.5V-312mv or 2.19V) Then Vout becomes 2 * 2.19 - 2.5V = 1.88V. Oh wait, I see now. I was worried I was going to see a negative Vout which would fritz the PICs ADC. This is not the case! The amplification is inverted (Vout > 2.5 reflects a negative g reading) but this is easily corrected in firmware.

Ahhh. Very nice. Thank you both!


PS Did you dig into the CMU site any? There are some cool pics and some really neat videos of their non-wheeled robots doing stuff.
sparky wrote:Nice! You've both proven the value of the support forum.

Indeed - I knew it should be something as simply as the mps-design example - thanks! Nice website btw, your own?


PS Did you dig into the CMU site any? There are some cool pics and some really neat videos of their non-wheeled robots doing stuff.
Thanks, the web site is for my consulting business. It's a work in progress, but I hope to have a gallery of products I've designed in the past few years completed over the holiday season.

I've been an electronics consultant for about 20 years now and finally have gotten the motivation to put up a nice web site. Now if I could only add a few more hours to each day... :roll:

The CMU site does have some cool videos there. I ran across the site some time ago and enjoyed the robotics videos too.

And congrats on this site too. I'm doing a lot of MSP430 designs lately and I found a lot of the items you sell useful, especially when I was first getting started with the MSP430 family.

I also have a Nordic 900MHz RF tranceiver designed, but not built yet. It's a lot like the SmiRF, except using the 900 MHz chipset. Glad you guys sell the chips... :)
User avatar
By sparky
That's pretty stinking cool! I did not know such things existed. Thanks!