element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products & Partners
    Products & Partners
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
    About the element14 Community
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      •  Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
My Project Is Trash
  • Challenges & Projects
  • Design Challenges
  • My Project Is Trash
  • More
  • Cancel
My Project Is Trash
Forum Knock-Knock-Sortin' #6 - Collecting accelerometer and microphone data
  • News
  • Forum
  • Projects
  • Enroll
  • Leaderboard
  • Files
  • Members
  • More
  • Cancel
  • New
Join My Project Is Trash to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 0 replies
  • Subscribers 1 subscriber
  • Views 7 views
  • Users 0 members are here
  • KnockKnockSort
  • my-project-is-trash
Related

Knock-Knock-Sortin' #6 - Collecting accelerometer and microphone data

amgalbu
amgalbu 41 minutes ago

Unfortunately, my plan in my proposal was an ADXL372 went wrong. I spent almost two days trying to make it work, but there is something I can't understand why the MISO signal is not read correctly.This causes unreliable reads. For example, the ID registers read 0xA9, 0x18 and 0xF0 instead of 0xAD, 0x1D and 0xFA. I really apologize to Element14 and Analog Devices: I will try again later on.

In order not to delayed too much the other project activities, I made a workaround and used what was already there: the LSM6DSOX inside the Nicla Vision. I mounted the Nicla under the chute plate and as shown in picture.

image

A MicroPython acquisition script runs on the Nicla:

  • The LSM6DSOX runs at 3333 Hz, ±16 g, and fills its own FIFO, so the sample spacing is exact. The script drains the FIFO into a 1 s ring buffer.
  • The microphone streams 16 kHz audio, with 24 dB of gain, into a second 1 s ring buffer.
  • When the absolute value of a mic sample goes above 8000, both rings are cut at the same moment. Each window is 500 ms long and starts 50 ms before the trigger.
  • Each window is saved on the internal flash as a JSON file in the Edge Impulse format (1666 rows of accX, accY, accZ in g) plus a WAV file (8000 samples).
  • After a capture, the script ignores the mic for 1.5 s, so the bounces don't create new files.

EdgeImpulse dataset

To train the classifier on EdgeImpulse, I created a samples dataset by dropping twenty time the following items;

  • A plastic bottle
  • A metal can
  • A paper box

image

Here is a collected sample for each class 

image

On the microphone I applied a filter to remove frequencies below about 50 Hz (I used a 20 ms moving average), because the raw signal carries a big slow drift. The gray trace is the raw one, and on paper it shows the problem that I describe later: the signal clips and then stays near full scale for hundreds of milliseconds.

Apart from this, luckily, the four classes look different:

  • Paper gives the strongest hit on the plate (11.4 g here -probably because I dropped it from a greater height or because if weights more than the other items) and a long tail of small bounces.
  • Plastic is a short burst on both sensors, over within about 20 ms.
  • Metal rings on the microphone for a long time, while the plate response is shorter than paper.
  • Noise has obviously no impact on the plate. The raw microphone sits near 8,700, just above the trigger, and that's why the window was saved.

Accelerometer data

For the accelerometer I removed the resting value (the gravity) from each axis and computed the magnitude of the three axes. These are all the drops in the first 60 ms, aligned on the trigger:

image

And these are the features of all 80 samples, one point per window.

image

What I read in the accelerometer data:

  • Paper box hits the hardest. The real drops go from 11.4 to 17.9 g, and the raw Z axis of one of them reached 15.6 g (the LSM6DSOX stops at 16 g) A real can or a glass jar will very likely go beyond it, and this is the main reason why I still want the ADXL372 to work.
  • Plastic hits softly and briefly. 5.4 g median, and the lowest Z centroid (50 Hz): the bottle gives a soft bump with little high-frequency content.
  • Metal sits in between on the peak, with a longer ring-down.
  • Noise is almost flat. The real false trigger stays at 0.02 g. A soft knock on the frame is the only noise that gets close to plastic, and the microphone is what separates them.
  • The timing differs. With paper, the plate starts moving between 0.3 and 2 ms before the trigger. With the real jar, the plate moves about 10 ms before it. I think the jar touched the plate first with a quiet contact, and the mic triggered on the second, louder one. This problem should be solved when the acquisition will be triggered by the CN0569 sensor.

Plate frequencies

This is the Z axis (vertical) spectrum after the impact, as the median of the 20 windows per class, with the middle 50% as a band:

image

  • Paper is the strongest across the whole band, with a clear peak around 700 Hz.
  • Metal follows the paper shape, just lower.
  • Plastic and noise have a peak around 690 to 730 Hz too, about 25 dB lower than paper.

Since the peak around 700 Hz appears in every class, I think it's a resonance of the plate and of the board mounting.

Item frequencies

The microphone is clearer than the accelerometer. Here is the median spectrum per class:

image

And the spectrograms of one window per class, which show how long each sound rings:

image

  • Paper is loud everywhere, 20 to 40 dB above the other classes. Part of this is real, and part is the clipping, which spreads energy over the whole band.
  • Plastic has most of its energy below 1 kHz (centroid 162 Hz), with bumps around 700 Hz and 2.1 kHz.
  • Metal rings for 155 to 354 ms. That's much longer (from 5 to 10 times) than paper and plastic.
  • Noise has the lowest level.

Class separation

This is the chart that I was waiting for: one point per window, with the brightness of the sound on one axis and the hardness of the hit on the other.

image

The four classes form four groups, and two simple numbers are enough to draw lines between them. This is encouraging, even if data has been collected in a clean environment, with very few variances: some items dropped from the same height and with a constant background noise.

Anyway, the chart says that my acquisition chain and my features can separate these classes.

An issue with the microphone 

The microphone has a problem that comes from the acquisition settings: the paper drops saturate the microphone. Some paper drops reached 32768, with 6 to 114 ms of samples at full scale. After the hit, the signal doesn't come back to zero: it stays away from the resting value for 280 to 450 ms. This means, that I will have to

  • Lower microphone gain from 24 dB to about 12 dB, and check that a paper drop doesn't reach full scale anymore.
  • Apply an high-pass filter to the mic signal (and require some movement on the accelerometer) before starting the capture. This will make samples more similar in the time offset from start

What's next?

The next step is upload data to EdgeImpulse and create a pipeline to classify items.

After that, I will 

  1. Collect a new dataset, where I will drop each item from a fixed height on a marked spot of the plate.
  2. Keep debugging the ADXL372, because a can may hit harder than 16 g.
  3. Out of curiosity, compare these results with simulations

  • Sign in to reply
  • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2026 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube