Skip navigation
2014

My DIY Oscilloscope, how i got my signal

 

Content :

- Description

- Screenshots

- Video

- Credits and links

 

Descriptions

 

I am experimenting with RF and IR signals in various frequencies and had some trouble with the receivers and needed to see what kind of signal i was receiving.

I cannot afford a real oscilloscope but i knew about the older Arduino oscilloscopes.

 

After trying many different versions of code and tutorials, I was unable to get a single one to work, and all the tutorials and guides around was 2-3 years old.
Not sure if it is the IDE or the actual hardware that has changed in such a way that it didn't work anymore.

 

I finally found a working oscilloscope from a Japanese website, (linked below) and a working TFT screen library,

meaning i could read the various signals received.

 

Clearly the limitations are 0-5v but that is fine, what i needed to know is either wave type and frequency, and this is sufficient.
It also gives me an indication of the amplitude which is just a nice bonus.

 

But what I'm most happy with, is the two channel feature, i often use the second channel as a reference point to be able to

differentiate the main channel on the screen.

 

 

Some screenshots..

2014-12-15 13.28.20.jpgThis is the .96" OLD test, single wave test

 

 

 

2014-12-19 16.22.48.jpg2014-12-19 19.14.29.jpg2014-12-19 16.20.02.jpg

2.4" TFT screen on the Uno,    two right images same screen on a Mega.

 

 

A youTube vidoe i made on the experience.

 

 

 

Credits and Links :

 

My compilation of the Oscilloscope and TFT library  ( what you see on the video and images ) :

https://dl.dropboxusercontent.com/u/19761809/arduino/Vaupell-Oscilloscope.zip

 

 

Original Oscilloscope link (code by : Noriaki Mitsunaga ) :

http://n.mtng.org/ele/arduino/oscillo-j.html

 

 

Original TFT display link ( TFT shield library source ) :

http://www.smokeandwires.co.nz/blog/a-2-4-tft-touchscreen-shield-for-arduino/

 

TFT library :

Library : https://github.com/Smoke-And-Wires/TFT-Shield-Example-Code

Previous posts in this project:

 

 

Introduction

 

After setting everything up in last post, I started working on the actual configuration of openHAB and control of the Arduino Yun via MQTT.

 

This is the result so far ...

 

openHAB

 

To be able to control the colors and animations of my digital Christmas tree, I opted for openHAB. I discovered openHAB during the Forget Me Not Design Challenge and like it very much. I find it easy to work with and very versatile (home automation, pet feeding, controlling Christmas lights).

 

In my previous post, I covered the installation and basic configuration. Now, i will document how I've created following interface to control my lights:

Screen Shot 2014-12-23 at 22.16.52.pngScreen Shot 2014-12-23 at 22.16.45.pngScreen Shot 2014-12-23 at 22.17.01.png

 

Items

 

The openHAB documentation on MQTT was sufficient to get me started. It describes how to define items to subscribe to or publish MQTT messages.

 

At this stage, I'm using openHAB to publish values selected in the web interface such as color or animation.

 

Here are some example items (the others are just duplicates of this with other names and topics):

Group All

Color TreeLight "Tree Color" (All)
String TreeLightColor (All) {mqtt=">[eclipse:/fvanTestOpenHAB/tree/color:command:*:default]"}
Number TreeAnimation "Tree Animation" (All) {mqtt=">[eclipse:/fvanTestOpenHAB/tree/animation:command:*:default]"}






 

You'll notice that I've separated the MQTT binding from the color picker. This is because I want to process the color picker's value before sending it over MQTT.

The processing of the color picker's value is done with a rule and then assigned to another item which then triggers the binding.

 

Rules

 

The color picker's default value format was not really usable in my case, so I needed to convert it to something I could use.

Taking the state of the color picker, I extracted the R, G, B and brightness values and put everything in one big string.

 

import org.openhab.core.library.types.*

rule "Set RGB value TreeLight"
when
        Item TreeLight changed
then
        val hsbValue = TreeLight.state as HSBType

        val brightness = hsbValue.brightness.intValue
        val redValue   = ((((hsbValue.red.intValue * 255) / 100) * brightness) / 100).toString
        val greenValue = ((((hsbValue.green.intValue * 255) / 100) * brightness) / 100).toString
        val blueValue  = ((((hsbValue.blue.intValue *255) / 100) * brightness) / 100).toString

        val color = redValue + "," + greenValue + "," + blueValue

        sendCommand( TreeLightColor, color )
