Jump to content

Using the USB-6008 for D I/O


jmtj6009

Recommended Posts

Hello all,

This is my first post, i read a few others but couldn't find the answer i needed, and it looks like everyone here has a pretty good opinion on things. I'm trying to use USB-6008/6009 DAQ cards to control the RPM of a electric motor. I want to use the digital output to generate a PWM, but I'm not sure exactly how to control the frequency of the Square Wave I want. So, I have a few questions...

1) Is it even worth using a USB-6008/6009 DAQ card?

- If not, whats the cheapest alternative?

2) I know i have to use the softaware to trigger the output, so I'm limited to how fast the software is going through the itterations, is it possible to get my signal reasonably to 50Hz while still having a descent amount of samples such that I can manipulate the duty cycle?

3) Has someone already done something similar to this and has code to give me a starting point? I'm in a bit of a jam with time :(. If not, i can try to get something together if it makes it easier for you guys to give me advice.

Thanks so much for you help!

-jim

Link to comment

I would not recommend to use a 6008/6009 to create a stable PWM-signal. You would have to do everything by software, which limits you to a theoretical resolution of 1 ms, but even that is not stable. You never know what Windows is doing besides.

I recommend to use any M-series DAQ-card, and then create the PWM-signal with the counter of that card. Very easy to do, very stable. You can find code as a starting point within the NI-Examplefinder, look for examples about continous pulse train.

Jens

Link to comment

Hey Jg69,

(1) Maybe try a PWM IC. Here is an example http://www.microsemi.com/datasheets/UC184xA.pdf. I didn't look through this one though, not sure if it is the right match for you. Just an example you could control with your 6008/9 Analog Output.

(2) Use the COM or printer ports for your digital PWM signal. I'm pretty sure you'll have less latency, but if I remember correctly you still get 1-5ms of jitter. Worth a try though (look up the printer port example in the ExampleFinder).

Best of luck,

Justin Reina

Link to comment

Thanks for the feed back so far,

I took a look at the M-Series Daq cards from NI,

I have to control 4 motors independantly but simultaneously, is it possible to do it with any of the M series DAQs? I'm currently Eyeing the NI USB-6210,

16-Bit, 250 kS/s M Series (Im looking for something USB powered mainly because I only need digital output, and installing a card

on my motherboard is a bit problematic since there is a sever lack of space in the computer case). I also like the 620 dollar price tag x.x

Link to comment

@JustinReina: I don't want to generate a PWM Signal, that's jmtj6009...

@jmtj6009: Oh, you want to control 4 motors. Then perhaps my suggestion is not the best one. You need 1 counter to control 1 motor, and a M-Series card has 2 counters. So you would need 2 M-series cards. Perhaps JustinReina's idea with the IC is also a good one.

BTW, for code, there is another current thread:

http://forums.lavag.org/Gen-2-Pulses-Conti...cle-t13672.html

Jens

Link to comment

How does the IC work and what kind of software/controls would i use with it?

also, NI has a single controller usb card (USB-6501) which has one counter channel which goes up to 5Mhz. Would it be possible to get a usb hub and plug in 4 of these bad boys and have stability in my signals? This would run me about 400 bucks since its 100/each which is pretty cheap.

