Sunday, March 12, 2017

Remote Temperature Monitoring for a 3D Printer with OctoPrint and DS18B20

This continues from a previous post: Wirelessly controlling a 3D printer with Raspberry Pi.
Now that I can monitor it remotely via webcam, I've set up a dedicated 3D printer shelf in my closet.



Tucking it in the closet reduced the noise, but printing in there unattended felt a bit risky, so I beefed up the remote monitoring.

Parts

Check on Amazon For the filament holder, I used one of these tension poles sold on Amazon — the kind used to prevent furniture from tipping over. Mounted horizontally to hold the spool. A regular thin tension rod tends to snag the spool as it rotates.


Check on Amazon For the camera, I used a sketchy Chinese night-vision cam.
The product at the link may differ from what I bought.
Chinese IR cameras tend to have lots of issues — consider it a gamble before buying.
Common complaints: IR LEDs don't light up, or it's just regular LEDs.
Mine had a volume dial that was only an ON/OFF switch, not a brightness control.
Turning it clockwise = ON. Very intuitive UX.

For how to set up webcam monitoring via OctoPrint, see the previous article.


Check on Amazon For temperature monitoring, I used a DS18B20 temperature sensor module.
It happened to be in a set of 20 assorted sensors I received as a gift.

A bare DS18B20 sensor works too, but the module version includes a built-in pull-up resistor, making wiring easier.
Note: the pin order is different between the bare sensor and the module — watch out for that.


Check on Amazon And of course, a Raspberry Pi.


Monitoring the Raspberry Pi Temperature

To prevent thermal throttling, I monitor the Raspberry Pi CPU temperature.
This is as simple as enabling a plugin in OctoPrint.
In the OctoPrint UI, go to Settings → Plugin Manager, enable "Navbar Temperature Plugin", and restart.


Monitoring Room Temperature

The M3D The Micro doesn't have a heated bed, so if the room gets too cold, prints can warp.
But if it gets too hot, the Raspberry Pi may throttle.
So I added room temperature to the display.
(There's a practical reason, but honestly I just wanted to try it.)

First, enable "Room Temperature Plugin" in OctoPrint's Plugin Manager.
The plugin description says:
"with a DS18b20 sensor connected on Pin n°4"
But which pin is pin 4, exactly?

The answer is on Raspberry Pi's official documentation.
Pin numbers are not sequential from the end of the header.
Pin 4 happens to be the fourth physical pin, but that's just a coincidence.

The DS18B20 module has a different pin order than the bare sensor.
On this module, "S" is the signal/sensor pin.
On the bare sensor, the middle pin is the signal pin.
Connect this to Raspberry Pi GPIO pin 4.

The "-" pin in the photo appears to be GND.
On the bare sensor, hold it with the flat (labeled) side facing you — the left pin is GND.
Connect this to a Ground pin on the Raspberry Pi.

The remaining middle pin is VCC.
DS18B20 is rated 3.0–5.5V, so either 3.3V or 5.0V should work —
most guides connect it to 3.3V.

After connecting and booting the Raspberry Pi, the module's LED blinks every few seconds.
Each blink is probably a temperature measurement.
The OctoPrint display updates after each measurement, so the temperature doesn't refresh very frequently.

The OctoPrint header section ends up looking like this:


Now I can check both the temperature and the print status from outside the closet via tablet or phone,
without having to physically open the door.
That said, this is monitoring only — no active control — so it doesn't actually improve print success rates.

No comments:

Post a Comment