end






 

The processed data is then sent to the correct variable, triggering the MQTT binding.

 

Sitemap

 

Finally, there is the sitemap, in charge of the layout of the web interface. This configuration defines how items are ordered in the GUI.

The configuration is very basic and categorises everything per LED strip. You've seen the result in one of the screenshots above.

 

sitemap xmas label="Holiday Lights" {
        Frame label="Topper" {
                Colorpicker item=TopperLight icon="slider"
                Colorpicker item=TopperLight2 icon="slider"
                Selection item=TopperAnimation mappings=[0=OFF, 1=Random_position, 2=Side_fill, 3=Middle_fill, 4=Alternating_colors]
        }
        Frame label="Tree" {
                Colorpicker item=TreeLight icon="slider"
                Selection item=TreeAnimation mappings=[0=OFF, 1=Pulse_slow, 2=Pulse_fast]
        }
}






 

Retain

 

One more thing ... Because some of my functions (animations) take longer to execute, I might miss certain MQTT messages. Also, if power is lost, no state is kept in the Arduino to restore colors and animations.

 

To remedy this, I enabled the option to "retain" messages. This will ensure the MQTT broker will keep the messages even after being sent, so that new or late subscribers are sent the messages again instead of having to wait for an update.

 

This is change in the "openhab.cfg" file:

 

# Optional. True or false. Defines if the broker should retain the messages sent to
# it. Defaults to false.
mqtt:eclipse.retain=true


 

 

Arduino

 

Benjamin Cabé did a great job to help us forward with his post on MQTT with the Paho client.

 

Still, I decided to give another library a try, not because I'm stubborn (perhaps a little bit ) but because I believe in multiple solutions to a certain problem.

This is why I used the following library: Arduino Client for MQTT « knolleary

 

The library is easy to use. The following bit of code reflects the general use:

 

#include <PubSubClient.h>
#include <Bridge.h>
#include <YunClient.h>

YunClient yunClient;
PubSubClient client("iot.eclipse.org", 1883, callback, yunClient);

void callback(char* topic, byte* payload, unsigned int length) {
  // handle message arrived
}

void setup() {
  if (client.connect("arduinoClient")) {
    client.publish("outTopic","hello world");
    client.subscribe("inTopic");
  }
}

void loop() {
  client.loop();
}








 

The hardest part (for me) was converting the received messages in a format I could use to compare/parse/etc ...

As you can see in the code above, the payload and topic are not strings.

 

For example, the MQTT messages sent for color codes, are formatted in RGB format with values ranging from 0, 0, 0 to 255, 255, 255.

 

To parse these, I did the following:

void callback(char* topic, byte* payload, unsigned int length) {
  // check for messages on subscribed topics
  Console.print("Topic: ");
  Console.println(String(topic));

  // check topic to identify type of content
  if(String(topic) == "\/fvanTestOpenHAB\/topper/color") {
    // convert payload to String
    String value = String((char*)payload);

    // split string at every "," and store in proper variable
    // convert final result to integer
    TopperR = value.substring(0,value.indexOf(',')).toInt();
    TopperG = value.substring(value.indexOf(',')+1,value.lastIndexOf(',')).toInt();
    TopperB = value.substring(value.lastIndexOf(',')+1).toInt();

    // print obtained values for debugging
    Console.print("RED: ");
    Console.println(TopperR);

    Console.print("GREEN: ");
    Console.println(TopperG);

    Console.print("BLUE: ");
    Console.println(TopperB);
  }
}








 

I repeated the "if" statement for every topic and am now able to receive all the messages required to apply color and animation of both strips.

 

 

Troubleshooting

 

During testing of this project, there are two "tools" I'm using quite often: MQTT Lens and Arduino Console.

 

MQTT Lens

 

MQTT Lens is an MQTT client capable of subscribing to and publishing MQTT messages.

Screen Shot 2014-12-23 at 21.04.04.png

 

Using this tool, I was able to verify the following:

  • MQTT messages are being sent properly
  • the content of the messages is correct
  • the content is published for the correct topic

 

Arduino Console

 

The Arduino Yun makes it possible to upload sketches wirelessly, so it must be able to debug wirelessly as well.

 

I initially tried to use "Serial.println()" statements for debugging, but that only works when connected to the Yun via USB.

After some digging around, I found the command to be used is very similar: "Console.println()".

 

In short, you can use the console as follows:


#include <Bridge.h>

#include <Console.h>


void setup() {
  Bridge.begin();
  Console.begin();
}

void loop() {
  Console.println("Output");
}











When placed at relevant places in your code, the output becomes very useful:

Screen Shot 2014-12-23 at 21.44.16.png

As you can see in the screenshot above, I'm using the console to verify the incoming MQTT messages on both topic and content.

This is very useful to know if the received content is parsed properly before being passed to the next function.

 

 

Demo

 

Finally, here's a short video demonstrating the control of both analog and digital LED strips connected to the Arduino Yun via openHAB and MQTT.

 

 

 

Happy Holidays

 

If you've come this far reading this blog post (or if you skipped ahead ), I'd like to wish you and your family happy holidays! May they be fun and festive.

 

I'll be back with more blogs for you to read in 2015! But in the mean time, enjoy this painting my 4yo daughter made:

kerstman.png

Previous posts in this project:

 

 

Introduction

 

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

 

You can jump to the topic of interest using the table of content links above. Enjoy!

 

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.png

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.png

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.png

 

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.png

 

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.png

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.png

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.pngScreen Shot 2014-12-17 at 09.39.46.png

 

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.JPG photo 2.JPG

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

photo 3.JPGphoto 4.JPG

 

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).JPG

 

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, peteroakes 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.png

 

After restarting the Arduino IDE, the example was available.

Screen Shot 2014-12-17 at 16.16.57.png

 

 

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.JPGDSCN3156.JPG

 

The analog stip 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).JPG

 

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.png

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 jancumps 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 by next post

 

Function 1

// alternate between two colors on even and odd LEDs
void alternateColor(uint32_t c1, uint32_t c2, uint8_t wait) {
  for(uint16_t i=0; i<dstrip.numPixels(); i++) {
    if(i%2 == 0) { // set even LED to color 1
      dstrip.setPixelColor(i, c1);
    } else { // set odd LED to color 2
      dstrip.setPixelColor(i, c2);
    }
  }

  dstrip.show(); // apply the colors
  delay(wait);

  for(uint16_t i=0; i<dstrip.numPixels(); i++) {
    if(i%2 == 0) { // set even LED to color 2
      dstrip.setPixelColor(i, c2);
    } else { // set odd LED to color 1
      dstrip.setPixelColor(i, c1);
    }
  }

  dstrip.show(); // apply the colors
  delay(wait);
}










 

Function 2

// gradually fill up the strip with random colors
void randomColorFill(uint8_t wait) {
  clearStrip();

  for(uint16_t i=0; i<dstrip.numPixels(); i++) { // iterate over every LED of the strip
    int r = random(0,255); // generate a random color
    int g = random(0,255);
    int b = random(0,255);

    for(uint16_t j=0; j<dstrip.numPixels()-i; j++) { // iterate over every LED of the strip, that hasn't lit up yet
      dstrip.setPixelColor(j-1, dstrip.Color(0, 0, 0)); // turn previous LED off
      dstrip.setPixelColor(j, dstrip.Color(r, g, b)); // turn current LED on
      dstrip.show(); // apply the colors
      delay(wait);
    }
  }
}










 

Function 3

// pick a random LED to light up until entire strip is lit
void randomPositionFill(uint32_t c, uint8_t wait) {
  clearStrip();

  int used[dstrip.numPixels()]; // array to keep track of lit LEDs
  int lights = 0; // counter

  for(int i = 0; i < dstrip.numPixels(); i++){ // fill array with 0
    used[i] = 0;
  }

  while(lights<dstrip.numPixels()-1) {
    int j = random(0,dstrip.numPixels()-1); // pick a random LED
    if(used[j] != 1){ // if LED not already lit, proceed
      dstrip.setPixelColor(j, c);
      used[j] = 1; // update array to remember it is lit
      lights++;
      dstrip.show(); // display
      delay(wait);
    }
  }
}










 

Function 4

