Best way to interface PC to arduino

Hey guys, first post.

I have done some research into wireless communication between PC and arduino. I would like to wirelessly send ascii characters to the arduino and in turn the arduino will move a stepper motor to a set spot, for example <s 1 10> will move stepper motor 1, 10 steps forward.

Now, bluetooth communication in my eyes would be the easiest as far as I have read, but I have also read that it is driver dependent and that doesn’t help if I want to make this a portable application.

I would like to make the program via dev C++ to work with the interface device. USB and bluetooth sound the easiest, but as I said before, they are dependent on drivers.

So basically I’m asking, is there an easy way to interface an arduino and a PC, so that I can easily create a C++ program to send ascii code to the arduino.

Thanks in advance!

Now, bluetooth communication in my eyes would be the easiest as far as I have read, but I have also read that it is driver dependent and that doesn't help if I want to make this a portable application.

Read where? Certainly not on this forum.

I would like to wirelessly send ascii characters to the arduino

Over what range?

So basically I'm asking, is there an easy way to interface an arduino and a PC, so that I can easily create a C++ program to send ascii code to the arduino.

Yes. Think XBee.

Well both the USB and Bluetooth all convert to Serial I/O which goes to the UART on the chip. The "easiest" way to talk to the Arduino is directly via a serial port, which requires nothing more than the standard system serial driver.

Many clone Arduinos save complexity and cost by supporting only Serial (RS232), just run through a MAX232 chip or similar. My Adafruit Boarduino is of this type-- I use a serial cable to my MAX232 based Serial-to-TTL cable, which connects directly to the port pins (rx/tx) on the BoArduino. That way, the BoArduino doesn't need to keep that circuitry on-board, reducing size and cost.

My (and your) "standard" arduino uses a chip on the board to convert from USB to Serial, which is then connected the same way, through a max232 (look on the board) serial-to-ttl converter.

SO... Serial the answer. How you GET to serial; that's the question..

I've not used any of the wireless solutions (yet), but as I understand XBEE as well as most Bluetooth adapters simply act as a virtual wire.. the computer and Arduino talk over a serial link via bluetooth, the only driver you will need is for your own bluetooth dongle or builtin on your computer. Once paired, neither the computer nor the Arduino know or care that the connection is wireless. I have an older inkjet printer that uses bluetooth as a connection option.. once paired to the computer, it's just another COM: port printer. The actual drivers to make that printer work are another issue, but the connection is simple.

Range for bluetooth is supposed to be something like 10m, I find around 20 feet more realistic for most applications in a noisy electrical environment when using other bluetooth-connected items.

Just with in the 10m radius that bluetooth is usually rated for.

The source was a C++ forum, a member asked about sending ascii data via bluetooth and was told that it is very difficult because of driver issues.

Are you saying that it would be much easier to code a program to work with the xbee "board" for the arduino than any other method of wireless transmission?

Thanks for the fast response!

XBees are basically a drop in replacement for the USB cable that is used to program the Arduino. Very easy to use.

Yes, I'm aware of that. My question is mainly aimed at simplicity via the PC end, arduino coding will be much easier. I need to basically find an easy way to transmit ascii via pc to arduino. In your opinion is bluetooth the way to go?

Also is there any sample code you have seen for C++ --> xbee communication via PC?

Again thanks for all the help!

In your opinion is bluetooth the way to go?

I thought I made that clear. No. There. Is that clear, now?

Also is there any sample code you have seen for C++ --> xbee communication via PC?

It's just a matter of writing to the serial port, and reading from it. Plenty of examples on the forum. Trivially easy from C#, but C++ is easy enough for some people.

Ok, sorry now you have confused me. I was under the impression that an Xbee is a Bluetooth radio frequency device. Is that correct?

From my research, I see there are 2 modes for the Xbee, there is USB and Xbee mode. As far as I know, I want to use the USB mode, which will connect to the PC via bluetooth… is this correct?

Or are you trying to say, there is a sender and receiver Xbee device? If that is the case then this will be the most easiest way because sending and receiving via serial will be much easier to code.

I was under the impression that an Xbee is a Bluetooth radio frequency device. Is that correct?

It may be in the same frequency, but XBee is NOT bluetooth.

Or are you trying to say, there is a sender and receiver Xbee device? If that is the case then this will be the most easiest way because sending and receiving via serial will be much easier to code.

Sender on the PC side. Receiver on the Arduino. (Although the radios are transceivers, so both can talk to the other.) Exactly.

Hey Paul... for my own reference (having seen modules around), are the bluetooth modules NOT "virtual wire"? I've browsed some at several online vendors, usually mentioning "AT" commands (are you kidding me? Is this STILL the Hayes/USR commandset from back in the day?).. I just had assumed that pairing by default would make it appear as a serial direct connection, not as a Modem, per se

