Arduino Pro Mini wiringArduino Uno wiring

I have a project where I am getting sensor data and sending it over to an ESP8266-01 to send to ThingSpeak. After some work I got it to work. So like a real smart person I decided to replace the Arduino UNO I was using (that worked) with an Arduino Pro Mini. Using the same code and connections the String isn't sent to the ESP and then not to ThingSpeak.

Here is a reduced version of the sending code that I used on the UNO and the Pro.

#include <FS.h>
#include <ESP8266WiFi.h> //https://github.com/esp8266/Arduino
#include <EEPROM.h>
//needed for library
#include <DNSServer.h>
#include <ESP8266WebServer.h>
#include <WiFiManager.h> //https://github.com/tzapu/WiFiManager
#include <ArduinoJson.h>
//#include <SoftwareSerial.h>

//SoftwareSerial espSerial(A0, D1); // RX | TX
//stuff to bring in string
const byte numChars = 32;
char receivedChars[numChars];
char tempChars[numChars]; // temporary array for use when parsing
// variables to hold the parsed data
char messageFromPC[numChars] = {0};
float floatFromPC = 0;
float floatFromPC2 = 0;
boolean newData = false;
//end stuff ti bring in string
String f;
String start = "start";
char Password[36] = "";
char apiKey[16] = "";
WiFiClient client;
//eeprom new end
char defaultHost[100] = "";
//Thing Speak IP address (sometime the web address causes issues with ESP :/
long itt = 500;
long itt2 = 500;
const byte wifiResetPin = 13;
int interruptPinDebounce = 0;
long debouncing_time = 1000;
volatile unsigned long wifiResetLastMillis = 0;
bool shouldSaveConfig = false;