// Light up the strip starting from the middle
void middleFill(uint32_t c, uint8_t wait) {
  clearStrip();

  for(uint16_t i=0; i<(dstrip.numPixels()/2); i++) { // start from the middle, lighting an LED on each side
    dstrip.setPixelColor(dstrip.numPixels()/2 + i, c);
    dstrip.setPixelColor(dstrip.numPixels()/2 - i, c);
    dstrip.show();
    delay(wait);
  }

  for(uint16_t i=0; i<(dstrip.numPixels()/2); i++) { // reverse
    dstrip.setPixelColor(i, dstrip.Color(0, 0, 0));
    dstrip.setPixelColor(dstrip.numPixels() - i, dstrip.Color(0, 0, 0));
    dstrip.show();
    delay(wait);
  }
}










 

Function 5

// Light up the strip starting from the sides
void sideFill(uint32_t c, uint8_t wait) {
  clearStrip();

  for(uint16_t i=0; i<(dstrip.numPixels()/2); i++) { // fill strip from sides to middle
    dstrip.setPixelColor(i, c);
    dstrip.setPixelColor(dstrip.numPixels() - i, c);
    dstrip.show();
    delay(wait);
  }

  for(uint16_t i=0; i<(dstrip.numPixels()/2); i++) { // reverse
    dstrip.setPixelColor(dstrip.numPixels()/2 + i, dstrip.Color(0, 0, 0));
    dstrip.setPixelColor(dstrip.numPixels()/2 - i, dstrip.Color(0, 0, 0));
    dstrip.show();
    delay(wait);
  }
}










 

 

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

Fredericks-MacBook-Air:~ fvan1$ sudo diskUtil list
/dev/disk0
  #:                      TYPE NAME                    SIZE      IDENTIFIER
  0:      GUID_partition_scheme                        *251.0 GB  disk0
  1:                        EFI EFI                    209.7 MB  disk0s1
  2:          Apple_CoreStorage                        250.1 GB  disk0s2
  3:                Apple_Boot Recovery HD            650.0 MB  disk0s3
/dev/disk1
  #:                      TYPE NAME                    SIZE      IDENTIFIER
  0:                  Apple_HFS Macintosh HD          *249.8 GB  disk1
                                Logical Volume on disk0s2
                                5642627E-CEC4-458D-AB8D-376EF3FB568C
                                Unencrypted
/dev/disk2
  #:                      TYPE NAME                    SIZE      IDENTIFIER
  0:    FDisk_partition_scheme                        *7.9 GB    disk2
  1:            Windows_FAT_32 boot                    58.7 MB    disk2s1
  2:                      Linux                        7.9 GB    disk2s2



















 

2) Unmount SD card

Fredericks-MacBook-Air:~ fvan1$ sudo diskUtil unmountDisk /dev/disk2
Unmount of all volumes on disk2 was successful



















 

3) Write image to SD card

Fredericks-MacBook-Air:~ fvan1$ sudo dd if=Downloads/2014-09-09-wheezy-raspbian.img of=/dev/disk2 bs=1m
3125+0 records in
3125+0 records out
3276800000 bytes transferred in 1596.406567 secs (2052610 bytes/sec)


















 

4) Unmount SD card

Fredericks-MacBook-Air:~ fvan1$ sudo diskUtil unmountDisk /dev/disk2
Unmount of all volumes on disk2 was successful


















 

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.

 

Fredericks-MacBook-Air:~ fvan1$ ssh pi@192.168.0.129
The authenticity of host '192.168.0.129 (192.168.0.129)' can't be established.
RSA key fingerprint is 02:4f:ed:b3:42:1d:e5:83:1c:1e:2f:7f:63:83:9c:bd.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.0.129' (RSA) to the list of known hosts.
pi@192.168.0.129's password:
Linux raspberrypi 3.12.28+ #709 PREEMPT Mon Sep 8 15:28:00 BST 2014 armv6l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.

NOTICE: the software on this Raspberry Pi has not been fully configured. Please run 'sudo raspi-config'

pi@raspberrypi ~ $

















 

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.png

 

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:

pi@raspberrypi ~ $ wget https://github.com/openhab/openhab/releases/download/v1.6.0/distribution-1.6.0-runtime.zip
pi@raspberrypi ~ $ wget https://github.com/openhab/openhab/releases/download/v1.6.0/distribution-1.6.0-addons.zip



















 

Step 2: Deploy the openHAB runtime and addons:

