자바와 라즈베리 파이로 만드는 DIY 네스트 / How to Build Your Own $3.2bln Nest Startup Using Java SE Embedded Tech
As we all saw recently, the company that starts with the letter "G" up Highway 101 in Mountain View bought Nest Labs for $3.2 billion (with a "b"), maker of the Internet of Things (IoT) Nest thermostat. Well, here's your chance in this new Java SE Embedded IoT blog series, to learn how to build your own $3.2 billion Nest Startup using a Raspberry Pi, some hobby electronic parts, and Java SE Embedded Technology.
This blog series was inspired by Spark Team's Arduino Based blog post at the spark.io. But, we'll use a more powerful but still inexpensive Raspberry Pi, and we'll base the software on Java SE Embedded which is a much more powerful programming language and platform than you can ever find on the Arduino.
This project will need the following parts:
1 Raspberry Pi $39.95 |
URL) http://www.adafruit.com/products/998?gclid=COKc7pqbk7wCFQWTfgodRRUAAw |
1 TFT 2.8" LCD touchscreen $34.95 |
URL) http://www.adafruit.com/products/1601 |
1 USB mini Wi-Fi adapter $11.95 |
URL) http://www.adafruit.com/products/814 |
1 DC to DC Voltage Step Down Transformer $2.99 |
URL) http://www.miniinthebox.com/ko/dc-3-40v-to-dc-1-5-35v-voltage-step-down-transformer-module_p421830.html |
1 Bridge Rectifier GBU608 $1.47 |
URL) http://www.digikey.com/product-detail/en/GBU608/GBU608-ND/1935038 |
1 Relay Switch Board for RPi $32.99 |
URL) http://www.mcmelectronics.com/product/83-14472&scode=GS401&CAWELAID=1667909763?cagpspn=pla&gclid=CJPO-ufNkrwCFRKBfgodJHkAWA |
1 DS18B20 Digital temperature sensor $4.00 |
URL) http://www.adafruit.com/products/374 |
So, for the low total cost of about $128.30 (plus tax and shipping) you can build your own $3.2 billion IoT startup company. Well... maybe, the start of a $3.2 billion IoT startup company, but you'll have a nifty IoT Java SE Embedded enabled home thermostat in the end, regardless. And, that's just as good as a $3.2 billion IoT startup, right? ;-)
So, let's get started in building your own $3.2 billion (with a "b") Nest Startup using a Raspberry Pi, some hobby electronic parts, and Java SE Embedded Technology. The journey of a $3.2 billion startup begins with a single step-down transformer... er, or something like that.
First, we'll need a crash course in home thermostat technology. Here in the U.S., if you first flip off the circuit breaker to your home heating furnace and A/C, then take off the thermostat panel in your house, you should see these standardized labeled wires (with various colors of wires that are not standardized):
Red - R - 24VAC |
If you see a wire labeled "C" (Common) and the rest of the labeled wires (above), then you are OK. If you do not see the "C" label on a wire, you must ask an electrician friend or hire an electrical contractor to run the common "C" wire from a furnace relay to your thermostat. Otherwise, if you do not have the "C" wire at your thermostat, stop here since the "C" wire is needed to power the Raspberry Pi and especially for the Wi-Fi adapter to have enough power to allow your new SmartThermostat to be networked.
If after one way or another you do have a "C" wire at your thermostat, then you are ready for the first step which is to connect the Bridge Rectifier GBU608 and the DC to DC step-down transformer from your Raspberry Pi to your thermostat wires to power it from the 24VAC of your thermostat wiring (C and either Rh or Rc or R). The Bridge Rectifier turns the 24VAC of your furnace relay from 24 volts of AC power to 33 volts DC power, and the step-down transformer turns the 33 volts DC down to 5 volts DC for the Raspberry Pi (and all its peripherals).
Come back to the next blog post to see how that's done... It's a fun step since it's your first one!
If you are this far along, it means you do have a "C" wire at your thermostat. Yay! That means you can connect the Bridge Rectifier GBU608 and the DC to DC step-down transformer from your thermostat wires to power your Raspberry Pi from the 24VAC of your thermostat wiring. We are using the C wire and either the (Rh or Rc wire) or the R wire to power the RPi, since one of the "R" wires is considered in AC terms "hot" and the "C" wire is considered "neutral".
NOTE: You need a "hot" wire and a "neutral" wire in AC household electrical circuits to complete or close an AC circuit. With most U.S. household thermostats, we are working with a lower 24VAC standard, and not your typical 110VAC found in U.S. homes. If your thermostat happens to be a higher voltage 110VAC thermostat, stop here and do not proceed. Your wiring for a 110VAC thermostat is not the same as the 24VAC we need for this project. If you are unsure whether your thermostat is 24VAC or 110VAC, ask an electrician friend or electrical contractor to check for you.
As a review, the Bridge Rectifier turns the 24VAC of your furnace relay from 24 volts of AC power to 33 volts DC power, and the step-down transformer turns the 33 volts DC down to 5 volts DC for the Raspberry Pi (and all its peripherals).
As with any $3.2 billion startup, you begin with a prototype, and that prototype is typically built using a breadboard, so that you can easily put it together and change it if necessary.
1) So find a hobby electronic breadboard, and add your GBU608 Bridge Rectifier. In this part of the project you will run the inner two wires to connect from the breadboard to your "C" and one of your "R" wires of your thermostat (refer to the pinout diagram above)
2) Use a wire connected to the notched edge pin of your GBU608 which represents the positive terminal to solder to the positive "IN" pad on your DC to DC Voltage Step-Down Transformer, and do the same with your unnotched edge pin of your GBU608 which is the negative connector and solder that to the negative "IN" pad on your DC to DC Voltage Step-Down Transformer.
3) Solder two separate wires to the positive and negative "OUT" pads of your DC to DC Voltage Step-Down transformer
4) Connect the two inner pins (marked with the "~" symbol) of your GBU608 Bridge Rectifier to your thermostat wires as described in Step #1: one inner pin connects to the "C" wire of your thermostat and the other inner pin connects to one of the "R" wires (or better yet for workbench development purposes, connect them to a temporary 24VAC power supply like this one to represent the thermostat power as you develop on your bench first).
5) Use a voltmeter to measure the OUT pads of your DC to DC Voltage Step-Down transformer and adjust the screw of the transformer until your voltmeter reads 5 volts.
Once you have the screw set on your transformer, then your are ready to connect your Raspberry Pi in the next step... Fun!
So, you've now added your Bridge Rectifier and Transformer to your $3.2bln Nest Startup prototype. You just need to connect to power up your Raspberry Pi.
This next step is pretty straight-forward. To make life easy, you should buy a USB A Jack to Wire Lead connector at element14 or Newark Electronics: here. This jack will allow you to plug in a typical micro USB cable to power up your RPi.
After you purchase the USB A Jack to Wire Lead connector (above), see the spec sheet for details on how to hook it up to your Transformer
URL) http://www.l-com.com/multimedia/eng_drawings/ECJ504B-UA.pdf
Then, connect the black wire of your USB A Jack to your Transformer GROUND OUT (-) pad by soldering it together, and connect the red wire to your Transformer POWER OUT (+) pad by soldering those together. That's it!
Plug in one end of a standard micro USB cable to your USB A Jack, and the other end to your Raspberry Pi. Then connect your 24VAC power from your house thermostat wiring to your breadboard Bridge Rectifier as mentioned in Part 3/Step 4 and turn your circuit breaker back on, or use a temporary power source on your workbench as described in the later section of Part 3/Step 4 to test it.
If you reach this point and you haven't fried your Raspberry Pi, then that's a very good thing. If you accidentally see white smoke coming out of your Raspberry Pi board, shout out your favorite expletive and quickly unplug everything. But don't worry, just go back to Part 1 and buy another one. Heck, they're just $35 each! Buy, 2 or 3 more, just in case... ;-) Wouldn't hurt.
When you reach this point, and your RPi powers up correctly with very little or no swearing, do a little dance and get ready for the next step in building your own $3.2bln Nest Startup, which is where you connect up the LCD touchscreen.