One Step Closer to Plug and Play ESP devices

For those of you that know me, I am kinda big on the ESP8266 WiFi enabled chip for IOT. I do use the Arduino IDE for coding these chips and have integrated aspects of automatic setup much like consumer IOT products use. The one thing that has been tricky is in setting up things like MQTT feeds and even the MQTT credentials on setup. Continue reading One Step Closer to Plug and Play ESP devices

IOT Holiday Lights

This tutorial will walk you through setting up a string of colorful holiday lights that connect to the internet. The lights can display many types of animations and colors based on information sent to it using Adafruit’s IO service. Once connected and programmed, IFTTT can be used to set date triggers as well as change animations based on your GPS location, the weather report for the day, and even when you are getting a call from your mother.

The hard stuff is already done and with just a bit of soldering and a few code edits, you will be deep into the beast known as the Internet of Things. Continue reading IOT Holiday Lights

ESP8266 and MQTT disaster averted…

Fair warning, this is going to be a super geeky IOT post. Just an hour ago I figured out a rather frustrating glitch in the code I was using to connect 2 ESP8266 chips to a local MQTT Broker. For some reason the code worked perfectly on both devices until I plugged them both in. Then they would constantly disconnect form the server.

I am using the PubSubClient library for handling MQTT interaction with my local Mosquito server running on a Raspberry Pi model B. I recently got a stable interaction going with some NeoPixels when I decided it was time to connect a few of them up for unified and individual control.

Think of this as like Phillips Hue, but with full animations, locally controlled, and at a fraction of the prices.

Anyway, the moment I got more than one turned on, both start continuously looking network connection. Packets get lost and the lights go form near bullet proof to buggy as hell. Unplug one and the other returns to near stable operation.

I checked to see that both devices were pulling unique IP addresses and just to be safe I even changed the topics that they were subscribed to. I hunted for people having the same issue, but nothing. At last I ran across two posts that mentioned an issue with matching Client ID’s clashing on the same MQTT servers on remote APIs.

I hunt through the exsample code to see what is going on and sure enough. They are using the same Client ID every time on Reconnect. I changed it to a unique one.

BAM!!!

All fixed. Now I need to add a random number to the end of the Client ID so that I never have to worry about this ever again.