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. General Discussion
  3. Stepper wont work with Mysensors

Stepper wont work with Mysensors

Scheduled Pinned Locked Moved General Discussion
6 Posts 2 Posters 2.1k 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.
  • TON RIJNAARDT Offline
    TON RIJNAARDT Offline
    TON RIJNAARD
    wrote on last edited by
    #1

    Hello,

    I try to run a stepper 28byj-48 with driver in mysensors. As soon as I Mysensors.h activate the stepper motor will not run. Can anyone help me what I do wrong. I use Int 4,5,6,7, above. Also at 3,4,5,6 not work I put too // for Mysensors the engine is running normally. Also burn without Mysensors all 4 LEDs. With Mysensors burn only 3 LEDs.

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

      Hi,
      we need

      • Schematic
      • Code
      • Relevant links to the used parts i.e. datasheets

      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
      • TON RIJNAARDT Offline
        TON RIJNAARDT Offline
        TON RIJNAARD
        wrote on last edited by TON RIJNAARD
        #3

        Here the image and the code that i wil use it a start. I am new to programm arduino.

        Schematic that i use this works without Mysensors.h (see the sketch)

        http://engyfun.blogspot.nl/2015/02/here-is-source-code-for-our-28byj48.html

        // =========================== Zet de serielle monitor aan ======================================
        #define MY_DEBUG
        // **************************** Einde Debug *****************************************************
        
        // =========================== Radio instelling RFM 69 ===========================================
        //#define MY_RADIO_NRF24
        #define MY_RADIO_RFM69
        
        //=========================== Node en Child infomatie =============================================
        #define MY_NODE_ID 17
        #define CHILD_ID 2
        //**************************************************************************************************
        
        //***************************** Einde Radio setup ***************************************************
        
        #include <SPI.h>
        //#include <MySensors.h>
        #include <AccelStepper.h>
        
        
        #define HALFSTEP 8
        
        // ============================ Motor pin definitions ==================================================
        #define motorPin1  4                    // IN1 on the ULN2003 driver 1
        #define motorPin2  5                    // IN2 on the ULN2003 driver 1
        #define motorPin3  6                    // IN3 on the ULN2003 driver 1
        #define motorPin4  7                    // IN4 on the ULN2003 driver 1
        
        int CHILD_CURTAIN_ID =4;
        
        // Initialize with pin sequence IN1-IN3-IN2-IN4 for using the AccelStepper with 28BYJ-48
        AccelStepper stepper1(HALFSTEP, motorPin1, motorPin3, motorPin2, motorPin4);
        
        //==================================================================================================
        
        MyMessage msg_S_COVER_U(CHILD_CURTAIN_ID, V_UP);
        MyMessage msg_S_COVER_D(CHILD_CURTAIN_ID, V_DOWN);
        MyMessage msg_S_COVER_S(CHILD_CURTAIN_ID, V_STOP);
        MyMessage msg(CHILD_CURTAIN_ID,V_UP);
        
        //*************************************************************************************************
        
        // ==============================  Begin Setup ===========================================================
        void setup() 
        {
          stepper1.setMaxSpeed(18000.0);
          stepper1.setAcceleration(100.0);
          stepper1.setSpeed(400);
          stepper1.moveTo(20000);
        
        }
        //****************************----- (Einde setup )---********************************************************
        
        
        // ==============================---- Begin Loop ----========================================================
        void loop() 
        {
        
          //Change direction when the stepper reaches the target position
          if (stepper1.distanceToGo() == 0) 
          {
            stepper1.moveTo(-stepper1.currentPosition());
          }
          stepper1.run();
        }
        
        // **************************** Eind Loop ==================================================================```)
        
        
        
        Sorry i can get the  code not in a nice black box.
        1 Reply Last reply
        0
        • pansenP Offline
          pansenP Offline
          pansen
          wrote on last edited by pansen
          #4

          Code looks good so far... (you misplaced the starting and ending ``` to mark code in a black box).

          What I can tell you from own, painful experience: If anything fails with the radio setup (also registration I think), loop() will never be executed. I was testing a LED library, working perfectly without MySensors.h but not doing anything with MySensors.h included.

          Later I realized my controller was switched off..after I switched it on everything worked. So ensure that MySensors can communicate properly. That means implementing presentation() and all other functions..

          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
          • TON RIJNAARDT Offline
            TON RIJNAARDT Offline
            TON RIJNAARD
            wrote on last edited by
            #5

            @Pansen,

            Thanks i give it a try.

            1 Reply Last reply
            0
            • TON RIJNAARDT Offline
              TON RIJNAARDT Offline
              TON RIJNAARD
              wrote on last edited by
              #6

              @ Pansen It work now!
              When connect the radio then the 4e led and stepper is working.
              Thanks for the help.

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


              17

              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