Page 2 of 5

Re: 8 buttons and 8 relays in esp with hc595

Posted: Sun Mar 24, 2019 2:26 pm
by elmaya
selo wrote: Sun Mar 24, 2019 12:32 am Thanks for this.
How can i use it for roller shutters?
viewtopic.php?f=24&t=3833&p=38209&hilit=elmaya#p38209

Re: 8 buttons and 8 relays in esp with hc595

Posted: Mon Mar 25, 2019 12:29 am
by selo
Thanks for your reply.
I have replaced

Code: Select all

  //SuplaDevice.addRelay(101, false);   
  //SuplaDevice.addRelay(102, false);  
  //SuplaDevice.addRelay(103, false); 
  //SuplaDevice.addRelay(104, false);   
  //SuplaDevice.addRelay(105, false);  
  //SuplaDevice.addRelay(106, false); 
  //SuplaDevice.addRelay(107, false);   
  //SuplaDevice.addRelay(108, false);  
  // CHANNEL8 - Thermometer DS18B20
  SuplaDevice.addDS18B20Thermometer();

  memset(btn, 0, sizeof(btn));
  btn[0].pin =5;          // pin gpio buton  0 = no buton
  btn[0].relay_pin =101;  // pin gpio Relay
  btn[0].channel =0;      // channel
  btn[0].ms =0;           //  if = 0 Bistable -- if > 0 Monostable for X ms
  btn[0].mem =0;
  
  btn[1].pin =4;          // pin gpio buton  0 = no buton
  btn[1].relay_pin =102;  // pin gpio Relay
  btn[1].channel =1;      // channel
  btn[1].ms =0;           //  if = 0 Bistable -- if > 0 Monostable for X ms
  btn[1].mem =0;
  
  btn[2].pin =2;          // pin gpio buton  0 = no buton
  btn[2].relay_pin =103;  // pin gpio Relay
  btn[2].channel =2;      // channel
  btn[2].ms =0;           //  if = 0 Bistable -- if > 0 Monostable for X ms
  btn[2].mem =0;
  
  btn[3].pin =14;         // pin gpio buton  0 = no buton 
  btn[3].relay_pin =104;  // pin gpio Relay
  btn[3].channel =3;      // channel
  btn[3].ms =0;           //  if = 0 Bistable -- if > 0 Monostable for X ms
  btn[3].mem =0;
  
  btn[4].pin =12;         // pin gpio buton  0 = no buton
  btn[4].relay_pin =105;  // pin gpio Relay
  btn[4].channel =4;      // channel
  btn[4].ms =0;           //  if = 0 Bistable -- if > 0 Monostable for X ms
  btn[4].mem =0;
  
  btn[5].pin =13;         // pin gpio buton  0 = no buton
  btn[5].relay_pin =106;  // pin gpio Relay
  btn[5].channel =5;      // channel
  btn[5].ms =0;           //  if = 0 Bistable -- if > 0 Monostable for X ms
  btn[5].mem =0;
  
  btn[6].pin =3;         // pin gpio buton  0 = no buton
  btn[6].relay_pin =107;    // pin gpio Relay
  btn[6].channel =6;      // channel
  btn[6].ms =0;           //  if = 0 Bistable -- if > 0 Monostable for X ms
  btn[6].mem =0;
  
  btn[7].pin =1;          // pin gpio buton  0 = no buton
  btn[7].relay_pin =108;  // pin gpio Relay
  btn[7].channel =7;      // channel
  btn[7].ms =0;           //  if = 0 Bistable -- if > 0 Monostable for X ms
  btn[7].mem =0;
  supla_btn_init();
with

