Coding Chase - Projects

My 3D Hub

Thank You For Donating:

Ikeeki (linux-sunxi@irc.freenode.net)
Computer Troubleshooters Brasil

Wednesday 30 December 2015

IoT Projects - ESP8266 [CTC-3D Printer Upgrade] ||

So, after having an ESP8266-01 control my CTC-3D printer LED lighting and Fan cooling, I decided to improve the solution further.

Moving more to ABS than PLA on prints, the fans stopped being that necessary - but what stood out as being a lot more interesting would be to actually turning the printer on or off.

Using the same principles as before, I replaced the Fan part of the solution and added the printer power cord to the available relay.

As an extra, I left cubietruck to manage Octoprint and the remaining solutions in previous posts and set out to build a nice embedded cluster:

  • 4 boards (even cubieboard A10 boards will do for this, but one might consider a cheaper alternative as the Orange Pi perhaps);
  • 4 webcams, in my case, the Hercules Twist HD as it molds perfectly to the case;
  • placing each webcam on the top corners of the printer case, pointing to the heat bed;
  •  Using cubietruck as the manager of the video solution and controlling each of the 4 boards as video feeds;

And since using the command line to issue MQTT commands wasn't actually that practical, I started working on a web platform to manage the solution.

I spent some time working with MEAN.js which I found to be brilliant by the way, integrated MQTT.js and socket.io into the base boilerplate as well as the live video feeds from the webcams.

In the end I got exactly what I wanted:

  • the ESP8266-01 connects to CloudMQTT, a cloud-based, free MQTT broker (moved to it after everything was confirmed to be working properly using mosquitto locally);
  • the MQTT broker is accessible by the MEAN.js web app (which later got published to heroku);
  • the web app uses MQTT.js to subscribe to CloudMQTT and socket.io to perform realtime UI updating if necessary (if I decide to use sensors in the future);
  • the webcams stream the video to the web app.
Using the app, either desktop or tablet or mobile, I'm able to work it:
  1. turn the printer on/off, which saves some power;
  2. turn the lighting on/off, in case there's poor lighting in the room;
  3. use a slicer remotely, like slic3r, generate gcode and upload it to Octoprint;
  4. run the prints remotely and accompany the status using the webcams.
 Some screenshots from the development phase, the web app is very crude, just the buttons and the video streams, just one stream being replicated at the time.

In spite of travelling over the web, the response time with MQTT is lightning fast, basically feels as if a local physical switch is being used...!



 
 As an alternative to MEANjs, there's also meteor.js but I haven't actually looked into that one, apparently it would have saved me some time integrating MQTT an socket.io - perhaps on my next project!
 

No comments :

Post a Comment