LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

PID to control speed of a motor

I want to build a control system with the following:
 
Sensor: analog microphone
actuator: DC motor
 
Basically, I want to control the speed of the dc motor as a function of volume (person's voice).  I will use NI elvis and labview to support PID controller.  my motor is 24V and I know that labview can only output a maximum of 5V.  I wanted to do it so if the volume went above a certain (low) point, the motor will kick on at 2V.  The next step would be when the volume was a little higher and the motor would spin at 3.5V (medium).  the last step would be the maximum output from labview and would turn the motor at 5V.  I realize that without using a transistor or some sort of amplifier, it will be difficult to tell the difference in speed of motor, but this will be sufficient. 
 
I was wondering what i need to input in labview to make sure my program has these step outputs (2V, 3.5V and 5V) and also how do i convert (in labview) the sound input from the sensor to voltage from (dB?)
 
i will try to post my .vi of the PID controller of what i have in the next few hours, but thanks in advance
 
greg
0 Kudos
Message 1 of 4
(2,991 Views)
Hiya,
Could you not do this with an else/if statement?  I'm not sure how you can use a pid loop as you don't have an error term, unless I'm missing something - which is highly possible 🙂

if( sound_level>Z )
    voltage_out = 5
else if( sound_level>Y )
    voltage_out=3.5
else if( sound_level>X )
    voltage_out = 2
else
    voltage_out = 0

Cheers,

Martin
0 Kudos
Message 2 of 4
(2,970 Views)
here is my vi... i am working off a lab that we had a few weeks ago... how do i change the input variable from a light sensor to volume??
0 Kudos
Message 3 of 4
(2,949 Views)

Hi Greg,

Have you tried using the sound VIs under Programming>>Graphic & Sound>>Sound in the functions palette?

These should help you convert sound to data points. There are also many examples of these in the LabVIEW example finder.

Just look under Hardware Input and Output/Sound/ using the browse tab of the NI Example Finder.

Aashish M
CEO
TransferFi
www.transferfi.com
0 Kudos
Message 4 of 4
(2,917 Views)