Dear DAVID Community,

As you are probably aware, the entire DAVID company, team and product range has been integrated into HP Inc.
This forum is now read-only. Relevant content has been migrated to HP and merged into HP's Support Forums on November 1, 2016.

To start new discussions for 3D Scanning, please register and post your new topic at the HP Support Forums

How to remotely control DAVID

Problems, solutions and discussion about scanning with a video projector and stripe patterns.

How to remotely control DAVID

Postby WalterMo » Tue Sep 10, 2013 11:58 am

This should be a guidance how to control DAVID externally via the USB connection. And it could be the beginning of a way to automatically do a series of scans on a turntable. Of course this isn't brand-new, others already have done it, e.g. here by Bernhard Mayrhofer:
http://www.youtube.com/watch?v=ZP8IP8WydAw

and here by Micropuller (Cyril):
https://www.youtube.com/watch?v=_m4VgIvaTmU

My intention is to show interested people how it could be programmed.

The transceiver on the other end of the USB cable is an Arduino Uno or Duemilanove. As you can read in our Wiki.....
http://wiki.david-3d.com/user_manual/com_port
.…it is possible to send commands to DAVID and also to receive short messages from DAVID. If you open in the DAVID software the window of the 'Advanced Settings' (it's top right under the gear symbol) and goto 'Communication', you will find these messages and commands as simple capital letters. And also their explanation. If you like you can change these letters. They are sent and received as string commands.

I have built a simple Arduino test board with 2 buttons and 3 LEDs. It should only be an example to show how the communication will work. The suitable code 'Control_DAVID_1.ino' is attached as a zip file.
Before all can work with DAVID two important settings are necessary to do in DAVID:
1. On the 'Hardware Setup' window: Goto 'Setup Type', 'Motorized Laser Setup', 'Motor Scanning' and set the same COM port address as you have used to upload the Arduino code to your board. Probably DAVID already has detected this address.
2. Goto 'Advanced Settings'. 'Communication', 'COM' and set a hook at 'Enabled'.

What the test board can do in the SL mode after successful camera and projector calibration:

If you push the 'Start' button the green LED will shine for 0.5 sec and DAVID will start a scan. This short green flash should only signal that the button was pressed, not more. The same will happen later on if the other button is pressed. Notice: Press only shortly!
DAVID will send a message (red LED on for 1sec) when it starts scanning. When the scan is finished it sends a 'T' and the yellow LED will shine for 1 sec.

Now you can save this scan by pressing the 'Save' button. But before you must have created a folder on your pc or on your USB drive where the scan file should be saved. As you can see on the Arduino code I have named the destination 'C:\\OBJ Test Files\\Scan1.obj'. Of course both paths must correspond. After DAVID has successfully saved the scan, the green LED will shine for 1 sec.

Walter

PS.
Note: You cannot upload the Arduino code if the (same) COM address is simultaneously activated in DAVID.

Edit: Additionally I have attached Sven's 'Test Com9'. This software can be used to check your Arduino board before the usage with DAVID. It can send commands and receive messages. Set the same COM address as which was used to upload the code to your Arduino board.
X71GHY

Code: Select all
// Program: Control DAVID 1
// Test program for sending a 'S' to start a scan. Receiving a 'S' if the scan was started and a 'T' when the scan was made.
// Sending a 'Z' with path and file name to request DAVID to save the scan. Receiving a 'Z' to check if DAVID has saved the file.
// The receiving infos are indicated by three LEDs. The commands are sent by two push buttons.
// By WalterMo, Sept 2013


int ledPinRed = 3;          // Pin of the red LED
int ledPinYellow = 2;       // Pin of the yellow LED
int ledPinGreen = 6;        // Pin of the green LED
int ch = 0;                 // Declare the variable of the coming in byte
int Button_start = 7;       // Button input for starting a scan at pin 7
int Button_save = 10;       // Button input for saving the scan at pin 10
int save = 0;               // Declare the variable save
int start = 0;              // Declare the variable start

void setup() {
 
  pinMode(ledPinRed, OUTPUT);      //Declare outputs and inputs
  pinMode(ledPinYellow, OUTPUT);
  pinMode(ledPinGreen, OUTPUT);
  pinMode(Button_save, INPUT);
  pinMode(Button_start, INPUT); 
  Serial.begin(9600);             // set the baud rate to 9600 Bauds
}

void loop()
{
ch = 0;
// Read coming in signals ************************************************************************************
if(Serial.available()>0)
{
 ch = Serial.read();
}
   
    if ( ch == 'S')                         // If a 'S' is sent (scan is started)
       {
     digitalWrite(ledPinRed, HIGH);         // Red LED on
     delay (1000);                          // wait 1 sec
     digitalWrite(ledPinRed, LOW);          // Red LED off
       }
      if ( ch == 'T')                       // If a 'T' is sent (scan is finished)
       {
     digitalWrite(ledPinYellow, HIGH);         // Yellow LED on
     delay (1000);                             // wait 1 sec
     digitalWrite(ledPinYellow, LOW);          // Yellow LED off
       }
      if ( ch == 'Z')                         // If a 'Z' is sent (scan is successfully saved)
       {
     digitalWrite(ledPinGreen, HIGH);         // Green LED on
     delay (1000);                            // wait 1 sec
     digitalWrite(ledPinGreen, LOW);          // Green LED off
       } 
// Send signals to DAVID *****************************************************************************************************+
     start = digitalRead(Button_start);       // Read the 'start' button
     if(start == LOW)           
    {
      Serial.println ("S");                   // sends 'S' to DAVID to start a scan
      digitalWrite(ledPinGreen, HIGH);        // Green LED on
      delay (500);                            // wait 0.5 sec, will also avoid any contact bounce
      digitalWrite(ledPinGreen, LOW);         // Green LED off
    }   
      save = digitalRead(Button_save);        // Read the 'save' button
      if(save == LOW)           
    {
      Serial.println ("Z C:\\OBJ Test Files\\Scan1.obj");   // sends 'Z', the path and the file name to DAVID
      digitalWrite(ledPinGreen, HIGH);        // Green LED on
      delay (500);                            // wait 0.5 sec, will also avoid any contact bounce
      digitalWrite(ledPinGreen, LOW);         // Green LED off
    }   
 }

Attachments
DAVID COM Control.jpg
The circuit diagram
Control_DAVID_1.zip
The Arduino code
(1.09 KiB) Downloaded 154 times
TestCom9.zip
The Test COM9 software
(558.75 KiB) Downloaded 151 times
User avatar
WalterMo
Moderator
 
Posts: 2363
Joined: Mon Apr 02, 2007 6:52 pm
Location: Braunschweig, Germany

Re: How to remotely control DAVID

Postby moog » Wed Sep 11, 2013 9:13 am

is this applicable to structured light?
Shouldn't this be in the "laser scanning" section?
you said.....

"1. On the 'Hardware Setup' window: Goto 'Setup Type', 'Motorized Laser Setup', 'Motor Scanning' "
LC532-5-3-F(16x65), BenQ PB8220 DLP Projector, logitec quickcam PRO9001, Casio EX-FH20
moog
 
Posts: 235
Joined: Sat Oct 24, 2009 8:54 am
Location: Australia, Gold Coast

Re: How to remotely control DAVID

Postby WalterMo » Wed Sep 11, 2013 10:36 am

I have tested it with structured light, DAVID version 3.8.1. But I think the remote control will also (or similar) work for laser scanning.

To set the COM port address was only possible to do on the 'Motorized Laser Setup' surface. Then I changed to 'Structured Light Setup'.
User avatar
WalterMo
Moderator
 
Posts: 2363
Joined: Mon Apr 02, 2007 6:52 pm
Location: Braunschweig, Germany

Re: How to remotely control DAVID

Postby BjoernReinke » Wed Sep 11, 2013 12:41 pm

thank you Walter - great of you to share examples and workflows, much appreciated.

Regards
Bjoern
BjoernReinke
 
Posts: 29
Joined: Sun Jan 16, 2011 5:26 pm

Re: How to remotely control DAVID

Postby Sven » Fri Sep 13, 2013 11:44 am

Thanks Walter... I wish I had had more time, I would have written a similar "how-to"...

Note:
1. On the 'Hardware Setup' window: Goto 'Setup Type', 'Motorized Laser Setup', 'Motor Scanning' and set the same COM port address as you have used to upload the Arduino code to your board. Probably DAVID already has detected this address.
2. Goto 'Advanced Settings'. 'Communication', 'COM' and set a hook at 'Enabled'.


Step 1. is not necessary!
After you have enabled COM (step 2.), you should be able to set the COM port in the Hardware Setup menu. At least it works here...

Sven
User avatar
Sven
DAVID Developer
 
Posts: 1541
Joined: Mon Jan 22, 2007 8:59 am
Location: Braunschweig, Germany


Return to Structured Light Scanning

Who is online

Users browsing this forum: No registered users and 2 guests

cron