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

USB steppercontrol direct from DavidLaser??

You can post your wishes for new features in future program versions here.

USB steppercontrol direct from DavidLaser??

Postby oddamann » Wed Mar 25, 2009 2:02 am

I have received and installed the Starter Kit and done some quick scanning –this look great

I also Installed the StepperBee from pc-control and in a half an hour it was
ready for test with the laser mounted direct on the stepper and both operate fine on the USB hub
( now I’m making the gearing for slower/shorter steps )

I was happy to see that now David could scan without backgroud and also that the StepperBee could be controlled from other programs
It look like it can bee implemented in David very easy - But I’m not a VB-programmer – and I hope You can have a look at this.

This is from: http://www.pc-control.co.uk/vb_stepperbee.htm

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Programming Stepper-Bee in Visual Basic


Although Stepper-Bee comes with it's own software (AutoStep) to allow the beginner to start using it in home automation projects very quickly, it also comes with a DLL interface to allow the intermediate and advanced user to write their own programs for it. The DLL provides a general purpose interface that greatly simplifies the task of writing programs for a USB device. It can be tricky manipulating the USB comms into sending and receiving messages to and from a device which can easily be plugged and unplugged at any time. The DLL eliminates all of these headaches by simplifying the task into a few library functions.

InitStp()
RunMotor1(steps, interval, direction, outputs)
RunMotor2(steps, interval, direction, outputs)
StopMotor1(outputs)
StopMotor2(outputs)
GetCurrentStatus(M1Active, M2Active, M1Steps, M2Steps, Inputs)

InitStp() Function Before using any of the motor control functions you must first initialise the StepperBee using the initialise function as follows…
InitStp()
There are no parameters required for this function call. Once initialised you can then use the functions, listed below, anywhere in your program.

RunMotor1() Function The RunMotor1() function has 4 parameters and will cause Motor1 to run according to your specified parameters. All of the following also applies to RunMotor2().
All four parameters are type integer and would be declared somewhere in your program as follows;
Dim steps, interval, direction, outputs As Integer
The corresponding function call would be
RunMotor1(steps, interval, direction, outputs)
The parameters are as follows..
steps - integer in the range 1 to 16000 corresponding to the number of steps to execute
interval – integer in the range1 to 16000 corresponding to the time interval in milli-seconds between each step.
direction – integer in the range 0 to 1. Zero corresponds to forward and 1 to reverse.
outputs – integer in the range 0 to 7 corresponding to the bit pattern for on/off of the additional switching outputs associated with motor 1. e.g. a value of 5 (which is 00000101 in binary) would result in outputs 1 and 3 being on.

Example
To run Motor1 forward for 200 steps with 50ms between steps and all additional switching outputs off would use the following function call…

RunMotor1(200, 50, 0, 0)

StopMotor1() Function
The following applies to both StopMotor1() and StopMotor2() functions.
The StopMotor1() function has one integer parameter and simply terminates the current task being performed by motor1 immediately while updating the current state of the other switching outputs.
The parameter is of type integer and would be declared somewhere in your program as follows:
Dim outputs As Integer
The corresponding function call would be
StopMotor1(outputs)

outputs – integer in the range 0 to 7 corresponding to the bit pattern of on/off of the additional switching outputs associated with motor1

Example
To stop motor 1 and set the switching outputs 1 and 2 to ON, use the following function call

StopMotor1(3)

GetCurrentStatus() function
This function may be called at any time to determine the running status of both motors and the status of the digital inputs. This function has 5 integer parameters passed by reference. The parameters would be declared in your program somewhere as..
Dim M1Active, M2Active, M1Steps, M2Steps, Inputs As Integer
The corresponding function call would be
GetCurrentStatus(M1Active, M2Active, M1Steps, M2Steps, Inputs)
After calling this function the values returned in the parameters correspond to the following…
M1Active – set to 1 for motor1 active, 0 for motor1 stopped.
M2Active – set to 1 for motor2 active, 0 for motor2 stopped.
M1Steps – integer in the range 0 – 16000 corresponding to the number of steps motor1 has left to complete.
M2Steps – integer in the range 0 – 16000 corresponding to the number of steps motor2 has left to complete.
Inputs – integer in the range 0 – 31 corresponding to the bit pattern of the current digital inputs. (bit 0 corresponds to input 1, bit 1 to input 2, etc…)

Example
If motor 1 is running with 123 steps left to complete, motor 2 is stopped and only digital input 4 is on then the following call…
GetCurrentStatus(M1Active, M2Active, M1Steps, M2Steps, Inputs)
… will results in the following values returned …

M1Active = 1, M2Active = 0, M1Steps = 123, M2Steps = 0, Inputs = 8


The only other thing that a VB program must do is to declare the functions that it is going to use within the DLL and the name of the DLL itself. This must be done at the start of your program or at least before any references to the three functions are made. The following is a program excerpt showing how this is done...
Declare Function InitStp Lib "stp.dll" () As Integer

Declare Function RunMotor1 Lib "stp.dll" ( ByVal steps As Integer,
ByVal interval As Integer,
ByVal direction As Integer,
ByVal outputs As Integer,
) As Boolean

Declare Function RunMotor2 Lib "stp.dll" ( ByVal steps As Integer,
ByVal interval As Integer,
ByVal direction As Integer,
ByVal outputs As Integer,
) As Boolean

Declare Function StopMotor1 Lib "stp.dll" ( ByVal outputs As Integer, ) As Boolean

Declare Function StopMotor2 Lib "stp.dll" ( ByVal outputs As Integer, ) As Boolean

Declare Function SetStepMode Lib "stp.dll" ( ByVal M1Mode As Integer,
ByVal M2Mode As Integer,
) As Boolean

Declare Function GetStatus Lib "stp.dll" ( ByRef M1Active As Integer,
ByRef M2Active As Integer,
ByRef M1Steps As Integer,
ByRef M2Steps As Integer,
ByRef Inputs As Integer,
) As Boolean


Normally each of the parameters of the functions would be on the same line in your program. They are shown here on separate lines for clarity. These provide sufficient information for your compiler to determine the correct way to use the functions contained within the DLL. You should also ensure that you copy the stp.dll file from the installation disk to your c:\windows\system32 directory so that your compiler can find it.
It should be noted that the
Lib "stp.dll"
lets the program know where to find the stp.dll file. When written like this it assumes, since there is no path information, that the stp.dll file can be found in the windows system directory ( c:\windows\system32 ) If you like you can copy the file stp.dll on the installation disk to the system32 directory and the above statement will work perfectly. Alternatively you can copy the file to some other location and give that location in the declaration as in the example below...

Declare Function InitStp Lib "c:\mylibrary\stp.dll" () As Boolean


Source Code To speed up your development of software for the Stepper-Bee a complete working example is available for download below. It is called VBstepper and creates a very simple form based program that has individual buttons for various functions such as initialising the Stepper-Bee, setting motor steps, intervals, directions, as well as setting the switching outputs and displaying the digital inputs. The main (and only) screen is shown on the right. This has been written using Microsoft Visual Studio .net and the download files contain the full workspace (solution) details to allow you to immediately open and start editing or running this application.

Even if you don't have Visual Studio, the source code is virtually self explanatory with the most relevant sections being in "Form1.vb" which can even be opened in a simple text editor such as notepad. The files are zipped for convenience and may be downloaded by right clicking on the link below and choosing "save target as" to begin the download.


xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

This is my idea of controlling:

The stp.dll is installed with the software that comes with the StepperBee
And the stepper-calibrations can be done with that software
and the values can be found for Advanced Setting in David-LaseScanner

So if this is possible to implement in David-LaserScanner

The button START should execute this before scanning start
// no motor is connectet to Motor2 but the switch output could power up StepMotor1 via relay since steppermotot is on when not running to.
RunMotor2(1-steps, 1-interval, 0-direction, 1on-outputs) ((( actual code look like this- RunMotor2(1, 1, 0, 1) )))

// Homing laser to a switch with Motor1 with two loops :
Loop1:
//find switch connected to Input1
RunMotor1(1-steps, 2-interval, 1-direction, 1off-outputs)
GetCurrentStatus(M1Active, M2Active, M1Steps, M2Steps, Inputs)
If Input 1 = high then loop
Else –end loop1

Loop2
//get of switch – because of switch travel distance
RunMotor1(1-steps, 2-interval, 0-direction, 1off-outputs)
GetCurrentStatus(M1Active, M2Active, M1Steps, M2Steps, Inputs)
If input 1 =low then loop
Else end loop2

//Start laser movement switch on laser (and two more options) – get values from Advanced Setting
RunMotor1(??-steps, ??-interval, ??-direction,??-outputs)


Run Start as normal..


The PAUSE should execute
// turn off Motor1 (with RunMotor2( 1-step,1-interval, 0-direction, 1off-output)
// and turn off laser and other options
RunMotor1(1-steps, 2-interval, 0-direction, 1off-outputs) //laser off
RunMotor2( 1-step,1-interval, 0-direction, 1off-output) // motor1 off via relay.

Run pause as normal

Thanks
oeSoeraa
oddamann
 
Posts: 15
Joined: Fri Mar 13, 2009 12:28 am

Re: USB steppercontrol direct from DavidLaser??

Postby Bongobat » Wed Mar 25, 2009 2:49 am

Hi oeSoeraa,

I think rather than reprograming David for your device it might be better to write or find someone who can write a program that opens a virtual com port and translates the the com commands to something your device can perform. Once the program is written you simply set David to output on virutal com and your program to input on the same virtual com and viola you have communication. I dont know how hard it would be to implement but it would help If David had the option to install its own virtual com.

Greg
DealExtreme red line laser, Microsoft Lifecam HD-5000
User avatar
Bongobat
Moderator
 
Posts: 1002
Joined: Mon Apr 02, 2007 10:02 am
Location: Ohio, USA

Re: USB steppercontrol direct from DavidLaser??

Postby oddamann » Wed Mar 25, 2009 9:35 am

Thanks for your reply.

In the topic: Talk to COM
viewtopic.php?f=3&t=929

Does this testcom "sniff" what comes from DavidLaser output ?
If it can detect what david send to a port - maybe communication can be done without a viritual port.

oeSoeraa
oddamann
 
Posts: 15
Joined: Fri Mar 13, 2009 12:28 am

Re: USB steppercontrol direct from DavidLaser??

Postby MagWeb » Wed Mar 25, 2009 10:16 am

Hi,
TESTCOM was only some small test application to see whether that DAVID/COM/Microcontroller communication might work.
Forget it now.

Now you can define any output in the advanced settings.
See:http://www.david-laserscanner.com/wiki/user_manual/com_port
Gunter
MagWeb
Moderator
 
Posts: 2499
Joined: Wed Jul 18, 2007 8:48 pm

Re: USB steppercontrol direct from DavidLaser??

Postby oddamann » Wed Mar 25, 2009 11:58 am

Thank ok I forget testcom now . what testcom? :lol:

ok - a viritual com port - seams to be a lot of it out there - any free one?
and any code for input to a program will help.
any thing at all....to get some start on this.

-have downloaded a 90day trail of Visual Studio and are ready to dive into it....
-have done a some small php programming java and vbExcell in the past.
(((((well I got the 90day to get into it......))))

- is it possible to get the code for David Laser to.??
I have bought the USB pin and starter-kit...
and the StepperBee -and a small portable pc for this project.

- I have tested david scanner long time ago
and was very happy when I saw that there was a possibility for scanning without the background
and a portable scanner was possible to make.
I was just little bit to quick . But have big hopes that this will be solved.

oeSoeraa
oddamann
 
Posts: 15
Joined: Fri Mar 13, 2009 12:28 am

Re: USB steppercontrol direct from DavidLaser??

Postby Bongobat » Wed Mar 25, 2009 1:16 pm

Hi again,

oddamann wrote:ok - a viritual com port - seams to be a lot of it out there - any free one?


I found this: http://sourceforge.net/projects/com0com/

oddamann wrote:any code for input to a program will help.
any thing at all....to get some start on this.


Sorry I cant help you there but I think the full version of visual studio makes it easy to add com functionality.

oddamann wrote:is it possible to get the code for David Laser to.??

There is not an SDK if that is what you mean. If you want to know how to program David to send commands look here: http://www.david-laserscanner.com/wiki/ ... l/com_port You should be able to do anything you want with the sending strings within David's com function.
DealExtreme red line laser, Microsoft Lifecam HD-5000
User avatar
Bongobat
Moderator
 
Posts: 1002
Joined: Mon Apr 02, 2007 10:02 am
Location: Ohio, USA

Re: USB steppercontrol direct from DavidLaser??

Postby oddamann » Fri Mar 27, 2009 11:10 am

Gift to all of you with the idea of making a step-motor-controlled laser .
StepperBee
http://www.pc-control.co.uk

a viritual COM-port com0com
http://sourceforge.net/projects/com0com/

and a communication program from me.
both David2stepperBeeV1 and com0com is in the zip file

oeSoeraa

Fix is done for stop and motor2 outputs
Last edited by oddamann on Sat Mar 28, 2009 8:24 pm, edited 1 time in total.
oddamann
 
Posts: 15
Joined: Fri Mar 13, 2009 12:28 am

Re: USB steppercontrol direct from DavidLaser??

Postby Bongobat » Sat Mar 28, 2009 1:23 am

Hi oeSoeraa,

Good work and in such a short time. The stepper bee looks to be a nice simple solution for laser control and it is nice to see someone come back after acomplishing their goal and share their work with others.

thanks,

Greg
DealExtreme red line laser, Microsoft Lifecam HD-5000
User avatar
Bongobat
Moderator
 
Posts: 1002
Joined: Mon Apr 02, 2007 10:02 am
Location: Ohio, USA

Re: USB steppercontrol direct from DavidLaser??

Postby joecnc2006 » Sat Mar 28, 2009 2:20 am

can you show your hardware and how you have it all setup?
Joe

David-Laserscanner Professional Edition, Logitech Pro 9000 Webcam, LC532-5-3-F(16x65)

www.joescnc.com
User avatar
joecnc2006
 
Posts: 207
Joined: Fri Dec 12, 2008 3:10 pm

Re: USB steppercontrol direct from DavidLaser??

Postby oddamann » Sat Mar 28, 2009 10:53 am

hi all
When you got StepperBee you need to copy the stp.dll to folder C:\WINDOWS\system32\

I have not been able to put it all together yet - I have been swimming inside Visual Basic for some days
-happy to find so mush guiding both in VB and the internett.

but the plans and parts is all here:
HardWare:
Inside a hand-drill there is a planetary gear that will do the steps a lot smaller. (( must try it first to see if it is enough ))
The biggest problem will be to fit the original motor-gearwheel(3mm) with the stepper-motor shaft(5mm). ((Lathe will do))

With the small pc "acer one" :
-test : no picture with 1600x1200 and only 5frame with 960X720
(( may need a better pc ,maybe ok for scanning - but probably not good for Shapefusion ))
http://www.david-laserscanner.com/wiki/ ... background

hope this pictures tell more:
HardWare_and_Gear_from_dril.jpg

back_front_without_Cover.jpg
will be bigger -to fit the calibration panels to (here 500mm X 250mm )

draw01.jpg


hope you all will have your dreams come true.
oeSoeraa
oddamann
 
Posts: 15
Joined: Fri Mar 13, 2009 12:28 am

Re: USB steppercontrol direct from DavidLaser??

Postby oddamann » Sat Mar 28, 2009 8:40 pm

hey
after testing with the gear on motorshaft:
at 40cm distance from center of rotation the step is now 0.3mm
( I was hoping to get smaller steps <0.1mm )
Maybe I add one more gear - because with longer distance from laser it will be more then 0.3mm

:oops: the stop button didn't work and I had forgot all about motor2 ( a lot of line in this programming thing )

her is the fix: also with com0com

V2_david2stepperbee_com0com.zip
(291.39 KiB) Downloaded 455 times
oddamann
 
Posts: 15
Joined: Fri Mar 13, 2009 12:28 am

Re: USB steppercontrol direct from DavidLaser??

Postby joecnc2006 » Sun Mar 29, 2009 9:42 pm

Here is my scan rig i will test to see how it works.

Scan Rig 1.JPG

Scan Rig 2.JPG
Joe

David-Laserscanner Professional Edition, Logitech Pro 9000 Webcam, LC532-5-3-F(16x65)

www.joescnc.com
User avatar
joecnc2006
 
Posts: 207
Joined: Fri Dec 12, 2008 3:10 pm

Re: USB steppercontrol direct from DavidLaser??

Postby oddamann » Mon Mar 30, 2009 8:20 am

nice set-up joecnc
-think I will look for some techno lego to -

I have tested with one more gear now
both 1:36 - homing-speed ok , to small scan-aera ,
the stepperbee have "only"16000 steps and it is not enough. (or other gears)
I will look into the program and find a way to run the motors unlimited,
oesoeraa
oddamann
 
Posts: 15
Joined: Fri Mar 13, 2009 12:28 am

Re: USB steppercontrol direct from DavidLaser??

Postby joecnc2006 » Mon Mar 30, 2009 12:10 pm

Joe

David-Laserscanner Professional Edition, Logitech Pro 9000 Webcam, LC532-5-3-F(16x65)

www.joescnc.com
User avatar
joecnc2006
 
Posts: 207
Joined: Fri Dec 12, 2008 3:10 pm

Re: USB steppercontrol direct from DavidLaser??

Postby donkeyot » Mon Apr 27, 2009 9:50 pm

Cheers for the virtual com port control for the stepper control appears to work haven't test scanned yet, These may be of interest.
http://www.mfacomodrills.com/
Coma drill with gearboxes really nice gearboxes epicyclic ones too, only tried the 919d1481 ratio 148:1 the cap pulls off and the gearboxes unscrew from the motor onto its own mounting plate so you can use the bracket too, difficult part getting the gear off the motor had to bash it with a shaft and a hammer. Hopefully send some pics soon. http://www.rapidonline.com/Electrical-P ... ft+coupler for shaft couplers you may need to drill out ( hopefully with lathe) to stepper shaft requirements, and gear will possibly need gluing to slightly smaller shaft 3mm. Looking at maybe going upto 1500:1 on the gearbox just to get better resolution lower in the scan, but may just be a matter of adjusting camera position or laser. Good work! :o)
User avatar
donkeyot
 
Posts: 19
Joined: Tue Apr 14, 2009 1:31 am

Next

Return to Feature Wish List

Who is online

Users browsing this forum: No registered users and 0 guests

cron