Go Down

Topic: How to detect FTDI UART connected to Arduino? (Read 3299 times) previous topic - next topic

_Leo_

Everyone,

I need a simple, effectiv and fast working solution on how to detect a FTDI UART connected to the Arduino.

Code: [Select]

Setup()
{
...
}

void loop()
{
if(FTDI UART board is connected to Arduino)
{
do this....;
}
else  // (Arduino is connected to a battery only)
{
  do that....;
}


Thank you.
Leo

Project "ALTDuino" - A homemade altimeter for model rockets.
http://www.altduino.de

Grumpy_Mike

Well you can't.
On a normal arduino the FTDI is connected all the time, what you are asking is is that connected to a USB.
Short of sending something out and seeing if there is a responce, there is nothing you ca do to detect if it is connected.

_Leo_

I'm using a Pro mini and a FDTI breakout board (I forgot to mention that).

Would that be possible?

If not, how would an example  "sending something" code look like?

Thank you.
Leo

Project "ALTDuino" - A homemade altimeter for model rockets.
http://www.altduino.de

PaulS

Quote
If not, how would an example  "sending something" code look like?

Code: [Select]
Serial.print("Hey, anybody want to do my research for me?");
The art of getting good answers lies in asking good questions.

Grumpy_Mike

#4
Jul 18, 2012, 11:15 am Last Edit: Jul 18, 2012, 11:22 am by Grumpy_Mike Reason: 1
Quote
how would an example  "sending something" code look like?

Code: [Select]
Serial.print("something");

This then relies on you having something at the other end that well send something back when it receives a prompt. If it has not replied in a certain amount of time then you can assume nothing is connected.

Code: [Select]

nothing = false;
long time= millis();
while(Serial.available() == 0 && nothing == false { if( (milis() - time) > timeout) nothing = true; }

// nothing = false if you have a connection and true if you do not


dxw00d

Quote
// nothing = false if you have a connection and false if you do not

Copy/Paste problem?

Grumpy_Mike

First thing in the morning brain fart problem.

_Leo_

Thanks guys.

I was hoping to avoid a solution as described above and wishing more of a method like; is any one PIN on FTDI board up or down.
Leo

Project "ALTDuino" - A homemade altimeter for model rockets.
http://www.altduino.de

pylon

You can make a special connector for your FTDI board that pulls some pin to ground when connected and program your Arduino to activate the pullups for that pin. So without the board connected you read HIGH, with the board connected it's LOW.

As this requires special hardware (the special connector) the other posters are right, that it's not possible by using only software (except if you have more than the FTDI connected like a computer that reacts to some prompt).

graynomad

You will have to add at least a little hardware. How about a pulldown resistor on the RX or DTR pin, when the FTDI cable is plugged in that should go high.

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

_Leo_

Thanks again guys.

Since I want to aviod any hardware changes I found a compromise solution by using the led on the Arduino to tell me if RX and TX is ready.

That will work for now.
Leo

Project "ALTDuino" - A homemade altimeter for model rockets.
http://www.altduino.de

Go Up