A place for all things related to ye olde Spark Thermostat Hackathon
Find a file
2014-01-17 09:41:44 -08:00
app added sidetiq to do the background polling to access actual temperature 2014-01-16 19:28:08 -06:00
config root.js tweaks to get the actual and desired.json endpoints rending in graph 2014-01-16 18:51:41 -06:00
db http://localhost:5000/actual_temp_readings.json and http://localhost:5000/actual_temp_readings/last.json working 2014-01-16 18:20:30 -06:00
doc Add MIT license and final readme tweak 2014-01-17 01:09:17 -06:00
firmware Flash read/write works now 2014-01-16 23:23:12 -06:00
lib Add a Rails skeleton 2014-01-16 11:01:38 -06:00
log Add a Rails skeleton 2014-01-16 11:01:38 -06:00
public root#index and root route route added to rails app 2014-01-16 11:11:32 -06:00
script added sidetiq to do the background polling to access actual temperature 2014-01-16 19:28:08 -06:00
spec http://localhost:5000/actual_temp_readings.json and http://localhost:5000/actual_temp_readings/last.json working 2014-01-16 18:20:30 -06:00
test Add a Rails skeleton 2014-01-16 11:01:38 -06:00
vendor added moment.js and flot.js and fixed exported env vars in start_server.sh 2014-01-16 16:53:44 -06:00
.gitignore root#index and root route route added to rails app 2014-01-16 11:11:32 -06:00
.ruby-version added a web_event route for posting changes that Sidekiq background workers will use to hit the core 2014-01-16 12:17:07 -06:00
config.ru Add a Rails skeleton 2014-01-16 11:01:38 -06:00
Gemfile added sidetiq to do the background polling to access actual temperature 2014-01-16 19:28:08 -06:00
Gemfile.lock added sidetiq to do the background polling to access actual temperature 2014-01-16 19:28:08 -06:00
LICENSE.txt Add MIT license and final readme tweak 2014-01-17 01:09:17 -06:00
Procfile added a web_event route for posting changes that Sidekiq background workers will use to hit the core 2014-01-16 12:17:07 -06:00
Rakefile Add a Rails skeleton 2014-01-16 11:01:38 -06:00
README.md Fixed link 2014-01-17 16:59:14 +01:00

Spark Open Source Thermostat

This repo contains all of the software goodies produced in a Spark Team Hackaton described in detail on the Spark Blog.

Hardware

The thermostat display is composed of 3 Adafruit Mini 8x8 LED Matrix boards.

The temperature and humidity are sensed using a Honeywell HIH6131-021-001.

These are all controlled by the Spark Core using a common I2C bus where pin D0 is SDA and pin D1 is SCL. The displays (from left to right) are on I2C addresses 0x70, 0x71, and 0x72.

Firmware

To build firmware for this product, you'll first need to be able to build Spark Core firmware by following the instructions shown here.

Once you have that working, you can simply copy all of the files from /firmware in this repo into core-firmware/src and run make again to build. (i.e. cp thermostat/firmware/* core-firmware/src)

Server Setup

The server components are:

  • a Rails 3.2 app
  • Sidekiq and Redis for background job processing

Development was done on OS X.

Dependencies

  • Ruby 2.0 (recommended to use rvm, rbenv, chruby, or other ruby version manager) (this app is ruby-2.0.0-p247)
  • bundler: gem install bundler
  • Install redis: brew install redis
  • Install foreman: download package from here https://github.com/ddollar/foreman
  • bundle install

Run Locally

In one terminal:

redis-server /usr/local/etc/redis.conf

(following instructions from homebrew install)

In another terminal:

bash script/start_server.sh
  • Note: You might need to change the SPARK_CORE_DEVICE_ID and SPARK_CORE_ACCESS_TOKEN env vars in this .sh file for this to work.

Hit http://localhost:5000 in a browser

Dev tips

You can put binding.pry pretty much anywhere in the code to bring up an interative debuging console. Then hit a brower make or whatever, and in the terminal where the start_server.sh script ran, you can type commands (like a var name) and see their value, etc.

The "SQLite Professional Read-Only" OS X app is a nice free app to look at the data the app is generating in real time.

When developing, it's nice to be able to destroy everything and start fresh when you are hacking:

bash script/bomb_and_rebuild.sh

What's Next?

Get your hack on, :), have fun. If you do something cool with anything in here, consider sharing it on the community site.