Author Topic: How to control robot using usb cable and PC  (Read 1417 times)

0 Members and 1 Guest are viewing this topic.

Offline weeblyTopic starter

  • Jr. Member
  • **
  • Posts: 7
  • Helpful? 0
How to control robot using usb cable and PC
« on: September 17, 2012, 10:03:12 AM »
I wan't to control my robot using usb cable from the PC. I have already a robot, usb cable and PC.
Simply I wan't to know how to drive a motor front,revers,left and right. I have a motor control circuit, and PIC development board.

I want to know about ,,

1.usb input/output circuit.(IC??? If there any cct diagram please post here)
2.controlling interface of PC

Please tell me clearly. I wan't to make this how ever. Before I did it using rs232. Now I want to do it using a usb cable.

Offline Arkboy

  • Jr. Member
  • **
  • Posts: 10
  • Helpful? 0
Re: How to control robot using usb cable and PC
« Reply #1 on: September 17, 2012, 10:09:32 AM »
weebly,

I don't know much about the PIC's but if they have UART pins you may be able to use a USB breakout board and your RS232 shifter to send commands to the UART pins.

-Arkboy
Failure is just another excuse to keep playing with your robot.

Offline weeblyTopic starter

  • Jr. Member
  • **
  • Posts: 7
  • Helpful? 0
Re: How to control robot using usb cable and PC
« Reply #2 on: September 17, 2012, 10:24:19 AM »
Thank you. Can I do it without using a PIC? If so how I should do it?

Just think now I have,

1.motor
2.usb cable
3.pc with a usb port
4.usb breakout board

Please tell me how to do this .

Offline Arkboy

  • Jr. Member
  • **
  • Posts: 10
  • Helpful? 0
Re: How to control robot using usb cable and PC
« Reply #3 on: September 17, 2012, 10:40:08 AM »
weebly,

The reason I said PIC was because you said you were using a PIC development board with your robot.  I'm not sure how you would drive it without a micro controller.  You would have to have an motor controller/H-bridge circuit to be able to drive the motors without killing your computer, but I don't know how to signal using USB.  Basically you would need to find drivers to turn on and off the tx pin on the USB port.  If the H-Bridge gets high logic level it will turn on your motor but you would need to have a USB cable for each H-Bridge channel so you are better off using a micro controller because you could tell the micro controller a lot more information and let it turn the motors on and off using the motor controller/H-bridge.   

-Arkboy
Failure is just another excuse to keep playing with your robot.

Offline weeblyTopic starter

  • Jr. Member
  • **
  • Posts: 7
  • Helpful? 0
Re: How to control robot using usb cable and PC
« Reply #4 on: September 17, 2012, 10:52:40 AM »
Thnaks for interesting and share your knowledge with me.

I have a motor controller. No worries about that. I guess I can do you told things buy using my PIC. It has USART pins. So is it possible for me to use my PIC? I'm using 18F452. When I using a usb break out board, is ther any crash because pc is UART and my pic is USART?

Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: How to control robot using usb cable and PC
« Reply #5 on: September 17, 2012, 04:17:11 PM »
Hi,

[...] using my PIC. It has USART pins. So is it possible for me to use my PIC? I'm using 18F452. When I using a usb break out board, is ther any crash because pc is UART and my pic is USART?
The '452 has got an AUSART (Addressable Universal Asynchronous Receiver Transmitter, The "S" just means "Serial" (as opposed to parallel) which they all are, synchronous or asynchronous, so the "S" is quite superfluous :)

Be aware that you have to set the PIC for the '232, as it is able to do '485 as well - apart from that, it's all semantics.


If you use an USB to (pseudo-) EIA/TIA-232 converter-cable, the PIC will just see the '232 signal, probably in a 0..5V logic, but you'll need to verify this before connecting up anything.

Personally, I'd just change to one of the USB enabled PICs, rather than having to mix two protocols.
Regards,
Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?
Please remember...
Engineering is based on numbers - not adjectives

Offline waltr

  • Supreme Robot
  • *****
  • Posts: 1,943
  • Helpful? 98
Re: How to control robot using usb cable and PC
« Reply #6 on: September 17, 2012, 05:53:17 PM »
Soeren,
Quote
The '452 has got an AUSART (Addressable Universal Asynchronous Receiver Transmitter, The "S" just means "Serial" (as opposed to parallel) which they all are, synchronous or asynchronous, so the "S" is quite superfluous :)


AUSART means: Addressable Universal Synchronous Asynchronous Receiver Transmitter.
It does have a Synchronous mode but the most common usage is for Asynchronous with an RS232 level translator.

weebly,

 Microchip has lots of App Notes on how to use PICs. For serial read AN774.

Here is a link to a good tutorial on using and programming PICs:
http://www.gooligum.com.au/tutorials.html
Almost all of the lessons can be done the the MPLAB SIMulator with a need to buy any hardware.

Offline weeblyTopic starter

  • Jr. Member
  • **
  • Posts: 7
  • Helpful? 0
Re: How to control robot using usb cable and PC
« Reply #7 on: September 17, 2012, 09:33:10 PM »
Thank you for all advice,,

According to your opinion

PC>>>>USB PORT>>>USB CABLE>>>USB BREAKOUT BOARD>>>>PIC(18f452)>>>MOTOR CONTROLLER>>>MOTOR

Is this impossible or difficult to do???I already have done rs232. That's why now I'm trying for usb mode.

Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: How to control robot using usb cable and PC
« Reply #8 on: September 18, 2012, 02:33:40 PM »
Hi,

AUSART means: Addressable Universal Synchronous Asynchronous Receiver Transmitter.
It does have a Synchronous mode but the most common usage is for Asynchronous with an RS232 level translator.


My bad assumption - based on Microchips website that describes it as:
Quote from: http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en010296
and Addressable Universal Asynchronous Receiver Transmitter (AUSART)

and I've seen this "S" on several instances on devices that don't do synchronous comms.

Nice that there's always a keen eye to catch the errors ;D
Regards,
Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?
Please remember...
Engineering is based on numbers - not adjectives

Offline waltr

  • Supreme Robot
  • *****
  • Posts: 1,943
  • Helpful? 98
Re: How to control robot using usb cable and PC
« Reply #9 on: September 18, 2012, 04:25:50 PM »
Thank you for all advice,,

According to your opinion

PC>>>>USB PORT>>>USB CABLE>>>USB BREAKOUT BOARD>>>>PIC(18f452)>>>MOTOR CONTROLLER>>>MOTOR

Is this impossible or difficult to do???I already have done rs232. That's why now I'm trying for usb mode.

If you know how to program for serial comm (RS232) on both the micro and PC sides then its just connecting some pieces to use a USB port as a virtiual Comm port. You could use an FTDI chip (USB to serial) or a adapter cable (USB to RS232).
PIC to motor controller can be very easy or a big challenge depending what if you buy the controller or build it.
Again, Microchip has a lot of App Notes including basics on motor control that are worth reading.

Offline weeblyTopic starter

  • Jr. Member
  • **
  • Posts: 7
  • Helpful? 0
Re: How to control robot using usb cable and PC
« Reply #10 on: September 18, 2012, 10:12:01 PM »
Usb breakout board has   GND , D+ , D- and VBUS .

The problem I have is where to connect these output? PIC 18F452 has TX and RX two pins. When I use a RS232 board there was direct two output for PIC RX and TX pins.

But in this case I have no idea about how to connect output to my PIC. Can anyone please help about that case.

Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: How to control robot using usb cable and PC
« Reply #11 on: September 19, 2012, 01:31:54 PM »
Hi,

Could you post a link to your USB board?
Regards,
Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?
Please remember...
Engineering is based on numbers - not adjectives

Offline waltr

  • Supreme Robot
  • *****
  • Posts: 1,943
  • Helpful? 98
Re: How to control robot using usb cable and PC
« Reply #12 on: September 19, 2012, 06:18:33 PM »
Usb breakout board has   GND , D+ , D- and VBUS .

The problem I have is where to connect these output? PIC 18F452 has TX and RX two pins. When I use a RS232 board there was direct two output for PIC RX and TX pins.

But in this case I have no idea about how to connect output to my PIC. Can anyone please help about that case.
Which USB break-out board??????????????
A link to its data sheet would help.

 


Get Your Ad Here

data_list