Mega 2650-ESP01S Wifi Enterprise | Arduino | Forum

The ThingSpeak community site has been upgraded to a new site. This site is currently in read-only mode. You can ask questions or post and read discussions on the new site.
Avatar

Please consider registering
Guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —






— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed sp_TopicIcon
Mega 2650-ESP01S Wifi Enterprise
No permission to create posts
December 14, 2020
2:33 am
Avatar
jayaeros
New Member
Members
Forum Posts: 1
Member Since:
December 14, 2020
sp_UserOfflineSmall Offline

Dear All,

I managed to connect to thingspeak server using Mega 2650-ESP01S using my home wifi that only requires SSID and password.

But when I tried to use my office wifi (Enterprise WPA2: SSID, username, and password), I do not know on how to program the Mega 2650 to include the username to match the Enterprise WPA2 configuration.
Kindly give me suggestion. Thank you.

#################################################################

Below is the code I have used for my home wifi

#include
#include
#include
#include
#include

#include

#define SECRET_SSID "XXXX" // replace MySSID with your WiFi network name
#define SECRET_PASS "XXXXX" // replace MyPassword with your WiFi password

#define SECRET_CH_ID XYX // replace 0000000 with your channel number
#define SECRET_WRITE_APIKEY "XYX" // replace XYZ with your channel write API Key

char ssid[] = SECRET_SSID; // your network SSID (name)
char pass[] = SECRET_PASS; // your network password
int keyIndex = 0; // your network key Index number (needed only for WEP)

WiFiEspClient client;

dht11 DHT;
#define DHT11_PIN A0
float humi;
float temp;

// Emulate Serial1 on pins 6/7 if not present
#ifndef HAVE_HWSERIAL1
#include "SoftwareSerial.h"
SoftwareSerial Serial1(19, 18); // RX, TX
#define ESP_BAUDRATE 19200
#else
#define ESP_BAUDRATE 115200
#endif

unsigned long myChannelNumber = SECRET_CH_ID;
const char * myWriteAPIKey = SECRET_WRITE_APIKEY;

// Initialize our values
int number1 = 0;
int number2 = random(0,100);
int number3 = random(0,100);
int number4 = random(0,100);

String myStatus = "";

void setup() {
//Initialize serial and wait for port to open
Serial.begin(115200); // Initialize serial

// initialize serial for ESP module
setEspBaudRate(ESP_BAUDRATE);

Serial.print("Searching for ESP8266...");
// initialize ESP module
WiFi.init(&Serial1);

// check for the presence of the shield
if (WiFi.status() == WL_NO_SHIELD) {
Serial.println("WiFi shield not present");
// don't continue
while (true);
}
Serial.println("found it!");

ThingSpeak.begin(client); // Initialize ThingSpeak
}

void loop() {

// Connect or reconnect to WiFi
if(WiFi.status() != WL_CONNECTED){
Serial.print("Attempting to connect to SSID: ");
Serial.println(SECRET_SSID);
while(WiFi.status() != WL_CONNECTED){
WiFi.begin(ssid, pass); // Connect to WPA/WPA2 network. Change this line if using open or WEP network
Serial.print(".");
delay(5000);
}
Serial.println("
Connected.");
}
DHT.read(DHT11_PIN);
humi = DHT.humidity;
temp = DHT.temperature;
Serial.print("H:");
Serial.print(humi);
Serial.println("%");
Serial.print("T:");
Serial.print(temp);
Serial.println(" C");

// set the fields with the values
ThingSpeak.setField(1, number1);
ThingSpeak.setField(2, number2);
ThingSpeak.setField(3, number3);
ThingSpeak.setField(4, number4);
ThingSpeak.setField(5,temp);
ThingSpeak.setField(6,humi);

// figure out the status message
if(number1 > number2){
myStatus = String("field1 is greater than field2");
}
else if(number1 99){
number1 = 0;
}
number2 = random(0,100);
number3 = random(0,100);
number4 = random(0,100);

delay(1000); //
}

// This function attempts to set the ESP8266 baudrate. Boards with additional hardware serial ports
// can use 115200, otherwise software serial is limited to 19200.
void setEspBaudRate(unsigned long baudrate){
long rates[6] = {115200,74880,57600,38400,19200,9600};

Serial.print("Setting ESP8266 baudrate to ");
Serial.print(baudrate);
Serial.println("...");

for(int i = 0; i < 6; i++){
Serial1.begin(rates[i]);
delay(100);
Serial1.print("AT+UART_DEF=");
Serial1.print(baudrate);
Serial1.print(",8,1,0,0
");
delay(100);
}

Serial1.begin(baudrate);
}

Forum Timezone: America/New_York

Most Users Ever Online: 166

Currently Online:
34 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 272

Vinod: 240

piajola: 95

turgo: 70

vespapierre: 63

Adarsh_Murthy: 62

Member Stats:

Guest Posters: 1

Members: 8665

Moderators: 1

Admins: 2

Forum Stats:

Groups: 3

Forums: 14

Topics: 1600

Posts: 5760

Newest Members:

tran, huldacormier, bogart, estebanmateo93, mikewrite, onlinebusiness

Moderators: cstapels: 460

Administrators: Hans: 405, lee: 457