This repo was made to maintain my undergrad project. It is made for personal use but feel free to look around.
This is the code for an arduino knock based kodi controller. It essentially records knocks in an array and compares them to a predefined set of knocks. If recorded knocks match one of the predefined knocks, then the arsuino sends a signal to Kodi to control it. Apart from an Arduino Uno it uses an Ethernet Shield to communicate with Kodi via it JSON-RPC API
The uniqueness of this project lies in the fact that it does not merely count the number of knocks but rather recognises patterns within knocks. So a knock with 3 regularly spaced taps can be differentiated from a knock with 3 taps in some other pattern.
Yeah. To know more about the above mentioned libraries go to the following link:
PiezoListener
ArrayValidate
- Arduino-Uno
- Ethernet Shield
- A Piezo Sensor
- LM358 Dual OpAmp IC
The piezo sensor is connected to a non-inverting terminal of an OpAmp that produces a mild 3.22 gain (1+100/222). This amplified output is then fed to another OpAmp working as a comparator. The voltage drop across the 100K potentiometer connected to the negetive terminal of the comparator acts as a threshold. The comparator outputs a high voltage only when the voltage at the positive terminal of the comparator is higher than the voltage drop across the 100K pot.
This comparator output is read by the Arduino. A successfully detected knock produces a high at the comparator output. The threshold can be adjusted by adjusting the potentiometer.
The resistor values can be adjusted as per gain and threshold requirements.
That looks a little complicated. Why not connect the the piezo directly to the Arduino with a 1M resistor in parallel?
We tried that. Infact that is the most common knock sensor example available on the internet. But there are a few potential problems with that approach:
- It's very inconsistant.
- We could not control the threshold without changing the actual code and uploading it to the arduino.