2013年5月1日 星期三

3D Scanner: Splinescan Project

自從有了3D印表機,其實還想再去找3D掃描器來做。(其實想做的太多了,包括自己建立一個更大的FDM系統、桌上型CNC、雷射切割機…) 所以我先找了一個OpenSource的計畫來閱讀一下:Splinescan Project。這是一位叫Andrew Lewis的英國人在2009年開始的計畫,然後在2010年Make雜誌上出現該project的內容。但十分可惜的是Software、Firmware的內容著墨不多,以至我還是無法由文章之中確定雷射如果運作得到點座標資料,再建立CAD的。但不管,我還是先翻譯出來,再繼續找資料。
1. Overview
3D Scanner主要分成四個部分:
(1) 主架構Chassis: 這是掃瞄器主要結構,必須夠堅固才能把東西放在上面旋轉。This is the backbone of the scanner. Everything fits onto the chassis, and it needs to be rigid enough to withstand the weight of all the other components, and whatever you intend to put onto the turntable.
(2) 齒輪箱Gearbox: 使用步進馬達來轉動待測物體,透過齒輪比換成我們要的速度,不過並不會太複雜。This part takes the turning force of the stepper motor and turns it into something more suitable for our needs. It’s a simple design with only a few components.
(3) 電子零件Electronics: 我們電腦也要連結到這台機器,上需就要一些電子零件來當窗口。The brains and nerves of the scanner allow you control the turntable from your computer. The wiring is not difficult, and only limited soldering knowledge is required.
(4) 軟體Software: 文中沒有提到這一塊,但目前看來是使用SplineScan來把資料傳進來變3D檔。

2. 材料清單 PARTS /TOOLS(1) Hot glue 熱熔膠
(2) Spray mount adhesive (1) 噴霧黏劑
(3) Plumbing end caps ½” (2) 銅管蓋 (直徑配合以下銅管)
(4) Copper pipe ½” diameter, about 6” lengths (2) 銅管6吋長
(5) Copper pipe 22mm, 65mm lengths (4) 銅管
(6) Aluminum sheet 333mm x 250mm x 3mm (2) 鋁板
(7) Aluminum sheet 150mm x 150mm x 3mm (1) 鋁板 (做旋轉板)
(8) Project enclosure aluminum, 160mmx103mmx43mm (1) 鋁箱 160x130x43
(9) Steel shaft silver, 4mm x 333mm (1) 棒軸 (直徑4mm333mm)
(10)Flange ball bearing Miniature, 4mm bore, 8mm OD, 3mm width (2) 法蘭承靠球軸承 (483)
(11) Nylon gear with brass hub, 10-tooth, 4mm bore (1) 尼龍傘齒輪中間帶黃銅套
(12) Plastic worm drive (1) 塑膠蝸輪蝸桿組
(13) Bipolar stepper driver/motor combo(1) 二相步進馬達
(14) Hook-up wire about 1m each 20 gauge or so; 12V at 2A, red and black (1) 紅色&黑色電線(12V2A)
(15) Laser line generator (2) 線性雷射光產生器
(16) Resistor 240Ω (2), 620Ω (2) (1) 電阻240歐姆 & 620 歐姆
(17) Voltage regulator IC LM317 (2) 穩壓器 LM317
(18) Diode 1N4001 (1) 二極體 1N4001
(19) Mono jack socket ¼” (6) 單聲道插座
(20) Cast phono plugs Neutrik ¼” (2) 音源線插頭
(21) USB A to A cable (1) USB A頭對A (沒說是A公還是A)
(22) USB socket Rear panel, double (1) USB插座 (2頭 to 1)
(23) Power supply 12V, 2A (1) 電源供應器 12V
(24) Socket 2.5mm DC (1) 2.5mm插座 (for電源的)
(25) Photographic gimbal head (1) 萬向節頭
(26) Bolts M3x25mm with nuts (9) M3螺絲25mm & 螺母
(27) Bolts M4x75mm with nuts (4) M4螺絲75mm & 螺母
(28) Plastic ball casters (6) 塑膠腳輪

Step 1: Make the chassis.

