Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

help with methods of connection to pc?

Status
Not open for further replies.

trancetyper

New Member
i have about 6 components.. mostly sensors, temperature readers, including wireless transmitter/receiver.. I'm trying to interface it with a gui system to hook all the components together.. its supposed to be a "smart home system"

intial idea was to use a PIC and bring all the data in (serial) and have it output to a small screen. However after discussing it with our professor he recommended the use of USB. We're trying to use Visual basic and so need to interface all the components via usb.

so we're thinking rs232-usb adapters and then a usb hub. This will help us connect all the devices through "one" usb.. otherwise it'd be 6 serial ports or use a MUX and DEMUX..

need help with visual basic and usb.. how to bring the data in/out of the usb.. ideas? sugguestions? thx
 
USB is greatly more complicated to do, and RS232 to USB converters are EXTREMELY slow, the maximum transfer rate is only 9600 baud!. Elektor did a good article about this recently, complete with test results. Essentially serial deals with single bytes, USB deals with much larger packet sizes - forcing USB to use single bytes (as an RS232 converter does) results in only 9600 baud.

It would be a great deal simpler to use serial, you only need a single serial port, use another PIC (or one of the existing ones!) to get data from all the sensors, then send it to the PC.
 
Yes, there's no reason you can't just send all the data with one PIC... simply send it all as one formatted string of data (delimit the values with commas or something) and then break it up at the receiving side... certainly worlds easier than having 6 serial ports, and it also allows for future expansion (adding more sensors, etc) without having to add a serial port each time.
 
Nigel Goodwin said:
... RS232 to USB converters are EXTREMELY slow, the maximum transfer rate is only 9600 baud!....

According to my experience this is not true. I use them all the time and they go up to 115kbps (most models) or higher (some models).

major drawback for all virtual coms is not the speed, it's the signal power.
they are ok for communication but not when device draws power from serial port (like some pic programmers for example).

some of the converters have multiple RS232 ports. those usually have lower speed limits per com port when compared to same brand / single com port devices. even so they usually meet at least 115kbps.

An example from Moxa:
single port adapter goes to 930kbps
**broken link removed**

four port adapter goes up to 115kbps per port
**broken link removed**

