Kitchen Appliance Monitor (Doing an Easy Thing the Hard Way) - Particle Argon - Lane Tech PCL

by Mascis Larson in Circuits > Microcontrollers

92 Views, 0 Favorites, 0 Comments

Kitchen Appliance Monitor (Doing an Easy Thing the Hard Way) - Particle Argon - Lane Tech PCL

IMG_3152.png
IMG_3149.png

In my kitchen, there are 3 high-current appliances plugged into a surge protector. If you turn on more than one, it trips the breaker. That controls power to about half my apartment. This one small corner of my kitchen is a ticking time bomb. A reasonable person might move some of those appliances, make sure they aren't all on the same circuit. Instead, I decided to design a system that detects when one is operating and turns on a warning light. You could also make something like this, I suppose, if you are similarly devoted to solving problems the wrong way. Who am I to stop you?

Supplies

  • An Argon
  • One breadboard
  • Two sound pressure sensors
  • One large, one small
  • One DHT11
  • 3 LEDs

Sensor Setup

IMG_3153.png

(There's a lot of things that can go wrong here; Or, at least, a lot of things went wrong for me here.)

Sound Pressure Sensors

  1. Determine the type of sound pressure sensor you need
  2. Large sensors are more sensitive but more directional, while small sensors are less sensitive. I used a large SPS to monitor my kettle and a small SPS to monitor my microwave
  3. Determine the detection threshold
  4. The sensor's values are arbitrary, so you'll have to test to see what number works.
  5. Take into account noise. The values from the sensor will fluctuate even in a silent room, so set your threshold with that in mind
  6. This threshold will change if you swap out the signal wire
  7. That being said, sometimes, for reasons I can't discern, the base range in which the sensor values fluctuate will shift by ~20, so if something stops working suddenly try moving your threshold up/down by 20

Temperature Sensor

  1. Select your sensor
  2. I used a DHT11, but any other DHT should be fine. Any analog temperature sensor, though, will not work with these instructions.
  3. Install the proper library
  4. On an Arduino (and seemingly many Argons), the Adafruit DHT library works fine. However, the Argon I used, for whatever reason, did not work with this library. If you run into an issue with the Adafruit library on Argon, use the library found here. This guide assumes you are using this alternative library.

The Code

Screenshot 2023-11-08 1.01.07 PM.png
Screenshot 2023-11-08 1.01.42 PM.png
Screenshot 2023-11-08 1.02.04 PM.png
Screenshot 2023-11-08 1.04.25 PM.png

There are a lot of global variables here, so I'll walk through them:

  • Any "_Val" variable is used for the input from the corresponding pin (k = kettle, m = microwave, etc.). These pin names refer to the appliance monitored by the attached device. kettle and microwave are connected to sound pressure sensors, while toaster is connected to a DHT11.
  • The "___Active" variables are used to store the current state of the relevant device, according to the relevant sensor.
  • The "_____Threshold" variables are used as the activation thresholds for the LEDs based on sensor input. They don't have to be declared here, but I did so I could easily edit all of them.
  • The "____PassingTime" variables are used to determine if a certain amount of time has passed as a condition in the activation/deactivation of an LED
  • Delay functions are not generally used because:
  • Large delays (sometimes multiple minutes long)
  • Delays will prevent the sound pressure sensors from taking good measurements (since they detect sudden fluctuations)

Additionally, the two pins passed into the creation of the DHT22Gen3 object must be unoccupied.

In setup(), alongside your standard pin mode setting, dht.setup() must be called, and the passing time variable for y. In loop(), dht.loop() must be called.


Within loop(), there are three other functions: kettleRead(), microwaveRead(), and toasterRead(), each of which takes input from a sensor and controls an LED.

  • kettleRead() requires a single sound pressure spike to be detected to activate its LED, which is deactivated on a timer
  • microwaveRead() requires a spike in sound pressure to activate and a second spike at least 2 seconds later to deactivate
  • A delay is used here specifically to prevent taking any input from the sound pressure sensors
  • toasterRead() checks if the temperature has passed 90 degrees F every 3 seconds, and then activates a callback (the use of which example code for the library demonstrates) within which the LED is activated and then deactivated 5 minutes later

Final Wiring

board.png

A5 = Large sound sensor

A4 = Small sound sensor

6 = DHT11 (With A2 and A3 necessary for operation but not connected)

0 = LED 1 (monitoring my kettle with a large sound sensor)

2 = LED 2 (monitoring my microwave with a small sound sensor)

4 = LED 3 (monitoring my toaster with a DHT11 temperature sensor)