Opening and Closing Serial Line

Hey all, I’ve got a sensor which I get data from through ttl. To get the data you need to power cycle the sensor which is how it is designed. You also need to, for some reason, disconnect the serial line for a couple of seconds then reconnect it or else it won’t transmit data again. So I was wondering if there is a way to open and close the line from the arduino. I was thinking about doing this with a transistor but I couldn’t think of a way to safely do it. Thanks for the help!

Got a link to the sensor. Would be able to help you better…

Yeah, its this one.

http://www.decagon.com/products/sensors … re-and-ec/

Right now I just have the serial line going into a normally closed switch with the other side of the switch connected to the rx input on the arduino and it works fine; however, when this is deployed there won’t be anyone there to press a button so I need to be able to do that in the code.

Wouldn’t setting the Arduino pins to inputs effectively disconnect them from the sensor (so far as the sensor could tell) ?

Is the serial communication and power cycling and timing that you’re trying to accommodate described on pages 10-12 of this ?

http://www.decagon.com/assets/Uploads/5 … -Guide.pdf

Yep, so right now I just power cycle the sensor every time I want to take a reading, but I only receive serial data if I also disconnect then reconnect the serial line. Could this be something to do with it being pulled high when it takes the reading?

Figured it out, if I just connect the serial line to ground after its done it does the same as disconnecting it. So I just set up a transistor to pull the line low when its done reading and now it works perfectly. Thanks for the help!

or get yourself a small reed type mechanical relay, and have it toggle the power and the serial connection (dual contact, single throw) , if the transistor route acts flaky or doesnt work.

Sometimes Ive found theres nothing else that truly opens a circuit like a mechanical relay does, because it really does create a mechanical opening as if the wire is disconnected!