Firmware do rolet dla silniczka krokowego

zbylcio
Posts: 12
Joined: Tue Sep 05, 2023 7:08 am

Post

Witam, wgrałem oprogramowanie z tego postu
roleta_nowa.ino.generic.bin.7z
do nodemcu v3 i mam taki nietypowy objaw.
Silnik pracuje normalnie ale w czasie gdy na nodemcu miga niebieska dioda sygnalizujaca prace silnik na chwilę się zatrzymuje i rusza dalej.
Objaw zawsze występuje w czasie mrugnięcia diody. Diody na kontrolerze silnika gasną wtedy na chwilę co sugerowałoby brak sterowania i zatrzymanie silnika? Sprawdzałem na dwóch oddzielnych układach nodemcu i dwóch oddzielnych sterownikach wraz z silnikiem ? I jeszcze pytanie, w kodzie jest
SuplaDevice.addSensorNO(2); // 1 czujnik krańcowy Call SuplaDevice.addSensorNO(A0, true)

jak można go podłączyć. Próbowałem i jakoś mi nie działa :( .
Image
You do not have the required permissions to view the files attached to this post.
User avatar
wojtas567
Posts: 2334
Joined: Sun Apr 03, 2016 7:16 pm
Location: Olsztyn

Post

zbylcio wrote: Sun Mar 03, 2024 3:57 pm
jak można go podłączyć. Próbowałem i jakoś mi nie działa :( .
Podpinałeś pod GPIO2 ?
Pozdrawiam
Wojtek
[email protected]
Posts: 1585
Joined: Mon Feb 06, 2023 8:56 am
Has thanked: 18 times
Been thanked: 26 times

Post

wojtas567 wrote: Sun Mar 03, 2024 4:49 pm
zbylcio wrote: Sun Mar 03, 2024 3:57 pm
jak można go podłączyć. Próbowałem i jakoś mi nie działa :( .
Podpinałeś pod GPIO2 ?
Sądząc po kodzie podpinal 🤣

gpio 2 to dioda ,użyj innego
zbylcio
Posts: 12
Joined: Tue Sep 05, 2023 7:08 am

Post

dzięki za szybką reakcję ;) (faktycznie D2 to dioda) nie mogę z tym nic zrobić bo ten gotowiec jest tak skompilowany :?
(chyba ,że
wojtas567
coś poradzi :) )

zwora
TX-D2
RX-D1
pn maja 20, 2019 1:11 pm

Dopiero teraz zauważyłem, że nie masz zworek :)
GPIO1 z GPIO4 i GPIO3 z GPIO5 lub zamiennie jeżeli roleta będzie szła w dół a w aplikacji do góry.
Pozdrawiam
Wojtek
User avatar
wojtas567
Posts: 2334
Joined: Sun Apr 03, 2016 7:16 pm
Location: Olsztyn

Post

