Sunday, September 20, 2015

Misterhouse controls a traffic light?

Okay, I've taken a bit of liberty with the title. The traffic light part consists of 3 LEDS (red, yellow, and green) on a breadboard with the Fubarino Mini, WIZ550io network interface and a DHT22. The Furbarino uses an Arduino type environment but uses the Microchip PIC32 instead of the AVR. I've mentioned my IoT boards in previous posts and decided it's time I shared a bit. First: pictures of the boards. At the moment I have 2 wired network prototypes working. I'm also working on wireless network prototypes but they're a long ways from being setup. The first working prototype was the simple Chipkit UNO32 with a WIZ550io board and a DHT22 temperature and humidity sensor. The code has the MQTT topics hard coded to specific topics. This board just sends updates about humidity and temperature. It can receive commands but doesn't really do anything with them other than send them to the serial debug port. Between iterations of that and the latest IoT device, the Fubarino Mini, I found all sorts of interesting features in the Chipkit libraries. The one that interested me the most was the createTask() function. It allows me to create tasks that run periodically outside the Arduino loop function. Very cool, I'm using that as a heartbeat function to see if the board has been disconnected or hung up and if necessary reboot. There are various interrupt functions I'll take a look at later so I can do things like push a button and get a reasonable response. But for now, lots of baby steps.

The second working prototype is my Fubarino Mini, in addition to working out the differences with the Arduino, the UNO32 and the Mini I started adding to the code so I could control the Mini from MQTT topics. Again, hard coded topics, but now the Mini is sending periodic updates and monitoring topics for commands. In this case a simple set of commands to turn on 3 LEDS. Since I've already added MQTT to Misterhouse, I wrote a simple routine to issue the commands to turn on the lights in a US traffic light pattern but with much shorter intervals. Other than a few minor glitches (power related?) both boards have been running for weeks with no reset (yea!). I still have a lot more work to do, such as finishing my methods of automatic configuration of the IoT device from MQTT topics. I also need to work on security as I really want to be able to install the devices in remote sections of the internet, subscribe/publish to an MQTT cloud service and still have my local Misterhouse control, configure and monitor these devices. I'm part way there but more thinking and coding needs to be done.

Okay so now I need to put together a web page explaining how to setup Misterhouse, MQTT, and my IoT devices. I'll also have to add to my other IoT publishers and subscribers also. I have a number of them including Node-Red and bash scripts. Most are publishers, get web information, filter what is needed then republish for local subscription. But there is also business (?) logic in things like Misterhouse and the different flows of my Node-Red code. I must say that I'm very excited about the 32 bit microcontroller and the use of MQTT in home automation. While a simple 4 bit processor can flip a bit add networking and security and more resources are required. I really don't need a Linux system such as a Raspberry Pi running a light switch when a PIC32 can handle all the requirements. Boy this is going to be one interesting IoT web page. ;-)

0 Comments:

Post a Comment

<< Home