Software apps and online services
Hand tools and fabrication machines
In a world where nearly everything can be smart (even toasters, why toasters?), our thermostat sure isn't. Imagine having to get out of bed, walk all the way down the hallway, and hold down the thermostat button for nearly three seconds just to change the temperature by one degree. What is this, the 2010's? We should be able to pull out our phones and adjust the thermostat remotely from wherever we are. That's what our project is about. We used two Particle Argons, a few temperature sensors, and a servo to remotely collect data and control the thermostat of our dorm from anywhere with internet connection.The Setup
The first Argon is connected to a DS18B20 temperature sensor, and a 9g Servo motor. The servo is attached to the thermostat, and when given a command, it rotates the servo horn far enough to press the increase and decrease buttons on the thermostat panel. Additionally, the first Argon publishes the temperature data to the Particle cloud, which is then sent to both the second argon device and ThingSpeak. This allows us to check on the temperature remotely and adjust the thermostat as well. The reason for all the tape is to securely hold the servo against the thermostat panel. One constraint we faced in this project was that the attachment method had to be removable and non-destructive. This meant we could not screw a mount to the wall, or glue a mount to the thermostat. As a result, we used many strips of tape to securely attach the servo to the thermostat.
The second argon device is attached to a wall on the other side of our dorm. Our roommates often complain that the further end of the dorm is warmer, so we were able to see if this was true. The second argon device is connected to a DHT Type 11 temperature and humidity sensor. This data is sent to the Particle cloud and then to ThingSpeak. Additionally, this Argon communicates with the Particle cloud and keeps track of the current time. This allows Argon 2 to instruct Argon 1 to change the temperature at certain times. Currently, there are only two of these routines in the code: One for lowering the temperature at night, and one for raising the temperature in the morning.How it Works
While both Argons communicate with the cloud every 0.5 seconds, they don't publish data this fast. The frequency of data publication is based upon a certain time interval. When that interval is reached, Argon 1 publishes its temperature to Thingspeak. It also publishes its temperature through a separate variable that Argon 2 is subscribed to. Once Argon 2 receives Argon 1's temperature, Argon 2 takes a temperature reading of its own. Argon 2 then publishes its temperature and humidity data, as well as the difference between Argon 1's temperature reading and Argon 2's temperature reading.
Argon 2 keeps track of the current time. Within the code are two set times and corresponding temperatures. When the current time matches one of the set times, the corresponding temperature is published. Argon 1 subscribes to this variable and will change the temperature accordingly. For example, at 8:30 am (0830), Argon 2 publishes "70". Argon 1 subscribes and receives "70", and then changes the thermostat to 70 degrees.
Argon 1 also has several functions that allow the user to make changes without editing the code.
- The first function,
Set Servo Angle, allows the user to change the angle of the servo to a value between 0 and 180. This function is for testing and is not intended to be used for changing the temperature. If successful, the response will be the angle given, and the servo will move. If there is an error, the response will be -1 and the servo will not move.
- The second function,
Change Temp, is the primary method for changing the temperature. When a temperature value is called, Argon 1 evaluates it to see if it is warmer or cooler than the current set temperature. Then, the absolute value of the difference in temperature is found. The servo is changed to a specific angle (depending on whether the temperature is raised or lowered). The servo is held at this angle for a period of time that is computed by multiplying the temperature difference by a time constant (the time it takes for the thermostat to change by 1 degree when the button is pushed and held). If successful, the response will be the temperature given, and the servo will move. If an error occurs, the response will be -1, and the servo will not move.
- The third function,
Calibrate Temp, is responsible for telling Argon 1 what the thermostat is set to. This is useful if the thermostat is changed manually. When a temperature value is called, the Argon updates the variable in its code that keeps track of the thermostat temperature. If this is successful, the response will be the temperature given. If an error occurs, the response will be -1.
- The fourth and fifth functions,
Change Time Interval minsand
Change Time Interval hours, are responsible for adjusting how frequently Argon 1 publishes its data. If these functions are used successfully, the response will be the value given. If an error occurs, the response will be -1.
This flowchart shows the flow of information between the Particle Cloud API and the two Argon devices.
As shown above, Argon 1 does most of the heavy lifting. It shares 6 variables with the Particle cloud that can be viewed (through the Particle app or Particle.io) at any time. It also listens to the cloud for 5 different functions. The second device, Argon 2, only shares 3 variables with the cloud. Additionally, Argon 1 and Argon 2 have bi-directional communications. Argon 1 shares one variable with Argon 2. Argon 2 shares two variables with Argon 1.Pictures
These are pictures of the project and some of its components.
All of the data that is recorded from the temperature and humidity sensors are recorded through live ThingSpeak channels. These channels are listed here:
Temperature 1 Graph (Temperature sensor near thermostat)
Temperature 2 Graph (Temperature sensor away from thermostat)
Difference in Temperature (Difference between the two temperatures. When positive, it is warmer by the thermostat. When negative, it is cooler by the thermostat.)Project Video