Smart Facilities Wiki¶¶
Overview¶¶
This project is geared toward improving technologies in high-density housing to enhance convenience for residents in apartment buildings. Our idea is to allow residents to see the status of the various facilities in or around the apartment building, such as laundry room, rec room, pool, or exercise room. To narrow the scope of the project, we focused on helping to inform the residents of the status of shared laundry facilitieswhich are often on the ground floorto save people unnecessary trips back and forth to determine if the washers or dryers are available. Our goal was to create a prototype of a system that could be integrated into a dryer and demonstrate sending signals forIn UseorAvailable,depending on the status of the machine.
High Level Design¶¶
The system determines the status of the machine by detecting if it has stopped and if the door has subsequently been opened and then closed, indicating that someone has removed their laundry. The status is then sent to an LCD display and to a webpage accessed through an iPhone app, which shows the status of the dryer (Fig. 1).
We made some assumptions about how a dryer is used to determine the two states,in useoravailable.A dryer is consideredin useif the accelerometer has indicated motion of the machine, and the user has not yet taken their laundry out. If the dryer has stopped and the door has been opened and then closed, and the dryer stays off for a minute, then we consider the dryer to be available. The extra time allotted allows for someone to check their laundry and add more quarters to turn the machine back on, in case the laundry is not yet dry. This is to reduce the possibility of sending a false signal ofavailableif someone is still using the dryer.
While visual monitoring could be helpful, we argue that many residents would find it intrusive to have their neighbors remotely watching them load and unload their laundry. And while a weight sensor could indicate if any laundry is left in the dryer, this kind of mechanical retrofit is beyond what we could practically do for our project, and may not be sensitive enough for small loads.
Though our solution may not offer complete information, it is a step in the direction of thesmart facilitythat knows its own status and can relay that information to interested people.
Figure 1 - Smart Facilities system diagram
Hardware Design¶¶
The Smart Facilities system determines if a dryer is consideredin usebased on two sensors: an accelerometer that indicates if the machine is on, and a door switch that indicates if the door is open or closed.
The accelerometer is a Freescale MMA7361 three-axis accelerometer When we tested the system on a dryer we found that one axis was dominant in terms of detecting vibration, so using just that axis was sufficient for our project. (See Results section.)
We ran the accelerometer output through a voltage follower to keep the ADC load from affecting the output voltage by using a Microchip MCP6024 Op Amp. We then used a simple voltage divider to get the final output voltage into the range that wouldnt saturate the XBee ADC. The schematic is shown below.
Figure 2 - Accelerometer and Op-Amp Schematic
We built this circuit on a prototype board, as shown below.
The door detector is a reed switch, which is a switch operated by an applied magnetic field. When the switch is closed, a high voltage passes through and when the magnet is pulled away by the door being opened, the switch opens and no signal passes through. This is attached to the XBee, with an internal pull-down resistor so the signal is pulled low when the door is opened.
Figure 3 - Sensor circuit attached to XBee Wi-Fi module
These two sensor inputs are connected to an XBee Wi-Fi module that samples and sends the data wirelessly to another XBee Wi-Fi connected to an Energy Micro EFM32 board through a Serial Peripheral Interface (SPI) bus.
Figure 4 - The entire system used for the Smart Facilities project
New samples are transmitted when the door switch changes and periodically from the accelerometer voltage. The Energy Micro board then performs the logic, described in the Software Design section, to determine whether the dryer status isIn UseorAvailable.
Software Design¶¶
The software consists of two main systems: the onboard logic for the micro-controller and an iPhone app with its software for updating a webpage.
Onboard logic¶¶
The ultimate objective of the software is to detect two states,in useoravailable, then change the LCD display and update the webpage. The state diagram is shown below.
Figure 5 - State diagram
The onboard logic for the Energy Micro controller determines the state of the dryer from the door switch and accelerometer data received by the XBee Wi-Fi attached to it via the SPI bus. The XBee will interrupt the EFM32 when a new packet is received from the data-sampling XBee. The EFM32 then processes the received door-switch and accelerometer data.
Whenever the door opens or closes, a timer is set which fires an interrupt after one minute. If someone opens or closes the door, we assume the loading or unloading of the dryer takes less than one minute. The interrupt service routine (ISR) will then perform the following, given in pseudo-code:
if door is still open
dryer_free = false
restart minute timer to come back to ISR later
else
if dryer is on
dryer_free = false
else
dryer_free = true
This is the only way for the dryer status to become free. There is one other way dryer_free can be set to false. This is done when new accelerometer data is received. If the dryer is determined to be on when new samples are received, dryer_free will be set to false.
The way the dryer is determined to be on is by counting the number of consecutive time periods the accelerometer datas variance is high. More specifically, the accelerometer samples are held in a 64-sample buffer, holding the most recent 64 samples. Every 64 samples, the difference between the max and min values in the buffer is compared to a threshold. If the difference is greater than the threshold, the dryer was on for that buffer period. At a sampling rate of 32 ms, this buffer period is about 2 seconds. But dryer movement could be caused by any number of events and so we need to eliminate false positives. This is done by counting the number of consecutive buffer-periods the dryer was on. If the max-min difference is greater than the threshold over 10 consecutive buffer periods, or about 20 seconds, then the dryer is considered to be on and, therefore, in use.
Whenever a change to the dryer_status variable is made, a corresponding change to the message displayed on the LCD screen is also made. This allows the user to quickly determine the status of the dryer remotely.
iPhone App¶¶
While the LCD display on the Energy Micro board is sufficient for demonstrating the prototype, we decided to take the system one step further by developing an iPhone app that could inform residents about the status of the facilities. To accomplish this, we first needed to update a webpage based on the status determined by the Energy Micro board.
Whenever the dryer_free variable is written, the microcontroller also commands its XBee Wi-Fi module to send a packet to a server located at a specific IP address. The packet contains a string which says the status of the dryer (i.e.freeordryer in use). A python script was written to listen for these packets from the XBee module. It resides on the server and listens to the port the XBee will send the packets to. Whenever a new string is received from the XBee, it then writes that string to a text file which is accessible via that servers public web server.
The iPhone app brings up a menu of four buttons representing four facilities one might find in an apartment complex. For our purposes, only the Laundry Room button is operational, but we show the interface this way to simulate how it might function if the apartment complex had an integrated smart facilities system.
Figure 6 - iPhone main menu display for choosing a facility
When the user taps theLaundry Roombutton, the application accesses a specific URL that has a text file with the information about one dryer. For our demonstration, we just update the status of Dryer 1.The application parses the string and changes the status text field, along with the color of the text, depending on if the string isdryer in useorfree.In the event the data is not available, the text field is set toUnknownin black letters. The back button (arrow in the upper left) returns the user to the main menu, where they could potentially access information about the other facilities.
Figure 7 - Status screen for the laundry facility
Results of the Design¶¶
The overall design of the system works as desired. One of the main concerns initially was whether the vibration of the dryer would be sufficient to generate large enough signals from the accelerometer. However, during our test we found that just one axis was enough for us to get the signal we needed for processing, as shown below.
Figure 8 - Result of placing the accelerometer circuit on a dryer and graphing it in Excel
It was also important to get the logic right, to best account for user behavior. We opted to indicate a status offreeonly after the door had been opened and closed and the machine had remained off for a minute. On testing different paths from thein usestate to thefreestate, we felt this was the most natural for how typical residents would use the dryers.
In the end, our system performed quite well. We could apply vibration to the accelerometer, stop the vibration, and open then close the switch -- and throughout the process, both the LCD screen on the Energy Micro board and the iPhone app would indicate the correct status. This demonstrated that we designed a working prototype that could conceivably be developed into a functional device.
Conclusions¶¶
Our vision is that all facilities in apartment complexes should be able to communicate their statuses to residents. With the proper sensors installed and everything integrated into a centralized system, that should be possible. We have already demonstrated the proof-of-concept for a laundry facility, by keeping track of and transmitting the status of a dryer. Similar functionality could be implemented in other facilities.
For example, the pool could have a thermometer that transmits its readings to the system. The exercise room could have pressure sensors on the bike machine seats and accelerometers on the treadmills to indicate if those devices are in use. And the rec room could use a form of device-free localization to determine approximately how many people are in the room (though this technology is still under development here at the University of Utah SPAN Lab and elsewhere).
Of course, creating smart facilities would be more straightforward with smart devices designed to send signals indicating their status. Our prototype depended on retrofitting a dryer with sensors connected to an XBee that relays the sensor information. Ideally, the manufacturer would design the machine to indicate if there are still clothes in the dryer, and send a signal that could be used by an integrated system at an apartment complex. And if manufacturers of other kinds of equipment included a system similar to ours in their machines, then smart facilities would soon be a reality, and apartment living would be more convenient.
Media¶¶
Below is our video that tells the story of the inspiration for the Smart Facilities system, how it was put together, and the final result.
References¶¶
Freescale Three Axis Accelerometer
http://www.sparkfun.com/datasheets/Components/General/MMA7361L.pdf
Microchip MCP6024 Op-Amp
http://ww1.microchip.com/downloads/en/devicedoc/21685d.pdf
ECE/CS 5780/6780 Lab 7: Data Converters
http://wiesel.ece.utah.edu/~schmid/teaching/ece5780/ece5780-s12-lab/lab7/
Cortex-M3 Reference Manual
http://cdn.energymicro.com/dl/devices/pdf/d0002_efm32_cortex-m3_reference_manual.pdf
EFM32G890 Data Sheet
http://cdn.energymicro.com/dl/devices/pdf/d0010_efm32g890_datasheet.pdf
XBee Wi-Fi Development Kit
http://ftp1.digi.com/support/documentation/90002133_a.pdf
XBee Wi-Fi RF Module
http://ftp1.digi.com/support/documentation/90002124_D.pdf