Something similar, but using the HTTP POST using the Arduino EthernetClient 
if you're unable to modify the InfluxDB host config.

To use the code below: 1) Change the MAC address, 2) change the IP address 
to your InfluxDB IP address, 3) change the line in the POST construction to 
your InfluxDB and Port "client.println("Host:");"

It starts breaking down when the loop delay is around 300ms. The POST is 
coming from a microcontroller and going to a Raspberry Pi 3.

#include <SPI.h>
#include <Ethernet.h>

// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the 
byte mac[] = { 0x00, 0x1A, 0xB6, 0x02, 0xF1, 0x16 };
IPAddress server(192, 168, 1, 136); // BBB

// Initialize the Ethernet client library
// with the IP address and port of the server 
// that you want to connect to (port 80 is default for HTTP):
EthernetClient client;

//data for HTTP Post;
String POSTData = "";

//data for HTTP response
char Response[255];

void setup()

//start Serial

//initialize ethernet
if (Ethernet.begin(mac) == 0)
Serial.println("Failed to configure Ethernet");

// give the Ethernet peripheral a second to initialize:

// let the monitor know it's starting


void loop()

// connect to the influxdb port
if (!client.connect(server, 8086)) 
Serial.println("Did not connect");

// set some test data
String POSTData = "uCont value=" + String(millis());

// Make a HTTP request:
client.println("POST /write?db=mydb HTTP/1.1");
client.println("User-Agent: Arduino/1.6");
client.println("Connection: close");
client.println("Content-Type: application/x-www-form-urlencoded;");
client.print("Content-Length: ");


if (client.available())
client.readBytes(Response, client.available());


// let the monitor know something is going on in case nothing is returned.


Remember to include the version number!
You received this message because you are subscribed to the Google Groups 
"InfluxData" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
To post to this group, send email to
Visit this group at
To view this discussion on the web visit
For more options, visit

Reply via email to