"Wifi relay" gpio pin 1 behavior at boot



  • Hi All,

    I'am trying to make a "wifi relay" got all the code working, but when i power the board GPio1 seems to react with the led. And that triggers one of my relays, is there a way to fix this at boot? I'am using a 8 channel relay with wemos d1 r1.

    Boris



  • The ESP8266 module (used in the D1 boards) outputs debugging messages at boot on pins GPIO1 and GPIO2, and that behavior is hardwired in the silicon and can't be changed.



  • It seems to going ON and OFF on all the GPIO I've tested (GPIO 16,0,2,1,3) on Wemos D1 R2 when power on. I need to eliminate this behavior.



  • @deshipu said in "Wifi relay" gpio pin 1 behavior at boot:

    that behavior is hardwired in the silicon and can't be changed.

    I think I recently stumbled across a post on the Espressif forum that indicates there is a way of "stopping" the debug messages. I was actually searching for something else at the time so I didn't pay too much attention. That said I generally record ALL the web pages I visit so I'll check if I have the details.



  • On an D1R2 I've been able to stop this behaviour by writing OFF on the PIN as very first operation, using the following sequence of command:

    #define ON      LOW
    #define OFF     HIGH
    void setup() {
      digitalWrite(D0, OFF);
      digitalWrite(D1, OFF);
      digitalWrite(D2, OFF);
      digitalWrite(D3, OFF);
      digitalWrite(D4, OFF);
      digitalWrite(D5, OFF);
      digitalWrite(D6, OFF);
      digitalWrite(D7, OFF);
      pinMode(D0, OUTPUT);
      pinMode(D1, OUTPUT);
      pinMode(D2, OUTPUT);
      pinMode(D3, OUTPUT);
      pinMode(D4, OUTPUT);
      pinMode(D5, OUTPUT);
      pinMode(D6, OUTPUT);
      pinMode(D7, OUTPUT);
    }
    
    void loop() {
    ....
    }
    

    It works on all relays except D3 and D4, that are pulled up by a resistor and therefore commute immediately at power-on (or reset) for a few milliseconds until the commands

    digitalWrite(D3, OFF);
    pinMode(D3, OUTPUT);
    digitalWrite(D4, OFF);
    pinMode(D4, OUTPUT);
    

    are executed.
    I think there is no way to avoid this, you can only reduce the ON time by writing these lines as very first lines of your sketch.



  • @karlo_65
    I've already did this as very first operation, but it always goes to HIGH for a very little while when I power it on. I think the only solution is to use an I2C I/O expander for piloting the relays.



  • Just a final suggestion, I have to say that I never tryed the following solution because in my project an initial unwanted click of the D3 and D4 rele doesn't have effect.

    My board has a bridge to power-on it, like this one have.

    http://www.ebay.com/itm/8-Channel-DC-5V-Relay-Module-for-Arduino-Raspberry-Pi-DSP-AVR-PIC-ARM-/191674534102?hash=item2ca0b148d6:g:cbkAAOxyIYhSY9pn

    I noted that, if I I remove the bridge before the Wemos power-on and I connect it after the boot, powering the rele board, there is no unwanted operation of any rele.
    I suppose you can use a MOSFET plus an RC network to power-on the rele board a few milliseconds after the power-on of the Wemos. This will of course not work during reset.



  • @mauvic One you could recommend? I'm going to try a PCF8574 breakout.


Log in to reply
 

Looks like your connection to WEMOS Forum was lost, please wait while we try to reconnect.