element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Pi IoT
  • Challenges & Projects
  • Design Challenges
  • Pi IoT
  • More
  • Cancel
Pi IoT
Blog [Pi IoT] Alarm Clock #08: IoT Tower Light
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: fvan
  • Date Created: 2 Jul 2016 8:24 AM Date Created
  • Views 1229 views
  • Likes 5 likes
  • Comments 2 comments
  • fvan_piiot
  • piiot
  • iot
Related
Recommended

[Pi IoT] Alarm Clock #08: IoT Tower Light

fvan
fvan
2 Jul 2016

  • IoT Tower Light
  • Modification
  • OpenHAB

 

The IoT Tower Light is a small project I created not so long ago, to be used as a notification system. One of the aims of this challenge, was to incorporate its control in OpenHAB.

 

IoT Tower Light

 

The project is basically a light in which I've replaced the internal circuitry by a Particle Photon and a NeoPixel Ring. Using IFTTT, different animations can be triggered using a smartphone and an internet connection.

 

A dedicated blog post exists on my website, containing wiring and code: Internet of Things Tower Light – Frederick Vandenbosch

 

Here's a build video of the original project, with a demo at the end:

 

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

Modification

 

Because the light currently uses the IFTTT service, it requires an active internet connection. This may not always be the case though, so in order to ensure local control without internet, a new mechanism needs to be added.

 

The protocol of choice for most in this challenge has been MQTT, and it won't be different for this project. I modified the Photon's code to add support for MQTT. This means the Photon will now listen to events from both IFTTT and MQTT, ensuring backwards compatibility with the DO Button app.

 

image

 

The new, extended code looks like this:

 

 

OpenHAB

 

The integration in OpenHAB is rather straightforward.

 

First, a new numeric item is defined, linked to the MQTT binding. It is configured such that the value of any command received on this item is published to the MQTT broker:

 

Number TowerLight <light> {mqtt=">[piiot:TowerLight:command:*:${command}]"}

 

Next, the item is added to the sitemap. Note that it is using the "switch" definition. The possible numeric values are linked to labels, to have meaningful buttons in the GUI:

 

Switch item=TowerLight label="TowerLight" mappings=[0="Off", 1="Siren", 2="Pulse", 3="Blink"]

 

This results in four buttons, each with a different label, linked to a command. When clicked, the command is passed to the item, which in turn triggers the linked MQTT binding.

 

2016-07-02 09:54:11.981 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'TowerLight' received command 1
2016-07-02 09:54:12.006 [INFO ] [marthome.event.ItemStateChangedEvent] - TowerLight changed from 0 to 1
2016-07-02 09:54:14.747 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'TowerLight' received command 2
2016-07-02 09:54:14.771 [INFO ] [marthome.event.ItemStateChangedEvent] - TowerLight changed from 1 to 2
2016-07-02 09:54:18.975 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'TowerLight' received command 3
2016-07-02 09:54:19.004 [INFO ] [marthome.event.ItemStateChangedEvent] - TowerLight changed from 2 to 3
2016-07-02 09:54:23.115 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'TowerLight' received command 0
2016-07-02 09:54:23.138 [INFO ] [marthome.event.ItemStateChangedEvent] - TowerLight changed from 3 to 0

 

In the GUI, the buttons are visualised like this:

image

 

Because the MQTT broker is on the local network, as opposed to the IFTTT service on the internet, the responsiveness has improved greatly.

 

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

That integration went smoothly, on to the next part!

 


image

 


Navigate to the next or previous post using the arrows.

image
  • Sign in to reply
  • DAB
    DAB over 9 years ago

    Nice post.

     

    I really like the video on the disassembly and modification to the lamp.

     

    DAB

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • mcb1
    mcb1 over 9 years ago

    It's coming together nicely.

     

    Might have to look at using this technology for an alarm indicator.

     

    Cheers

    Mark

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube