From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Take pictures with USB webcam and move stepper motor

Hi,  this is my first post on the forums and I have very little LabVIEW experience. 


I am simply trying to use LabVIEW to take pictures through a USB camera (DirectShow compatible)(AmScope MU300)  without the expensive Vision software.  I have attempted using the old NI IMAQ for USB driver from here: https://decibel.ni.com/content/docs/DOC-3929. however the webcam did not apper in NI MAX, and the example program couldn't be launched.  

 

In addition to taking pictures, I am also interested in moving a stepper motor (about 5 mm) . I have absolutely no other hardware, other than my laptop and the stepper motor.  Can you please advise me on the cheapest way to make this work?  

 

Sorry that these may be very noob questions, but I have had very little experience using and implementing labVIEW on my own

 

Thank you so much in advance,

9001

0 Kudos
Message 1 of 3
(3,063 Views)

Here is a link to a 2012 post where they access the USB webcam without the vision software, based on Windows DLL function calls.  

 

http://forums.ni.com/t5/LabVIEW/2-hours-finished-the-webcam-program/td-p/782481/highlight/true/page/...

 

I have used the example on page 5 of the thread and it works fairly well.  You may have to do some additional work to get the image into a format you can save to a file but this will currently display the webcam on the front panel.

 

 

Stepper motors are another thing all together.  A set of precise pulses will advance the motor forward or back 1 "step".  How far this is depends entirely on your particular motor.  So you will need to loop a large number of steps to get say "5mm" of travel.

 

As for the control, you will need a drive circuit for each coil of the stepper motor (usually 4 coils).  How the coils are triggered in various combinations determines direction of movement.  The basic drive circuit consists of a couple resistors and 1 transistor for each drive circuit (you can get these from a site like Digikey.com for a total price of a few dollars - Add more if you need a board to build the circuits on). 

Once the drive circuit is built, you will need LabVIEW to trigger the various circuits by sending a high voltage to the gate of the required transistors (so you need 4 separate +5V outputs).  This is where I feel you will need to buy a piece of hardware.  My system used a NI-USB-6008 which is rather inexpensive, easy to use, and interfaces with LabVIEW very well.

 

A word of warning with stepper motors.  There is no confirmation of distance traveled and you can "drop" signal pulses if they arrive too quickly.  Make sure there is enough time between steps.

0 Kudos
Message 2 of 3
(3,044 Views)

@9001 wrote:

...  without the expensive Vision software. 


Just to be sure you know, it's the Vision Acquisition Software you need, not the very expensive Vision Development software (there is also a free subset of the later available as the Vision Common Resources).

0 Kudos
Message 3 of 3
(3,035 Views)