Project works, but does not connect to freeboard.io

The project is for kitchen safety

The ESP32 is supposed to run as a local server and send sensor data to freeboard.io

I can connect to wifi but not to the freeboard server. Any suggestions?

Steps I followed: https://www.hackster.io/javier-munoz-saez/esp8266-sending-data-to-an-online-deskboard-3e7e91

(Note: the variable “host” has been changed to “dweetServer”)

Code generator that helped me: TUNIOT

TUNIOT__v3.ino (9.83 KB)

String ReadIncomingRequest()
{
    while(client.available()) 
    {
        ClientRequest = (client.readStringUntil('\r'));
        
        if ((ClientRequest.indexOf("HTTP/1.1")>0)&&(ClientRequest.indexOf("/favicon.ico")<0))
        {
          myresultat = ClientRequest;
        }
    }
  return myresultat;
}

Why does this function need to return a global variable?

(Why) (is) (the) (call) (to) (the) (readString()) (method) (wrapped) (in) (useless) (parentheses) (?)

    // Capture response from the server. (10 second timeout)
    long timeOut = 4000;

4000 milliseconds is NOT 10 seconds.

    //Writing data to local server
    client = server.available();

No, that is NOT what that code does.

    ClientRequest = (ReadIncomingRequest());

(More) (useless) (parentheses).

Why do you bother reading what the client asked for, when you intend to deliver exactly the same reply?

Inside the and tags you are supposed to have and tags.

I can connect to wifi but not to the freeboard server. Any suggestions?

Yes. “I can’t connect” is useless information. The connect() method returned a value. That value obviously doesn’t mean success, but it is not false, either. What IS it?

I'm a programming noob and left most of the base code as it is.

I know I have some output issues from my variables but never knew the base code was this much of a parenthesis mess.

Fixed my not %100 comment about local server (meant that ESP32 is being used as one)

Arduino - WiFiClientConnect ; connect() returns true or false

All functions work properly except the one introduced for freeboard; I can send SMS, I can connect to wifi, I can send data as HTML but not to connect to freeboard.

And it prints "connection failed" with short "c" from dweetdata()

Arduino - WiFiClientConnect ; connect() returns true or false

Rubbish.

class WiFiClient : public Client {

public:
  WiFiClient();
  WiFiClient(uint8_t sock);

  uint8_t status();
  virtual int connect(IPAddress ip, uint16_t port);
  virtual int connect(const char *host, uint16_t port);

connect() returns an int. The specific value just might provide a clue.

Turns out my ESP32 was broken and couldn't connect to wifi and to the dweet/freeboard server. I thought it was because I was in another room and could not connect properly.

Bought a NodeMCU v3, reworked the code and got rid of the "local server" idea to upload to freeboard via dweet.

However, I didn't realize it only had pins with 3.3V output max only; I need it to power two relays to control for fuel and fire extinguisher valves.

Should I connect a 1.5V battery to each of the two pins and use it to control two 5V valves?

WARNING WILL ROBINSON — these devices should never be used in safety critical applications. There are too many ways each of these components can fail and in combinations you will not be able to predict or mitigate. ESPs, SMS devices, and servers can (WILL) fail intermittently and cause your system to glitch and they are not safety certified. Glitches can kill, especially if you are controlling fuel valves or vent fans — even alarms.

I would abandon the project and use the devices for something else - especially if you are a noob.

Pat.

More like a college project for a "proof of concept"

I just need to demonstrate the valves open/close with the desired conditions.

Someone suggested me to use a switching transistor and will look to it.

And how do I select the analog output 0 on the nodeMCU v3 and store it in an int variable?

I can do it with digital pins but not with analog; Found a picture of nodeMCU pins.

I just want my code to look neat