Friday, February 27, 2015

High resolution test with the Piclop

I mentioned the Piclop on the 3D scanning subreddit and ComeOnDoolittle asked me about scanning some rather unusual objects: stone arrow heads or spear points.  Sadly,  I didn't have either. As a substitute I tried scanning a couple of small rocks, but the results weren't really all that interesting and I wasn't sure they would be applicable, though ComeOnDoolittle was satisfied with the early results.

Enter eBay, where it's well-known that you can buy anything, including stone arrow heads (spear points too, but they're quite a bit more expensive). Many are quite pricey, but after a little shopping I found a nice-looking one described as an "Authentic Missouri arrowhead", selling for the very reasonable sum of $2.99. Although shipping almost doubled that, an arrow head for $6 seemed like a good buy.

As soon as it arrived, I realized that I'd need some kind of support in order to put it on the scanner turntable. I've seen people use clay or blu-tack in order to anchor objects, but I didn't have either one handy, so I improvised with some stiff wire wrapped around the base. That's visible in the scans, I think it could be edited out. Still, some clay would be a better bet. And of course the arrow head would need to be turned over and have the base scanned too in order to get a complete picture; I haven't done that yet. Here's what it looks like mounted to the turntable:

I've used the arrow head for several tests now, leading up to the first attempt to do a full-resolution scan with both lasers, 5 megapixel mode on the camera and 3200 steps/revolution. And here's what that looks like:

I am impressed with the quality that the scanner has been able to achieve. There's actually a bit less detail in the point cloud than it appears, because the color changes trick the eye into thinking that there are shape changes too; nevertheless, the scanner managed to get the proportions right and avoid any extraneous points. The edges are pretty sharp too, just like the original.

There was also a question on the Google+ ATLAS group about how much CPU load the Raspberry Pi 2 was under. I installed a simple monitoring application called RPi-Monitor and used it to display the load average during the scan:

I started the scan at 22:22 and it finished at 01:44. The long-term average during the scan was about 0.6, but RPi-Monitor itself puts a background load on the machine of 0.2-0.25, so the actual usage by FreeLSS is less than 0.5 for the scan, and about 1 during the final processing. When I was monitoring the load average at the CLI, before installing the monitor software, I was seeing those kinds of levels; the processing peaked at about 0.9 or so. Since the processing is taking most of one CPU and the Pi 2 is 900 MHz versus 700 for the B+, I think that means there is a speed-up during that phase. Of course, if the processing step could be multithreaded the difference would be much more dramatic.

And for anyone who would like to play with it, I've posted the compressed PLY file on Drive:  1424913318.ply.gz  Be aware that it is a 24 MB download and will uncompress to 83 MB. I've been using Meshlab to view all the PLY files, though I confess that I don't know enough about the program to do anything other than look at them, yet. That's the next thing to learn. . .

Friday, February 20, 2015

Camera holder for the Piclop

My early experiments with the Piclop were done with scotch tape holding the camera module onto the front of the tower; that worked, but obviously wasn't going to be a satisfactory solution. I planned for a simple mount that would hold the camera right against the front of the tower, but after a few scans discovered the need to adjust it at least a little. The camera module needs to be perfectly vertical when viewed from the side; in other words, parallel to the Y axis, which is perpendicular to the turntable surface. It also needs to be aimed directly at the center of the turntable, using the "Camera" screen in FreeLSS and lining up the red cross-hair to hit the center. And that cross-hair also needs to be vertical, which I measured by putting a square on the turntable.

The camera mount I've come up with is easy to print and install, solid, and allows fine motion for two of those adjustments. However, it can't adjust the third, and in that respect it is somewhat lacking; I have a workaround, but ultimately it may need to be replaced with a better design. The files are on Thingiverse: It's still a work in progress because of the limited adjustments; in the meantime though, here's what it looks like.

My apologies for the overexposed pictures; it's really hard to take good photos of shiny black PLA. As you can see, the case is very simple, printed in two halves that snap together to hold the board. The four mounting holes on the board line up with holes in both halves, and M2-20 screws pass through all three and thread into the camera tower.

The case is held away from the tower by a ~1 cm square of closed-cell foam about 4 mm thick, cut from a piece that some electronic components were shipped in. The idea is to provide a little spring effect between the tower and the case, so it will be held against the screw heads and they can be tightened or loosened to adjust its position. Four small springs under the screws would do the same thing, but the foam seems simpler.

The first adjustment I made was to line up the case vertically, by setting a square on the table and making sure that the front of the case was parallel to its edge.