pi@raspberrypi ~ $ sudo mkdir /opt/openhab
pi@raspberrypi ~ $ cd /opt/openhab/
pi@raspberrypi /opt/openhab $ sudo unzip /home/pi/distribution-1.6.0-runtime.zip
pi@raspberrypi /opt/openhab $ cd addons/
pi@raspberrypi /opt/openhab/addons $ sudo unzip /home/pi/distribution-1.6.0-addons.zip
pi@raspberrypi /opt/openhab/addons $ sudo mkdir unused
pi@raspberrypi /opt/openhab/addons $ sudo mv *.jar unused/
pi@raspberrypi /opt/openhab/addons $ cd ../configurations/
pi@raspberrypi /opt/openhab/configurations $ sudo cp openhab_default.cfg openhab.cfg



















 

Step 3: Make it executable:

pi@raspberrypi /opt/openhab $ sudo chmod +x start.sh














To have openHAB start automatically at boot, add following line to "/etc/rc.local":
sudo /opt/openhab/start.sh &



 

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:

 

################################# MQTT Transport ######################################
#
# Define your MQTT broker connections here for use in the MQTT Binding or MQTT# Persistence bundles. Replace <broker> with a id you choose.#
# URL to the MQTT broker, e.g. tcp://localhost:1883 or ssl://localhost:8883
mqtt:eclipse.url=tcp://iot.eclipse.org:1883
# Optional. Client id (max 23 chars) to use when connecting to the broker.
# If not provided a default one is generated.
mqtt:eclipse.clientId=fvanPiOpenhab

 

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.


Introduction


Alright! I've been selected for the The Internet of Holiday Lights RoadTest Plus (or "mini challenge") along with 19 other competitors.


In this post, I will describe my submission and what I intend to realise for this RoadTest.


The idea


My internet holiday lights idea for this Road Test plus is about making a Christmas tree with both classic and modern elements.

 

The classic element would be the base of the tree, where I would hollow a wood log in order to stuff the electronics in (Arduino Yun + Infineon Shield).

The modern element will obviously be the lights. I'd like to use a combination of LED strips (addressable and non-addressable) to create a Christmas tree shape and tree topper.

 

This is a quick sketch of what I have in mind:

photo (6).JPG

 

The tree shape would be controlled by the Infineon shield to control color, brightness and other effects (glowing, fade in/out, ...).

For the tree topper, I'd like to use an addressable strip and neopixel ring to create more granular animations (rotation, inward/outward motion, random, ...).

 

The color of both the tree and the topper would be controlled individually via an app on the smartphone. The app would also allow for an automatic mode where the colors and animations would randomly change.

 

In "manual" mode, everything is controlled by the user via his/her smartphone: selection of colors and animation.

 

One of the types of animation I was thinking of, could be triggered by a local sensor. I've experimented with this before as demonstrated in the video below, using a distance sensor.

 

 

What I'd like to achieve is to have the tree topper have an inward motion when nearing the tree and outward motion when getting further away (or vice versa).

 

When in "automatic" mode, the colors and animations for the tree and the topper would be determined based on data gathered from the internet.

 

An example could be to change colors based on keywords found in song titles. By tuning in on an internet radio channel playing Christmas songs, the lights could adapt based on certain keywords in the title of the song playing at that specific moment:

  • "Let it snow": glowing white
  • "Mr. Santa": alternate between red and white
  • etc ...

 

Research

 

For the communication between the Yun and the smartphone, I was thinking of using MQTT and openHAB, which I would deploy on an earlier project: Internet Radio Player with Raspberry Pi, PiFace CAD and MPD/MPC

IMG_3148.JPG

 

While doing some research for this project, I came across an Arduino library for MQTT that is compatible with both the Yun and the UNO (combined with an ethernet shield).

I couldn't help myself, and already gave it a try with the UNO and ethernet shield.

Screen Shot 2014-11-19 at 10.51.57.pngScreen Shot 2014-11-19 at 10.44.49.png

Using an online MQTT client from 2lemetry, which I found via iot.eclipse.org — Ecosystem I was able to successfully publish data from the Arduino and visualise it online.

This is only part of the solution, as the actual project will also require the Arduino to subscribe to a certain topic in order to retrieve the colors and animations that need to be used.


Screen Shot 2014-11-24 at 20.30.20.pngScreen Shot 2014-11-24 at 20.34.51.png


While exploring MQTT for the CC3200, I discovered that a Paho Arduino client exists. Thanks to one of kartben's posts, I also discovered MQTTlens, to visualise MQTT message easily.

After my submission, Benjamin also posted a nice tutorial on how to use the Paho client with the Arduino Yun. You can find it here.

 

That's my project idea for this RoadTest, hope you like it!