Log in

View Full Version : Creative Misuse of Digital IO


Orborde
30-05-2005, 03:47
I've been reading about how serial communications could be used for Good Things on the robot, and since I haven't figured out quite how to use the TTL/RS232 ports, I thought of writing a serial data transfer thingy for use between two IFI RCs over the Digital I/O ports. So the question is: what happens if I wire a digital IO configured for output directly to one configured for input? Does anything dangerous result? My electronics is a little shaky, so I'm not quite sure whether this might damage the RC.

Joe Johnson
30-05-2005, 07:38
I've been reading about how serial communications could be used for Good Things on the robot, and since I haven't figured out quite how to use the TTL/RS232 ports, I thought of writing a serial data transfer thingy for use between two IFI RCs over the Digital I/O ports. So the question is: what happens if I wire a digital IO configured for output directly to one configured for input? Does anything dangerous result? My electronics is a little shaky, so I'm not quite sure whether this might damage the RC.

This should be fine. Actually, when you are debugging, it is sometimes useful to loop the TX and the RX to eachother on one RC. It this way you can send data and check that you get it in the same program.

Joe J.

Mike Betts
30-05-2005, 12:56
This should be fine...

Dr. J.,

I would disagree. The TTL port is meant to be used by a device which derives it's power from the RC (such as a SMiRF or CMU2cam).

I am unsure if the RC has an optocoupler on this port. I rather doubt it. and you don't want the power supplies of the RC's fighting each other...

Unless IFI says different, I would wirewrap a small optical interface board where the RX side of each channel was powered by the receiving RC's +5V and GND. There are many optoisolators which can be used. As an example, I would recommend the HCPL2300 IC chip with a 3.3K series input resistor and a output inverter/buffer for this task.

If IFI says it is OK, you could connect only TX RX and GND and not connect the +5 power between RC controllers.

Bottom line, I would not direct connect without talking to IFI first.

Mike

Kevin Watson
30-05-2005, 19:18
Dr. J.,

I would disagree. The TTL port is meant to be used by a device which derives it's power from the RC (such as a SMiRF or CMU2cam).

I am unsure if the RC has an optocoupler on this port. I rather doubt it. and you don't want the power supplies of the RC's fighting each other...

Unless IFI says different, I would wirewrap a small optical interface board where the RX side of each channel was powered by the receiving RC's +5V and GND. There are many optoisolators which can be used. As an example, I would recommend the HCPL2300 IC chip with a 3.3K series input resistor and a output inverter/buffer for this task.

If IFI says it is OK, you could connect only TX RX and GND and not connect the +5 power between RC controllers.

Bottom line, I would not direct connect without talking to IFI first.

MikeYes, optoisolators would be nice to have, and I certainly understand your worry about frying electronics if the ground potentials were different, but I can't see anything bad happining if everything is battery powered (and referenced to the battery's ground terminal). Bad things will likely happen if the two devices are powered by separate AC/DC converters, where the grounds can have very different relative potentials (I know you know this Mike, but I suspect a few people reading this don't).

-Kevin

Joe Johnson
30-05-2005, 21:52
I would listen to Betts or Watson on this one. I am just an ME are heart. I was thinking about what I would do on my benchtop rather than the possible problems Mr. Betts brings up.

I would think all would be well if the ground wires for the RC's would be connected.

What do the Sparkies in the audience say?

Joe J.

Matt Krass
31-05-2005, 23:04
Not to be a bugger, but I don't think he intends to use the TTL port...he meant using the Digital sensor input/outputs..at least thats what I got from his post. I'm no electrical guy, but I don't think that'd be a problem, I'd perfer to have someone a little more experienced confirm this, I don't want anyone chasing after me yelling "You blew up my $500 RC!"

Orborde
01-06-2005, 01:10
Not to be a bugger, but I don't think he intends to use the TTL port...he meant using the Digital sensor input/outputs..at least thats what I got from his post. I'm no electrical guy, but I don't think that'd be a problem, I'd perfer to have someone a little more experienced confirm this, I don't want anyone chasing after me yelling "You blew up my $500 RC!" That is precisely correct. I assumed that the TTL ports would be built to be plugged into each other, but since I haven't figured out how to use those, I was wondering about the Digital IO.

Al Skierkiewicz
01-06-2005, 07:42
So the question is: what happens if I wire a digital IO configured for output directly to one configured for input? Does anything dangerous result? My electronics is a little shaky, so I'm not quite sure whether this might damage the RC.

I think what you are asking is "Can I use the relay outputs as a serial digital link to the digital inputs on another RC?" The answer is maybe but there are some other things that will get in your way besides just the electronic interface. I will let Mike or Kevin answer more on this, but the digital inputs are scanned. That means that the RC isn't looking at them all the time so to act as a serial port you will need to keep data there long enough to be accurately read. In normal serial communications, the transceivers "handshake" and both will know when data has been transmitted and when it is accurately received.
The relay outputs are really intended to control the IFI Spike relays. Being the kind of output that does not need to rapidly turn on and off, these outputs may in fact, be to slow for your use. That being said, we have used the digital inputs for data transfer from a custom circuit to the RC.

Matt Krass
01-06-2005, 09:00
I think what you are asking is "Can I use the relay outputs as a serial digital link to the digital inputs on another RC?" The answer is maybe but there are some other things that will get in your way besides just the electronic interface. I will let Mike or Kevin answer more on this, but the digital inputs are scanned. That means that the RC isn't looking at them all the time so to act as a serial port you will need to keep data there long enough to be accurately read. In normal serial communications, the transceivers "handshake" and both will know when data has been transmitted and when it is accurately received.
The relay outputs are really intended to control the IFI Spike relays. Being the kind of output that does not need to rapidly turn on and off, these outputs may in fact, be to slow for your use. That being said, we have used the digital inputs for data transfer from a custom circuit to the RC.

I don't think he meant the relay outputs either (I know I'm very annoying :) ) it would seem from the spec sheet for the RC that 16 digital I/O lines are just that, input/output lines, so you should be able to send a signal from them. These should be faster than the relay outputs right? I believe his intent was using purely the digital I/O lines, but I could be wrong. However if he is would I be correct in saying it's electrically safe/compatible?

