weekly report: january 4 - january 11, 2018blizzard.cs.uwaterloo.ca/iss4e/wp-content/uploads/... ·...

4
Weekly report: January 4 - January 11, 2018 Yerbol Aussat January 11, 2018 1 Summary of the work done in the last term 1.1 Controlling Philip Hue Bulbs In the last term I learned how to control light intensity, color and saturation of the Philips Hue bulbs. Hue bulbs are controlled by Node-RED using the node- red-contrib-hueplus plugin. The plugin allows to add Philips Hue bulb blocks to a Node-RED flow. After configuring the Philip-Hue blocks and connecting to the bridge, Philips Hue bulbs can be controlled both individually and in groups . In addition, I found and tested Philips Hue python library that allows to conveniently control Philips Hue bulbs with Python script. Attached is the reference to the library. 1.2 Controlling DC LED Bulbs Onion Omega 2 is used for controlling DC LED ceiling light fixtures. I learned how to control light intensities of the ceiling fixtures by generating PWM signals on the Onions PWM expansion. Onion Omega 2 communicates with the Raspberry Pi controller using TCP/IP connection through WiFi. Python server is run on Onion Omega 2, and TCP client is run on the Node-RED (Raspberry Pi). Client sends a message with a bulb id and desired PWM value, and server adjusts PWM accordingly. Omega Onion 2 is able to automatically start the server right after it finishes booting. 1.3 Light Level and Motion sensing I learned how to get light level and motion measurements on the Node-RED run on Raspberry Pi. For light level measurements TSL-2561 digital luminosity sensor is used. It contains both infrared and full spectrum diodes, meaning that infrared, full- spectrum or human-visible light can be measured separately. The sensor has a digital (i2c) interface, and there is an existing Node-RED plugin for this sensor specifically. Therefore, it was straightforward to wire the sensor and use it with Node-RED. 1

Upload: others

Post on 07-Jul-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Weekly report: January 4 - January 11, 2018blizzard.cs.uwaterloo.ca/iss4e/wp-content/uploads/... · Onion Omega and Node-Red run on the Raspberry Pi. I was able to successfully connect

Weekly report: January 4 - January 11, 2018

Yerbol Aussat

January 11, 2018

1 Summary of the work done in the last term

1.1 Controlling Philip Hue Bulbs

In the last term I learned how to control light intensity, color and saturation ofthe Philips Hue bulbs. Hue bulbs are controlled by Node-RED using the node-red-contrib-hueplus plugin. The plugin allows to add Philips Hue bulb blocks toa Node-RED flow. After configuring the Philip-Hue blocks and connecting tothe bridge, Philips Hue bulbs can be controlled both individually and in groups.

In addition, I found and tested Philips Hue python library that allows toconveniently control Philips Hue bulbs with Python script. Attached is thereference to the library.

1.2 Controlling DC LED Bulbs

Onion Omega 2 is used for controlling DC LED ceiling light fixtures. I learnedhow to control light intensities of the ceiling fixtures by generating PWM signalson the Onions PWM expansion.

Onion Omega 2 communicates with the Raspberry Pi controller using TCP/IPconnection through WiFi. Python server is run on Onion Omega 2, and TCPclient is run on the Node-RED (Raspberry Pi). Client sends a message with abulb id and desired PWM value, and server adjusts PWM accordingly. OmegaOnion 2 is able to automatically start the server right after it finishes booting.

1.3 Light Level and Motion sensing

I learned how to get light level and motion measurements on the Node-REDrun on Raspberry Pi.

For light level measurements TSL-2561 digital luminosity sensor is used. Itcontains both infrared and full spectrum diodes, meaning that infrared, full-spectrum or human-visible light can be measured separately. The sensor has adigital (i2c) interface, and there is an existing Node-RED plugin for this sensorspecifically. Therefore, it was straightforward to wire the sensor and use it withNode-RED.

1

Page 2: Weekly report: January 4 - January 11, 2018blizzard.cs.uwaterloo.ca/iss4e/wp-content/uploads/... · Onion Omega and Node-Red run on the Raspberry Pi. I was able to successfully connect

For measuring occupancy AMN-22111 sensors are used. Unlike AMN-23111sensors used in SPOT systems that have a sensing distance of 5 meters, thesesensors have a sensing distance of 2 meters, which is more suitable for ourapplication. Since AMN-22111 has analog output, the signal was converted todigital with MCP3008 A/D converter. The MCP3008 connects to the RaspberryPi using a SPI serial connection. Software SPI is used to talk to the MCP3008.

AMN-22111 sensor proved to be practically reliable for occupancy sensing.Once the sensor detects motion the value of its output changes significantly. Oc-cupancy is determined by finding the standard deviation of every 10 consecutivemeasurements and setting up a treshold for ”occupied” state.

1.4 A simple binary control of Hue bulbs based on occu-pancy and light level in the room

After learning how to control the bulbs as well as to sense light levels andoccupancy, a simple system light control system was built. The controller onRaspberry Pi turns off the Hue bulbs if station is not occupied. If the stationis occupied, the controller turns on the light, only in case if the illuminationin the room is low. For this test a light level threshold for when the controllershould turn on the light was hard-coded. The breadboard of system is shownin Figure 1, and the corresponding Node-RED flow is shown on Figure 2. Afterconducting a set of experiments, it was confirmed that the system is robust anworks reliably.

Figure 1: Experimental setup: breadboard and sensors

2

Page 3: Weekly report: January 4 - January 11, 2018blizzard.cs.uwaterloo.ca/iss4e/wp-content/uploads/... · Onion Omega and Node-Red run on the Raspberry Pi. I was able to successfully connect

Figure 2: Node RED flow: Binary light control using PIR and light sensors

2 Activities

It is important that the lighting system can support several stations, i.e. thecases when there are several stations on an office. We want the system to bemodular and, therefore, all sensing for each station happens at a separate ”perstation” microcomputer. The diagram for this idea is shown on Figure 3.

This week I worked on using a separate Onion Omega 2 for sensing light levelsand occupancy for each station, and on establishing communication betweenOnion Omega and Node-Red run on the Raspberry Pi.

I was able to successfully connect the TSL-2561 light sensor with OnionOmega using a digital (i2c) interface. Then light level measurements were ob-tained by running a Python script on the Onion Omega. The Python TCPserver was set on the Onion Omega and TCP client was set on the RaspberryPi (Node-RED).

I ran into the issues while trying to connect AMN-22111 with the OnionOmega. Onion Omega doesn’t have any analogue inputs, and I am still tryingto figure out how to use the MCP3008 analogue-to-digital converter wih OmegaOnion via SPI.

3 Next

• Occupancy sensing from Onion Omega

3

Page 4: Weekly report: January 4 - January 11, 2018blizzard.cs.uwaterloo.ca/iss4e/wp-content/uploads/... · Onion Omega and Node-Red run on the Raspberry Pi. I was able to successfully connect

Figure 3: Smart Lighting System Diagram

• Integrate a ”per-desk” Onion Omega sensing module (Figure 3) into thebinary light control system

• Control intensity of Philip Hue bulbs precisely (not just a binary control)based on the level of illumination in the room

4