Hi guys/ and the minority of girls.

This topic is for my teacher, who has asked me to find information of the following for himself.

How can he interface a USB port to run a motor through C++?

He is relatively good with computer systems himself, so why he does not know this I am not sure.
He says, if someone can show in code how to send 5volts to the motor, he should be able to do the rest.

Regards,
Harry.

Recommended Answers

All 5 Replies

Does the device already have a driver or is he expected to write one?

I've been thinking of doing something very similar, but not with a motor. Will be watching this thread with interest.

Windows, Linux, or something else?

Also, what sort of "motor" are we talking about? Servo, stepper, DC or not even electric? And define "run": Does it have to turn at 1 constant speed?

He just want to know how to send a 5V signal?

You don't just write some code to send a HIGH output to a USB port. In days gone by you could simply write some code to send a byte to the parallel printer port, or more commonly to a serial port (com1 or com2). But things have gotten at lot more complicated with the USB ports.

However, there is a chip manufacturer that makes a chip which simulates an old fashion serial com port (virtual com port) from a USB port. This chip requires almost no additional components, it just hooks up to the USB cable on one end and you get your serial output (and input) from the other end of the chip. And the chip can even be powered by the USB's own power supply lines. The manufacturer also supplies a royalty free driver software for the chip that you can download for free from their website.

So I would think that this would be his path of least resistance in getting a program to output serial data (which can easily be converted into parallel data). With this setup, the operating system sees this as the usual USB port but your application sees this as a regular com port. You also will get much higher data rates than the old com ports gave, unless you set the thing up as an RS232 port, since the level shifting IC will slow things down to about 1 megabit per sec.

So then, with this setup, writing to the USB port will be reduced in complexity to writing to a com port - which I think he should be able to figure out. Here is a link to the chip:

Click Here

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.