8 buttons and 8 relays in esp with hc595

elmaya
Posts: 204
Joined: Wed Jun 27, 2018 5:48 pm
Location: Sevilla

Sun Mar 24, 2019 2:26 pm

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

Mon Mar 25, 2019 12:29 am

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: 6398
Joined: Tue Jan 19, 2016 9:26 am
Location: Paczków
Contact:

Mon Mar 25, 2019 10:04 am

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

Mon Apr 01, 2019 9:10 pm

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
Attachments
16_push_button_and_2x8_relay.png
16_push_button_and_2x8_relay.png (2.91 MiB) Viewed 323 times
Post Reply