Week 8

Input Devices

Introduction:

This week we were tasked with building something that used some sort of sensor.

Workflow

Plan: Experiment with sound sensing in preparation for the final project.

Design

In my final project, I want to build a sound sensor that can track where the general noise is coming from. My plan is to use four MEMS sensors and have some measure of the average amplitude of sound from each direction, and create a sound vector from that.

To begin, I wanted to design a comparative circuit that would compare two MEMS signals. I thought about it for about a minute, and realized any such strictly analog circuit would be wholly useless for my purpose (because of how quickly sound waves change) - but it did give me a personal goal. I want some part of my final project to have a circuit with no digital logic.

As an aside, I looked into analog averager circuits. They aren't that complicated to implement, and could actually give me a useful comparator circuit. Maybe a side project for the future?

This was my initial sketch for a digital 2 sensor comparator. It was heavily inspired by the MEMS circuit example Neil had. I decided against trying this because I wanted a simpler proof of concept before I scaled it up, and due to time constraints. As a result I ended up cutting the same example board from the cba site.

Cutting & Soldering

Using Neil's example circuit, I could jump straight into the circuit design.

Of course, nothing in life comes easy. The first cut didn't go deep enough because the backing was slightly bent. I cut the same thing again, and saw that the traces were not very clean. It definitely was an issue with the bit (which I tried changing), but no dice. However, the traces were clean enough to forge forward.

Soldering was fun and easy. To get the sensor on the board, I had to use the heat gun to warm up solder I had early placed on the pads. It seemed to work well!

Code

I began with the example code, and uploaded that to make sure everything was working correctly. Things uploaded without concern, and I got the audio graph to show up! I then started working on my own augmentations. Because I had just the one sensor, I wanted to buildup the structure of the rest of my code.

I added some averaging logic, and tested it out.

Then added thresholding logic so that I could easily compare two sound sources. I then implemented a way to determine magnitude of the sound signal.

And after testing different thresholds, I got some useful output!

I think a lot of hours will have to go towards figuring out the various threshold amounts. Lot of guess and checking, especially when the four sensors are on my flowerpot.

What I would do differently

  • Nothing really! Just got to do it with 2 sensors, and then four.