From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, 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: 

PWM signal using Labview and H-bridge device

Hi all,

 

I am trying to use a Labview-generated pulse-width modulated (PWM) signal outputted via an NI 6211 Multifunction I/O in conjunction with a Simple-H H-bridge device.  Basically, by varying the voltage of the power source (between 0-5.5 V) and modulating that with the Labview code, I want to be able to output a 24 V signal from the H-bridge.

 

So far, I have checked to make sure that Labview outputs a counter output signal of around 5 V for high duty cycle, which it does.  However when I connect everything together and attach a voltmeter to the outputs of the H-bridge, I do not obtain a voltage measurement at all...any ideas?  Are my connections wrong?

 

Right now, I have connected the two leads of the power source to B+ and B- (see pg.3 of link below).  From the NI device, I have connected the grounds together, and connected a +5 V signal to the EA (Enable) pin to activate the board.  And then the counter PWM output is wired to the PA pin.

 

My voltmeter leads are attached to M1 and the ground (battery minus pin).  Any ideas what I am doing wrong?

 

http://www.robotpower.com/downloads/Simple-H-user-manual.pdf - Page 3 shows a diagram of the H-bridge board

 

Thanks for your help!

 

P.S.  I can attach my Labview code as well, which is generating the PWM signal, but I am pretty sure this is not the problem...

 

- T

0 Kudos
Message 1 of 6
(3,922 Views)

I have several questions:

 

1. What is your PWM frequency?

2. What duty cycle are you using when you see no output?

3. If you measure from PA to Battery Negative (Ground) with your voltmeter, what do you get?

4. Do you have any kind of load connected from M1 to M2?  What is the impedance of that load?

5. Have you tried to measure from M1 to M2?  What is the result?

6. Are the jumpers installed as indicated on page 2 of the data sheet?

 

The reasoning behind the questions: Some voltmeters do not respond well to high frequency signals.  A low duty cycle signal at 20 kHz may not register at all on some meters.  Measuring the PA signal will verify that your program is generating an output and that your meter can measure it.  At 50% duty cycle the meter should read about 2.5 V.  Depending on the internal circuitry the H-bridge output may do strange things with no load. Try it with a 10-25 ohm resistor (rated to handle 60-25 watts) across M1 and M2.  If you do not have a suitable resistor, you could use two automobile (12 V) brake lamps in series. With a resistive load if you still do not see anything try reducing the PWM frequency to 1-2 Hz.  Then you should be able to see it actaully switch with any DC voltmeter.  Do you have an oscilloscope available?

 

Lynn

0 Kudos
Message 2 of 6
(3,915 Views)

Hi Lynn,

 

1.  Right now, I am using a frequency of around 4000 Hz.  The H-bridge people recommended that I use somewhere between 2000-8000 Hz, but said that it could vary for my application.

2.  I am using a high duty cycle (0.999).  This is the highest my counter output will allow before it crashes with some error message.

3.  When I measure this for the above parameters, I get a voltage of around 4.33 V.  I'm not sure why, but I cannot quite get the full 5 V output even when the duty cycle is basically maxed out.  As you were saying, I would think a 0.5 duty cycle would give somewhere around 2.5 V, but when I measure with the voltmeter at that value, it is closer to 2.17 V...

4.  Right now I just have the leads of the voltmeter connected to M1 and M2.  Eventually I will connect a heater to M1 and M2 so that the PWM signal will power the heater.  Additionally I'm not sure of a good way to measure impedance since I am only using a multimeter.

5.  When connecting the voltmeter between M1 and M2, as shown in the H-bridge diagram on page 3 of that link, something curious happens.  For lower voltage readings, the voltmeter reads ~0 V.  However when I gradually increase the power source voltage, at somewhere between 4.8-5.0 V, the voltmeter suddenly jumps and reads at whatever the power source is outputting (so it reads for 5.3 V for a 5.3 V output from my power source).  I have NO idea why that is the case...

6.  Yes, the jumpers are connected as described, in the EA and CA positions.  Note that I have nothing wired to the CA screw terminal on the CN1 connector block.

 

I do not have a resistor available to me right now, but maybe I can get a hold of one...are you suggesting that I connect a resistor across M1 and M2, and then measure between M1 and Bat. Negative?  Also don't have an oscilloscope.  Is that the only way to observe a switching of the circuit?

0 Kudos
Message 3 of 6
(3,895 Views)

Here is my attached code that generates the PWM signal...seems pretty standard, but let me know if you notice anything wrong.

0 Kudos
Message 4 of 6
(3,893 Views)

1. 4000 Hz is probably OK.  Most multimeters can respond to that.  If you were using 20 or 50 kHz, it might have been more of a problem.

2. I do not have the DAQ VIs or your device, so I cannot investigate.  Some counters in pulse generation mode cannot go to 100% duty cycle.

3. If you look at the specifications for the 6211 Digital Outputs, you will see that the voltage comes down from 5 V fairly quickly when some current is drawn.  The schematic for the H-bridge shows 220 ohms and an LED connected at the PWM-A input.  This will draw about 14 mA at 5 V (depending on the LED forward voltage characteristic).  At that current the 6211 output is down to about 4.3 V.  Exactly matching your measurement!  Of course 2.17 volts is exactly half of 4.33 V.

4. This may not be an issue.

5. Again the data sheets are your friend.  The BTS7960 half bridge IC is rated to work from 5.5 to 27.5 V. So it is completely normal for it to put out nothing until the power supply gets close to the minimum rating.

6. CA is an output to monitor the load current.  Not connecting it is OK.

 

I do not see anything obviously wrong with your connections.

 

In your VI I would probably initialize the duty cycle shift register and the DAQ Create Channel wiht a constant of value zero and put the Duty Cycle control terminal inside the loop in place of the local variable.  What is the purpose of the Is Task Done?vi inside the loop? You do not connect the boolean output to anything.

 

Try using an automotive tail or brake lamp (incandescent, not LED) as a load.  Set your power source to about 12 V. Vary your duty cycle and see if the intensity of the light changes.

 

Lynn

Message 5 of 6
(3,887 Views)

Thank you very much for the reply!  I made the changes to the VI which I guess makes for cleaner code.  I also got rid of the Task Is Done vi since I am really only just passing the tasks and error through it...I thought it had something to do with unbundling the "Status" to check for a stop condition, but it turns out that was not the case.

 

I did not have an incandescent light so I just used a 25-ohm resistor and measured the voltage across the load, and it looks like it works!  Now I can use the PWM signal in a PID application to control temperature, which was my original goal...thanks!!

0 Kudos
Message 6 of 6
(3,857 Views)