Noise Sensor & Companion Device


This project is called DeciSense, it's made up of two parts. One device measures the levels of noise in an environment, while a companion device displays the readings using an OLED screen. The client we had in mind when designing this was parents with children who have sensory issues, although there could be many use cases.
Supplies



The supplies needed for this project are listed below:
Hardware
- Arduino ESP8266 (x2)
- Pin headers for the Arduino's (optional if you want to solder instead)
- Microphone (we used the LM 393 Sounds Detection sensor)
- OLED display
- Wires
Access to Devices
- Computer with Arduino IDE, MQTT explorer, and access to the internet
- 3D printer
Files
- The code - two programs for the two devices
- STL files (for the enclosures)
Misc
- Filament for 3D printing
- A cable that can connect the Arduino's to your computer
The 3D Print


In order to make this project for yourself, firstly, using the STL file attached, 3D print the enclosures. The supports should be removed and they should be sanded down to ensure a good fit before continuing.
Downloads
Construction



The next step is to wire everything up, and put the components inside the enclosures.
Please refer to the wiring diagram attached, and connect all of the cables. Once everything is connected you can put the components into their enclosures.
Ensure the Arduino's are sat in the recessed part of the inside of the enclosures, with the micro USB ports accessible through the rectangular holes in the enclosures. The screen should sit in the recessed part on the outside of the enclosure, there are holes for mounting if required. The microphone should poke through the circular hole in the other enclosure.
Really it all only fits together one way, so this step should be fairly straightforward, but you can refer to the images attached.
Downloads
The Code
Next, you will need to make some small adjustments to the code, and set up MQTT explorer, in order for this to work on your network. Please go through the steps provided.
MQTT
- First ensure you have MQTT installed, head to https://mqtt-explorer.com
- Open MQTT
- Give the connection a name, it could be anything but should be unique
- In the "host" field type "test.mosquitto.org"
- Enabe "Validate certificate"
- Disable "encryption (TLS)"
- Press connect
- Enter your topic ID, it could be anything but should be unique
- That's all for MQTT!
Subscribe Code
Open Arduino IDE and connect your Arduino that's connected to the display. Open the "Subscribe" code attached below. You will need to install the libraries listed below in the "library manager".
Librarys
- ESP8266WiFi.h (Library for to allow the D1 mini to connect to the MQTT throught the WiFi)
- MQTT.h (allows to send data to the MQTT)
- Adafruit_GFX.h (library for the OLED screen, this may change depending on your display)
- Adafruit_SSD1306.h (Library for the OLED screen, this may change depending on your display)
Code
You will now need to make some edits to the code, follow the steps listed below.
- Line 6 - change "StudentResidences" to your wifi network
- Line 7 - you may need to enter your wifi password within the quotation marks
- Line 40 - change "ACameron2" to the topic ID that you entered in MQTT
Now you can send this code to your Arduino.
Publish Code
Next, have Arduino IDE open and connect your Arduino that's connected to the microphone. Open the "Publish" code attached below. You will need to ensure the libraries listed below are instaled in the "library manager".
Librarys
- ESP8266WiFi.h (Library for to allow the D1 mini to connect to the MQTT throught the WiFi)
- MQTT.h (allows to send data to the MQTT)
- conns.h
Code
You will now need to make some edits to the code, follow the steps listed below.
- Line 24 - change "ACameron2" to the topic ID that you entered in MQTT
- Line 51 - change "ACameron2" to the topic ID that you entered in MQTT
You can now send this code to your Arduino.
That's all, your code should be working now.
Optionals
Although the devices should work perfectly fine now, there are a few extra steps that could (optionally) be taken to customise and upgrade these devices, as listed below.
Cosmetic
- Paint - we opted to spray paint the enclosures for an even finish
- Stickers
Enclosures
- We found that the enclosures work well as is, however there are areas that magnets could easily be recessed into the plastic, with simple modifications to the STL files. This would help hold the enclosures together.
Batteries
- There are no internal batteries in our design, however we have intentionally left space inside the enclosures so that a small battery could be installed if required.