ESP EasyRelay little mod

8 years 11 months ago #1275 by cdj
Replied by cdj on topic ESP EasyRelay little mod
Hi again, I'm experiencing problems defining 4 different Esp8266EasyIoTMsg structures.

With just two of them it works flawlessly; I can send messages and update state as expected. As soon as I add even a third Esp8266EasyIoTMsg console output starts to get garbled.

Is there any limit on the number of Esp8266EasyIoTMsg I can use? The sketch size does not seem to be the problem.

Thanks in advance for your help
The following user(s) said Thank You: pobes

Please Log in or Create an account to join the conversation.

8 years 11 months ago #1520 by cdj

Please Log in or Create an account to join the conversation.

8 years 6 months ago #2362 by javier
Replied by javier on topic ESP EasyRelay little mod
HI

Im interested on your relay modification!

Im working on it in the last days, But i can´t do it!

Im working with one ESP8266, arduino nano and arduino relay. I want to control first the lights of my home.

I made a circuit with this elements and Im running the server on raspberry pi,
It works perfectly switching the relay by the web page and I can control the lights with my smartphone but the problem its that i want to still have my switches on the wall and I would modify the code adding this switches. I I would control this by adding a input on arduino, and a 5v switch.

In this post I read I have to:

Put this : Esp8266EasyIoTMsg msgRelay1(RELAY_1, V_DIGITAL_VALUE); (in my declaration)

and this : change the RELAY_1 state when I change the state of my switch and I have to send the changes to the server with : esp.send(msgRelay1)

can you explain my this please, I change the status of my relay but not the status on the server :(

Please Log in or Create an account to join the conversation.

8 years 6 months ago #2365 by cdj
Replied by cdj on topic ESP EasyRelay little mod
Hehe, i've used too an arduino input to update status of node if you turn on a light phisically....

this is my loop code using photo resistor :
void loop()
{
    esp.process();
  //CDJ Here i define status from photores and it works perfectly 

  statusphotores1 = digitalRead(PHOTORES_1);
  statusphotores2 = digitalRead(PHOTORES_1+1);
  statusphotores3 = digitalRead(PHOTORES_1+2);
  statusphotores4 = digitalRead(PHOTORES_1+3);
  
  if (statusphotores1 != prevstatusphotores1) {
  Esp8266EasyIoTMsg msgRelay1(1, V_DIGITAL_VALUE);
    esp.send(msgRelay1.set(statusphotores1));

     prevstatusphotores1 = statusphotores1;

   }
  if (statusphotores2 != prevstatusphotores2) {
 Esp8266EasyIoTMsg msgRelay2(2, V_DIGITAL_VALUE);
    esp.send(msgRelay2.set(statusphotores2));

     prevstatusphotores2 = statusphotores2;

   }

  if (statusphotores3 != prevstatusphotores3) {
   Esp8266EasyIoTMsg msgRelay3(3, V_DIGITAL_VALUE);
   //   //Serial.print("photores3 status: ");
   //       ////Serial.println(statusphotores3);
          
   esp.send(msgRelay3.set(statusphotores3));

      
    prevstatusphotores3 = statusphotores3;
   
   }
   if (statusphotores4 != prevstatusphotores4) {
   Esp8266EasyIoTMsg msgRelay4(4, V_DIGITAL_VALUE);
//      ////Serial.print("photores4 status: ");
//          ////Serial.println(statusphotores4);
   
   esp.send(msgRelay4.set(statusphotores4));
      
    prevstatusphotores4 = statusphotores4;
   }

   
}

Please Log in or Create an account to join the conversation.

8 years 6 months ago #2366 by javier
Replied by javier on topic ESP EasyRelay little mod
oh ok!

I read you where using other relays, and the photo resistor to check the state. My English is not so good, i dont know if I want to build the same as you, i think no. In my case I will put the relay arduino and esp direct to the light (220 AC) and i will put 2 wires to my wall switch to attach an arduino input. (The arduino will have always the control of the light). And the arduino relay will be connected and disconnect by the arduino that will receive the order via serial (esp) or input (wall switch).

After the expanation :P ! Im reading your code and I think I have to put this

Esp8266EasyIoTMsg msgRelay1(1, V_DIGITAL_VALUE);
esp.send(msgRelay1.set(statusphotores1));

and correct me if I´m wrong I have to replace your (statusphotores1) with my variable i think boolean 0 or 1 its that correct? i cant write my sketch no I have to wait for some free time :)

Please Log in or Create an account to join the conversation.

8 years 6 months ago #2367 by cdj
Replied by cdj on topic ESP EasyRelay little mod
Sincerly i don't understand how you want to tell to arduino that lights is on, but code is correct as you understand.

Buena sorte!
Dario

Please Log in or Create an account to join the conversation.

Time to create page: 0.492 seconds

Forum latest

  • No posts to display.