Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Hardware
  3. Sonoff Wifi Switch, GPIO14 and interrupts

Sonoff Wifi Switch, GPIO14 and interrupts

Scheduled Pinned Locked Moved Hardware
2 Posts 2 Posters 2.6k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mgaman
    wrote on last edited by
    #1

    The Sonoff has a 'spare' GPIO number 14.
    I hooked this up to a Hall Effect Water Meter and tried to count the pulses.
    The Arduino sketch I wrote works fine on the NODEMCU but doesn't record interrupts on the Sonoff.
    For the NODEMCU the board was set as NodeMCU 0.9, for the Sonoff I set it as Generic ESP8266
    I'm open to ideas as to why I'm not getting interrupts.
    Awaiting your valuable insight

    1 Reply Last reply
    0
    • pansenP Offline
      pansenP Offline
      pansen
      wrote on last edited by pansen
      #2

      can you post some code? interrupts work fine with my sonoff:

      attachInterrupt(PIN_PIR_SENSOR, ISR_PIRPinHasChanged, CHANGE);
      [...]
      void ISR_PIRPinHasChanged(){
        int currentPinStatus = digitalRead(PIN_PIR_SENSOR);
        if(currentPinStatus == LOW){
          Serial.println("ISR fired, pin LOW");
        }
        else{
          Serial.println("ISR fired, pin HIGH");
          ToggleRelay();
        }
      }
      
      ISR fired, pin LOW
      ISR fired, pin HIGH
      toggling relay to OFF
      switching off
      sending status to controller
      ISR fired, pin LOW
      ISR fired, pin HIGH
      toggling relay to ON
      switching on
      sending status to controller
      ISR fired, pin LOW
      ISR fired, pin HIGH
      toggling relay to OFF
      switching off
      

      Orange Pi Plus 2e connected to nrf24 PA via SPI running git-development MySensors gateway, OpenHAB2, mosquitto and MySQL persistence.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      10

      Online

      11.7k

      Users

      11.2k

      Topics

      113.1k

      Posts


      Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • MySensors
      • OpenHardware.io
      • Categories
      • Recent
      • Tags
      • Popular