Adding a Wyze Cam-Pan to Octopi

I’ve been using Octopi with my 3D printers for almost as long as I’ve been printing. The whole concept of printing from SD cards just seems alien to me, when Octopi/Octoprint jumps through all the hoops for you. I mean ALL the hoops. Upload your gcode to a web interface, set the print, watch the print, manage temperatures… there is even a spaghetti detection plugin!

One of the biggest benefits is camera integration. Why? To monitor progress, to create stunning time-lapses. The technology has advanced so much that the Octolapse plug-in can detect when the Z-layer changes, move the extruder to an out-of-the-way corner, and take a snapshot of the current state of your print, then continue printing as if nothing happened. This results in beautiful yet creepy time-lapses where the object simply appears to grow out of thin air.

The typical thing to do is integrate directly with the Pi camera. It is perfectly utilitarian, and does the job. I haven’t been super happy with the Pi camera, however. Until recently, I had cobbled together systems to hold a camera in place using helping hands, or whatever other makeshift device I had on hand. Then I 3D-printed a mount to do the same thing. But the quality’s just not there. The resolution is inferior, it doesn’t handle low-light well, and it can’t pan, tilt or zoom, so you’re stuck with manual adjustments.

Then I saw that someone had created a frame mount for a Wyze Cam-Pan for the Ender 5. The Cam-Pan can be found for under $30, and has full HD and PTZ capabilities. Also records and speaks audio, not that I’d need that here. So I printed one, and ordered one, before researching how to integrate it.

Well, by default, the Cam-Pan wants to work like a Ring camera and send its output to the cloud. SAAS is king, apparently. But wait. Wyze offers RTSP firmware for it. That makes it simple, right? Well, not so fast. It makes a decent stream, but it doesn’t seem that Wyze’s RTSP firmware offers the still-image function which is required by the Octolapse plug-in.

Another option Wyze offers is USB Webcam firmware. But that requires a clunky additional wired connection, a USB-A to USB-A cable, from the Pi to the Wyze camera. HATE IT.

Started talking with Kevin about reverse-engineering the Wyze firmware to see if there was hidden functionality, but then I remembered that everything has already been done. So I googled Wyze camera reverse-engineering. First I found some very confusing custom firmware made for the Wyze V1 and V2 cameras. This was getting closer, but I’m specifically looking for the Cam-Pan version. I started reading the “issues” section of the github for that release, which hadn’t been updated in three years, and people were wondering why it exists at all, since at its core it’s a no-further-benefit fork of Xiaomi Dafang firmware for Wyze, which is better documented, more thorough, specifically known to support the Cam-Pan, and was updated just four months ago.

Fast forward a couple hours, and I did it:

  • I flashed the custom bootloader. It’s smart. if it detects the SD card with the custom software on it, it runs that. Else it runs the built-in Wyze version. BRILLIANT.
  • I created the custom SD card, editing wpa_supplicant.conf to connect to my wifi.

I booted it up, and was dismayed. It clearly “works,” in that ssh, web and rtsp ports are open by default, but this was clearly written before the great clampdown on TLS. A self-signed cert with an untrusted root cert, whose name will never match on the common name. I spent at least an hour going down that rabbit hole and trying to bypass it, but here’s the thing. Not only does it have to work on my browser, but it also has to work from the Octoprint installation on the Pi. Since I now have SSH access to the Wyze camera via its new firmware, I logged in to see if it would be easier to just “replace the certs.”

Sure enough, it all hinges on just a cacert and a lighttpd cert. I figured I had little to lose at this point, so I generated a new cert for it, signed by my infrastructure (what, doesn’t everyone run FreeIPA in their basement in 2021?), and dropped these new and authenticated certs into place. I power-cycled the camera. IT CAME BACK UP. And now, at least it ALLOWS me to bypass SSL/TLS errors (apparently my FreeIPA server isn’t too smart about daylight savings time, so I still have twenty minutes before that cert is valid). (This was incorrect, as I discovered today. My infrastructure was using an ntp server that had been removed from my network, and has been WRONG for some time now. I fixed that today!)

The point of the whole TLS exercise is so that I can add the camera to Octolapse, which actually does a verification check to ensure it can read both the stream and the “capture current pic” snapshot link. I suppose I also could have figured out how to turn off https entirely on lighttpd, but I was already nearly done when I thought of that option. Also, it’s not a full linux deployment on that firmware. It’s a busybox/mips stripped down linux with all the configs living on the SD card.

I ended up disabling SSL support anyway, because why not?

