Hi Readers,

I have started using ESP8266 and I would like to share it with you.

So let’s begin. Connection of ESP8266 to Raspberry Pi is very easy as you can see on attached picture:

drawing
ESP8266 to Raspberry Pi

As you can see CH_PD is powered down so you need to connect 3.3V to it to power it up as your ESP8266 wont start.

After that you can start communication with esp module as first what you can do you can send ‘AT’ command which is like saying hi to module which after that if will replay with also ‘AT’ it will mean that connection has succeed.

I have wrote simple application in nodejs which you can use to test it you can find it in my github repository at:

https://github.com/rbrus/gettoknowthebob/blob/master/node.js/Coordinator/coordinator.js

or you can find it here:

console.log(“– Begin”);
var list = [“AT\r\n”,”AT\r\n”,”AT\r\n”,”AT\r\n”];
var start = 0;
var allData;
var SerialPort = require(‘serialport’).SerialPort;

var serialPort = new SerialPort(‘/dev/ttyAMA0’, {
baudrate: 115200,
dataBits: 8,
parity: ‘none’,
stopBits: 1,
flowControl: false
});

serialPort.open( function(error)
{
if(error)
{
console.log(‘failed to open: ‘ + error);
}
else
{
console.log(‘open serialport’);

serialPort.on(‘data’, function(data)
{
console.log(“data received: ” + data);
if(data == ‘AT+CWLAP\r\n’)
{
start = 1;
}
if(start == 1)
{
if(data.endsWith(‘OK\r\n’))
{
console.log(allData);
}
allData += data;
}
});

for (var i = 0; i < 3; i++ )
{
serialPort.write(list[i], function(err, results)
{
console.log(‘err ‘ + err);
console.log(‘results ‘ + results);
});
}
}
});
console.log(“– End”);

During next couple weeks I will be adding more information, trick and tips how to use ESP8266.

IMG_20160327_164000
Picture of my raspberry pi and ESP8266 module

Github repository: https://goo.gl/ii9xsz

Be positive and stay calm!

Cheers,

Radek

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s