OpenSprinkler Forums OpenSprinkler Unified Firmware ESP32 port of 2.1.9 firmware

Viewing 25 posts - 101 through 125 (of 125 total)
  • Author
    Posts
  • #76073

    Ken.238
    Participant

    I guest may be define gpio. My esp32 scl gpio 22 and sda gpio 21.The sensor1 gpio 15 and I can’t locate the sensor2.I try enable rain sensor not thing shown up. So far button and sensor1 working.

    #76082

    Ken.238
    Participant

    Look like the sensor2 not work at all. the rest working fine.

    #76091

    polskifacet
    Participant

    @v1pr I noticed that the GPIOs in your firmware don’t match the board? Ja carters did match up, I’m using 12,13,14,15 for stations. Probably explains why the screen isn’t working.

    #76093

    v1pr
    Participant

    @polskifacet I’ve check Ja.Charer’s esp32.h and I see the issue. For some reason he changed the I2C pins from the default 21/22 PINS to PIN 4/5. To get the screen working do the following:

    – pull esp32.h (just I file) from my repo, I’ve changed it to reflect Ja.Charer’s original config

    After that search for ‘SDA’ in OpenSprinkler.cpp, and change SDA and SCL near it to SDA_PIN, SCL_PIN – this should be done in 3 places, around line 96, 98 and 789 (I’ve done some other changes, so I cannot push it to git now).


    @ken
    .238 check the wiring/routing and change the pin in esp32.h accordingly. (E0_PIN_SENSOR1 and E0_PIN_SENSOR2)

    I’m using a totally different board, so – till today – esp32.h reflected my setup. FYI: you should always check esp32.h if it matches your HW setup.

    #76097

    polskifacet
    Participant

    @v1pr I wasn’t able to compile with the new version of ESP32.H, I used the old one and just made the changes you suggested and put my pins etc. The GPIOs function in the correct order now (I assume those were double assigned to something else). LCD still doesn’t want to comply :(. Any other tips?

    #if defined(LCD_SH1106)
    SH1106Display OpenSprinkler::lcd(LCD_I2CADDR, SDA, SCL);
    #else
    SSD1306Display OpenSprinkler::lcd(LCD_I2CADDR, SDA_PIN, SCL_PIN);
    #endif

    if defined(ARDUINO)
    #if defined(ESP32)
    if(!Wire.begin(SDA_PIN,SCL_PIN)) { DEBUG_PRINTLN(F(“Error initiating I2C”)); }
    #ifdef ENABLE_DEBUG
    scan_i2c();
    #endif
    #else
    Wire.begin(); // init I2C
    #endif
    #endif

    #76098

    v1pr
    Participant

    What was the error, when you wanted to compile? Are these line exists in esp32.h:

    #define SDA_PIN 5
    #define SCL_PIN 4

    ?

    Wire.begin should look like this: Wire.begin(SDA_PIN, SCL_PIN);

    Sorry, forgot one thing. Please modify I2CRTC.cpp also! Line 46. You also have to remove the comment block signs ‘/*’ and ‘*/’ from the begining (line 32 and 37), so esp32.h gets included.

    (search for SDA in the whole Opensprinkler.cpp)

    #76102

    polskifacet
    Participant

    Awesome LCD works !!!!

    #76105

    v1pr
    Participant

    Great 🙂 All looks good than? Or is there something else, what is not working for you?

    #76107

    rickerdo
    Participant

    Is there a repo available that captures all of the changes up to this point? It looks like some great work has been done.

    #76115

    v1pr
    Participant

    Don’t be so lazy pls… the whole topic is just 5 pages, and you only have to read back 1 or 2…

    #76116

    polskifacet
    Participant

    @v1pr Everything I use is working great, I don’t have any sensors etc. The old 2.1.9 port had a weird bug with the time not staying current from ntp, but I think Ray improved that in newer versions (no external rtc needed). Superb work and I’m sure many people will appreciate this.
    One question I have is WeMos D1 mini seems to get compiled as well, will this work for most esp8266? Ray’s esp8266 code works but I think only with the IO expander. Esp8266 with OLED only has 3 free gpios (that are not set to high on boot) but either a version without the screen or just the 3 gpios for remote stations could be useful.

    #76117

    v1pr
    Participant

    @polskifacet thanks for the feedback, I’m glad to here. IMHO it’s easier to hook up a $2-$3 I2C RTC to the I2C bus – to the same pins as the LCD. Same stands for the IO Expander.
    About the ESP8266: yes, it’s possible, but needs some – pretty minor – modification to the code, in OpenSprinkler.cpp, so that the HW revision is not based on an IO Expander on the I2C bus. Unfortunatelly I cannot do it now, since I’ve “messed” up the codebase a bit for another thing, but I can do it later to support that. As a B) option, you can buy a cheap IO expander with PCF8574.

    #76118

    polskifacet
    Participant

    @v1pr For sure I just like minimalist setups, for example I’m using OpenSprinkler for a chlorine dosing pump which needs 1 GPIO to go to a relay. Having Io expander just makes it messy lol.

    #76119

    v1pr
    Participant

    I totally understand your point 🙂 I’ll change the code once I’ve finished with the current stuff.

    #76124

    Ken.238
    Participant

    @v1pr I need help from you. For some reason I had had an error when compile. *** [.pio\build\esp32_sprinkler\src\OpenSprinkler.cpp.o] Error 1. Do I missing something. Thanks.

    #76125

    v1pr
    Participant

    From this I cannot tell. Please copy the whole compile output.

    #76126

    Ken.238
    Participant

    Sorry, I miss the post to replace esp32.h. Every thing working fine. Only issue I have the sensor2 not work at all. What ever gpio I replace sensor1 work not the sensor2.

    #76127

    v1pr
    Participant

    Ken, any chance, that it’s a sensor fault? Have you tried swapping the sensors? The connected pin number should be an easy thing to test. Either follow the trace on the board to the esp32 or use a multimeter in diode check mode – unplug the board first! – (preferably with sound). From the top of my head I’m not sure, if the sensors are GND or 5V based, but I guess the first; so one pin of the sensor is connected to GND, the other is to the esp somewhere.
    Once you know where it’s connected on the esp32, you can check any esp32 pinout diagram on the net and adjust the esp32.h accordingly.

    What’s the type of the second sensor?

    #76130

    Ken.238
    Participant

    I just upload to development board to test. I confirm the sensor2 not work. I try set that gpio work on sensor1 to sensor2 and issue the same. I use the sensor2 as program switch.

    #76227

    polskifacet
    Participant

    I uploaded this code to a regular ESP Wroom-32 dev without OLED and everything I use works (just 4 relays, no buttons, no sensors).

    #76250

    v1pr
    Participant

    @Ken.238: please check the PIN config for SENSOR2, there is/was a typo in esp32.h, the assignment from the original firmware:

    #define E0_PIN_SENSOR1 36 // sensor 1
    #define E0_PIN_SENSOR2 2 // sensor 2


    @polskifacet
    : I’m glad it’s working. I’m currently busy with some renovations, will work on the esp8266 when finished. Please be patient 🙂

    #76267

    Ken.238
    Participant

    So far I don’t see any typo in esp32.h yet and still working on. Beside esp32.h any file I need to check. Thanks.

    #76417

    Corinake
    Participant

    Hi.
    First of all, Ja.carer and V1pr’s congratulations for the work done.

    I use this version of the motherboard with relays:
    https://werner.rothschopf.net/microcontroller/202208_esp32_relay_x8_en.htm

    I tested the 2.1.9 version of Ja.carr and everything is functional, 8 relays, display, buttons, and both sensors.
    I also tested version 2.2.0 of V1pr’s and is functionally almost everything, except sensor 2.
    Also in the console I am constantly appearing an error: gpio: gpio_set_level(226): GPIO output gpio_num error

    In ESP32.H I changed the pin number from sensor 1 to sensor 2 and then the sensor 1 did not work and the sensor 2 worked.
    To check the operation of the sensors, simply connect the cable from the sensor to the common grounding.
    With the last option of ESP32H that you have loaded in reposis, where you commented those definitions in the last part, I cannot compile.
    If I remove the comments as in the previous version, it works
    I also attached my log in the console, as well as the functions of the pins.
    In version 2.1.9 it did not work to use pins with the “input_only” function.
    In version 2.2.0 I did not try, but I tried with pins 18 and 17. Sensor 2 did not work

    rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
    configsip: 0, SPIWP:0xee
    clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
    mode:DIO, clock div:2
    load:0x3fff0030,len:1184
    load:0x40078000,len:13192
    load:0x40080400,len:3028
    entry 0x400805e4
    [ 45][E][Y.���\�����5
    hw_type = 172 hw_rev = 0
    E (46) gpio: gpio_set_level(226): GPIO output gpio_num error
    Starting sensors – INPUT_PULLUP
    Sensor1 PIN: 19
    Sensor2 PIN: 5
    Starting RFTX pins
    RFTX PIN: 255
    LCD SSD1306 init
    Init file system…
    Flash size: 4194304 bytes
    Listing directory: /
    FILE: done.dat SIZE: 1
    FILE: iopts.dat SIZE: 64
    FILE: nvcon.dat SIZE: 16
    FILE: prog.dat SIZE: 1
    FILE: sopts.dat SIZE: 1920
    FILE: stns.dat SIZE: 17856
    Done.
    Detecting RTC…done.
    [ 1836][E][WiFiAP.cpp:141] softAP(): SSID missing!
    Starting AP with SSID
    — Setting up options
    — PD init
    — Time setup
    FILE: done.dat
    FILE: iopts.dat
    FILE: nvcon.dat
    FILE: prog.dat
    FILE: sopts.dat
    FILE: stns.dat
    Starting network
    ETH enabled: 0
    Wifi mode: STA
    OTF start with http_port 80
    Started OTF with just local connection
    DNSServer start
    Setting update server
    Started update server
    — MQTT Init
    2106-02-07 01:28:29 – MQTT Init
    2106-02-07 01:28:29 – MQTT Init: ClientId OS-94E68689BCB4
    E (13105) gpio: gpio_set_level(226): GPIO output gpio_num error
    Setting up WiFi client
    Connecting in STA to WiFi network Deea
    E (13193) gpio: gpio_set_level(226): GPIO output gpio_num error
    E (13979) gpio: gpio_set_level(226): GPIO output gpio_num error

    This is a part from esp32.h:
    #define E0_PIN_BUTTON_1 18 // button 1
    #define E0_PIN_BUTTON_2 17 // button 2
    #define E0_PIN_BUTTON_3 16 // button 3
    #define E0_PIN_RFRX 255
    #define E0_PIN_RFTX 255
    #define E0_PIN_BOOST 255// special HW needed
    #define E0_PIN_BOOST_EN 255// special HW needed
    #define E0_PIN_LATCH_COM 255// not needed for ESP32
    #define E0_PIN_SENSOR1 19 // sensor 1
    #define E0_PIN_SENSOR2 5 // sensor 2
    #define E0_PIN_IOEXP_INT 255// not needed for ESP32

    #define PIN_ETHER_CS 255 // ENC28J60 CS (chip select pin) is 16 on OS 3.2.

    #define USE_IOEXP_SR 0 // use Shift-register as station setting – uncomment this to use built-in gpio style

    #define ON_BOARD_GPIN_LIST {13,12,14,27,26,25,33,32} // ESP32 on board gpins to be usead as sections, 255 – pin not defined
    #define PIN_FREE_LIST {} // no free GPIO pin at the moment
    //#define PIN_FREE_LIST {01,03,04,02,15,00} // no free GPIO pin at the moment

    // if set to a real ADC pin, than it means the board has current sensor capabilities
    #define PIN_CURR_SENSE 39 // not used on v1pr’s board, so 255

    #define STATION_LOGIC 1 // Zone output logic for relays – 1 => HIGH in ON, 0 => LOW is ON – v1pr board: 1

    // Rotary Encoder instead of buttons – not used for now
    //#define USE_ROTARY_ENCODER
    #define ROTARY_ENCODER_A_PIN 255 //35
    #define ROTARY_ENCODER_B_PIN 255 //34
    #define ROTARY_ENCODER_BUTTON_PIN 255 //36 // this should be same, as one of the BUTTON_PINS
    #define ROTARY_ENCODER_VCC_PIN -1

    #define BOOT_MENU_V2

    #define SEPARATE_MASTER_VALVE 255

    // 74HC595 shift reg
    // #define IOEXP_SR_OE_PIN // output enable pin, not used now
    #define IOEXP_SR_DATA_PIN 255 //25
    #define IOEXP_SR_CLK_PIN 255 //27
    #define IOEXP_SR_LATCH_PIN 255 //32

    #define SYS_STATUS_LED_PIN 23

    #76424

    Ken.238
    Participant

    As you said sensor2 won’t work. I just find out if I used PCA9555 I/O expander not either. My I/O expander board work on esp8266 not esp32. I think might be address set not correct. I still working on.

    #77286

    polskifacet
    Participant

    Thanks again @V1pr. This has been rock solid for me on esp32! No issues, hasn’t even needed a reboot since June!

Viewing 25 posts - 101 through 125 (of 125 total)
  • You must be logged in to reply to this topic.

OpenSprinkler Forums OpenSprinkler Unified Firmware ESP32 port of 2.1.9 firmware