Second, I set the square on the turntable with its corner at the center and went to the Camera page in the FreeLSS web interface, and made sure that the red crosshair was in line with the edge of the blade. The camera mount doesn't have the ability to make that adjustment; that's the limitation I mentioned above. Theoretically the squareness of the printed parts and the flat table should have ensured that the alignment was good, but it wasn't quite close enough. The simplest way to achieve that was to shim the right edge of the turntable with some folded paper. For a permanent solution I'll glue some paper to the bottom of the turntable, but I also need to make sure that my table is entirely flat, which it might not be.

The final adjustment was to make the camera point directly at the center of the turntable, which is easily done by loosening or tightening both screws on one side. Here's what the picture should look like once everything is lined up.

That completes the camera alignment, at least as far as I understand it to this point - if there's a step I missed, I'll be sure to edit this post to correct things. While I have the square on the turntable, though, I also line up the lasers. In the same FreeLSS page there are buttons to toggle each laser on and off, so I turn them on one at a time and make sure that they are focused, vertical and lined up with the very edge of the square. This is the result after both have been aligned.

That's the whole alignment process, and once it is done the scanner should be ready to be measured for calibration.

Tuesday, February 10, 2015

Piclop Bill of Materials

My accumulation of parts for the Piclop build is complete, and here's the Bill of Materials that I've come up with.

Item Source Price
Raspberry Pi Adafruit or MCM Electronics $35-45
Raspberry Pi camera Adafruit or MCM Electronics $25-30
8"/200 mm camera cable Adafruit $2
NEMA 17 stepper EMSL $15-16
16014 ball bearing Amazon/WJB $10
line laser module AixiZ (on eBay) $8 each
A4988 stepper driver MakerGeeks $10
ULN2003A driver IC Discount Components Warehouse (on eBay) $7.49 (for 10)
RasPi HAT protoboard Adafruit $5

I already had a few things to start with, including the Raspberry Pi; however, it was the old model B and the availability of the new Raspberry Pi 2 was too much temptation, so I've replaced it. It isn't hard to find a place to buy the Pi 2 but it can be difficult to find one that actually has stock, at least until the manufacturing catches up with demand. In the meantime, if you have a Pi of any flavor it should work fine, and the Pi 2 will be a worthwhile upgrade when they're more readily available. You'll also need the Pi camera of course, which luckily has been out for a while and is easy to get. And in order for it to reach the front of the mount, the cable needs to be a little longer; Adafruit makes an assortment, of which the 8"/200 mm seems to be about right. That could change, though, if it turns out the camera needs to be mounted differently; I also ordered a 12"/300 mm just in case.

The turntable doesn't ask much of the stepper motor used to turn it; the big bearing keeps the friction low even for heavy objects, and prevents binding from the weight being off-center. EDIT: the original version of this article listed two motors that are 48 mm tall, and I've since been told that they won't fit in the Ciclop turntable base. That makes the motor selection a lot more difficult. The motor that remains in the BOM is not the one I'm actually using, but one that I've bought in the past to upgrade a 3D printer and can recommend. However, it is 1.8 degrees per step, or 200 steps per revolution. With standard 1/16th microstepping drivers like the A4988, that means 3200 steps per complete revolution. The default setting for FreeLSS is twice that, 6400 steps, which is most easily obtained by switching to a motor with 0.9 degree per step. They're less common, and I have not yet found someone who sells a 0.9 degree per step motor that's less than 48 mm tall. For reference, the motor I'm using for the Piclop is a Wantai 42BYGH610P2, but the supplier I bought it from is out of stock and doesn't appear to be re-ordering.

The big 16014 bearing is a key feature of the Ciclop turntable design and I think it's an excellent idea. They aren't the easiest things to source, however, with prices ranging from $10 to well over $100. The one I listed was amongst the cheapest I found at $10, though shipping doubled that price. It seems to be well-made and works fine but if you can find one locally you might be able to do better on the total cost.

I did some shopping for laser modules before settling on the ones from AixiZ; they're available from many sources, but I was concerned that most of them don't have the ability to focus the laser optics. In normal use they'd be expected to be used over a considerably longer distance than we'll need for the scanner and without focusing I was afraid they'd produce a blurry line. AixiZ seemed to have a good reputation, and later I heard from Uriah Liggett, creator of FreeLSS and ATLAS, that he likes their modules. One thing that I didn't realize at first is that they're somewhat larger, at 12 mm diameter; the original Ciclop holders were made for 8 mm modules and needed to be redesigned to work with these lasers.

