8 buttons and 8 relays in esp with hc595

elmaya
Posts: 1482
Joined: Wed Jun 27, 2018 5:48 pm
Location: El Saucejo - Sevilla

Post

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
selo
Posts: 9
Joined: Mon Mar 04, 2019 1:31 am

Post

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?
User avatar
pzygmunt
Posts: 19243
Joined: Tue Jan 19, 2016 9:26 am
Location: Paczków

Post

Do not worry about it. This is how it should work when fully closed / opened.
edm
Posts: 522
Joined: Mon Jan 15, 2018 6:18 pm

Post

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
You do not have the required permissions to view the files attached to this post.
Wziąłem udział w Supla Offline Party 2023 :D
User avatar
bulek68
Posts: 456
Joined: Thu Feb 08, 2018 6:51 pm
Location: Podkarpackie

Post

elmaya
Posts: 1482
Joined: Wed Jun 27, 2018 5:48 pm
Location: El Saucejo - Sevilla

Post

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 ;)
User avatar
bulek68
Posts: 456
Joined: Thu Feb 08, 2018 6:51 pm
Location: Podkarpackie

Post

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
elmaya
Posts: 1482
Joined: Wed Jun 27, 2018 5:48 pm
Location: El Saucejo - Sevilla

Post

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
User avatar
bulek68
Posts: 456
Joined: Thu Feb 08, 2018 6:51 pm
Location: Podkarpackie

Post

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?
elmaya
Posts: 1482
Joined: Wed Jun 27, 2018 5:48 pm
Location: El Saucejo - Sevilla

Post

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. ;)

Return to “Ideas and concepts”