Skip to content

Archive for January, 2017

23
Jan

Octoprint Webcam

One of the nice things about Octoprint is that it’s relatively easy to add a webcam so you can easily view your print progress from your local network, or from anywhere on the internet if you so choose.

What’s not so nice is trying to get a camera working sometimes.

I picked up a couple of Logitech C270 webcams when a local store put them on sale. Plugged them into the USB on the Rasp Pi 3 (the other went on a Rasp Pi 2), booted the PI and printer up. Working. No muss, no fuss.

And the first problem. I hadn’t thought about it but when sitting in front of a computer you’re about 30″ away from the monitor in most cases (arms length), so that’s the fixed focus point for the majority of webcams. On Thingiverse there are any number of focus ring hacks for the C270 cameras so you can actually adjust the focus as need be.

Therein exposing the second problem. Depth of field. Ever notice those telephoto shots in National Geographic are sharp on the subject but the background is typically out of focus?. Webcams suffer the same thing. If you focus on the center of your printer bed, when the head moves to the edges of the bed, they can go out of focus.

Once you get the focus adjusted to where you want it, the camera in a nice convenient position, I’ve found that the field of view is very narrow. In other words, you see about a 4″ square in the center of the bed. Outside of that is beyond the cameras view.

For a webcam to work nicely, it should be a wide angle lens, and adjustable focus.

First Webcam Test

I scoured fleaBay for some of the cheapest webcams I could find and ordered some. As in $3 webcam. No doubt the ultimate quality. Or not. For the price, if it didn’t work, who cares.

The first one I tried was described as: 8 Mega Pixels 50M 6 LED USB Webcam Camera. Whatever the heck all those numbers meant. Essentially 640 x 480 with a manual focus ring. USB 2.0.

When I plugged it in, no soap. Where the image should have shown in Octoprint there was a place marker.

8 Mega Pixels 50M 6 LED USB Webcam Camera with Mic for PC Laptop Computer | eBay 2017 01 23 12 44 58

Octoprint really doesn’t do the webcam any way, there is a jpeg Streamer it links to on the Raspberry. Obviously something was off.

A quick Google and I found the Octoprint Webcam Compatibility List.

Reading down through the list I found this reference:

Webcams known to work  foosel OctoPrint Wiki  GitHub 2017 01 23 12 50 07

I didn’t bother checking the USBid of the camera, just looked at the configuration needed to make the camera work and what file to modify. This info is right at the top of the webpage as boot/octopi.txt

Going to have to SSH to make the change. So off to another computer on the network to run a terminal program. Mac guys can use the Terminal app in /Applications/Utilties. Windows users seem to prefer using PuTTY. Since I’m not a Windows user, I can’t help with PuTTY but most term programs work the same any way so my screen shots should look more or less like what you might see.

Raspberry Pi IP

You’ll need to know the IP address of your Octoprint installation. If you can’t figure it out, there’s actually a plug-in for Octoprint that’s quite useful. It’s called “Detailed Progress”.

Oct Detailed

To install it, click on Settings–>Plugin Manager–>Get More and look through the list of plugins you can download.

After the plugin is installed, the Pi will reboot and when it starts back up your LCD display will show the IP it has on your network. That’s the IP you’ll use in the Terminal program to SSH to it.

The plug in will also display, during a print, the elapsed time, the time that the print will finish, the estimated elapsed time of the print, and percentage done.

SSHing We Go

Run your Terminal application and you should get a prompt where you can type in commands…and you type in the following line replacing the IP with the IP of your Rasp Pi and press return:

SSH PI IP

On the Mac, you might see something like this if you have never SSH’d into it before:

SSH PI Authen

What it’s saying is it doesn’t have a ECDSA, encrypted digital signature for the host, so…type in yes, we want to make sure in future the Term program knows who this host is.

Next up you’ll be greeted with the Password prompt. No brainer, if you’ve never changed your Pi’s password, it will be raspberry

If you’ve used a different password, use it. A successful login looks like:

SSH PI LOGIN

When you arrive on the Pi, you’re in your users directory so use this line to give yourself admin status and go into the text editor on the Pi:

sudo nano /boot/octopi.txt

This is a text editor, you don’t use the mouse. You use CTRL keys and your keyboard arrow keys to move around.

SSH Nano 1

Use the arrow keys to move the cursor down to just below where it says, “# for available options”. The # symbol means the line is a comment, not a command.

Press Enter to start a new blank line and type in the configuration for your webcam. In my case the line will read:

camera_usb_options=”-r VGA -y” and end the line with the return key.

Press CTRL O, this will write out the file and yes, you want to overwrite the old file.

Press CTRL X, to exit the Nano text editor

Back in the terminal now, type in:

sudo reboot

You can now quit your Terminal application.

The Rasp Pi will drop the connection to your computer, reboot and you should then be able to pull up Octoprint and have your web cam work.

19
Jan

3D Printing Power Meter

Just wandering through fleaBay sometimes produces a “hey that looks kind of interesting”…which then unlocks the labyrinth of bunny trails.

Since energy seems to be a topic, when I spotted a simplistic energy monitor, well, heck, let’s take it for a spin..

Energy Monitor

This is a 20 AMP AC monitor, a cumulative monitor no less. For the rock bottom cost of $10 CDN. For bucks like that, it’s probably so accurate it’s even used in medical applications. Or Not.

IMG 2295

A whopping four screw terminal is all you need to connect said wee beastie to the AC source. Which in my case (in the event you are not in North America) 120VAC.

IMG 2297

The unit brags that polarity is not an issue, none the less I tried to keep the neutral and hot leads where they might go logically. This is using the broad assumption that the engineer who designed this anticipated such logical thinking. Or Not.

Instead of leaving those uber friendly 120VAC lines laying around, I made a quick box and printed it to house the hazards.

IMG 2301

Next, up, what to measure?

3D Printer

This was solved fairly quickly since I had a 16 minute print job to do. I plugged in the Energy Meter, turned on the printer. Darn thing worked. Am I surprised? Yes, I am. Many is the time I have received things from fleaBay only to have the smoke leak out on the first power up.

From the first power up, with no printer even turned on I got this information:

PM Start

Next I turned on the printer. In my case it’s a Kossel 360W 12Vdc 30A power supply, Raspberry PI Octoprint AC adapter). I initiated the print and the bed starting heating. According to the Energy Meter, it’s using 10.3W of power, 140ma. Not exactly a power sucker.

I examined the 12V power supply to see what the current draw was when connected to the AC line. Yeah, what was I thinking. I dunno. Line voltage is the only spec for AC they give you.

PM Bed Heating

Once the bed was up to temp, the hot end kicked in. Oddly I thought the bed would be the demanding one. Turns out the hot end is actually the energy sponge. At this point the bed is not on. Just the hot end.

PM Printing

And then the bed kicked in, with the hot end. With both heaters on, we have a 2A load. Not exactly a heavy power user. To put it perspective, five of these printers would use less than an electric kettle, although it will run longer…

PM Bed Printing

After the print job was completed, the energy meter displayed the Wh (watt hours) used for the 16 minutes. Of course the printer was still on and drawing power so that is displayed as well.

PM Complete

Summary

So what’s the point of all this? Honestly it was more curiosity than anything else.

I can’t see this saving any money or anything, and considering the energy meter itself is a load, if left on for long enough it would add itself to the energy cost.

Plus it’s not like companies who build/clone 3D printers are going to suddenly get energy responsible any time soon. You can’t compare energy costs of this printer vs that printer, magazines don’t even give out that sort of info in their reviews.

I’ve never a review that stated, “While this printer turns out incredible print jobs, the energy cost is far above/below normal”. Wait. I’ve never seen the latter, I’ve seen the former too many times without any supplied hi-res photos of actual print output.

So there you go, for what it’s worth. Which could be slightly less than some of the reviews you’ve read. Or not.