Nic nie poradzę bo to jest za stary soft :(
Ostatnio próbowałem wrócić do tamtych czasów ale nie mam bibliotek.
Pozdrawiam
Wojtek
zbylcio
Posts: 12
Joined: Tue Sep 05, 2023 7:08 am

Post

:( czyli rozumiem ,że niema nowszego rozwiązania na suple i 28BYJ-48 :(
dzięki za odzew :(

Może ktoś by skompilował i wrzucił zamieniając D2 np. D3,D4 lub D8
radzik_r
Posts: 468
Joined: Sun Aug 11, 2019 5:32 pm
Has thanked: 1 time
Been thanked: 2 times

Post

Dla jednego silnika podłączonego do WEMOSA pod GPIO 12, 13, 14, 15

Testowałem na ESP32. Na Wemosie też powinien działać.

Code: Select all

/*
  Copyright (C) AC SOFTWARE SP. Z O.O.

  This program is free software; you can redistribute it and/or
  modify it under the terms of the GNU General Public License
  as published by the Free Software Foundation; either version 2
  of the License, or (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/

/* This example shows ESP82xx/ESP32 based device with simple WebInterface
   used to configure Wi-Fi parameters and Supla server connection.
   There is one RollerShutter, one Relay and 3 buttons configured.
   Two buttons are for roller shutter with Action Trigger.
   Third button is for controlling the relay and for switching module to
   config mode.
   After fresh installation, device will be in config mode. It will have its
   own Wi-Fi AP configured. You should connect to it with your mobile phone
   and open http://192.168.4.1 where you can configure the device.
   Status LED is also configured. Please adjust GPIOs to your HW.
*/


#include "Stepper_28BYJ_48.h"

// piny pod które podłączony jest Stepper_28BYJ_48 //
#define PIN1 12
#define PIN2 13
#define PIN3 14
#define PIN4 15


Stepper_28BYJ_48 stepper(PIN1, PIN2, PIN3, PIN4);

#define STATUS_LED_GPIO                        2
#define ROLLER_SHUTTER_UP_RELAY_GPIO_VIRTUAL   0 // pin wirtualny
#define ROLLER_SHUTTER_DOWN_RELAY_GPIO_VIRTUAL 1 // pin wirtualny
#define BUTTON_UP_GPIO                         4
#define BUTTON_DOWN_GPIO                       5
#define BUTTON_CFG_GPIO                        0

#include <SuplaDevice.h>
#include <supla/network/esp_wifi.h>
#include <supla/control/roller_shutter.h>
//#include <supla/control/relay.h>
#include <supla/control/button.h>
//#include <supla/control/action_trigger.h>
#include <supla/device/status_led.h>
#include <supla/storage/littlefs_config.h>
#include <supla/network/esp_web_server.h>
#include <supla/network/html/device_info.h>
#include <supla/network/html/protocol_parameters.h>
#include <supla/network/html/status_led_parameters.h>
#include <supla/network/html/wifi_parameters.h>
#include <supla/device/supla_ca_cert.h>
#include <supla/events.h>
#include <supla/io.h>

// Choose where Supla should store roller shutter data in persistent memory
// We recommend to use external FRAM memory
#include <supla/storage/eeprom.h>
Supla::Eeprom eeprom;
// #include <supla/storage/fram_spi.h>
// Supla::FramSpi fram(STORAGE_OFFSET);

Supla::ESPWifi wifi;
Supla::LittleFsConfig configSupla;

//Supla::Device::StatusLed statusLed(STATUS_LED_GPIO, true); // inverted state
Supla::Device::StatusLed statusLed(STATUS_LED_GPIO, false); // inverted state
Supla::EspWebServer suplaServer;


// HTML www component (they appear in sections according to creation
// sequence)
Supla::Html::DeviceInfo htmlDeviceInfo(&SuplaDevice);
Supla::Html::WifiParameters htmlWifi;
Supla::Html::ProtocolParameters htmlProto;
Supla::Html::StatusLedParameters htmlStatusLed;

Supla::Control::RollerShutter *rs = nullptr;


class VirtualExpander : public Supla::Io {
  public:
    VirtualExpander() : Supla::Io(false) {}
    void customDigitalWrite(int channelNumber, uint8_t pin, uint8_t val) override {
      VIRTUAL_VARIABLE[pin] = val;
    }
    int customDigitalRead(int channelNumber, uint8_t pin) override {
      return VIRTUAL_VARIABLE[pin];
    }
  private:
    bool VIRTUAL_VARIABLE[8];
};


void setup() {

  Serial.begin(115200);

  auto EX_OUTPUT = new VirtualExpander();

  // Channels configuration
  // CH 0 - Roller shutter
  rs = new Supla::Control::RollerShutter(EX_OUTPUT, ROLLER_SHUTTER_UP_RELAY_GPIO_VIRTUAL, ROLLER_SHUTTER_DOWN_RELAY_GPIO_VIRTUAL, true);

  // Buttons configuration
  auto buttonOpen  = new Supla::Control::Button(BUTTON_UP_GPIO,   true, true);
  auto buttonClose = new Supla::Control::Button(BUTTON_DOWN_GPIO, true, true);
  auto buttonCfg   = new Supla::Control::Button(BUTTON_CFG_GPIO,  true, true);

  buttonOpen->addAction(Supla::OPEN_OR_STOP, *rs, Supla::ON_CLICK_1);
  buttonOpen->setHoldTime(1000);
  buttonOpen->setMulticlickTime(300);

  buttonClose->addAction(Supla::CLOSE_OR_STOP, *rs, Supla::ON_CLICK_1);
  buttonClose->setHoldTime(1000);
  buttonClose->setMulticlickTime(300);

  buttonCfg->configureAsConfigButton(&SuplaDevice);

  // configure defualt Supla CA certificate
  SuplaDevice.setSuplaCACert(suplaCACert);
  SuplaDevice.setSupla3rdPartyCACert(supla3rdCACert);

  SuplaDevice.begin();

}

void loop() {
  SuplaDevice.iterate();

  static bool x;
  switch ( rs->getCurrentDirection() ) {
    case  0: // RS STOP
      if (x) {
        digitalWrite(PIN1, LOW); digitalWrite(PIN2, LOW); digitalWrite(PIN3, LOW); digitalWrite(PIN4, LOW);
      }
      break;
    case  1: // RS DOWN
      x = 1;
      stepper.step(-1);
      break;
    case  2: // RS UP
      x = 1;
      stepper.step(1);
      break;
  }
}
You do not have the required permissions to view the files attached to this post.
zbylcio
Posts: 12
Joined: Tue Sep 05, 2023 7:08 am

Post

Dziękuje @radzik_r za odpowiedź.
Połączyłem:
PIN1 - GPIO 12
PIN2 - GPIO 13
PIN3 - GPIO 14
PIN4: - GPIO 15
przycisk GDN-GPIO5
przycisk GDN-GPIO4
Wgrałem i efekt jest następujący:
- silnik działa wirtualnie w aplikacji (roletę zamyka, otwiera) jak wystosowuje ręcznie przyciskami
- silnik fizycznie nie obraca się, diody nie świecą
- jak podłączę GPIO5 GPIO4 z TX RX to coś tam silnik działa ale nie do końca :(
radzik_r
Posts: 468
Joined: Sun Aug 11, 2019 5:32 pm
Has thanked: 1 time
Been thanked: 2 times

Post

zbylcio wrote: Mon Mar 04, 2024 7:11 am Dziękuje @radzik_r za odpowiedź.
Połączyłem:
PIN1 - GPIO 12
PIN2 - GPIO 13
PIN3 - GPIO 14
PIN4: - GPIO 15
przycisk GDN-GPIO5
przycisk GDN-GPIO4
Wgrałem i efekt jest następujący:
- silnik działa wirtualnie w aplikacji (roletę zamyka, otwiera) jak wystosowuje ręcznie przyciskami
- silnik fizycznie nie obraca się, diody nie świecą
- jak podłączę GPIO5 GPIO4 z TX RX to coś tam silnik działa ale nie do końca :(
Właśnie sprawdziłem działanie z przycinków, u mnie normalnie się uruchamia z przycisków i z aplikacji.

po co łączysz z RX i TX? nie ma takiej potrzeby.

sprawdź swoje połączenia przycisków,

Ktoś jeszcze może sprawdzić u siebie?
zbylcio
Posts: 12
Joined: Tue Sep 05, 2023 7:08 am

Post

po co łączysz z RX i TX? nie ma takiej potrzeby.
Ponieważ po podłączeniu nie było oznak życia, sprawdziłem czy jest sygnał sterowania jak w poprzednim projekcie, i ten sygnał jest, diody na sterowniku się zapalają.
sprawdź swoje połączenia przycisków,
Tak jak pisałem przyciski jak wyzwalam ręcznie na nodemcu działają tylko wirtualnie w aplikacji tzn. roleta podnosi się i opada,
niestety brak reakcji silniczka :(
to chyba będzie coś z
ROLLER_SHUTTER_UP_RELAY_GPIO_VIRTUAL: Numer pinu wirtualnego przekaźnika do podnoszenia rolety
ROLLER_SHUTTER_DOWN_RELAY_GPIO_VIRTUAL: Numer pinu wirtualnego przekaźnika do opuszczania rolety

Return to “Pomoc”