Let's Make Robots!

Accelerometers, PWM vs. analog?

While looking through the Components section, I came across the accelerometers Fritsl and BaseOverApex posted.

Having never used an accelerometer, I have to ask why you would prefer a PWM accelerometer over analog?  I was reading this article about them and in reference to PWM, they seem to indicate "[t]he disadvantage here is that it requires you to use the timing resources of the microcontroller to measure the duty cycle, as well as performing a computationally intensive division operation." Is it not that significant to take these measurements?  It seems analog output typically can be retrieved with something like: acceleration=read_adc();

I'm sure there is a time and place for each.  Any opinions?  

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
BaseOverApex's picture

I prefer measuring pulse widths. It may be historical, though because the first PICs I used had no analog inputs. Then, when they started to use ADCs, I could only find CMOS accelerometers and could not be bothered with setting up the 3.3V supply rail and sorting out the reference voltages for the analog inputs.

Bear in mind that "acceleration=read_adc();" is not an MCU command of any sort. Someone programmed it to process the command. I never took up the high level microcontroller programming, since I could already do whatever I wanted in RISC assembler.

Once we get the ball rolling on our modular open source solution, I would hope we'll come up with a 3-axis I2C accelerometer.

fritsl's picture

analog, i2c or serial - nothing else.

Prefer analog; nothing to set up, and a reading the instant you want it. (which often is nice when it comes to balance etc)

/ Fritsl