I had assumed (and ads didn't say directly as I have since noted) that the modules would act as a simple COM port device transparently via the bluetooth connect.. is that not the case?

If that's the case, then Xbee (because it does support virtual wire mode) is the right way to go for sure...

I had been thinking about getting one of these: http://www.mdfly.com/index.php?main_page=product_info&cPath=8_47&products_id=428 "Bluetooth TTL Transceiver Module w/ Breakout", $13.95 (9.95 for the 3.3v version) to play with.. I burned up my RS232/TTL converter, and I figured this is better than replacing the max232 on my hokey cable.. I've bought things from MDfly before, dirt cheap on basics like LED's (50 3mm LED's for $1.35, a 16x2 standard LCD (works great) $4.. they've so far been fast and exactly as described. It would just "not be like them" to leave it kinda gray, imo)- and it would seem to indicate that it should function as a transparent COM connection, though not worded that exact way. If it's not going to function as a virtual wire, then it's not very useful for the purpose I (and the poster!) wanted it for, and I'd be wasting $14+a couple bucks shipping.

Thoughts?

I've browsed some at several online vendors, usually mentioning "AT" commands (are you kidding me? Is this STILL the Hayes/USR commandset from back in the day?).

Just because modems are no longer as prevalent as they once were does not mean that a good protocol should be discarded.

are the bluetooth modules NOT "virtual wire"?

They are not real wires, but they replace real wires, so, yes, they can be thought of as virtual wires.

I had assumed (and ads didn't say directly as I have since noted) that the modules would act as a simple COM port device transparently via the bluetooth connect.. is that not the case?

If you are referring to XBee modules, no. XBee id NOT bluetooth. It is far better.

For one thing, it works. I have not seen a single post on this forum that said "Hey, I got my bluetooth whatever working with my Arduino" or "Hey, I got my bluetooth Arduino working with whatever".

Ok, thanks for the help! Looks like I'll be getting a few Xbee's then.

I found this board http://www.littlebirdelectronics.com/products/XBee-Explorer-Serial.html

Looks like it would be the easiest way to interface.

The board I linked to above is $38 :'( and each Xbee is ~$35 for the 2mW series.... WTF? Is there cheaper clones of the Xbee's? or a cheaper board for serial connection? I have had a look around in the hardware section, but I don't know what I'm looking for....

Thanks...

Do you have a real serial port on your computer? Is that port what you are trying to connect to? If so, then that board is what you need.

If you have USB ports, though, something like this

is cheaper.

I have used both BlueTooth and xBee between the Arduino and PC.

The only advantage BlueTooth has is that many PCs already have it built in and if they don't it is incredibly cheap to get and easy to find. If you want almost anyone to be able to connect to your device without special hardware, BlueTooth is a good choice. Even if they have to get an adapter, I would not consider BlueTooth "special"; I can get it off the shelf half a dozen places on the way home (and one of those places only stocks items costing $5 or less).

However, from a usability/usefulness perspective, xBee wins hands down. I can lose BlueTooth connectivity inside my house. I have 900 MHz xBee modules that are good for over a mile with small antennas and about 5 miles with bigger ones. You can also get lower power ones for less money that have no visible antenna. Anyway, more choices in range. When I break a connection to a BlueTooth device, if I had the COM port open in an application that connection is now invalid and can only be re-established when the device is back in range and the partnership re-established. With xBee, my connection is to the xBee attached on my end. Having another xBee come into range or wander out of range does not change the status of my COM port connection to the xBee. Depending on how you set them up, it is possible to communicate with multiple devices using just the single COM port connection.

I will say that it might be semantics, but I disagree with the notion that both are like virtual wires. BlueTooth is, IMO. A wire limits you to one device on the other end and causes a problem if it is cut or stretched too far. An xBee connection is a connection to a transciever that can communicate with other transceivers when they are in range.

I will say that it might be semantics, but I disagree with the notion that both are like virtual wires.

I think we'll chalk it up to semantics. The Series 2.5 XBees can form a mesh. The Series one are point-to-point or point-to-multi-point. In the point-to-point situation, they replace a pair of wires (RX and TX). In a point-to-multi-point situation, they replace many pairs of wires (multiple connections to RX and multiple connections to TX). So, they could be considered virtual wires.

No argument that XBee is superior to bluetooth.

I was thinking about it more and in the technical sense, there is more there than semantics.

If you connect a BlueTooth dongle (or already have it built in) and there is no device in range that it is paired with, there is no serial port provided by it for you to open. When you have a Bluetooth serial device available, the BlueTooth part of it is invisible to you from a connection POV; it's like that connection is directly to the device at the other end.

However if you have a single xBee on a USB explorer, you will have a serial port available to open and the xBee will be visible to you to communicate with if you need to change settings or whatever.

Interestingly enough, they are extremely similar on the Arduino side. Both are serial devices that are always accessible and visible to you and you can communicate with the BlueTooth module even if it isn't paired.

The reason I think it is more than semantics is that the bar is a little higher as far as understanding communications and implementing protocols to get the high level of functionality available from the xBees. To use Bluetooth you don't have to understand how the data gets there, just the steps to set up a partnerships so that sometimes the data will get there (yeah, I have had issues with Bluetooth reliability). To use the xBees, you will likely need a higher level of understanding.

But yes, we agree that for most wireless Arduino applications xBees will make more sense.

Well, there's my lesson for the day. Overall, I would have thought bluetooth to be a more mature and reliable technology. I know there's range issues, but I had assumed with the module I had linked to, it would be as simple as a generic pairing and from then forward it would be functionally the same as a "regular" serial COM port.

I knew xbee could be set up this way, but I thought it to be the inferior (for no good reason, I just thought bluetooth was the obvious solution and others for the most part would be wannabe's). Score one for marketing, I guess. So, a proper xbee solution is two transceivers, and is the "right" way to do it.. even if costly. A pair is something like $50-60, yes?

I really want to add wireless to my Boarduino, as I blew up my Max232 cable jobbie, so I've got to use ISP, with Arduino as programmer, if I want to use it (until I replace the max232 with something). I'd been looking and hoping that a bluetooth-to-TTL link link might be as easy as that $14 board... should have known better ;)