The driver board needs two ICs, the A4988 stepper driver (which is actually a tiny circuit board with the IC and a bunch of other components) and a ULN2003A Darlington array to drive the lasers. Both are widely available; most 3D printers use the A4988 to drive their steppers and if you use RAMPS on your printer you may already have a spare (if you don't, I highly recommend buying one!) I got mine from MakerGeeks since I was ordering other things from them anyway, but they're essentially generic items. The ULN2003A is even more generic, so I picked an eBay seller with a good rating and a decent price, albeit for a pack of 10 chips; I figured I might need spares, and the cost of buying just one was going to be several dollars by the time I paid for shipping from a commercial supplier. I'm hoping to assemble the circuit on the Adafruit protoboard HAT, though it will be tight; I haven't yet tried to wire it.

There are three voltage levels needed for the FreeLSS driver circuit: 12 volts for the stepper motor (via the A4988 driver), 5 volts for the Pi, and 3.3 volts for the laser modules. It's easy to get all three from a modern PC power supply, but I didn't want to have that kind of bulk. For testing, I've been using a supply that I salvaged from some old equipment, capable of 3 amps at both 12 and 5 volts, with a regulator on the protoboard to produce 3.3 volts. For the final product I'll either continue with that supply or just bring 12 volts to the board and use separate regulators for the other two, depending on the real estate that's available.

Of course all the parts needed to be printed, and for that I decided to start with a fresh roll of 1.75 mm PLA; I hate running out partway through a project and having to change colors! For this one I picked MakerGeeks 'Dark as Night' black, one of the filaments that they have started to make in-house. The quality has been excellent and the prints are very nice; the only thing I noticed is that it wants to be a lot hotter than any of the other PLA I use, 225° C rather than the 200° I am used to.

Friday, February 6, 2015

Ciclop turntable build

I've finished the Ciclop turntable assembly (using the files from GitHub) and it is solid and functional, and looks quite nice in my opinion.

The base is chunky but with pleasantly rounded lines; the turntable support and bearing clips go together well without any cleanup or fitting needed; the motor-to-turntable connection is well thought out and makes assembly very easy. The only problem is that some of the nice features also make it hard to print.

The pretty arch on the bottom of the base is a classic no-no in FFF printing, starting off easy but becoming an impossible overhang. And not visible in my photo but just as important, the flat area where the motor attaches is also unprintable, even as a bridge, because it has to contain the holes for the motor shaft and the four attachment screws.

There are a couple of ways this could be dealt with. One would be to slice the entire piece in half horizontally, to allow the curved base to be printed upside-down and the flat top upright, with screws holding them back together. A small redesign might even allow for the four motor screws to to the job. I don't know for sure whether the flipped lower part would print cleanly, but I think the fillets along the curved edges would help.

All that said, the motor base does print; even though the finished product is a little bit sloppy the problem areas aren't readily visible, and it is still entirely functional. I did some basic cleanup of strings and drooping lines, and had to drill the holes for the M3 screws to mount the motor since they were completely closed over; I was able to use the top infill pattern to locate them pretty well. It is printable because the designers at BQ included hand-drawn support material, visible at the edge of the arch. Slicer-generated support material is a mixed bag in my experience, typically effective but often very difficult to remove. In this case it might be a real improvement though, since the supports as supplied were barely functional. The very large and solid puck at the bottom printed fine, but the tiny, single-walled tubes that were intended to do the actual support work were too weak and didn't print cleanly, with only about half of them making it all the way to the point where they were supposed to hold up the overhangs.

The finished product is the first functional part of the scanner, so naturally I had to jury-rig a circuit to allow the Raspberry Pi to drive it. I have more appropriate prototyping parts coming in the mail: an Adafruit T-Cobbler to connect the GPIO pins instead of using spare motor and endstop cables, and a USB serial console cable (also from Adafruit) that connects directly to the right pins. But this bodged version was able to make the turntable spin, and by good luck I actually connected it to turn in the correct counterclockwise direction.

Power is coming from a tiny switching supply that I salvaged from an old external disk enclosure; it produces 12 and 5 volts at 1.5 amps each, which ought to be enough for this project. While testing I'm using an old Model B Pi, but I have a shiny new Pi 2 waiting in the mailbox to replace it.

Next up will be printing the parts for the other end of the scanner; the camera and laser holders. I've had to redesign both of them in order to match my parts and the physical layout that the FreeLSS software prefers, so while those print I'll document the Bill of Materials, so far.

Tuesday, February 3, 2015

Building the Piclop

The last few weeks have been exciting - at least, if you get excited about 3D scanners that you can build at home. In the past have been plenty of announcements of 3D scanners, either using multiple cameras or lasers, including fully commercial models and ones that were introduced through crowdfunding. But they've mostly been closed-source and expensive.

The announcement that started the excitement was the CES 2015 announcement of Ciclop, from Spanish company BQ. The primary parts of the scanner are mostly printable on standard home 3D printers or available at hardware stores (though with one notable exception) and the electronics are based on BQ's nice-looking Arduino board (the ZUM BT-238) and a custom shield (the ZUM SCAN). The camera is a Logitech USB webcam, and the entire assembly is orchestrated by BQ's Horus software, running on Linux or Windows (and with future possibilities for OS X, since it's written in Python).

The second new scanner is the ATLAS, brainchild of Uriah Liggett. Rather than using the ubiquitous but somewhat underpowered Arduino, he wrote his software for the Raspberry Pi, a package called FreeLSS. To go with FreeLSS, Uriah designed a scanner that can be almost entirely printed, and decided to fund further development with a wildly successful Kickstarter that has raised more than 60x his original goal. The Pi already had a nice camera module, and Uriah designed a simple board to let the Pi control the stepper and lasers, analogous (and similar) to the ZUM SCAN.

As far as I'm concerned, each design has strengths and weaknesses. I like the Ciclop's mix of printed and manufactured parts; the custom pieces are natural choices to be printed, and using threaded rod for the structural bits is inexpensive and solid. Their choice of 8 mm rod is especially convenient for those of us in the non-metric US, since 5/16" rod is a perfect substitute. The only difficult piece is the large 16014 bearing that supports the scanning turntable. It's a very good idea; the bearings in the stepper motor aren't designed to hold up a heavy item while it is being scanned, and relying on the 5 mm wide shaft as the only support for the turntable is a recipe for wobble and long-term wear problems. The bearing appears to be a common one, too, but unfortunately the price varies all over the place; I've found them as low as $10 (albeit with $9 shipping) and as high as $105. Apparently they're used for ATVs and similar vehicles, and I imagine that enthusiasts have opinions about which work best for them. For a scanner turntable, I think the $10 version will be fine!

What I don't like about the Ciclop is the requirement for a dedicated computer to run the scanner, on top of the Arduino/shield/webcam combination. The ZUM Arduino board costs $40 US (plus unknown shipping), I'm guessing that the shield will probably be $30 based on the components. Add the webcam and you're up to around $100; on top of that, you need a computer to which the scanner will be tethered with USB.

The ATLAS has the opposite set of problems. I understand the desire to print as much of the machine as possible, but in my opinion making the frame out of a dozen pieces, all of which have to be screwed together, is taking the concept too far. The Ciclop uses a couple dollars worth of threaded rod and nuts to save hours of printing and effort, and the frame will certainly be stronger and stiffer. Although some of the design details are still being filled in, it also appears that the ATLAS turntable is only attached to the stepper motor.

On the other hand, FreeLSS looks like a great solution. A Raspberry Pi replaces the Arduino and the attached PC, handling both the machine control and processing tasks (yes, it looks as though the new Pi 2 will do an even better job, but nobody has been able test it yet). A simple adapter board holds a standard stepper motor driver module (the Allegro A4988 that most of us rely on for our 3D printers) and a Darlington transistor pack that lets the Pi switch the lasers on and off. The system is designed to be networked and headless, accessed via a webpage that it serves up. The Pi camera has higher resolution than most any webcam and, at $30, costs even less. Its ribbon cable is not as friendly as the typical USB round cord and the one that ships with the camera is too short, but replacements are readily available. All together it is a straightforward, inexpensive and powerful package.

The best thing about both projects, of course, is that they're entirely Open Source. Ciclop is Creative Commons licensed (CC-BY-SA) and both Horus and FreeLSS are GPL; ATLAS hasn't yet been released but is promised to be open. That means I can take whatever I think is best out of both of them, and that's what this project is all about; a physical design based on Ciclop (with some modifications) and driven by FreeLSS on a Raspberry Pi. Hence, Piclop!

In the next post I'll talk about the printing that I've done so far, and the parts that I think need to be reworked or redesigned, as well as the initial BOM and sources for the electronic parts. One other note; the ATLAS Kickstarter is wrapping up as I write this, but there's still time to get in. Although I'm not using all the same parts that Uriah is sourcing, I believe that everything he's chosen would work fine for the Piclop, and his professionally made boards will be a lot nicer than the homemade versions that I'll be making. Even if you don't want a parts kit, a contribution to the project is certainly worthwhile given the effort he's put into making FreeLSS available for all of us to use.
Creative Commons Atribution Share-Alike license (CC-BY-SA) - See more at: