Holiday Lights – Getting Started

This post is mainly about setting a lot of things up: the Arduino Yun, the Infineon Shield, LED strips and the Raspberry Pi.

Arduino

Intro

This will be my first time working with the Yun. The thing that prevented me from getting one, was mainly the price: at approximately €70, it is not cheap!
But thanks to this Road Test, I can finally find out what the Yun is all about.

The UNO on the other hand is much more affordable (€30). It does not have the networking capabilities built-in, but is a great starting point for anyone interested in microcontrollers.
I’ve worked with it many times before, but haven’t planned to use it in this project.

IDE

To find out more about the Yun, I headed over to the Arduino website’s “getting started” page. At some point, it is mentioned that a special beta version of the IDE is to be used when working with the Yun.

Screen Shot 2014-12-16 at 20.29.53
Download and installation were straightforward.

OpenWrt

When scrolling further down the page, to the “other software” paragraph, there is another piece of software relevant for the Yun: an updated openWrt image.

Screen Shot 2014-12-16 at 20.32.43
OpenWrt is a linux distribution for embedded devices. If you want to learn more about OpenWrt, go to https://openwrt.org/.

The OpenWrt image for the Yun can be installed in two ways:
using the web interface
using the command line interface (via SSH)

You can find both procedures described in detail here: Arduino – YunSysupgrade

There are two ways to connect to the Yun:

  • connect an ethernet cable to the Yun and have it receive an IP address via DHCP
  • connect to the Yun wifi access point

Screen Shot 2014-12-16 at 21.00.07

Once connected via either way, you should be able to access http://arduino.local/

The following page should appear:

Screen Shot 2014-12-16 at 20.52.45

The password is not mentioned in the procedure. I first tried to log in without entering any password, but that was refused. Next, I tried “arduino” and I was in. Lucky guess I suppose …

Screen Shot 2014-12-17 at 09.29.01

I pressed the big “RESET” button at the bottom of the page and waited for approximately 3 minutes for the upgrade to finish.

Screen Shot 2014-12-17 at 09.30.35

Once the onboard WLAN LED stopped blinking, I tried to connect to the Yun via the wired network. Unfortunately, that wasn’t working, so I connected to the Yun’s access point instead.

On the web interface, it reported the wired network was disconnected. I removed the ethernet cable and plugged it back in. The Yun then reported it was connected to the wired network. Strange …

Screen Shot 2014-12-17 at 09.38.47 Screen Shot 2014-12-17 at 09.39.46

But, the Yun is now ready to go!

Infineon Shield

The infineon Shield comes without headers on the board, and none are included in the box either.
I find that rather strange. Someone buying a product usually expects to be able to use it right away, or at least have all the parts to do so.

On the other hand, this gives you the opportunity to choose your own set of headers: long, short, stackable, …

I went for the extra long stackable headers, which I found online. I wanted to make sure there was enough clearance for the Yun’s vertical USB port.

photo 1 photo 2

After soldering, I checked the shield with both the UNO and the Yun. Clearance was good!

photo 3 photo 4

One thing I missed is that my headers didn’t were not for the correct number of pins, leaving the I2C pins unconnected.
And let that be the two pins required for communication with the Yun. So I came up with a small workaround to fix that.

photo (8)

Anyway, after the hardware, comes the software part.

It seems there is no library from Infineon available for this shield. They have a variety of examples on their website though.
Unfortunately, all example files have a “.exe” extension. Why ?? What about Linux and Mac OSX users? Plain “.ino” files would have sufficed.

Luckily, Peter Oakes came to the rescue with following blog post: BYOB Party #3, Infineon Library Available
He created a library to make our lives easier! Thank you, Peter!

I created a folder called “Infineon” in the libraries folder, and put his library files there. As such:

Screen Shot 2014-12-17 at 16.15.41

After restarting the Arduino IDE, the example was available.

Screen Shot 2014-12-17 at 16.16.57

Lights

I have to LED strips to experiment with:

  • a non-addressable, 12V, 100cm, 60 LEDs strip (analog)
  • an addressable, 5V, 100cm, 60 LEDs strip (digital)

DSCN3155 DSCN3156

The analog strip will be controlled using the Infineon shield. The digital strip will be controlled directly by the Yun, using Adafruit’s NeoPixel library.

I ordered more online, but until then, this will have to do. Experimenting with both strips will allow me to prepare the code until the new strips arrive.

Analog

Connecting the analog LED strip to the Infineon shield was easy.

I stripped off the connector, tinned the wires and plugged them into the socket. On the other side, I did the same with a barrel jack connector.

photo (10)

The barrel jack connector is then attached to a 12V power supply.

Digital

I connected the digital LED strip to the Yun as follows:

Screen Shot 2014-12-17 at 11.28.42

The nice thing about these digital strips, is that they run on 5V, which can be used to power the Yun simultaneously. On top of that, the strip only requires one pin to be controlled!

I’ve prepared some animations for this strip:

  • setting the even LEDs to a color and the odd ones to another and then
  • toggling
  • gradually fill up the LED strip with random colors

Here’s a video of the animations in action:

The functions I created are the following, feel free to use/improve them if you want.

As Jan Cumps already pointed out to me, yes, there is a tiny bug in the last animation where the last LED doesn’t light up. I’ll fix that asap 😉

Function 1

Function 2

Function 3

Function 4

Function 5

Raspberry Pi

Intro

The Raspberry Pi will be responsible to run openHAB, which will be used to:
control the LEDs connected to the Arduino
report sensor data from the Arduino

The Pi will also be in charge of tuning in to an internet radio channel playing exclusively Christmas music.

Raspbian

First thing to do with the Raspberry Pi, is to prepare the SD card which will run the operating system.

1) Identify the SD card

2) Unmount SD card

3) Write image to SD card

4) Unmount SD card

The SD card is now ready and can be inserted in the Raspberry Pi. I connected the Pi to the network using an ethernet cable and powered it on.

After finding out the IP address via my home router, I SSH’ed to the Pi.

There is a clear notice asking to run the raspi-config tool to fully configure the Pi, so I did.

Screen Shot 2014-12-18 at 21.37.00

I used the “raspi-config” tool to:

  • expand the filesystem
  • enable SSH, I2C, SPI and camera (even though not all are needed for this project)
  • change the hostname
  • update the system

openHAB

OK, with the system set up and updated, the next step is to install openHAB.

Step 1: Download the openHAB files:

Step 2: Deploy the openHAB runtime and addons:

Step 3: Make it executable:

To have openHAB start automatically at boot, add following line to “/etc/rc.local”:

MQTT

I activated the MQTT binding by moving it from the “unused” folder to the “addons” folder:

Then, I configured the broker settings in the “openhab.cfg” file:

The other parameters were left untouched.

OpenHAB still requires additional configuration files such as items and sitemaps. I’ll focus on those in my next post.

Conclusion

With all of this already out of the way, I can start diving deeper in the actual configurations and actions of my project.

3 thoughts on “Holiday Lights – Getting Started”

    1. Hey Yves,

      dit zijn voor zover ik kan zien en mij kan herinneren slechts fragmenten code, ter illustratie.

      De variabelen declaratie, setup en loop zijn hier dus niet aanwezig. De Adafruit NeoPixel library bevat complete voorbeelden die je verder zouden moeten helpen.

Leave a Reply

Your email address will not be published. Required fields are marked *