Go Down

Topic: Troubleshooting a dodgy sensor (MMA7361) (Read 149 times) previous topic - next topic

BabyGeezer

May 29, 2019, 06:39 pm Last Edit: May 29, 2019, 06:41 pm by BabyGeezer
Am just sharing my experience here, and maybe fishing for confirmation whether my conclusion is valid or just a fluke.


<< you can jump down to the TL;DR marker and skip the history >>

One of the first ever accelerometers i bought was this cheapest available breakout module (from DFRobot) and also because it had those "Grove type" (n00b connections) where you didn't have to solder header pins. They broke out each axis into a 3-pin socket (like for servos) and you could just plug those into a breadboard.

It put out a 10-bit analog reading and it made the code very simple to construct - you could get away with having to calculate angles from the g-values with arcsin etc.

Perfect for a beginner - or so one would think.

The readings were *SO* noisy -- now, this is of course par for the course for accelerometers but it really was over the top (now, looking back in hindsight).

I had ended up learning about low-pass filters, both in hardware and software, and "dampened" the results using a weighted average value.

Anyway, i never really got far with that sensor as i eventually (months having passed !!) got 'brave enough' to solder header pins on the ubiquitous MPU-6050 which were starting to flood the market.

Thus, the shift in learning to use accelerometers (*with* a gyro !) saw the MMA7361 left behind, tucked away.

Am still on that long journey to achieving a self-balancing robot, encountering various pitfalls of cheap and inappropriate actuators, but learning what the ideal specs are from trying to use insufficient components.

Now, on another project of making something like an 'air-joystick', i thought i should be able to use the MMA7361 as i didn't need to have accurate angle values and would just read it like a glorified potentiometer.

<< TL;DR marker >>


Revisiting this sensor, along with more knowledge under my belt led me to some interesting discoveries.

I had previously only used two axes, X & Y and hadn't connected the third axis at all, BUT connecting it this time introduced even more noise ! (Also, the breadboard setup was rather more rickety (shoddy!) than the last time.)

However, with the (new IDE feature) Serial Plotter, i could now monitor it quicker (with less hassle of copying numbers to a spreadsheet for manual plotting of the data) - and could see changes happening immediately.

To my surprise, like the "old skool banging of the side of a TV to get it to work" :D - i found that the noise was actually getting worse progressively but seemed to get reset when the sensor was moved.

Picture shows this;


Furthermore, i actually had a SECOND sensor (unknowingly buying another one not realizing that it was the same sensor i had opted for in the Starter Pack that i first got !)

So i opened the sealed package and tried the second one... what a shocking difference !


All this time i had actually been faffin' about with a dodgy sensor !!

I reverted back to the dodgy one to see if i could trace what was going on - i had a close look at the PCB and noticed two of the SMD capacitors (my guess is it was the decoupling ones, on the "Grove connection") were not sitting flush on its pad but did look like it made a connection - the one on the z-axis looked the worst, so i just unplugged the cable and commented out the code for its analogRead().

The results were a lot cleaner - although having plugged the dodgy one back using the same wiring and breadboard setup as the SECOND one, it did show much worse readings than before.

Eventually i tried various methods to make the sensor usable, increasing the set of readings for the damping average as well as using the less sensitive setting (from 1.5g to 6g) and managed to get a lot less spiky plots - although the sensor would still progressively get more and more noisy and eventually no amount of "banging the side of the TV" would stop the noise (literally -- i had rigged up a buzzer to sound when the angles strayed beyond 20^ when just sitting still).


The Conclusion.

I will now solder header pins to that breakout board and see if those would give a cleaner connection (and possibly bypass using the dodgy tracks to the Grove connections), but before i even attempt to rework those SMD capacitors, i'd like some feedback as to whether they could actually be *a* reason for the noisy readings - or is it possibly some thing else altogether ?
Attach your images to be viewed directly - THIS WAY;
https://forum.arduino.cc/index.php?topic=519037.0

BabyGeezer

#1
May 29, 2019, 06:56 pm Last Edit: May 29, 2019, 06:57 pm by BabyGeezer
FWIW: a couple more pics.

This shows a better settling down after "tapping the sensor" to knock it to it's senses :P



And this shows a manual plot where there is clear drifting(?!) which i had seen a lot of when i first experimented with it but never thought it was that abnormal.
Attach your images to be viewed directly - THIS WAY;
https://forum.arduino.cc/index.php?topic=519037.0

Go Up