The next problem — it looks like Octoprint/Octolapse, between the two of them, need the feed in lots of different ways. The main “control” screen in Octoprint needs it in http/mjpeg — no other feed type will work here and show the current moving image. There are -three- settings within Octolapse — base address, stream and snapshot. And I’m pretty sure the stream option here would take an rtsp stream. The snapshot, however, is ghoulish, in that it needs an actual snapshot function. Why not just build in a function that takes a curent snapshot from the stream? Oh well, I don’t know the capabilities that well, there must have been a good reason for that choice.

Meanwhile, the camera won’t do http mjpeg with any of the firmware I’ve tested so far. The workaround for this seems to be back to the beginning thoughts — use ffmpeg and ffserver on the Pi itself to suck in the rtsp stream and serve it on a different port locally as mjpeg. Again, it seems like an awful lot of load to do something so seemingly simple. But packetwise, they’re staying local, it would be sucking that feed into Octopi anyway. BTW, ffserver requires a specific older version of ffmpeg and is a 2-4 hour compile on the Pi.

After managing to get it “working” with the mjpg custom firmware, I wasn’t happy with the result. The network overhead of the Pi streaming the video from the camera and then re-streaming it internally was too much, and the image ended up being glitchy and problematic. I also think having ffmpeg and ffserver was adding a notable load to the Pi.

So I broke down and bought the USB-A to USB-A cable and flashed the Wyze camera with the Wyze USB-Cam version of the software. Then I ran raspi-config to turn off Pi Camera support. After setting Octoprint back to the Webcam profile and rebooting it, it just picked it up naturally. I did install the uvc software so that I could tweak the settings, but I’m not 100% that was necessary for the camera to work. In any case, I have great video quality and can now tweak some of the exposure and white balance settings on the camera for more dramatic timelapses.

I guess that’s a wrap. Check out the DC540 youtube for future timelapse videos.

3D-printed lithophane “art”

When I first saw examples of 3D-printed lithophanes, I thought it was a great development of the technology for uses that may not have been originally intended. Lithophanes have a long history, predating all of our high-tech methods.

https://itslitho.com/itslitho-blog/one-of-the-most-unusual-artworks-from-the-early-19th-century-the-history-of-lithophane/

But some of the articles I read at first said that doing them with PLA via FDM was impractical, and you’d really need SLA for the increased accuracy and complexity available. But then I recently started finding articles that showed examples with quality white PLA, so I tried it. Sure enough, it’s fantastic.

And it’s ridiculously easy to get quality results. Just upload your image to https://3dp.rocks/lithophane/ and it will make an STL for you. Here’s the tutorial I used:

https://sovol3d.com/blogs/news/tutorial-how-to-print-lithophane-on-your-3d-printer

Lithophane as printed , still on print bed.
Same lithophane held up to a light source.

Latest utility print: Phone mount for Jeep JKU

I’ve tried vent mounts, seat bolt shaft mounts, and others. Everything sucked. But some kind soul designed a phone mount specifically for the area of the dash above the radio. It clips into the dashboard tray and the gap just above the radio, without disrupting buttons if you aim it just right. And it has a cutout for a wireless charger, specifically it seems to be deisgned for the Vinsic extra-slim wireless charger. Got one on the way to try out.

One comment says that a hot day caused enough meltage for his to fall and warp. He was going to try it in another material (PETG) to see if that helped. I haven’t printed in anything besides PLA yet, but it’s about time for my experimentation to move to the next level, so I’ll keep an eye on that.

It printed in three parts — the main front panel and the two side mounts. Fitting the mounts to the front piece was a VERY tight fit, I actually had to shave the mounts a bit with a razor, and still had to tap them in. Nice solid piece overall, and fits my Pixel 3 snugly.

Source: https://www.thingiverse.com/thing:2769593

Cornstarch solves more household problems

Ever since adding the two LACK shelves to my music lab, using the computer in there has been annoying. Actually, it was annoying before. The table is too low to use it while standing, so I either had to bend a little bit or sit. And since adding the monitor, sitting is a non-starter, because I’m staring up into the abyss.

I tried placing the keyboard up on the shelf, but the shelf is fairly narrow, and the monitor base got in the way. So off to Thingiverse I go, yet again, in search of Apple keyboard risers. I found this one, which looked promising. Initially I was looking for something I could adapt to have a slight overhang at the front end, so that it would be anchored to the shelf. But this one, bless the designer’s heart, has three insets for 5mm rubber beading. Two on the bottom, to keep it from sliding on a surface, and one on the top, to help keep the keyboard itself stable, although the channel for the rear undercarriage should keep it well in place.

