This past week we built 2 barebone shields for testing purposes of ESP8266 ESP-01 Modules from RoboRium and the soon-to-be-added-on-RoboRium GSM Module.
These shields allow RoboRium.com to test their modules before they are shipped out to the customer.
Here are some photos of the shields.

DSC02901

GSM and ESP8266 Shields

DSC02894

ESP8266 Shield

DSC02899

GSM Shield

The test code for ESP-01 Module you can use is:

// Copyright of JMoon Technologies Pvt. Ltd.
// Created by Jasmeet Singh
// To view the result of this code, go to https://thingspeak.com/channels/27966
#include <SoftwareSerial.h>
#define NET "JMOON" // SSID of your wifi network
#define PASS "JMOONMAKERSPACE" // Password of your wifi network
#define IP "184.106.153.149" // IP of thingspeak.com
String GET = "GET /update?key=UZJ2B1U9TTYYYRBQ&field1=";
SoftwareSerial esp(8,9);
String command = "";

void writeEsp()
{
// Serial.println(command);
esp.println(command);
command = "";
}
void readEsp()
{ char ch;
while(esp.available())
{
ch = esp.read();
Serial.print(ch);
}
Serial.println();
delay(3000);
}

void readfastEsp()
{ char ch;
while(esp.available())
{
ch = esp.read();
Serial.print(ch);
}
}

void atEsp(){
command="AT";
writeEsp();
readEsp();
}

void atlapEsp(){
// List all networks. NOT USED.
//Before Using, Change _SS_MAX_RX_BUFF in arduino\libraries\SoftwareSerial\SoftwareSerial.h from 64 to 960.
command="AT+CWLAP";
writeEsp();
readEsp();
delay(5000);
}

void atmodeEsp(int mode){
// mode = 1 - Station , 2 - AP, 3 - Both
command="AT+CWMODE=";
command+=mode;
writeEsp();
readEsp();
}

void netconnectEsp(){
command="AT+CWJAP=\"";
command+=NET;
command+="\",\"";
command+=PASS;
command+="\"";
writeEsp();
readEsp();
}

void checkIP(){
command="AT+CIFSR";
writeEsp();
readEsp();
}

void statusEsp(){
command="AT+CIPSTATUS";
writeEsp();
readEsp();
}
void connectionEsp(int mode){
// mode: 0 - Single Connection, 1 - Multiple Connection
command="AT+CIPMUX=";
command+=mode;
writeEsp();
readEsp();
}

void siteconnect(int id){
// id: 0,1,2,3,4 channels
command="AT+CIPSTART=";
command+=id;
command+=",\"TCP\",\"";
command+=IP;
command+="\",80";
writeEsp();
readEsp();
}

void sendThing(int count){
command="AT+CIPSEND=4,43"; /* 43 is the packet size because I was only sending digits from 0 to 9 so the size did not change, if you want to send more data or 2 digit integers, keep in mind to use command.length() to find out the actual packet size. Packet size also includes the \r\n at the end.*/
writeEsp();
readfastEsp();
command=GET;
command+=count;
writeEsp();
readEsp();
}

void siteclose(){
command="AT+CIPCLOSE";
// command+=id;
writeEsp();
readEsp();
}

void flushat(){
char ch;
while(esp.available())
{
ch = esp.read();
}
}

void setup()
{
Serial.begin(9600);
esp.begin(9600);
atEsp();
atmodeEsp(3);
statusEsp();
netconnectEsp();
checkIP();
connectionEsp(1);
}

void loop()
{
for (int count=0;count<=9;count++){
siteconnect(4);
sendThing(count);
delay(100);
siteclose();
// siteclose(4);
delay(5000);
flushat();
delay(55000);
}
}

The result of this code is the following graph:

Categories: Projects

0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *