We’re here to help you

Menu

Light Show Using Dezyne and Hue

This Dezyne example is Martin Keesen’s submission for the Dezyne Challenge 2018.

The application

The goal of this project is to create a Proof of Concept (POC) for Real Estate illumination, generate Python code from Dezyne models and deploy it to Raspberry Pi.

POC:

  • Light show to attract attention

  • Cost effective solution

  • Standalone equipment

Light show examples:

image image image

image image image

image image

Patterns have the following possibilities:

  • Up to MaxLamps lamps

  • Up to MaxSteps steps

  • Each step can set Color of up to MaxLamps lamps

  • Color can be any of the colors possible within Hue system

Architecture

Approach:

  • Separate models for every possible part of the system

  • Interface and component models in separate files

HueDezyne

image

HuDezyneMain

Handles events Start System, Stop System, Heartbeat, Button trigger and all WebUI generated events
Starts and stops RaspBerry, Scheduler, Hue and WebUI
Relays Button trigger from RaspBerry to Scheduler
Relays Heartbeat to RaspBerry and Scheduler
Relays WebUI generated events to Scheduler and WebUI
Note: underscores in name used to make the component shown wider

RaspBerry

Controls LEDs and button on RaspBerry PI.

LED

Controls LEDs on RaspBerry PI, toggles it based on heartbeat, step_indicator.

Button

Polls button to provide trigger for scheduler.

Scheduler

Instruct Hue to send light commands based on selected pattern
Support starting, stepping and stopping of schedule execution

StepTimer

Provides step trigger to Scheduler
Supports longer/shorter trigger intervals

WebUI

Handles content of web pages used to control the system

WebServer

Handles Flask webserver

Hue

Component to control Hue system
Provides IP address from store or from pinging an IP address range
Supports authentication sequence for Hue system

image

HueMain

Instruct HueAddress to obtain IP address of Hue system.
Instruct HueAuthenticate to perform authentication of Hue system.

HueAddress

Obtains IP address (if available) from storage.
When storage contains no IP address scans IP range and pings addresses.

HueAuthenticate

Handles authentication of Hue system.

HueSendLightComand

When Hue system is connected and authenticated sends light commands to the Hue system

Project Setup

Below is the overview of HueDezyne project:

image image image

Dezyne generated code is stored in the Production/dzn directory.

Directory Production/hal contains system support code and the pattern files:

image

Project Results

image

image

image

You can find some videos showing the behaviour of the system as it runs on a Raspberry Pi here:

Lessons learned

Dezyne IDE is a BIG improvement and a nice environment to work in. However, there are a few improvements need to be made to the IDE.

I created over 50 tickets for these, of which 7 are closed during the Challenge.

ToDo List

  • Report current step on web UI

  • Use button to test lamps (as is done now via web UI)

  • Timer, Flask webserver and Dezyne code each on separate thread

  • Ping process on separate thread

  • Replace Heartbeat timer by Dezyne model based SystemTimer

  • Add color to Hue lamps

  • Support patterns of different length

  • Support patterns with different numbers of lamps

  • Apply bool return type once supported for Python

  • Implement Authentication

  • Proper separation of Dezyne generated code and hand-written code

Documentation

You can download the example in a zip-file here.

Note that all of the diagrams included in this document have been produced in and exported from Dezyne. The System View and State Charts are part of the Dezyne editor. The Sequence Trace has been produced using the Dezyne simulation engine.

If you have questions that weren’t by this Guide,
let our support team help you out.

Enjoy this article? Don't forget to share.