#idea Thermostat - Final

Simplify IoT Development.

Moderators: jiankai.li, yexiaobo

#idea Thermostat - Final

by philip.mallon » Sun Apr 17, 2016 5:25 pm

This posting is the conclusion of my initial discoveries of the Wio Link Computer since it arrived 4 days ago. Here is an update on the Thermostat project where I use every Grove module - all six and every API method - both polling with POST and GET and event API with websockets. While it is not a true thermostat it does switch off the fan if the temperature is above a set point so it is only an open loop controller. This project is still a proof of concept and can be simplified - its true purpose is to discover the capability of Wio Link.

The set point is set by the rotary encoder and push button while the display toggles between a display of temperature and humidity (TT:HH) and temperature and set point temperature (TTSS). I am also using the Grove BMP085 Barometer module to measure altitude, pressure and temperature and a Grove Temperature ad humidity module to measure temperature and humidity. Everything is tracked with a node-red user interface modules and the results are displayed on any Chrome web browser so you can see all the variables graphed on gauges and charts there. The user interface is from the node-red library.

I am also using a state variable 'tempSP' for temperature Set Point and this is a node-red global variable that is accesible to all tabs of the node-red canvas. I need to add some hysteresis on the temperature control - easily fixed. When the set point temperature is reached both a 220V wifi power switch for the fan and a local LED on a Grove LED module come on. To save power WioLink is put to sleep every 30 secs. The push button uses event programming so events are not lost when you press the button. After you press the button the display - using a Grove 4 Digital Digit module uses both the measured and set point temperatures. This project demonstrates every API technique and interface - analog, digital, serial and I2C interfaces are used.

The node-red program is on a Beaglebones Green (BBG) computer using a Debian OS. The BBG also has a Grove cape which can expand on the IO if necessary or it can handle extra Wio Link computers on the same node-red flow or on different tabs on the canvas.

So how would you turn this into a real thermostat? Just add a pid controller - there is already one already for node-red. You also need a controllable variable such as air conditioners power to adjust temperature rather than using bang-bang and open loop control. This is another project and I will be using an infra red blaster interface that allows me to control an air conditioner directly. The future project will have 1) control multiple rooms using a single controller but multiple sensing points - one for each room so many air conditioners in the house can be controlled (simple scaling), 2) PIR sensing so that energy will be saved if no one is in a room (I have done this already on a separate WioLink Computer)and 3) measure the cost of electrical power consumption (I am already doing this with a python script - just need to interface it.

So how did the Wio Link computer and platform perform? Very well and the cloud APIs did the job. I enjoyed using the Android app and the only problem was the app failed when I have multiple instances on the phone, table and also on a iPad - only one instance is allowed. Everything was easily achieved with node-red programming including a couple of extra simple javascript nodes and a single state variable. I enjoyed doing this project.
Attachments
DSC_0540.JPG
The WioLink and Grove modules on Lego. All six Grove modules are used
DSC_0540.JPG (73.5 KiB) Viewed 1534 times
Flow1.jpeg
The overall flow for the Thermostat in node-red
Flow1.jpeg (270.43 KiB) Viewed 1534 times
Flow2.jpeg
The top part of this flow show the websocket processing for push button event. The rest is for getting the temperature and processing it for both digital and ui display and determining if the fan should be switch on
Flow2.jpeg (130.5 KiB) Viewed 1534 times
Flow3.jpeg
Here the processing of the rotary encoder allows capturing the temperature set point. Also getting the humidity measurement and part control for the 4 digit digital display with ":' separate between measured and set point temperatures.
Flow3.jpeg (196.03 KiB) Viewed 1534 times
Flow4.jpeg
Here the Grove BMP805 Baromater measurements are processed and delivered to the user interface
Flow4.jpeg (141.51 KiB) Viewed 1534 times
Flow5.jpeg
This part of the node-red flow allows you to control the S20 220V wifi power switch for the fan
Flow5.jpeg (81.51 KiB) Viewed 1534 times
State Variable as a global Set Point.jpeg
This node-red dialog allow you to access the global variable, tempSP (Set Point Temperature)
State Variable as a global Set Point.jpeg (32.69 KiB) Viewed 1534 times
UI.jpeg
The user interface on a chrome browser allowing you to track measurements from Grove modules
UI.jpeg (67.04 KiB) Viewed 1534 times
Pre-kindergarten
Pre-kindergarten
 
Posts: 34
Joined: Fri Oct 31, 2014 12:32 pm

Re: #idea Thermostat - Final

by kchios2000 » Mon Jul 04, 2016 5:40 pm

I have 2 questions:

As am a beginner with node-red in order to get the temperature from wio link and send it to Thingspeak I will do the following:

1.Add to the flow an HTTP request with get and url the one from Wio Link (https://iot.seeed.cc/v1/node....)
2.connect a json node
3.Connect a Function node (do I have to put code in there and if yes, what should I put?)
4.Connect a debug node with msg.payload AND an HTTP request with POST and https://api.thingspeak.com/update?api_key= (with the write key of my channel, having added temperature and humidity and some other fields)

It doesn't get data because I miss something,can you help me please?

2nd question: You mention and show a picture of the UI in chrome.To what are you referring to?
Pre-kindergarten
Pre-kindergarten
 
Posts: 4
Joined: Thu Apr 21, 2016 6:32 pm


Who is online
Users browsing this forum: No registered users and 1 guest