Go Down

Topic: Monitoring USB Output via Linux Terminal (w/ IR) (Read 899 times) previous topic - next topic

tweedius

Oct 27, 2010, 03:20 am Last Edit: Oct 27, 2010, 03:22 am by tweedius Reason: 1
Hey all, many of you may be very well aware how to do this, but it took me about 45 minutes to track this information down, hopefully this can help someone :)

I have been developing an IR TX/RX system using two Arduinos and none of the solutions on this forum quite work for what I want to accomplish.  Hopefully, I can get this done in the next week or so as I have time.

Anyways, here's what I have and maybe it can help someone not waste as much time as I did!

I guess I'll start with the code/setup (included in the code).

Code: [Select]

/* Works with IR breakout board from Sparkfun.com
  Sparkfun P/N SEN-08554, it utilizes the Vishay TSOP85
  Pin Out:
  Vcc = Arduino 5V
  Out = Arduino D2 (Interupt 0)
  Gnd = Arduino Gnd                                    */

int interuptPin = 2;
int IRPin = LOW;

void setup()
{
 pinMode(13, OUTPUT);  //For Debugging
 attachInterrupt(0, IRStateChange, CHANGE);
 Serial.begin(9600);  //For Debugging
}

void loop()
{
 digitalWrite(13, LOW);
}

void IRStateChange()
{
 IRPin = digitalRead(interuptPin);
 digitalWrite(13, HIGH);
 Serial.print(IRPin);
}


On a windows system with this program loaded and monitoring the serial port, you can point a remote at it and get a stream of 1's and 0's.  This was tested with a Philips Universal remote and a Charter Cable universal remote.

On linux it is a little more tricky, but not much.  Connect your arduino to the USB and make sure you get something along the lines of:
Code: [Select]

usb4-2 blah blah blah
...
usb4-2: FTDI USB Serial Device converter now attached to ttyUSB0


On Fedora Core 12 and with an old cruddy computer I didn't have to install any drivers and it was automatic.

Then, simply use the command:
Code: [Select]

screen /dev/ttyUSB0 9600


That is it and obviously ttyUSB# depends on what the OS reports your USB port # as.

(google screen commands for help with screen as I am not allowed to post the link because this is my first post!)

Hopefully some part of this post helped for some reason for someone :)

-Tweed

EDIT: If you find yourself in trouble with any USB device in Linux, it is always a good idea to unplug it and sift through the ashes.

Go Up