Is it possible to send data to telegraf over USB?

Hi All,

Just to preface this, I’m pretty new to a lot of this - so this may be an easy question.

I have a sensor sending data from one LoRa radio to another.

I want to communicate the data from the receiving radio into a RPi running an instance of telegraf.

The first method that comes to mind is to connect the radio via USB to the RPi and have it communicate the data that way.

How do I configure telegraf to listen to the data coming in over USB…

I’d appreciate a few pointers. Thanks.

Hello @Quark,
I’m not sure but does this resource help you at all? Writing Data from Arduino to InfluxDB v2 | InfluxData

Thanks for the reply @Anaisdg, article is useful thanks. Also found this one:

Seems WiFi shield is the way to go. Still wonder if its possible to get data into InfulxDB via USB. I suppose the benefit might be lower cost than an additional WiFi module, and possibly simpler code, just Serial.print()…

Q

1 Like

Hi @Quark

When you talk about getting the data over USB, are you using a Serial → USB convertor? More specifically, is the serial port available to a Linux box as a tty serial device?

If yes, then I sort of solved this and left some notes on this issue:

If the serial port can be read as a file, then you can use the “tail” plugin in Telegraf to read the file device directly and read the data.

1 Like

Thanks @willcooke. Great to see I’m not the only one asking the question.

I was intending to use the USB port on the RPi. So no Serial>USB converter needed. Will have to look into the tail plugin.

My other thought was to forget telegraf and write some python that reads data from serial port and passes into an InfluxDB.

Using Python is certainly an option, and the Python client library will make that easier.

But… I think Telegraf adds a lot of value here. It will handle the batching for you, and it will handle network unreliability and automatically cache and retry. You can also use Telegraf to do some basic processing of the data as read from the serial device.

It’s personal preference of course, but in my limited experience investing a bit of time in getting Telegraf to do what you want will make life easier for you in the future.

Good luck! I’d love to hear how you get on.

1 Like