The idea came about when a friend of one of the teammates was experiencing temporary homelessness. After spending a few days trying to navigate the system of shelters and housing programs, he thankfully found a place to stay with a relative. However his account of the troubles and headache he faced and the ineffectiveness of the city’s support infrastructure presented an opportunity to address the problem in a novel way. So after a few days of brainstorming and presenting several possible solutions the BOSS was conceived.
What it does
Counted uses a new low-cost sensor platform entitled Bed Occupancy Sensor Suite (BOSS) to detect whether a bed is occupied or not. Our scaleable network of wireless sensor nodes feeds sensor data to a database that serves homeless shelters, city workers, and individuals that need to find the available beds.
Individuals looking to find available shelter beds can text our service to find open beds in real-time. Shelter administrators and other city workers can use the suite to monitor trend information about shelter usage, and make quick predictions to help them serve their clients.
How we built it
Counted has 5 components:
- A sensor bundle for collecting and transmitting the data needed to determine bed occupancy.
- A collector script to ingest and parse the sensor data and store it.
- A graphite server to store the sensor readings as time series data. This server also provides an administrator console to view sensor metrics over time.
- A Twilio webhook that pulls the graphite server’s data on demand as json to report to a chat service the current occupancy of the shelter.
- A natural language chatbot using API.AI to converse with users.
The sensor bundle was created with a collection of low-cost off-the-shelf sensors and a Texas Instruments MSP-430 board which gathers their data and sends it wirelessly to another MSP-430 board which acts as a hub for a local sensor network, connected to a PC or server via USB.
The data from the hub is consumed by a python script which parses it and sends it to the graphite server via TCP. The graphite server has a dashboard configured for the center which aggregates the data from each bed to show not just current occupancy but trends for occupancy over time. The thresholds for what constitutes an “occupied” bed can be tweaked in this console by a simple alteration of the graph’s settings. The graphite server also has an API which allows external services to grab a single data point for a given point in time or several points over a time range. That data can be pulled as an image, CSV, or JSON.
Challenges we ran into
Our low-cost board provides some fantastic capabilities, but none of us were experienced in programming its firmware. Bit operations, serial input/output, and lower level wireless messaging were all new challenges for our firmware programmer, who also did not have previous experience programming in C. Flashing the firmware was also fraught with issues using the sometimes poorly documented TI development software. Output from the serial port was messy, and required wrangling to be consumable by our Graphite endpoint.
Accomplishments that we're proud of
- Bending the TI device’s firmware to our will
- Leveraging a tool traditionally used for server monitoring (graphite) for a whole new application
- Finding an inexpensive solution to a widespread problem in our city
What we learned
- Graphite has exciting possibilities in the IoT space
- How to make python read serial data
- A bit more about docker
- NASA engineers are insane
- Graphite! A really cool tool for tracking time series data.
- API.ai NLP as a service...
- Twilio SMS Sorry Nexmo : /
- C syntax
- encoding packet data to fit in limited size wireless packets
- some basic electrical engineering principles
- some additional bash scripting techniques
- sensor hardware integration on ultra low-power devices
What's next for Counted
- Developing a field prototype
- Create a more accessible user interface for the graphed data!
- Add voice capability to the chat service.
- Organize a focus group with multiple stakeholders including: homeless men and women, service providers, city government officials to talk about concerns and next steps.