# Hardware based magnitude for accelerometer

In the past I've taken the magnitude of an accelerometer digitally, using the following equation:

magnitude = sqrt(x^2 + y^2 + z^2)


However, in order to do this I need to sample all three accelerometer planes (x, y, and z) which takes up three channels in my DAQ. This is fine for a single accelerometer, but now that I'm starting to use multiple accelerometer this means I need a lot of channels!

Seeing as I'm just taking the magnitude anyway, I was wondering how I would perform the same calculation in hardware, prior to sampling the planes, so that I only have to sample one channel per accelerometer as opposed to three.

Would someone be able to show me what the circuitry would look like for me to perform this magnitude calculation?

Thanks in advance.

• Put an MCU with analog inputs and let it sample and calculate... Or use a digital accelerometers sitting on an 2-wire I2C bus all together. – Eugene Sh. Sep 15 '16 at 21:53
• Look up the price of an "analog multiplier" IC and weep. Then re-think the idea... – Brian Drummond Sep 15 '16 at 21:54
• Some of the multi axis digital output chips have a built-in motion processor, it is quite likely you could program it to do the magnitude calculation internally. Or an MCU capable of doing so should be cheap, provided the update rate isn't too high. – Chris Stratton Oct 16 '16 at 0:37

## 1 Answer

This is a classic problem, and has a classic answer. simulate this circuit – Schematic created using CircuitLab

While straightforward, it is marked by considerable inaccuracies if you try for a wide dynamic range. 1% accuracy is pretty much standard. Such multipliers are still available, such as theAnalog Devices AD532.

• That AD532 from digikey is an 'eye watering' price! – gbulmer Sep 16 '16 at 4:37
• @gbulmer - They used to be a good deal cheaper, but with declining usage the price has gone up. – WhatRoughBeast Sep 16 '16 at 13:23
• It seems doubtful in this day and age than precision analog computational circuitry would be advantageous over an MCU-based digital solution. – Chris Stratton Oct 16 '16 at 0:38