I would like to generate vibration patterns using the SW-420 or something similar that is able to reproduce the same pattern on similar vibrations. So if a 10p coin was dropped on a table from 1m at a 90 degree angle then I would expect the second time it dropped to make the same vibration pattern.

The objective is for the software on the Arduino to keep a small database of recorded vibration patterns and alert the user when a similar pattern has been detected.

  • 1
    the SW420 is just a highly sensitive switch ... small bump makes it close ... you need to use a good quality microphone to differentiate the sound of the coin – jsotola Jun 16 '20 at 1:16
  • Thanks for this. Assume I get the right mic. How would I pattern match the sound pls? – Jaspal Singh Rathour Jun 16 '20 at 9:00
  • Google "Audio Fingerprinting". – Majenko Jun 16 '20 at 9:28
  • This sounds like a job for AI TBH. Waaaaaay outside the scope of an Arduino. Maybe a K210 could do it. – Majenko Jun 16 '20 at 9:29
  • I did initially think that I might need AI. However I though that maybe i could get a basic profile of the key points in the coin landing. It would nowhere be as complex as human speech. So a real cut down version of the kind of pattern matching required could be done by the Arduino? how would one go about matching patterns taken with a reference pattern using LUA? – Jaspal Singh Rathour Jun 16 '20 at 9:43

What you want might be way more complex, than you think, depending on your exact requirements.

The vibration sensor activates with any small vibration. It is not capable of distinguish different sources of the vibrations. The only pattern, that you might be able to look for with it, is a special pattern of multiple activations, as the coin jumps over the surface (depending on the max activation frequency of the sensor). Obviously this error prone.

Using a microphone to record the direct sound can give you more information about what happens. But that can get very complex very fast:

  1. You need to measure the voltage from the microphone (which needs a suitable amplifier) with a sufficient samplerate (at least 2 times as fast as the highest frequency, that you want to measure). A high quality microphone might also need a better ADC (Analog Digital Converter), than the Arduino has build in.

  2. The pattern recognition is another problem. Basically you have 2 ways:

    • You can look at the target sound signal and look for a few special properties of that signal, for which you can test the signal (for example a specific pattern of peaks above a threshold. Then you can test with some if statements for these properties, which is relatively easy. Though this is still very error prone.

    • You can train an AI to recognize the coin sound pattern. Though this is not a job for an Arduino, especially not for the Uno. You should use a special AI board for that. Though this is off topic here.

Which way you want to use depends on your exact requirements. When the recognition with the vibration sensor is sufficient, just use it. But we cannot say, if that is the case, because we don't know the actual pattern, that you want to recognize, nor do we know your exact requirements. You will need to test that yourself.

  • Hi Chris. Thank you very much for pointing me in the right direction. Always good to bounce these ideas. So on 1: Could I use for example CZN-15E (ebay.co.uk/itm/…) for the mic as a starting point or would you recommend something better for the initial proof of concept? 2: will I need something like LM386 Audio Amplifier or can I start with just using the mic? Thanks again!! – Jaspal Singh Rathour Jun 16 '20 at 12:53
  • That is not a microphone, but a sound sensor. It will output the level of sound over analog and change the digital output, when the sound level reaches a theshold. You need a real microphone module, which gives you the pure audio signal amplified to the range 0-5V (or 0 - 3.3V, depending on the board, that you use in the end) – chrisl Jun 16 '20 at 13:01
  • Hi Chris, I have been looking at the MPU6050 (amazon.co.uk/gp/product/B07TKLYBD6/…) and using the scope i can get it to show me movements in xyz planes. I can see a distinct pattern for each type of coin. How can I store this for each type of coin and then use the code to detect? – Jaspal Singh Rathour Jun 19 '20 at 12:51

Not the answer you're looking for? Browse other questions tagged or ask your own question.