Although we use everything (StarCom, Belkin etc., whatever we can get
fast so anythign you see in Business Depot or Stales or radio Shack ...),
But I really like Moxa products. They usually cost more but they have far superior products.
I am not aware of any other brand offering 15kV ESD protection on COM port (most don't have any).
everyone makes internal multiport cards (such as PCI with 4 or 8 ports)
that even come with isolation - but only on 2 or 4 signals (which they usually don't tell you).
Moxa has 8-port card that is fully optically isolated.
 
Well if it is power that limits the transmission speed of a PC COM port you could produce a daughter-board to buffer the PC-output to allow some current capability. That way the PC-COM port only has to supply a small amount of current
 
buffering would allow operation of devices hungry of port power.
better would be to design device to use com port for communication.
making all these hardware hacks and pay price of compatibility
just to avoid small power supply is silly.
simple way of adding number of com ports to pc is by use of multiport cards as mentioned already or using com servers. rocketport and others
make such devices that have 1,2,4,8 or more ports and connect to ethernet for example. all of the makers supply proper drivers (like ActiveX) for easy integration in VB. We use VB as well.
VB's built in components for rs232 are limited to 19200bps but if you use just about anything else you can use any speed supported by device.
 
panic mode said:
Nigel Goodwin said:
... RS232 to USB converters are EXTREMELY slow, the maximum transfer rate is only 9600 baud!....

According to my experience this is not true. I use them all the time and they go up to 115kbps (most models) or higher (some models).

Have you measured the actual transfer rate?, the RS232 link can quite happily be set to 115kbps, but the overall transfer rate is still only about 9600 baud - individual bytes are transferred at 115kbps, but with large waits inbetween bytes.

The Elektor article quoted the reasons and the maths behind it, plus they gave speed measuring programs to measure it for your self.
 
i AM sure, i do it almost every day. :D

ok, just to prove it, i decided to use generic el-cheapo converter with Prolific chip, two PCs and crossover cable (Allen Bradley 1747-CP3).
the other pc was also D800 Dell laptop using similar converter.
(Dell D800 comes with built in port too).
port setting 115kbps (if you want i'll test with higher too), 8-bit, no parity, no handhake. sample file was PDF document about recovering password from AB PLCs (SLC series). file is 1,540,096 bytes or close to 1.5Mb.
sustained transfer rate was just over 11200 characters per second. transfer was complete in about two minutes.
 

Attachments

  • virtualport_115kbps.gif
    virtualport_115kbps.gif
    36 KB · Views: 944
edit:
the screenshot is using COM5 but i named it com1_port while
setting up HyperTerminals....
note that first 300kb was transfered in under 30second which
also indicates more than 10kb/s
 
Are you using USB 2.0 or USB 1.1?.

The Elektor article is about USB 1.1, I'll give you a VERY brief summary.

Serial data is transferred over USB in data packets.

The data packets are sent out at 1mS intervals.

The receiver must check that a complete and correct data packet has been received and send back acknowledgement data.

The shortest possible turn-round time for sending a single byte over USB is three milliseconds.

The link to the Elektor test software can be found at **broken link removed**.
 
trancetyper said:
i have about 6 components.. mostly sensors, temperature readers, including wireless transmitter/receiver.. I'm trying to interface it with a gui system to hook all the components together.. its supposed to be a "smart home system"

intial idea was to use a PIC and bring all the data in (serial) and have it output to a small screen. However after discussing it with our professor he recommended the use of USB. We're trying to use Visual basic and so need to interface all the components via usb.
Why not just go old school style and use a serial port and Quick Basic?
All you need to figure out is the port address (either 3F8h or 2F8h) and write to it.


so we're thinking rs232-usb adapters and then a usb hub.
You dont need them

This will help us connect all the devices through "one" usb.. otherwise it'd be 6 serial ports or use a MUX and DEMUX..
You can just connect all serial port devices around a central controller, and give each device an ID so that it knows when to work for you.
 
just learn PYTHON and download the PYserial module it is soo easy to work with serial (and USB) using PYTHON
 
Nigel,

Elektor's software only supports COM1-4. I cannot test it with USB1.x since all our PCs have USB2.0 (this includes USB hubs).
I'm not sure about the USB<>RS232 adapter, but it's old and I think it's only USB1.0 (I'l try to find disc with drivers and manuals).
I don't see where one byte turnaround of only 3ms comes from when USB1.x supports up to 12mbps - thats 100x faster than 115kbps used in my test. It should allow transfer rates of 1Mb/sec. With 3ms per byte, max troughput would be some 330 bytes per second.
 
panic mode said:
With 3ms per byte, max troughput would be some 330 bytes per second.

yeah, if it only sent one byte per 3ms packet.

however, who's to say that every USB-serial converter only sends one byte per packet? with a small buffer it could easily send many bytes in a packet, then I imagine it would only be a matter of the driver being able to deal with that. I'm sure what nigel says is correct for some usb-serial converters (perhaps older ones?) but I find it hard to believe that there are none out there that can go faster.
 
that's what i tought too but the article supporting it is supposedly only a month old. hard to think they would get so many lemons. maybe they just missed few decimal points.
 
thanks guy for the input. That was the initial idea, to use a pic to process the information. Teacher was just adding that usb would be better cause its newer technology blah blah.. shoot... with 7 weeks left to this project and 9 months passed, i think we'll stick with our original plan and use a pic to do the integration of the components and use the pc as just an interface.. thanks again

nesh
 
panic mode said:
that's what i tought too but the article supporting it is supposedly only a month old. hard to think they would get so many lemons. maybe they just missed few decimal points.

They tested a number of different converters, I presume that most are based around the standard chips you can buy?, does the FT232 and similar not do any buffering?.

Obviously if the converter can buffer a number of bytes in order to increase the packet size, then throughput would be increased accordingly.

The converters I've used have always seemed very slow, but I've usually used them on digital cameras, where it's slow to read from the card anyway!.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top