1. 44mm的洞在上下鋁板子(6),然後中間套65mm長的銅管(5),用M4螺絲固定(27)。延著上板長邊鑽6個孔給1/4吋的單聲道插座(19),孔的大小請依插座配合。鑽孔時的配對,可參考零件規格圖或自行量測後再鑽。先鑽小,再鑽大。Drill 4mm holes in the corners of the top and bottom plates, to accept the 65mm bolts that hold the chassis together. The 6 larger holes along the longest sides of the top plate are for the ¼" audio jacks. The outer diameter of the jack may vary depending on the brand you use. Use the exploded parts diagram and the template to decide on the hole sizes for the other parts of the chassis. Hole sizes will vary depending on product brands, and the best rule (after "measure twice, cut once") is to start small and drill bigger if need be.

2. 上圖左下方白色橢圓形的孔是要給USB(22)用的。最好可以使用桌機內部常用的USB座。大部分賣電腦的地方都有賣,但因為不是標準件,所以大小尺寸不一。所以一樣在自行量測後再鑽孔安裝。The small oblong marked on the top template is just a guideline for positioning the USB socket. The best source of USB sockets is a computer port extender that fits inside your computer and connects to the motherboard . Most computer shops have these on the shelf, but the design isn’t standard and the mounting holes can be in any position. If you want to fit your USB socket to the chassis, now’s a good time to mark and drill the holes using your socket as a template.

3. 兩塊鋁板用4M4螺絲加65mm長的銅管(5)隔開,銅管的直徑不是太重要,但記得要鎖,不要歪掉。The 2 aluminum plates are held together by 75mm M4 bolts and spaced apart by bits of copper (or plastic) pipe. The exact diameter of the pipe is not important. Cut four 65mm lengths of pipe and put one at each corner of the top and bottom plates. Feed the bolts through the corner holes in the top and bottom plates, and secure them temporarily with a nut. Make sure everything lines up correctly, and then disassemble the parts again.

4. 現在所有的洞都打好了,你可以把毛邊除一下。Now that all the holes are drilled, you can apply any finishing touches, like painting the copper and aluminum, and polishing any plastics.

5. 轉盤(7)是被6個塑膠球腳輪(28)撐著,這時候可以把腳輪先定位。塗上一點膠不會有太大的傷害。The turntable is supported by 6 plastic ball casters, which can be pushed into place at this stage. These should be a tight fit, but a little glue won’t do any harm.

6. 安裝61/4吋的單聲道插座(19),從下面往上裝。這些可以讓你有多個位置使用2個雷射模組。接下來可以來安裝齒輪箱和馬達了。Install the six ¼" jacks, which go down both sides of the top plate; these will let you use 2 laser modules in various positions. With that done, you can turn your attention to the gearbox and motor.

Step 2: Make the gearbox.

1. 在盒子較大的那一面鑽孔,讓馬達的軸棒可以穿過其中,接塑膠蝸輪螺桿(12)。然後在盒子的四角鑽孔,待會用來安裝盒子本體用的。Drill a hole through the center of the largest side of the box, to allow the shaft and the plastic worm drive to pass inside. Drill holes at the corners of the box that line up with the mounting holes on the motor, using the motor as a template.

2. 接下來將蝸桿的洞擴孔到6.5mm以讓馬達的棒軸塞進去(其實要現配馬達的軸徑),然後剪掉蝸桿長度,以配合盒子內的空間。再來為了要讓蝸桿不要打滑,所以可以滴快乾膠來黏住蝸桿與馬達桿軸。Next, enlarge the hole in the plastic worm drive to 6.5mm so it will fit onto the motor shaft, and cut the worm drive to the length of the motor shaft. It should be a tight fit, and you might want to dab a little epoxy on the end to make sure the shaft stays put.

3. 8mm的洞在盒子的窄側,用來安裝法蘭承靠軸承(10)。這裡需要十分注意位置精度的問題,因為軸承要套軸棒,而軸棒要套蝸輪,蝸輪與蝸桿又有配合的關係,所以要十分小心位置的設計。(按編:其中這個步驟應該要注意軸棒垂直度才對,因為不準的話,上面的轉位會不平,位置配合應該交給馬達安裝時來調整。)Drill 8mm holes through the narrowest sides of the box, to house the miniature shaft bearings. This step is quite tricky; the holes need to be positioned so that plastic cog and the worm gear mesh together accurately. Measure carefully, and allow plenty of tolerance in the motor mounting holes. Remember that it's much easier to reposition the motor than to reposition the bearings.