(EDIT: I checked the specs, it doesnt support Pulse Generation, this means i can't send a PWM signal?)

-Jim

Link to comment

Hello jmt6009.

Do you have access to a co-worker or friend who knows a little bit about micro-controllers? It would be a simple exercise to produce one that talked to a PC via serial, and outputted 4 stable PWM signals. A uC is ~$5 each, and a programmer can be around $30.

If this is an idea you are interested in this but don't have access to a friend/co-worker, the code is super easy to digest, and pretty simple. If it comes down to it I can provide the code (I just need to re-hash some current code I have for 8-Bit Atmel). This would be a low-latency, low-cost, high-reliability, one-chip solution. Not as intimidating as it sounds, literally only requires one chip ($5), one programmer ($30) and one Serial level-shifter (~$5).

Let me know how progress goes.

Best of Luck,

Justin

*There maybe a chip out there that already does it. Or at least there should be. Never found one though.

Link to comment

JustinReina,

thanks for the advice! I just started looking around at chips but there are quite a bit to choose from. If possible, it would be great if you could provide me the code.

Also, I'm not quite sure how it would work in the end, but does the microcontroller have an embeded program and oscillator? How would I use to talk to the controller, and what language do you use to program it?

thanks so much!

-Jim

Link to comment

Hell Jim,

The controller has a CPU, oscillator, serial port and six PWM channels onboard. It comes in a DIP package (google '40-DIP'). We need

to use an external crystal (or at least we are always told to) to make the serial port timing stable (~$1).

Here is a screen-shot of some useable code for you. If you are interested in this route let me know. Other than shipping from Digikey,

it should take less than a few hours to get your chip working from install to usage. Atmel is great for such tasks.

-Justin

Link to comment

Justin,

Thank you so much for your help, i really appreciate it.

I googled '40 dip' and is this what you're talking about? http://microcontrollershop.com/product_inf...roducts_id=1287

So, I think i'm going to go with this path, Could you walk me through your code a little?Also, essentially, what should I be ordering? And when everything is finished, does this end with me inputing a voltage and then receiving a set frequency at a duty cycle proportional to the voltage?

-Jim

Link to comment

Hello Jim,

You would order:

(1-3)$5-15 Atmel Atmega 644P *You could pick any uC, but I am personally most familiar with this one

(1) $35 Atmel mkII ISP *This is a USB device that programs the chip

(1) $8 RS-232 Level Shifter (small kit)

(1) $1 Crystal (16MHz)

(1) $5-25 Misc Electronic stuff

First though as I forgot to ask, whats your electronics background? Do you have experience hooking up simple electronic circuits? Are you comfortable wiring this guy up?

Finally in response to your question, you would send 'messages' from LabVIEW through your serial port with VISA. The controller would receive and decode these, and

set the PWM accordingly. This eliminates the need for any DAQ, and is much faster and more reliable.

-Justin

*If your curious, I will be developing similar code (exactly similar) for a project coming in about two weeks. Figured if it helped you, I could just develop it now. Wont take more than an hour to write and debug.

Link to comment

Justin,

I have some electronics background, definately enough to hook up some simple circuits. I'm a Mechanical engineer (will be at the end of this semester :) ) And this project is for my senior design project (need to control motors for the thrusters to my hovercraft). I asked around to my electrical engineering dept., but they were telling me stuff that sounded way more compliated than this.

And yes, i was curious about why you were so helpful lol, but i wasn't going to start asking questions :).

-Jim

Link to comment

Justin,

Yea, thats what it looks like. I was wondering, what programmer should i look into buying?

*edit: i looked on the atmel website and they have a free prorgammer, the AVR Studio 4, codes in C or assembly, is this worth grabbing?

* Also, i'm going to have to explain how i ended up with a programmed microcontroller when i present the overall hovercraft.

* Do you mind if I cite you as a source or something since you've helped me so much? :)

-Jim

Link to comment

oops i didn't post the links... I thought I had.

(1)$35 Programmer http://search.digikey.com/scripts/DkSearch...me=ATAVRISP2-ND

(2)$18 ATMEGA 324P http://search.digikey.com/scripts/DkSearch...EGA324P-20PU-ND

(3)$16 Board http://www.sparkfun.com/commerce/product_i...?products_id=31

The board is cool cause it dramatically reduces the wiring stuff you'll have to do.

-Justin

*For my app, i need a port of Dig outputs, two SE ADCs and one diff ADC, so you'll get a little extra :) I attached a draft of my IO.

oops get one programmer, '2' chips and '1' board :)

Link to comment

jmtj6009:

As a caution, you may want to power the chip separate from you motor battery if possible. Not sure how much electrical noise you motor will generate it may be enough to cause erratic operation of the chip. Not sure if this is feasible for your craft due to additional weight. You may want to fire up the motor and check for noise with an oscilloscope then make a decision.

-AK2DM

Link to comment

AK2DM,

actually, we have a 40HP engine that will create a 36V power sink using some marine batteries that will be powering the motors seprately than all the other components of the craft. There is a seperate 12V alternator hooked up to the same engine that will be fed into an inverter to create the power source, which i think will be used for the controls. At this point weight really isnt an issue :). We had 4 of us in the group stand on the hovercraft at once, plus all the other components (around 600 lbs total weight) and we were floating :).

-Jim

Link to comment

Justin,

Definately, no prob. The guy working on the Motor/Alternators will meet up with me tomorrow and i'll start drawing out a diagram to put together. I'll send it to you as soon as we finish it up. In retrospect, we should have talked with the EE department and tried to steal some students for our senior design project lol.

-Jim

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.