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.8k 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
    • P Offline
      P 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

      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

      With your input, this post could be even better 💗

      Register Login
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      27

      Online

      12.0k

      Users

      11.2k

      Topics

      113.4k

      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