void saveConfigCallback () {
  Serial.println("Should save config");
  shouldSaveConfig = true;

void handleWifiReset() {
  if (millis() < wifiResetLastMillis) {
    wifiResetLastMillis = millis();
  if ((millis() - wifiResetLastMillis) >= debouncing_time) {
    Serial.println("Clearing WiFi data resetting");
    WiFiManager wifiManager;
  wifiResetLastMillis = millis();
int addr = 0;
void setup() {
  //EEPROM.begin(512); //Initialize EEPROM
  WiFiManager wifiManager;
  pinMode(wifiResetPin, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(wifiResetPin), handleWifiReset, FALLING);
  WiFiManagerParameter customAPIKey("apiKey", "ThingSpeakWriteAPI", apiKey, 16);
  //Local initialization. Once its business is done, there is no need to keep it around
  //WiFiManager wifiManager;
  //reset saved settings
  //set custom ip for portal
  //wifiManager.setAPStaticIPConfig(IPAddress(10,0,1,1), IPAddress(10,0,1,1), IPAddress(255,255,255,0));
  //fetches ssid and pass from eeprom and tries to connect
  //if it does not connect it starts an access point with the specified name
  //here  "AutoConnectAP"
  //and goes into a blocking loop awaiting configuration
  strcpy(apiKey, customAPIKey.getValue());
  if (shouldSaveConfig) {
    Serial.println("saving config");
    DynamicJsonBuffer jsonBuffer;
    JsonObject& json = jsonBuffer.createObject();
    json["defaultHost"] = defaultHost;
    json["apiKey"] = apiKey;
    String apiKey2 = String(apiKey);
    File configFile = SPIFFS.open("/config.json", "w");
    if (!configFile) {
      Serial.println("failed to open config file for writing");
    //end save
  Serial.println("local ip");
  //or use this for auto generated name ESP + ChipID
  //if you get here you have connected to the WiFi
  //save the custom parameters to FS
  strcpy(apiKey, customAPIKey.getValue());
  EEPROM.begin(512); //Initialize EEPROM
  // write appropriate byte of the EEPROM.
  // these values will remain there when the board is
  // turned off.
  EEPROM.write(addr, 'A'); //Write character A
  addr++; //Increment address
  EEPROM.write(addr, 'B'); //Write character A
  addr++; //Increment address
  EEPROM.write(addr, 'C'); //Write character A
  //Write string to eeprom
  String www = apiKey;
  for (int i = 0; i < www.length(); i++) {
    //loop upto string lenght www.length() returns length of string
    EEPROM.write(0x0F + i, www[i]); //Write one by one with starting address of 0x0F
  EEPROM.commit(); //Store data to EEPROM
  //Read string from eeprom

//callback notifying us of the need to save config
void loop() {
  //new stuff string
  if (newData == true) {
    strcpy(tempChars, receivedChars);
    // this temporary copy is necessary to protect the original data
    //   because strtok() used in parseData() replaces the commas with \0
    newData = false;
  //new stuff string end
  WiFiManager wifiManager;
  if (WiFi.status() == WL_DISCONNECTED) {
  if (WiFi.status() == WL_CONNECTED) {
    WiFiClient client;
    long itt = 50;
    long itt2 = 200;
    char defaultHost[100] = "api.thingspeak.com";
    Serial.println(""); //Goto next line, as ESP sends some garbage when you reset it
    Serial.print(char(EEPROM.read(addr))); //Read from address 0x00
    addr++; //Increment address
    Serial.print(char(EEPROM.read(addr))); //Read from address 0x01
    addr++; //Increment address
    Serial.println(char(EEPROM.read(addr))); //Read from address 0x02
    //Read string from eeprom
    String www;
    //Here we dont know how many bytes to read it is better practice to use some terminating character
    //Lets do it manually www.circuits4you.com  total length is 20 characters
    for (int i = 0; i < 16; i++) {
      www = www + char(EEPROM.read(0x0F + i)); //Read one by one with starting address of 0x0F
    Serial.print(www); //Print the text on serial monitor
    if (client.connect(defaultHost, 80)) { // "" or api.thingspeak.com
      itt++; //Replace with a sensor reading or something useful
      String postStr = www;
      postStr += "&field1=";
      postStr += String(floatFromPC);
      postStr += "&field2=";
      postStr += String(floatFromPC2);
      postStr += "\r\n\r\n\r\n";
      client.print("POST /update HTTP/1.1\n");
      client.print("Host: api.thingspeak.com\n");
      client.print("Connection: close\n");
      client.print("X-THINGSPEAKAPIKEY: " + String (www) + "\n");
      client.print("Content-Type: application/x-www-form-urlencoded\n");
      client.print("Content-Length: ");
      Serial.println("% send to Thingspeak");

//more new stuff for string
void recvWithStartEndMarkers() {
  static boolean recvInProgress = false;
  static byte ndx = 0;
  char startMarker = '<';
  char endMarker = '>';
  char rc;
  while (Serial.available() > 0 && newData == false) {
    rc = Serial.read();
    if (recvInProgress == true) {
      if (rc != endMarker) {
        receivedChars[ndx] = rc;
        if (ndx >= numChars) {
          ndx = numChars - 1;
      } else {
        receivedChars[ndx] = '\0'; // terminate the string
        recvInProgress = false;
        ndx = 0;
        newData = true;
    } else if (rc == startMarker) {
      recvInProgress = true;

void parseData() { // split the data into its parts
  char * strtokIndx; // this is used by strtok() as an index
  strtokIndx = strtok(tempChars, ","); // get the first part - the string
  strcpy(messageFromPC, strtokIndx); // copy it to messageFromPC
  strtokIndx = strtok(NULL, ","); // this continues where the previous call left off
  floatFromPC = atoi(strtokIndx); // convert this part to an integer
  strtokIndx = strtok(NULL, ",");
  floatFromPC2 = atoi(strtokIndx); // convert this part to a float

void showParsedData() {
  Serial.print("Message ");
  Serial.print("Float ");
  Serial.print("Float ");
//end new stuff string

Sorry for the length but... I don't know if I need to modify how I send the string or I have to turn on the TX and RX pins in the Pro Mini. I have tried connecting the RX Arduino to TX ESP and TX Arduino to RX ESP and RX to RX and TX to TX with no results. I know the pins work because I have programmed the ESP and the PRO numerous times with the TX and RX pins.

Can anyone help me with this? It is driving me crazy.

  • Are you using the same connections between the ESP and either Arduino? Cross-connecting RX/TX is correct. The Uno is a 5v device; the ESP is a 3.3v device. The Pro-mini could be either. Did you use level shifters or equivalent with the UNO? Does the Pro-mini both need & use them (5v Pro-mini) or not need and not use them (3.3v Pro-mini)? – JRobert Jun 11 '19 at 11:59
  • So I tried some experiments. I had an adapter module attached to the ESP so I removed it and wired directly to the ESP. I went from the Pro's board pins both RX to TX and TX to Rx and the other way around with no upload, no flashing tx led on board I also tried from the header pins at the end of the board both T – user1114881 Jun 11 '19 at 18:09
  • sorry hit return here is the end of the previous comment TX to RX and RX to TX and visa versa. But with no better results. I usually use level shifters but didn't for the experiment on the Arduino Uno and the Arduino Pro Mini. Without the shifter it worked with the UNO and not the Pro Mini. So I don't think it is the pin connections. – user1114881 Jun 11 '19 at 18:20
  • Something about you Pro-min is different from you Uno. (Operating voltage? Frequency? Baud-rate selection?) We don't have enough information (yet) to know what it is, but that's the direction you'll need to take. – JRobert Jun 12 '19 at 11:45
  • So the ESP is running off a separate voltage regulator 3.3v. I have tried all kinds of baud rates on both Pro and ESP. The ESP is supposed to run at 115200 and when I try to reset it it says that the 115200 baud rate is overridden with 115200 but what ever rate I put in the code to override I have to set the serial monitor to that rate to have it read correctly. The Pro says its normal rate is 57600 but I have tried to reset it and nothing seems to help. I need a definitive answer. Is the TXO on the Pro board go to the RX on the ESP and RXI to TX. this is how I have it set up. – user1114881 Jun 12 '19 at 14:39

I finally got this to work by repeating the Serial.print (f); and then delay(1000); multiple times. I changed my original post to reflect this. Somehow this gets the string over to the ESP so it can parse it and upload it. Now all I want to do is add a temperature sensor and maybe add an IFTTT to the whole thing so if the low end gets too low or the high end too high (of the water level I can get a notification to check out the whole system. Thanks JRobert for the help I got the power I needed to the board.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.