David SLS with Rotating Platform

snapshot02
I have been working on automating my David SLS-2 structured light scanner.The above STL ready for 3D printing is the result of several sequential scans of my own face. All I had to do was hit “Scan” once and then hold still for a few minutes while the structured light scanner took scans followed by rotation of the chair I was sitting on.
The chair came from a Kinect scanning machine that I created for the Reston Maker Faire. The chair is on a platform that is rotated by a pellet stove auger motor. That’s the thing that feeds pellets. I wrote a Python program to lift a Kinect scanner as the chair rotated. I used Reconstructme to generate 3D meshes of the people who sat in the chair. I 3D printed several people. Now I am re-using the rotating chair, but now it rotates and then stops between structured light scans.
The key to making this work is the fact that the David program is set up to receive and send serial port messages. I used an Arduino Uno plugged in to a USB port to read and write letters on a PC serial port to communicate with the David software. Once you have an Arduino in the mix, you can do just about anything. For now I am turning a solid state relay on and off to rotate a platform that a person can sit on so that I can scan their entire head.I also comes in handy since my kids are sick of sitting for any kind of 3D scanning. I have resorted to paying them in some cases.
The auger motor runs on 110V AC, so it was an ideal candidate for the solid state relay. The 5V signal from the Arduino can switch high current AC. I can just as easily control a stepper motor and make a smaller platform for rotating and scanning inanimate objects. In fact I plan to do so, and I will blog about that as well.
Here are some pictures of the chair on a rotating platform, the solid state relay, and the black felt background that I use to absorb light that is not part of the scan.
I am using the David SLS-2 scanner and DAVID-LASERSCANNER v3.10.4 software. Here is an image of the scanner mounted to the wall using 8020 hardware. I set the height based on my own seated height. As you can see, it is adjustable. I am the tallest customer.
IMG_5722

Here is the “Shape Fusion” result of several scans of my face using the SLS-2 and David software.

snapshot00

This is a snapshot from Meshlab. Note that the texture map is very dark in the original .MTL file associated with the .OBJ mesh. I opened the MTL in Photoshop and maximally brightened it twice. The modified MTL still maps to the OBJ, so this is a nice way to try to improve the appearance of a mesh, at least for rendering. For 3D printing, the color map is of course not important.

In my previous post, I scanned a mannequin head. I manually rotated the chair between scans. There are several advantages involved. First, the mannequin holds still forever. His whole head is white – very reflective, so structured light scanning works well. He also has a nice, even texture all over. The result looked great, and made me think at first that real head scans would also be great. They are in fact quite a bit more difficult to capture.

I have not had much luck scanning the back of my head or that of anyone else for that matter. I think the light level is just too low. I might need to try a larger, brighter projector. I noticed that even on the David web site, the example head scan only shows the front of a person’s face.

As an aside, I was advised to not alter any hardware settings like camera aperture after calibration. I did try overexposing the camera during calibration to see if I could brighten the image. As I improve my results, I will blog about the best settings.

On Thingiverse, I found two other efforts described here and here where they are using a rotating platform with the David scanner, but they don’t tell you how it works or how to build it!

Here is a link to a finished product for big bucks! Seriously people, save your thousands of dollars and try to do this yourself!

So rather than post a video just to show how successful I am at integrating a rotating platform, I am going to tell you how to do it!
First, get yourself an Arduino Uno. That’s easy on eBay. I typed “Arduino Uno Real” since I did not want to mess around with a copy. The real thing is under 20 bucks.
Plug in your Uno to a serial port.
If you are observant, you can catch which serial port was used during installation. If not, right click Computer, select Properties, Device Manager, Ports COM & LPT, then find your Arduino and note its serial port. You need to tell the Arduino programming environment that you are using an Uno and what port it is on in order to upload a program.
Open the Arduino programming environment and cut and paste the code shown below. Remember, this is for an AC powered platform, not a stepper motor platform. I turn pin 13 high, which activates an AC solid state relay, which powers a pellet stove auger motor, which rotates the platform where a person is sitting. I experimented with different delays to increase and decrease the rotation between scans. I think that a normal person can try to hold still for about 3 minutes without complaining. Watching my own shadow during scans, it is also obvious that I am moving a little bit even when I try really hard to hold still. This result will be much more impressive for inanimate objects.
ARDUINO CODE FOLLOWS
——————————————————————–
/*
SerialWriteRotatePlatform sends a scan command (letter ‘S’) to the David SLS-2 3D scanner through a
serial port. Waits for the signal (letter ‘Z’) indicating that
the scan has been saved. Turns on pin 13 to control a solid state
relay and rotate a platform.
*/
// Pin 13 has an LED connected.int led = 13;// Set a variable to look for the scan finished signalint incomingbyte = 0;void setup()
{
// start serial port at 9600 bps and wait for port to open:
Serial.begin(9600);// initialize the digital pin as an output.
pinMode(led, OUTPUT);
}

void loop()
{
Serial.println(“S”); // Send scan command to David scanner

do // Wait for the scan saved indication
{
delay(50);
incomingbyte = Serial.read();
} while (incomingbyte < 90 || incomingbyte > 90);

// Rotate the platform

digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
delay(4000);               // wait for a second
digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
delay(50);               // wait for a second
}

——————————————————————–
END OF ARDUINO CODE
Click the right pointing arrow in the programming environment to upload the code to the Arduino. This code will loop forever, so as soon as it starts, it sends an ‘S’ on the serial port. Unless the David scanner is ready, the Arduino loop will then just wait for the ‘Z’ to come back from the David software, so once you set things up and his “Scan,” the scan will proceed, finish, and send the ‘Z.’ Then the code will rotate the platform and send another ‘S.’ This will go on forever until you press “Cancel” in the software.
Now open the David 3 software
On the top right-ish side of the screen is a small gear symbol that includes “Advanced Settings.” Select Advanced Settings, Communication, COM. Makes sure that “Enabled” is checked. Use the rest of the defaults. By default, COM is NOT checked, so you need to change this.
Now under “Hardware Setup,” There is a section called “Motor Scanning.” Select the COM port that your Arduino is plugged in to. The default value will be “-none-,” so you need to change this to your Arduino port number.
I need to write at least one entire blog post about the best settings to use with the David SLS-2. You do need to make sure that “Auto. Add to List” is checked and that “Align to Previous Scan” is NOT checked. The automatic sequence stops in Shape Fusion if it tries to automatically align scans. Also, the person holding still in the chair will not want to wait all the extra time it takes for the scans to align every time. It’s best to capture multiple scans as quickly as possible and then let the person move. I will blog about how best to align multiple scans in a later post.
If your Arduino has the program above uploaded, it is plugged in to your PC, and you set the correct COM port in the David software, Pin 13 should go high for a few seconds at the end of each scan, and then the Arduino will trigger the next scan. Next time I will post a program that can control a stepper motor. You can add any code in here that you want to use.
You may also have noticed the switch that I have wired to the Arduino. I want to be able to manually rotate the platform to make sure to point the subject properly before I begin the scan. I think I will need to use an interrupt for this since I otherwise do not want to interfere with the main loop.
Advertisements

One response to “David SLS with Rotating Platform

  1. Pingback: Details for rotating scan platform | G. P. Le Sage Blog·

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s