Al Skierkiewicz
01-06-2005, 09:08
I don't think he meant the relay outputs either (I know I'm very annoying :) ) it would seem from the spec sheet for the RC that 16 digital I/O lines are just that, input/output lines, so you should be able to send a signal from them. These should be faster than the relay outputs right?
Yes, you are correct. The RC manual does indicate that digital inputs on the RC can also be outputs with some added code and no support from IFI. I was going for the simplest solution first. Per the RC...
"For advanced users, the first six digital I/O pins can be configured as hardware interrupts. While powerful, this feature can cause undesired operation if improperly used. Therefore Innovation First will not provide support for this feature. More details on using interrupts can be found by referring to the 18F8520 microcontroller datasheet and the MPLAB® C18 C Compiler User’s Guide. The Default Code has an interrupt handler written for these pins, but you must still configure and enable the interrupts to use them."

Dave Flowerday
01-06-2005, 09:23
the digital inputs are scanned. That means that the RC isn't looking at them all the time so to act as a serial port you will need to keep data there long enough to be accurately read.
This was true on the old PBASIC RC, but is not accurate anymore since they switched to the PIC for the user processor. The digital inputs are inputs direct to the processor and are not scanned.

Sparks333
01-06-2005, 10:37
Just a thought:
It seems to me that if one were to connect to the Digital I/O, you wouldn't want to choose the interrupt lines, whichever ports they may be. You wouldn't want to hook the +5v lines together, because of potential differences. How about powering both robots off a single battery, or hooking the batteries together? Both would be at the same voltage level, then. On the digital i/o only using ground and signal, it seems, may be a safe experiment.
This is outta my leauge, so I look forward to a response.

Sparks

Al Skierkiewicz
01-06-2005, 10:45
Sparks,
The RC guide speaks about the interface activity for the Digital I/O ports. See page 9 for a complete description. In effect what takes place is the inputs are all pulled up internally so that external devices only need to supply closing contacts to ground for a low or an open (pulled up internally) for a high. As outputs, the description indicates a standard tristate device in which the pin can be either high, low, or open circuit. The RC guide also points to the Programming Reference Guide for software control of the pins.

Kevin Watson
01-06-2005, 13:49
I've been reading about how serial communications could be used for Good Things on the robot, and since I haven't figured out quite how to use the TTL/RS232 ports, I thought of writing a serial data transfer thingy for use between two IFI RCs over the Digital I/O ports. So the question is: what happens if I wire a digital IO configured for output directly to one configured for input? Does anything dangerous result? My electronics is a little shaky, so I'm not quite sure whether this might damage the RC.As I mentioned above, this won't be a problem if they're both battery powered. Do not try this using two AC/DC converters because the two RC grounds may be at very different potentials and much current may flow when you connect the grounds together (Many years ago, when I was a newbe engineer, I smoked some hardware when I attached a non-isolated oscilloscope probe ground to the circuit I was debugging <grin>). Furthermore, it would be pretty hard to fry the digital I/O pins because IFI uses 680 ohm series resistors (http://www.ifirobotics.com/docs/analog-digital--i-o-rc.pdf) to keep the current within safe limits.

BTW, I've written some code that implements a software serial transmitter that can use any I/O pin. You can find it here: http://kevin.org/frc.

-Kevin