Today David Lindberg a fellow graduate student and colleague ask, “I need a better picture of the data you’re receiving from the houses. Can you send me your database schema“? David will be looking at modelling tools and developing a model for the home. I though it might be a good idea to take some time and post what I have experienced and some of my opinions.
- a relay, like on/off, 1/0, yes/no, open/closed, or high/low;
- or, a setpoint, like a scale or discrete value (e.g. the temperature, the light level).
With sensors you can read these values and with actuators you can set these values. When it comes to reading sensors, there are 2 ways that sensors can be read, and this depends on the function of the sensor:
- continuous and periodic set interval, meters and environmental sensors (temperature, light) are typical examples of this;
- or, event triggered, PIR motion and door/window contacts are typical examples.
An example of how you can read sensors and set actuators would be to trigger a furnace to heat a room. You might place a temperature sensor in a room that is connected to micro-controller or MCU (e.g. an Arduino). The MCU would continuous read a discrete value from the temperature sensor, say once every second. The MCU could also be connected to the furnace (the actuator), say via a relay interface. We then program into the MCU the simple command, “when the temperature is under 21°C set the furnace relay to on, and when the temperature is over 21.5°C set the furnace relay to off”. Note: setting the furnace relay to on would turn the furnace on, and 21°C would be considered a setpoint.
Now if you wanted to store sensor data in a database the most basic table you could create that would store any kind of reading would be:
- the sensor name or ID, this is a unique value and a way to identify one sensor from another;
- the date and time of the reading, it is best to store this in UTC or GMT to avoid daylight savings time change issues;
- the periodic value, the amount since the last periodic reading;
- the instantaneous value, what the sensor’s reading is now.
So what is this periodic value, instantaneous value thing? When and how do I use them? Good questions, I am glad you asked! If we look at power meters, the periodic value would be the amount of Wh (watt-hours) used since the last reading and the instantaneous value would be in W (watts) for the current power level. With temperature sensors there would be no periodic value and the instantaneous value would be the current temperature (in °C, °F, or °K).
I may have more to add later…