Now the keyboard is right in front of the monitor, perfect for the occasional standing Google search or setting it up to monitor Octoprint. Rubber beading is on the way, but it’s reasonably stable without it!

Source: Thingiverse: https://www.thingiverse.com/thing:2811956

Filling my life with specialty cornstarch…

Yesterday I decided I was tired of using random nearby objects as a riser for purposes of elevating my airpod case in the wireless charger to where it can reach the level of the charger.

I started looking on Thingiverse for random airpod cases to see if one could be adapted for this purpose. Lo and behold, I found one. This one was offered as a Tesla-branded holder, but I chose the unbranded alternative that was also offered.

It sits nicely in the cradle, and elevates the case to just the right level to receive a charge.

Did you know that PLA is a thermoplastic derived from cornstarch? This was a recent revelation for me. It’s even compostable!

I find myself paying more attention to household annoyances and organizational challenges that can be solved with 3D-printed objects. My eye is frequently with the intent to design something, but every time so far, I have found something on Thingiverse that can be used without having to design from scratch. I am grateful to Thingiverse for providing this platform, and to all of the makers out there that put their designs out there for us to use and remix.

“Making” useful things

I printed a bunch of these today. Dual purpose, really. The intended purpose is to solve the “tangled filament” issue, where loose filament on the spool backs up when not under tension, and crosses under another row, and when being fed, it sometimes catches and stops feeding. If you don’t catch it, it will fuck up a print for sure.

Dragon clips

They’re called dragon clips, and they clip to the side of the spool, and have a smaller clip into which the filament clips snugly, keeping it taut when not feeding the printer.

Dragon clip in use

But when I printed this, I had an additional use in mind. My UV LED strips around my music lab tend to fall away from the wall mirrors they’re attached to as the adhesive backing fails over time. The strain of cables pulling on them tends to amplify the problem.

I was really hoping these clips would fit behind the mirror and hold the LED strips in place, and it looks like they’re going to work fine for that purpose.

Simple fitness timer / Arduino Uno R3

I’ve been working out religiously this year, and reading up on getting the most out of my workouts. I read something about optimizing the rest time between sets, and I started wondering how to best track that. The phone is a pain, because unlocking it, getting to an app, etc. is distracting and takes time. Laptop, same thing, plus I have to have a laptop in my workout area.

I started thinking, well, I have a whole bunch of unused Arduino Uno units and a 3D printer, maybe I could cobble something together. So what do I need? I want simplicity, so a box with buttons and a display.

I found this case shape on Thingiverse: https://www.thingiverse.com/thing:845415

It’s built for an Arduino Uno and the DFRobot LCD 1602 shield with buttons. The case even has 3D-printed button extenders that are used to press the buttons on the shield. Simple yet elegant. Ticks all the boxes.

I ordered the HiLetGo shield for $6.49 here: https://www.amazon.com/gp/product/B00OGYXN8C/ref=ppx_yo_dt_b_asin_image_o01_s00?ie=UTF8&psc=1

…and started printing the case. I decided to print in two colors for cool points. Black for the bottom case and buttons, silver silk for the top. Came out OK. I might sand & finish it later.

The shield arrived today. I quickly cobbled together some test code, attached the shield to one of my spare Unos and uploaded the sketch.

Nothing on the display. The backlit was lit, but nothing on the display.

Turned on serial in the code and added some debugging. Uploaded again. OK, good news, the Arduino is working, it’s moving around in the code, my button presses are recognized.

I tried adjusting the contrast via the onboard pot. Nothing.

Went to the amazon reviews/comments for the device. Finally found the relevant comment: “Adjust the ‘pot’ for contrast just realize this style pot takes ALOT of turn to get to the other end.”

So, with my tiny screwdriver, I turned and turned, for way longer than I would have expected, and eventually my sample text showed up.

Now I just have to write a quick sketch for button-initiated 60- and 90-second timers, and I’m good to go! Quick, no-fuss timer with customization capabilities and a simple interface and display. Might add a sound feedback in a future iteration.

UPDATE: Here’s my first stab at a script. Up gives a 60-second countdown, Down gives a 90-second countdown, and the screen shuts off when it’s done so you don’t even have to watch it closely. Screen shuts off after initial display, SELECT to see the very few instructions again.

https://github.com/dc540/arduino1602ShieldTimer

UPDATE 2: Here’s a link to a buzzer that will fit in this exact case. It’s not super loud when wired directly. Supposedly a transistor might kick it up a notch. https://www.adafruit.com/product/1740

As promised, Anet A8 vs Ender 5 comparison

