LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Speed Control using Hall effect sensor

I would like some help in modifying the current code to do the following.

1. Add a second pump (12vdc) to the stepper sequence.

2. Turn a fan on/off for five minute intervals.

3. Use a hall effect sensor to measure rpm and control pump speed.

The new step by step sequence is now as follows :

1. First set the  flow rate/ pump speed for stepper number one .

  • Measure rpm using hall effect sensor and show the measurement on  a gauge. Use the measurement to adjust the pump speed . Stepper number one will run at constant speed to maintain the pump speed/ flow rate at whatever the user inputs.

2. When prompted to sample

  •        Stepper number two will move 'x' number of steps forward.

  •       Stepper number three will then move 'y' number of steps forward .

  •       Turn on 12 vdc pump for 10s.

  •       After a wait period stepper number three will move 'y' backwards and stepper number two will move backwards 'x' number of steps.

* There are 4 different sampling positions so stepper number two and three will move different steps each time the user hits sample.

3. Turn fan on/off for five minute intervals.

I have two questions. Firstly is there a better way to do the five minute intervals. In my current code I think the event structure will only read when there is  a value change ( sample button) instead of the specified time interval.  Secondly how do i incorporate the hall effect sensor measurement and control to the current code. I would appreciate any help before I butcher the code that was given to me.

Thanks in advance

Charles

0 Kudos
Message 1 of 4
(11,528 Views)

Just to be clear. There are 3 steppers, one of which has a pump and hall effect sensor attached, a 12v pump and a fan. You want to follow the sequence outlined above each time you hit SAMPLE? Controls  FAN and START/STOP PUMP will enable or disable the fan and 12v pump?

As you wrote it, the fan will only react to a fan control button press. Any time you press the fan button the fan will run except when you press and the VI has run for exactly 5 seconds. Any other input will be ignored by the "Fan" case as you thought.  Will the fan cycle time ever change? Is the fan on pin 0 or pin 32? how does it get its power?

Does the pump on stepper #1 run continuously? What kind of driver controls the stepper power? Steps per rev? Max steps/sec? Do you want to check/set the pump speed once just before a sample sequence begins or every n seconds or continously? If continuously, you'll be need to be doing several things at once.  This takes a bit more information before I can answer.

* what is the expected RPM range of the pump whose speed you want to measure and control? Does the hall sensor get its power from Arduino or from somewhere else?

* how do times x and y change?  User input, schedule or sequence? are there only 4 possibilities?

* is 12 volt pump duration always 10s ? will this ever change? how is the pump getting its power? 

* how long to wait after 12v pump stops before stepper movements begin? does this ever change?

JohnCS

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

Thanks for your response !

1.You are correct, the hardware is as you described . Yes I want to follow the sequence when i hit SAMPLE ( see 3 for specifics) . START/STOP should enable/disable stepper number 1 ( the one with a pump attached to it).

2.The fan is on pin 32. The fan is connected and powered as shown here. The fan cycle time does not change. I am using the fan to cool my circuitry so I figured i'd just time the fan to turn on/off after every 5 min ( now that you ask I am starting to think of using one of these for temperature control)

3. The pump on stepper number 1 runs continously until START/STOP or when a 'new' flowrate is entered. This driver controls stepper # 1  ( 200steps/revolution , 20 steps/sec max). I would prefer to check/set the pump speed continously (I think every couple of seconds (<10s) would work as well). 

* I expect a ~ 0 to 300 rpm range. Yes , the hall effect sensor gets its power from the arduino.

* HOW ? = Schedule and User Input: x and y are the number of steps stepper number 2 and 3 will move during each sampling sequence respectively. Stepper number 2 controls the position of a sampling block in the 'x' direction and stepper number 3 controls the position of the sampling block in the 'y' direction.  There are four sampling positions ( A, B,C and D). Therefore x and y changes depending on the next sampling position (SCHEDULE).

  WHEN? = I am collecting my samples in 2.5ml vials. Stepper number 1 (connected to pump) controls this volume  so after stepper number 1 moves n number of steps  (vial at position A is full ) then turn 12V pump on for 10s and then move sampling block to position B.  I would also like to choose the sampling position (e.g go to position A at the beginning of a run /procedure or position D to run and collect cleaning solution.) 

* Yes 12 volt pump duration is always 10s. This pump flushes the sampling lines before the next sample is collected. I have duplicated the fan circuitry on a different pin (28).

* ~5seconds. This never changes.

0 Kudos
Message 3 of 4
(3,634 Views)

Here's a method to control your fan cycling. You can change the timeout duration if you want to slow down checking the stepper 1 speed.

To read the Hall sensor, you'll need to sample its output for a second or two, measure the sampling time and calculate the rpm. Then you can determine a new step rate to get the speed you want. Alternately, you could add an interupt driven counter to the Arduino firmware to continually measure the speed. It would be useful to be able to measure frequency or pulse duration. 

I have left out any error handling to make the BD a little simpler. But before you put the VI into production, you should work out a graceful method of shutting down the motors.

Download All
0 Kudos
Message 4 of 4
(3,634 Views)