Code: Select all

   // CHANNEL0 - TWO RELAYS (Roller shutter operation)
  SuplaDevice.addRollerShutterRelays(101,     // Pin number where the 1st relay is connected
                                     102, false);    // Pin number where the 2nd relay is connected

   SuplaDevice.setRollerShutterButtons(0,    // Channel Number
                                       5,   // Pin where the 1st button is connected
                                       4);  // Pin where the 2nd button is connected

   // CHANNEL1 - TWO RELAYS (Roller shutter operation)
  SuplaDevice.addRollerShutterRelays(103,     // Pin number where the 1st relay is connected
                                     104, false);    // Pin number where the 2nd relay is connected

   SuplaDevice.setRollerShutterButtons(1,    // Channel Number
                                       2,   // Pin where the 1st button is connected
                                       14); // Pin where the 2nd button is connected

      // CHANNEL2 - TWO RELAYS (Roller shutter operation)
  SuplaDevice.addRollerShutterRelays(105,     // Pin number where the 1st relay is connected
                                     106, false);    // Pin number where the 2nd relay is connected

   SuplaDevice.setRollerShutterButtons(2,    // Channel Number
                                       12,   // Pin where the 1st button is connected
                                       13);  // Pin where the 2nd button is connected

      // CHANNEL3 - TWO RELAYS (Roller shutter operation)
  SuplaDevice.addRollerShutterRelays(107,     // Pin number where the 1st relay is connected
                                     108, false);    // Pin number where the 2nd relay is connected

   SuplaDevice.setRollerShutterButtons(3,    // Channel Number
                                       3,   // Pin where the 1st button is connected
                                       1);  // Pin where the 2nd button is connected
It work's perfect from Supla app. But the physical buttons take double time to close and open roller shutters. Have you any idea?

Re: 8 buttons and 8 relays in esp with hc595

Posted: Mon Mar 25, 2019 10:04 am
by pzygmunt
Do not worry about it. This is how it should work when fully closed / opened.

Re: 16 push button, 16 relay

Posted: Mon Apr 01, 2019 9:10 pm
by edm
elmaya wrote: Fri Jan 25, 2019 6:53 pm 16 push button, 16 relay
Thank you.
See here, first attempts viewtopic.php?f=6&t=4629

Re: 8 buttons and 8 relays in esp with hc595

Posted: Wed Oct 02, 2019 2:22 pm
by bulek68

Re: 8 buttons and 8 relays in esp with hc595

Posted: Wed Oct 02, 2019 2:36 pm
by elmaya
bulek68 wrote: Wed Oct 02, 2019 2:22 pm These modules it's ok?
https://allegro.pl/oferta/74hc595-rejes ... 7594566453
https://allegro.pl/oferta/8-kanalowy-mo ... 8047947761
https://allegro.pl/oferta/wemos-d1-mini ... 7804539515

I need only flash wemos with suitable bin and next connect all?
The relay module is active low.
the outputs will be on when the app shows off.
Better to use relay with active high .

the rest ok ;)

Re: 8 buttons and 8 relays in esp with hc595

Posted: Wed Oct 02, 2019 2:59 pm
by bulek68
bulek68 wrote: Wed Oct 02, 2019 2:22 pm The relay module is active low.
the outputs will be on when the app shows off.
Better to use relay with active high .
This will be ok ;)

https://botland.com.pl/en/relays/2357-r ... 41373.html

Re: 8 buttons and 8 relays in esp with hc595

Posted: Wed Oct 02, 2019 3:04 pm
by elmaya
bulek68 wrote: Wed Oct 02, 2019 2:59 pm
bulek68 wrote: Wed Oct 02, 2019 2:22 pm The relay module is active low.
the outputs will be on when the app shows off.
Better to use relay with active high .
This will be ok ;)

https://botland.com.pl/en/relays/2357-r ... 41373.html
yes

Re: 8 buttons and 8 relays in esp with hc595

Posted: Wed Oct 02, 2019 5:19 pm
by bulek68
elmaya wrote: Wed Oct 02, 2019 3:04 pmyes
elmaya thx!

Ps.
I have a question.
Is it possible to combine functionality. It means.... 8x realy and 8 Supla direct link on one WEMOS?

Re: 8 buttons and 8 relays in esp with hc595

Posted: Wed Oct 02, 2019 6:03 pm
by elmaya
bulek68 wrote: Wed Oct 02, 2019 5:19 pm
elmaya wrote: Wed Oct 02, 2019 3:04 pmyes
elmaya thx!

Ps.
I have a question.
Is it possible to combine functionality. It means.... 8x realy and 8 Supla direct link on one WEMOS?
It's not a good idea, it slows down the code a lot.
esp 8266 are very cheap, better a separate one. ;)