LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Light Sensor as input to get motor pwm output

Hi

 

I have made a program which the motor will track the light actively using single photo sensor. I have made two different programs. 1st program uses DAQ card to drive motor. 2nd Program drives the motor using a motor driver which has a USB attached to computer and it identifies the COM port and runs it.

My next approach is to make Servo motor actively track the light using 2 input sensors. I want the motor to actively track by moving clockwise and anti clockwise direction to track the light. Suppose the left sensor receives low voltage compared to right sensor I want the motor to move towards the direction of left sensor and vice versa. I have attached the file of both program which I have done. Please help me achieve this by either the first program or the second program (whichever is easier)!!!:womansad:

 

Download All
0 Kudos
Message 1 of 4
(2,384 Views)

Hi jacksons,

 

It seems to me that you have all of the necessary building blocks to produce this kind of behaviour. To derive the appropriate functionality, all that you would need to do is configure a second channel for analogue input to poll the voltage from the second photosensor; you could do this by specifying a second channel from within your AI Voltage task and configure the Analogue DBL Read VI for Multiple Channels. The only other changes that you would need to make from this point would be to add extra logic based on comparison against known constants to decide on moving the motor clockwise or anticlockwise proportionally. You'll be able to modify the flow of the program through decision making via a Case Structure.

 

However, I don't understand the relation between the VISA Serial or DAQmx implementations that you have uploaded; your choice in which VIs to base your application on which is easiest but what hardware you're intending to use.


Alex Thomas, University of Manchester School of EEE LabVIEW Ambassador (CLAD)

0 Kudos
Message 2 of 4
(2,366 Views)

Hi

 

I have these two different programs for two different interfaces. The one is by using DAQ USB-6281 and other program runs by motor driver. It was my attempt to have input voltages. 

In the first program I get the logic but I don't know how to make the motor move anti clock wise. Could you show me how to do it please 

0 Kudos
Message 3 of 4
(2,348 Views)

Hi Jacksons,

 

PWM output can be achieved by configuring a counter output in a similar way to that shown here. This example demonstrates how you can change the duty cycle of a counter frequency output whilst the program is running.

 

You can then configure your program to adjust this duty cycle based on the data acquired from an analogue input (namely, your photosensor). As for controlling the motor itself and achieving anticlockwise motion, you would need to refer to the datasheet for your specific motor and understand what signals the drive module requires to do this.

 

I hope that helps, best of luck with the project.

0 Kudos
Message 4 of 4
(2,344 Views)