4. 將軸承套入盒上(不需要上膠),穿上棒軸。這時可能十分難穿過,可以用膠鎚輕輕敲入。Push-fit the bearings into the holes (they shouldn't need glue) and then slide the shaft through the first bearing. This will be quite a tight fit, and might need a gentle tap with a heavy object to push the shaft through.

5. 現在裝入馬達,包括蝸輪蝸桿。我們可以轉動馬達來試試看,讓蝸輪蝸桿適當的配合,最後用螺絲將馬達固定在齒輪箱上。(按編:因為馬達會振動,所以螺絲鎖上去的時候中間還是要再墊橡膠來減振。) Now fit the motor (with the worm drive on the shaft) into position and bolt it in place. You can also move the 10-toothed gear on the 4mm shaft so that it meshes with the worm gear, and fix it into position using the small setscrew on its brass hub.

6. 接下來把齒輪盒的蓋子蓋上去,就差不多完成齒輪箱了(按編:建議塗點黃油在齒輪上)。然後把齒輪箱用M3d的螺絲鎖到主結構的上鋁板之下方,同樣地,還是以現配去鑽孔。文中也建議用墊片隔在齒輪箱與上鋁板之間,去使塑膠的齒輪箱可以適當地案裝在鋁板上。Fit the end caps in place, and you've almost completed the gearbox. Screw the gearbox into the chassis top with M3 screws, using the top as a template for the holes in the gearbox. If you use a 3.5mm drill bit, you can tap the holes in the gearbox and screw directly into it. You may want to include some packing washers between the top of the gearbox and the top plate of the chassis, to accommodate the plastic sides of the gearbox.

Step 3: Make the turntable.

1. 3mm的鋁板切成我們所需的旋轉盤,當然用硬度足夠的塑膠也是可以。然後在中心的地方鑽4mm的孔,並安裝4mm的輪轂,再快乾膠黏起來。但我另一個做法是在輪轂上鑽洞,然後用3mm的沉頭螺絲從上下端把輪轂與鋁板固定起來。Cut the turntable from a piece of 3mm aluminum or rigid plastic using the template at splinescan.co.uk. Drill a 4mm hole in the center and fix a 4mm mounting hub in position, using a 4mm shaft as a guide. You can glue this if you wish, but I modified the hub and used 3mm countersunk bolts to hold the hub in place.

2. 將轉盤放到機殼上,並調整棒軸的長度,使得轉盤在適當的高度(當然棒軸不能超過轉盤)。然後用內六角扳手把安裝螺絲鎖進輪轂來固定軸棒。(按編:其實可以去買軸聯結器,一端用來固定鋁板,一端用來固定軸棒,又可吸收軸心未對齊的誤差)。最後把板子表面貼上漂亮的墊子或塗漆。Fit the turntable in position on the chassis, and cut the shaft so it won't protrude above the turntable. Fix the turntable onto the shaft by using a long Allen key to tighten the grub screw (setscrew) in the hub on the underside of the turntable. To finish the turntable, you can cover it in sticky-backed foam or paint it with a matte finish.

Step 4: Mount the electronics.

1. Milford Instruments的馬達控制器是使用序列訊號控制的,然後再轉成馬達的運動。把馬達與控制器接起來,除了電源供應的線要另外接到2.5DC插座上,而這個插座要安裝在板子的上方,方便安插。The Milford Instruments motor controller takes a serial port signal and converts it into motor movement. The motor wires connect directly to the controller board, leaving only the power wires, which are attached to a 2.5mm DC socket on the side of the chassis.

2. 原作者將DC插座安裝在桌電擴充式的USB插槽板上,DC插座直接連結到USB插座 (這裡我還真的看不懂作者在說什麼)。馬達控制器需要12V的電源而電源供應器也是用音源插座來供電……(我想作者要說的是電源供應器進來的之後,各別分接到插座上與馬達控制器上) I mounted the DC socket in an old blanking plate from the rear of a PC (the same plate I took the USB socket from). The DC socket is wired directly to the USB socket in the top of the chassis plate (red to red, black to black). Connection is made to the PC using an ordinary USB A-to-A cable. The motor controller needs 12V to operate, and the power supply also powers the jacks. You can connect the jacks directly to power via the DC socket; this is acceptable if you don't like soldering and you want to keep things as simple as possible.

3. 這樣子的接法有個缺點,就是音源插座上永遠都是有電的,意思就是雷射收發器和光源若都插到音源插座上,那就一直都是開的,即使機器沒有在動。另一個更棒解決方案是把馬達的電源接出來,再使用二極體避免電流倒灌。這樣的優點是當控制器被關掉的時候,雷射收發器和光源也會被關掉。但若馬達是在暫停的狀態被鎖住時,雷射收發器和光源還是開著的。 The drawback is that the power to the jacks will be constant, meaning that any laser emitters or lights plugged into the system will always be switched on, even when the machine is idle. A more elegant solution is to draw power from the motor, using diodes to prevent current feeding back between the coils. The advantage of this method is that when the controller board powers down the motor, any lights or laser emitters will switch off. If the motor is idle but locked, the lights will be switched on.

4. 注意:你可以使用Ardunio配合適當的外加板來控制步進馬達,未來掃描器可能會都用Ardunio當作標準。只是因為我在另一個計畫中使用Milford的控制器了,所以就用現成的。NOTE: You can also use an Arduino with a suitable motor shield to control the stepper motor, and future versions of the scanner may use Arduino as standard. The truth is that I already have several of the Milford Instruments controllers left over from another project, and I don't have any spare Arduinos at the moment.

Step 5: Make 2 laser emitters.

1. 假如你有興趣在3D的掃描,那你會需要電射射出器插在你的音源插座上。同樣地,你也可以做一個插入式的LED模組來照亮轉盤上的物體。但從音源孔出來的電壓大概是12伏左右,而雷射發射器與LED燈大部分都比這電壓來得小。所以這時需要用穩壓器來降壓,原文作者建議使用LM317If you're interested in 3D scanning, then you'll need to make laser emitters to plug into the jacks. Similarly, you could make plug-in LED modules for illuminating objects on the turntable. Power taken from the jacks will be around 12V, and since most laser emitters and LEDs use substantially less, you'll need to step down the power using a monolithic voltage regulator. I recommend the LM317, which can be wired to produce a range of different voltages.

2. 電射射出器的外殼設計十分簡單,原文作者用Neutrik Cast Phono的塞子,這個塞子剛好可以塞在銅管孔。作者說這剛好有足夠的空間給穩壓器和小型的線型雷射產生器。然後用標準的塞蓋去蓋著每個射出器的頭,再塗成黑色的。並且用熱熔膠與安裝螺絲固定這些射出管棒。 The design of the emitter casings is quite simple. I used Neutrik cast phono plugs, which fit neatly into copper pipe. I had ample space to fit the power regulator circuit and a tiny laser line generator that I got on eBay. I used a standard plumbing end-cap to finish the top of each emitter and then painted them black, and held the copper tube onto the cast plug using a combination of hot glue and grub screws.

Step 6: Install and run the control software.

1. 控制轉盤是非常簡單地,不論是使用作者的Milford還是各位自己的序列通訊方法。作者提供了Python libray和這個馬達溝通。codehttp://www.monkeysailor.co.uk/code.php。各位可以去下載來用。Controlling the turntable is very easy using either Milford's own software or simple serial communication. I have provided a Python library to interface with these motor controllers, motorcon.py, in the code section of my website at http://www.monkeysailor.co.uk/code.php.

2. 原文作者的"巴比倫"版本SplineScan軟體 (作者用它來掃描巴比倫石碑),可以直接支援這種轉盤掃描。它完全是一個開放軟體,是200912月在splinescan.co.uk發布的。所以如果你有興趣在3D掃描,那你是幸運的。SplineScan是用Python和子模組Pygame寫成的。Python是一種物件導向的程式語言。詳請請參閱:http://zh.wikipedia.org/wiki/Python
My "Babylon" version of the SplineScan software (I used it to scan Babylonian stone tablets) will support this turntable directly. It's completely open source and was released in December 2009 at splinescan.co.uk, so if you're interested in 3D scanning then you're in luck. SplineScan Babylon uses Python and Pygame, and has been designed to work on Linux, although it should work quite happily on Windows machines, too.

3. 所以,現在你有了一台用電腦來控制的轉盤,並且應用在開源的3D掃描上。作者最後在機器上做一個外罩,以免每次操作房間充滿雷射光。未來還可以加上擠出頭變成極座標的3D印表機。So, there you have it: an earnest attempt at a computer-controlled turntable suitable for open source 3D scanning, photography, or display. I mounted mine in an outer casing, so I can scan objects without bouncing laser light all over the room. In the future, I might even modify the design to include a moving extrusion head, and develop a polar 3D printer.