And I realize this isn’t apples to apples. Other factors are involved. A lot of people have been able to get the Anet to print way better than this. But there’s a reason there’s a long list of “essential upgrades” for the Anet. It is a rock-bottom DIY machine. I’m not even going to call it entry-level. For entry-level, a primary requirement is ease-of-use. Lower quality can be excused, but entry-level should not frustrate users out of the hobby.

Left: Anet A8. Right: Same piece, Creality3D Ender 5

Here are two prints of the exact same part, side by side. Same Cura settings, good bed leveling. The piece is designed to hold glue sticks. The piece on the left, because of the inaccurate circle size printed, won’t even accept the glue stick. It’s just OFF. Can’t even jam it in there. No dice. The piece printed by the Ender, however, has well-rounded holes, and the glue stick just slips in with no friction as intended. The print is within spec.

Now for a closer look.

Anet A8 hole close-up
Ender 5 hole close-up

See how much neater and rounder the holes are on the Ender 5? I attribute this to the Anet having an acrylic frame and just being overall wobbly. And with an acrylic frame, you can’t really tighten it too much, else it will crack the acrylic. Accuracy is critical when printing parts that interact with other parts. Also note the uniformity in the fill lines. Still not perfect on this print, but way tighter. This is not because the nozzle is different in any way. It’s the same sized nozzle.

Next let’s look at the layer stacking.

Anet A8 layer stacking
Ender 5 layer stacking

Just so much cleaner.

Again, some of this is definitely attributable to my own skill level. I’m still relatively new at this. A proven amateur. My point is that I got these results from the Ender 5 with a stock, straight out of the box machine, after only adjusting the extruder steps/mm. This is the way.

I still had a bit of an issue with edge curl-up on this print, you might notice that in the side-by-side. I printed the next piece, which is nearly identical, with a brim, and also brought the nozzle just a hair closer to the bed, and about four hours in to a 13 hour print, it looks like edge curl isn’t going to be an issue with this one. As I get more attuned to this machine, I should get better at predicting and preventing issues like that.

Update: Indeed, the brim held, and the next two pieces were virtually flawless, with no corner curl-up. It’s possible the problem was nozzle distance and it would print fine without a brim. Further testing will reveal that, when I’m not trying to complete pieces.

How I Became Less Discouraged About 3D-Printing

A few years back, I bought my first 3D Printer. I settled on the Anet A8. Mainly because it was cheap. Partly because it was a DIY challenge, and I tend to take on challenges, but mainly because it was cheap. I had it mostly assembled, but reached an obstacle which I can no longer remember, and set it aside. Then in 2018, I moved, having never printed anything, and packed it up.

When unpacking the “lab” boxes in the new home, I decided to refocus my efforts on getting it up and running. I was able to continue where I left off pretty easily, and printed several things successfully, and many more things unsuccessfully.

I will now rattle off all the things I hated about the Anet A8. I hated them so much that it actually gave me a feeling of dread when considering a 3D print job. My failure rate was so high that more than once I ordered things printed on the open market rather than attempt them myself.

  • I hated the bed. The bed on the A8 sits low and moves back and forth on one axis. If the belt is even slightly off, too loose or too tight, print problems will occur. The bed was also leveled by SCREWS set in the corners of the bed, so if you add an alternate build surface, you have to move that out of the way to adjust the bed leveling. I added larger knobs later, but they were still problematic due to that design. Also, because the bed was flat at the bottom of the build area, reaching underneath to level it was painful.
  • The Z axis was controlled by TWO SEPARATE MOTORS on two separate threaded rods. Yet another thing requiring manual synchronization, or print issues will occur.
  • I didn’t know any better, but I hated the acrylic frame, because it made the whole thing a bit rickety, and “wobbled” during prints.
  • The hot end was physically attached to the extruder. Maybe this was a good thing, because you don’t have a bunch of unused filament hidden away in a long bowden tube, but if anything goes wrong anywhere in the hot end on the Anet, it’s a real PITA to disassemble and reassemble. It almost requires four hands to hold the extruder, hot end and fan all together while tightening the screws. Once I didn’t tighten the heater block enough on reassembly, and it vibrated loose and came off during the print, and dragged all over the piece, melting plastic in its wake.

It got to the point where I was afraid to run bigger and more complex prints because all too often they resulted in just wasted PLA.

So after losing all faith in both my printer and my own abilities to manage it, I finally started researching better units. Several friends had reported that the printers they purchased were far less maintenance-heavy and far more reliable. I’m a smart, adaptable guy, but it was a new problem every time, and I was tired of it.

So I bought a new printer last week. I settled on the Creality3D Ender 5. Still very affordable ($300) but a step up from the Ender 3. Four corner thick extruded aluminum frame. The bed moves up and down on the Z axis, while the nozzle moves on the X and Y axis at the top of the unit. The extruder motor and hot end are separated by a long bowden tube, which is alternately annoying and a relief.

Assembled the Ender 5 in less than an hour. Before printing anything, I measured the extruder for accuracy, and corrected the E-steps/mm. My first test print came out better and sharper than anything on the Anet A8 ever did, with no further adjustments. My first large print failed, but that’s on me, because I didn’t properly route and secure the cables and bowden tube, and they snagged on a motor. Ever since fixing that with a zip-tie, I haven’t had a single failure. I can reliably print large items now, and I wish this had been my experience in the beginning.

Same tray as in the earlier photo. It isn’t just the dragging hot-end that disturbed that earlier piece, the actual resolution of the print suffered because of the instability and wobble of the machine.
SexyCyberg Maker Coin, about 5cm diameter. The “hairs” are prominent in this photo due to flash photography, they are mostly loose and will brush out easily.

So if I have any advice at all to aspiring 3d-printer owners, it’s this. Get the right printer the first time. Don’t necessarily get the cheapest. Get something that someone you know recommends, or that gets great reviews. Learn calibration, learn bed-leveling. Consider a Pi 4 with a PiCam and Octoprint.

Would I recommend the Ender 5? Fuck yes. My friend has a CR-10S and he recommends that one as well, but I was trying to stick to a budget. I’m very pleased with this unit. I’ve got another piece being printed right now, and after only a few days, my confidence level has allowed me to forget about checking on it for a while. But it looks like it’s doing fine. But I have to focus that camera, LOL.

I’m waiting for a new spool of copper silk PLA to arrive in the next day or two. I have a large-ish complex piece I am going to reprint, because I’m unhappy about the results from the Anet. I will show a side-by-side comparison of the two pieces in my next post in the next few days.

Lock Bypass on a Zero Halliburton Centurion Elite Briefcase

I picked up this older briefcase at auction in 2018. It was a good deal. Listed as locked, no knowledge of the contents at the time, and sold for way less than a used case of this variety would normally sell for. I like these cases. Each half of the shell has small bracket tabs which can be used to install aluminum panels, making them ideal for portable radio or other instrumentation installs. I was confident I’d be able to get into it one way or another.

Indeed, I was able to get in by popping the hinge pin. From there I was able to remove the lock mechanism from the inside. It’s not a sophisticated protection mechanism, nor is it a particularly secure case. I’m going to venture to guess the new ones are even less secure, since they have TSA locks.

I spent quite a bit of time (before popping the hinge pin) brute-forcing the lock. You’d think that with only three 0-9 dials, just 1,000 possible combinations, that that would be sufficient, but I found that even with several tries, before and after removing the lock mechanism from the case, I was unable to make it happen. I think it’s a matter of imperfections in repetitive motions. After a certain amount of times, I guess your hands just “expect” the movement to continue to fail, and you fail to follow through with enough strength to clear the mechanism even when you get the right combo.

Last night I decided to give it another go.

When brute-forcing with the lock attached, the test is to attempt to open the case. When brute-forcing with the lock removed, the test is to attempt to slide the combination-reset switch on the back of the mechanism, which won’t budge without the right combo. Again, repetitive motion attention failure likely prevented this from working properly, so I went back to the drawing board and researched bypass techniques with wheel-based combination locks such as this one. I found one technique involving proving to the right of the wheel with a narrow probe while turning the wheel and feeling for a “notch.” I tried that, and lo and behold, I found that each wheel had a notch point, in my case corresponding to “7-5-8.” I engaged the reset switch, and it worked!

The reset switch is engaged by sliding it inwards, then upwards. It can only be engaged while the correct combo is set, and while engaged, any changes to the dials result in a change of the combination. I reset the combo to 666, just so it’s easy to remember for now, and reinstalled it in the case. Tests showed that the new combo works, and the case is both lockable and unlockable.

Here’s a photo of what the notches look like without the front cover. Interestingly, this mechanism, a Prestolock 2046 or 2546, is installed by screwing the lock mechanism directly to receiver tubes on the front cover from the inside. With the lock installed, you can’t see these notches. But knowing they’re there, on this and lots of other wheel-based combo locks, will help you to easily determine the current combination and disengage the lock. If your lockpicks are thin enough, they may work for feeling these notches even with the front cover engaged.