fhem status display using Neopixel (WS2812B) LEDs

Introduction
Code and details
Assembly
Fritzing
Construction
Current Consumption
Update


Introduction

This project was inspired by a post in the fhem forum.
It is based on Adafruit neopixel sticks mounted in a picture frame and shining through a printed sheet of paper. The Neopixels are controlled using an Arduino Pro-Mini.


Code and details

Sadly there is little detail given in that thread, and the wiki page has not yet appeared however there is basic code on github and a couple of videos such as this one online.
I could not get the github code to compile in the Arduino IDE, I tried eclipse, as that is what I believe the author used, but with my limited experience with it that also failed.
I decided to modify the code to run with the Arduino version of the light_ws2812 library (the author seems to have used the AVR version).
With a few changes it worked and I was able to control the LEDs on the sticks, both steady and blinking.

As mentioned on my other fhem page, I am coding this on a RaspberryPi using the Arduino IDE. It is obviously slower than a desktop machine but I think the most difficult thing to come to terms with is using a 15 inch monitor - that's the only spare I have at the moment.
A great advantage is that I can leave everything set up in a corner without cluttering up my desk any more than it usually is.

I am adding a piezo buzzer, a 3-tone device I got from Maplin's I think. It has three extra wires in addition to the standard power and ground.
Connecting either the yellow or orange to green modifies the basic tone.

I have added the code for the buzzer whilst waiting for some reed relays to arrive, these are to reduce the load on the Arduino pins.

The relays and associated bits have arrived so time to test both code and circuit - and failure! Not a major problem, simply that the relay pins are too short to make contact with the breadboard conductors.
Sitting on top of a header all worked as hoped.

Next step is to assemble the relay circuits on perfboard, make sure all is working and then think about an fhem module.


Assembly

The perfboard circuit is assembled now - and all working!


Fritzing

Fritzing is a great application for designing circuits on breadboards. Images can be created of finished designs of breadboards, schematics or even PCB layouts.

For this project I had to create the SPST reed relay as only a DPDT relay is included in the install.
I used inkscape on my desktop machine to create the graphics then exported to Fritzing on the RaspberryPi (I haven't attempted to install/load inkscape on the RaspberryPi).

I am running a later version of Fritzing on the RaspberryPi than is available on wheezy and it uses the new parts editor. This requires specific layers in the PCB SVG image and I was getting copper0/copper1 errors. I couldn't find much on these but the answer is fairly simple once you know where to look.
Download the templates file and open the PCBViewGraphic_Template.svg in inkscape then Edit->XML Editor. Somewhere in there you will see the nested copper layers. You just need to copy that style to your own SVG.

If that still doesn't make much sense, open the PCBViewGraphic_Template.svg file in a text editor. The copper layers are plain to see there - if you are feeling adventurous you may even be able to modify your new SVG in the text editor.

Another tip: make sure you save from inkscape as plain SVG!


Basic perfboard and schematic diagrams for the relay board. The built version is a little more compact than this image shows as some components can be assembled vertically...

Reed relay perfboard Reed relay schematic
Reed relay board and schematic

Basic breadboard and schematic diagrams for the Neopixels...

Neopixels breadboard Neopixels schematic
Neopixels breadboard and schematic

Construction

Still to do...
I have a deep picture frame for mounting everything, using the backboard to support all the components so I will need accurate dimensions for marking and drilling holes for the LEDs to shine through.
I thought I would have to measure and draw something up myself in CAD but I found a useful PDF at https://sites.google.com/site/splitbrainsite/documents

Initially I was puzzled as the dimensions given in this file are different to those on the Adafruit site but checking the ones I have they are as per the drawing. I still intend to print off and compare just in case. (Incidentally the holes need to be about 4mm diameter).


Current Consumption

LED Value 1 LED Red 8 LEDs Red 1 LEDs White 8 LEDs White
0 7mA
0x3F 10mA 33mA 16mA 80mA
0x7E 14mA 66mA 27mA 160mA
0xBD 18mA 98mA 38mA 230mA
0xFF 23mA 130mA 50mA 300mA

I did a rough measure of the current consumption of a combination of LEDs as shown above.
This would seem to suggest that a display of 4 sticks or 32 Neopixels may draw up to 1.2A - probably a bit much for a serial cable ;)
I'll have to allow for an additional power cable.


Update

I seem to have been rather sidetracked for much of this year and haven't touched this project for many, many months but I got all the bits out again recently.
(Updated the Pi too - I now have Arduino 1.6.5 IDE on a Pi2).

I'm not sure that I'll ever actually put it all together as originally planned - and the buzzer idea has certainly lost its appeal, however it did all work - and it all kept me busy for a while.
It may end up as just a couple of pixel sticks in a small mounting of some kind to signal errors and warnings.
Finding a suitable small enclosure is part of the problem. These sticks are small!

I've tidied up the module code a bit and added some documentation too - once I remembered, from all that time ago, how it all worked!
It's not perfect but seems to be working OK from the limited testing I have done with it.


I have come to the conclusion that this is not really what I need. It is too limited in requiring a serial connection to fhem.
All a very interesting exercise though and forms the basis of an alternative using wireless communication with panStamps.
See my progress here Neopixels and a bit of Developing which is working but I need to order another panStamp before final assembly.


I've tidied up these pages a bit - I hope I haven't broken too much!




Last updated 11-12-2015
All trademarks referred to in this web site are the properties of their respective owners. Trademarked names appear throughout the content of this site. Trademarks, and their respective owners, are not systematically listed or marked in the text, but nevertheless all trademarks are acknowledged. Any trademarks or names being used are for editorial purposes only, and to the benefit of the trademark owner, with no intention of infringing upon that trademark.

© 2009-2015 fruit
Page design by fruit.

No js mail weblink

Valid HTML 4.0!
Document made with Nvu
Home My work My computers Links page Genealogy pages Bits & pieces