Home Environment – Part 2

Components used

Most of my components were found cheap on AliExpress or on Ebay. It’s amazing what you can get for a few dollars, if you are ready to wait for 1-2 month for delivery 🙂

Here are the pictures of my components. I only linked to the search on aliexpress, because their products/copies changes all the time. You should be able to identify them by the pictures:

 

 

 

Diagram

The diagram was made pretty fast using Fritzing. Fritzing has a lot of well known components, but most of mine were missing. I made them very fast by this small trick on Youtube.

 

Splitting things into two microcontrollers

I decided to have two microcontrollers, mainly because the ESP is very time sensitive because it has to handle Wifi. It also has problems with its ADC introducing noise in my readings when the Wifi is transmitting. The ESP only takes care of:

  1. Three I2C devices: light, pressure/temperature and co2/tvoc
  2. Talking to the Arduino Pro Mini I2C slave device to get data from it’s sensors

The Arduino Pro Mini takes care of:

  1. Pir sensor – a simple high/low input. Are people moving or not?
  2. The temperature/humidity sensor via one-wire.
  3. Digital input from the dust sensor. This is has to be timed precisely via interrupts
  4. Microphone analog input. Sampling at 19khz – also pretty timing sensitive.
  5. Working as an I2C slave answering the ESP with collected data
  6. Periodically waking up the master for it to send it’s data

 

Noise

The microphone seems quite sensitive to noise on it’s power supply. When it’s on the same 3.3V supply as the ESP I get noisy readings. I tried decoupling it with a couple of electrolytes and some 100nF capacitors without luck.

The noise issue was fixed by powering the mic from an output pin of the Arduino Mini. Also by sleeping the ESP most of the time, I don’t see this problem anymore

 

Breadboard

Here is my test setup on a breadboard:

 

Next

In part 3 I will talk a little about the Aduino code.

Leave a Reply

Your email address will not be published.