Nock Me In: Building an Intelligent Signal Device With a Budget-Friendly Vibration Sensor - Part 1
by RakaAmburo in Circuits > Arduino
316 Views, 3 Favorites, 0 Comments
Nock Me In: Building an Intelligent Signal Device With a Budget-Friendly Vibration Sensor - Part 1
Hi there, on this occasion, as the title explains, we will be creating an intelligent device that captures a sequence of hits or nocks against a surface and then sends it to a desired destination to be processed. In this first part, we will be dealing with the general concept, main details, sketches, connections, and specifics.
Supplies
For the project, we will require, of course, a piezoelectric Vibration Sensor Module which, by the way, has high sensitivity. And it is super cheap!. An Arduino board could be a nano or other as well, I think the sensor will work in many modules. A board with wifi capabilities like esp8266 or esp32. And finally some cables.
Diagram
We have a simple layout for this project:
- The sensor will be attached to the Arduino.
- The Arduino board will do the first detecting and processing of the vibration signal.
- The Arduino will be connected to the esp8266/esp32
- The esp8266/esp32 will be sending the UDP signal through the wifi connection
Why the Use of an Extra Board!
So, you may ask, why the extra board? Why don't we have just the esp8266 or an esp32? Well, the reality is that that was my first idea as well. However, it turns out that the extensive use of the analog pin infrastructure with the sensor interferes with the wifi communication. So basically the wifi is disabled during the readings. This as I tried to investigate is because the Wifi system uses the same resource as the analog system. So from that point, I had several paths to follow: try to use the digital output for the sensor, change the rate at which the analog pin is checked, and try to tune the configuration for the Wifi to see if it can be activated after the signal is captured and some others. To be honest I did not follow all of them! I made some effort to see if I could keep my first idea. But in the end, that did not work, so it was easier to add an extra board. And since we already had a tutorial connecting an Arduino and a NodeMCU there was no extra difficulty.
The Concept
So the overall idea is to collect the signal once is detected in the Arduino, and send this signal through the ESP board to a main system that can process that signal, interpret it, and act based on what that signal represents. For example, you can have different signals to activate a variety of gadgets. You can turn lights on and off, unlock doors, activate some kind of gear to close windows, or do something a little bit complex like send some kind of emergency signal in situations where you can not make a loud noise. Bear in mind that the sensor is capable of registering low-intensity vibrations as you can see in the demo video. To be able to do this and handle many scenarios with the signaling that the sensor and the Arduino produce, we will have to quantize the signal, which means, mapping the analog signal into 3-state values based on the range of each signal. This will be clarified in the code. We will do this to map certain signal sequences into actions.
The Arduino Sketch
We read the sensor and check if it is a real signal in a period. Then we store the time between signals. If the time between signals exceeds a certain amount and the message contains some signals, that means the signal has been completed and we send it to the other board. Check out the code!
The Esp8266/esp32 Sketch
In this board, we just wait until a message from Arduino comes and simply send it through UDP to its destination. You can check out the code in our GitHub repository!
Bare in mind you can use your own implementation here in order to send an HTTP message instead. In fact, in future updates, I will be doing that I think.
Connections
As you can see the connections are super simple. The boards are connected to each other through D3, D4, and ground as we did in this previous tutorial. The sensor is connected to A0, 5v, and ground.
What Is Next
So in the next tutorial, I will show you how I will put everything together into a board that will contain the boards and the sensor. This board will be easily attached to many surfaces so we can put it to work. Have a good one!