Node.Js to Arduino

Want to receive data(internet Time and date ) from Node.js server to Arduino.

Please help.

Thank you.

I don't know anything about Node.js.

Can it connect to a serial port and hence to the Arduino over a USB cable?
Can it connect to the Arduino using bluetooth and a bluetooth module on the Arduino?

In either case the examples in Serial Input Basics should be useful.

If the Arduino needs to connect over Ethernet or Wifi you will need a suitable add-on for the Arduino (or use a Yun which already has them). The ESP8266 is an inexpensive WiFi module.


Yes it is able to send the data to Server through ESP8266-01 wifi module.Now i am trying to receive data from Server to Arduino via ESP8266-01 wifi module.

Thank you.

Fetching data from node.js is the same as any other web page from the client side.

Suggest you search "arduino esp8266 http get"

A couple of likely-looking links below to get you started.

Basically you get the entire web page as a chunk of text which you have to search through to extract the information you want.

Ok.Thank you very much.

Hi rw950431,

I wanted to fetch the JSON data from Server to arduino+Esp8266(Wifi module) and store it into some variable and display in Arduino’s Serial monitor. After implementing the code from the link, the result i
got is attached in image format below.

I am not able to fetch the JSON data from Server.

Please have a look a at the image attached.

Thank you.

I want to fetch the JSON data(time and date) from Node.Js Server to ESP8266-01 using http GET method.

I have used Software serial definition as
SoftwareSerial ser(A8,A9); // Connect TX and RX of ESP8266 (A8 for TX A9 for RX) of ATMEGA2560.

In the code i have written

ser.print(String("GET ") + “/details HTTP/1.1/\r\n” +
“”+ “\r\n” +
“Connection: close\r\n\r\n”);

// Read all the lines of the reply from server and print them to Serial
String line = ser.readStringUntil(’\r’);

Serial.println(“closing connection”);

where ser is defined function for ESP8266-01 is Local server IP address from where i have to fetch the JSON data(data and time in my case).

But i am not able to fetch date and time data.

Perhaps try the code from

Yours seems to omit the space between GET and /details and also the "host:" before the IP address.

ok. I have initialized for ESP8266 for ATMEGA 2560 as below shown code and used ser.println function,hope using “ser” is correct?

#include <SoftwareSerial.h>
SoftwareSerial ser(A8,A9);

Then in the esp8266 function as

void esp_8266()

String cmd = “AT+CIPSTART=“TCP”,”"; // AT cammand for TCP/IP connection
cmd += “”; // IP adress
cmd += “”,5000"; // HTTP port no.

ser.println(cmd); // Sending AT cammand
if(p == 1)
if(ser.find(“Linked”)) // Serching for responce from ESP8266

Serial.println(“Connection Made for Receiving data”);


int deviceid = serialNumber;
String getStr = “GET /log/345/12/status/”;
getStr += DHT.temperature;
getStr += “/”;
getStr += DHT.humidity;
getStr += “\r\n\r\n”;

cmd = “AT+CIPSEND=”; // AT command to send Data at TCP server
cmd += String(getStr.length()); // send data length
ser.println(cmd); // Wrighting the AT command to ESP8622

if(ser.find(">")) // Serching for responce to send data from ESP8266

ser.print(getStr); // Printing the string with sensor data to send on ESP8266 module


delay (100);

ser.println(“GET /details HTTP/1.1”);
ser.print("Host: ");
ser.println(“Connection: close”);

// Read all the lines of the reply from server and print them to Serial
String line = ser.readStringUntil(’\r’);

Serial.println(“closing connection”);

Hi rw950431,
The stackoverflow link which you provided is not working . can you just have a look one more time.

rw950431 adviced you to try this example, which isn't on stackoverflow. IWhen you ignore someone's advice then s/he will ignore your future requests for advice.


I tried the example what you mentioned in the link which uses #include<WiFiClient.h>, but i got an error which i attached in the image.