I made this project for the Lane Tech Physical Computing Class. This is a project to turn a fan on and off using either the Blynk app or the surrounding temperature.DHT22:
The first thing I did was hook up the DHT22 temperature sensor. I connected pin 1 on the DHT to 3v power on the photon. Pin 2 connects to D2 and a 10kOhm resistor connects to power. Pin 3 connects to nothing, and Pin 4 connects to ground.
I then connected the MPL115A2 pressure sensor. The VDD pin on the MPL connects to 3v. GND connects to ground, SCL connects to A5, and SDA connects to A4.
Next, I connected the Relay. Connect IN to D6, VIN on the Photon to VCC on the relay, and GND to GND.
Finally, I connected the fan to the relay, putting one wire into COM and the other into NO (Normally Open). This is so when I activate the relay the fan will turn on.Blynk:
To control the relay with the Blynk app, I first had to connect my Blynk account to my photon account (Tutorials can be found here: http://docs.blynk.cc/). I then placed a button widget and connected it to Virtual Pin 0, and changed the mode to "Switch". I placed 3 displays, connected to Virtual pins 1, 2, and 3, to display the Pressure, Temperature, and Humidity, respectively.Difficulties
- The Particle Photon environment didn't have the library for the MPL115A2 pressure sensor, so I had to figure out how to put them in.
- The relay wouldn't turn on and off when I would use digitalWrite, so instead I used pinMode to activate and deactivate the pin.