News:

PROTON pic BASIC Compilers for PIC, PIC24, dsPIC33

Main Menu

WiFi remote display

Started by shantanu@india, Jan 19, 2022, 12:44 PM

Previous topic - Next topic

shantanu@india

Hi,
A customer wants a running hours display of an industrial compressor based on the factory WiFi network.
Shall I offer them a ESP8266 based solution or are there other options?
Regards
Shantanu

Parmin

I have no solution, but am very interested in this.

Giuseppe MPO


The solution with an ESP8266 is the simplest, but to analyze everything,
you should know how the data is read by the compressor, perhaps RS232?
And how should the data be received, on a mobile phone, on a PC?
Is it sufficient to transmit data on your local network or to be read even remotely from the internet?

shantanu@india

Guiseppe,
There is a RS485 modbus port available in the compressor which might provide lot of machine info but just for the sake of running hours I am thinking of tapping a potential free auxiliary contact from the main contactor and connecting it via an opto to the esp8266 module.
They initially want just a remote display for which I need two esp's on each side. For internet access I might need to use the micropython http/ftp modules to upload data to cloud.
Regards
Shantanu

Giuseppe MPO

I don't understand, if you use a free contact of the contactor it means that you are not reading the temperature but at the most you are reading the status of an alarm.
You can use an ESP for both reading this status and for internet access.
For a similar problem, to read the temperature of remote freezers, I used an ESP01 with a DS18B20 temperature sensor and, using a Telegram BOT,
I can interrogate it to know the current temperature and, possibly, if the temperature exceeds the limits I have. imposed, it sends me alarms.
In this case I used a single ESP that reads the temperature, connects to the internet and sends the data on Telegram.
Then with the mobile phone, without having any other cards, I interrogate or receive alarms from the ESP

shantanu@india

Guiseppe,
Just curious... how did you program your ESP-01...Arduino environment?
Regards
Shantanu

Giuseppe MPO

#include "CTBot.h"
#include <OneWire.h>
#include <DallasTemperature.h>
CTBot myBot;

String Allarme = "on";
String ssid = "xxxxxxx";                                            // WIFI SSID
String pass = "xxxxxxx";                                       // WIFI PASSWORD
String token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";   // TELEGRAM BOT TOKEN
uint32_t MyId = xxxxxxxxxx;
int8_t Soglia = -10;

//#define temperature_topic "sensor/temperature"

//Setup sensor, data wire is connteced to pin 2
#define ONE_WIRE_BUS 2

// Setup a oneWire instance to communicate with any OneWire devices
OneWire oneWire(ONE_WIRE_BUS);

// Pass our oneWire reference to Dallas Temperature sensor
DallasTemperature DS18B20(&oneWire);

void setup() {
  DS18B20.begin();
 
  Serial.begin(9600);
  Serial.setTimeout(500);
  Serial.println("\nStarting TelegramBot");

  // connect the ESP8266 to the desired access point
  myBot.wifiConnect(ssid, pass);

  // set the telegram bot token
  myBot.setTelegramToken(token);

  // check if all things are ok
  if (myBot.testConnection())
    Serial.println("Test Connessione OK");
  else
    ESP.reset();

  myBot.sendMessage(MyId,(String)"Esp avviato");
}

void loop() {

  DS18B20.requestTemperatures();
  float temp = DS18B20.getTempCByIndex(0);

  // a variable to store telegram message data
  TBMessage msg;

  // if there is an incoming message...
  if (myBot.getNewMessage(msg)) {
    if (msg.text.equalsIgnoreCase("/Pozzetto")) {
      String reply;
      reply = (String)"Pozzetto = " + temp + (String)"°C";
      myBot.sendMessage(msg.sender.id, reply);
    }
    if (msg.text.equalsIgnoreCase("/Pozz_off")){
    Allarme = "off";
    myBot.sendMessage(MyId,(String)"Allarme pozzetto spento");
    }

     if (msg.text.equalsIgnoreCase("/Pozz_on")) {
    Allarme = "on";
    myBot.sendMessage(MyId,(String)"Allarme pozzetto acceso");
     }
  }
  if (Allarme == "on") {
  if (temp > Soglia) {
    String reply;
    reply = (String)"ALLARME POZZETTO = " + temp + (String)"°C";
    myBot.sendMessage(MyId, reply);
  }
 }
  delay(500);
}




Programmed under Arduino using a Telegram BOT to connect to the internet, and the code is this

shantanu@india

Regards
Shantanu