Close

More progress

A project log for IoT Ethernet Sensor using Power over Ethernet

This solution has a number of unique benefits, a sensor platform with webserver, powered over Ethernet, accessible and programmed by browser

deandobdeandob 04/26/2015 at 02:020 Comments

MQTT now working. Wasn't as easy as it should have been (isn't it always....). I tried to use PIC code written for a PIC32 and porting to PIC18 but due to the complexity of all the MQTT functionality supported it proved too difficult. So I scrapped that, read the MQTT spec and implemented just the basic MQTT functions appropriate for a relatively dumb sensor (init, publish, subscribe). Wasn't too difficult but time consuming as debugging on a PIC isn't as easy as PC software and involved lots of reflashing due to fixes. I have reflashed the PIC I'm prototyping with probably over 200 times now, and no problems with flash wear (this chip is only supposed to be flashed a max of 100 times).

The host end was easy on node.js, using the excellent MQTT components from MQTT.js on github (https://github.com/mqttjs) and easy to fit into my homebrew automation framework by submitting / consuming messages on its message bus.

I have most of the sensor code written and working (ultrasound, OLED, GPIO, audio) so I need to finalise the code and post it up to github, then work on the basic interpreter which will need a larger memory PIC chip, so I have the PIC18F67J60 on order, I should have started with that chip for just another $1 but I wasn't expecting the microchip network library to be so fat. I also have my doubts about this library as I can see a number of malformed packets from the pic when sniffed with wireshark - it might be my implementation, but it doesn't stop the communication. I'm also thinking of redoing the board to fix the patches and making it smaller by removing some of the IO connections (current board exposes all the PIC IO pins on connectors - overkill for 99% of sensors / use cases).

Discussions