element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Remote Monitoring & Control
  • Challenges & Projects
  • Project14
  • Remote Monitoring & Control
  • More
  • Cancel
Remote Monitoring & Control
Blog CatDogFoxBot #3 : The Step Motor Scanner is Working
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Remote Monitoring & Control to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: dubbie
  • Date Created: 9 Jul 2019 10:49 AM Date Created
  • Views 1687 views
  • Likes 13 likes
  • Comments 4 comments
  • nano
  • remotemonitoringcontrolch
  • step motors
  • grideye
Related
Recommended

CatDogFoxBot #3 : The Step Motor Scanner is Working

dubbie
dubbie
9 Jul 2019

Having collected together all the parts I thought I needed to get started with my CatDogFoxBot Project14 effort for Remote Sensing and Control I happily sat down for a couple of hours using TinkerCAD to design some 3D printed parts to hold everything together. So far I have made the platform to hold the stepper motor and a widget to connect the Grideye PCB to the spindle of the stepper motor. For an initial design I am very happy with these parts as when combined with some metal pillars a compact and tidy module has been produced. I have left the designing of the holder for the Nano until a later time as I am not entirely sure how the structure will progress once I start to get it ready for going outside all night - in the cold, damp and possibly even rain. The video below illustrates this module just scanning the Grideye sensor backwards and forwards through 180 degrees.

 

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

The main part of the Nano programme is listed below. It is not complicated, just a for loop that scans one way through 180 degrees and then back again, inside a while loop set to run forever.

 

count = 0;

while(1)

  {

    if (count < scansteps / 2)

      {

        leftturnstep();

      }

    else

      {

        rightturnstep();

      } /* if */

    count++;

    if (count > scansteps)

      count = 0;

    } /* while */

 

The stepper motors have four phases so a simple one phase on at a time output sequence is all that is needed. I use a function to create the four step sequence to activate each phase once. The for loop then uses these functions.

 

void leftturnstep(void)

{
  digitalWrite(PhaseA, HIGH);   // turn the Phase on (HIGH is the voltage level)
  delay(stepdelay);                       // wait for a bit
  digitalWrite(PhaseA, LOW);    // turn the phase off and the next one on
  digitalWrite(PhaseB, HIGH);
  delay(stepdelay);                       // wait for a bit
  digitalWrite(PhaseB, LOW);    // turn the phase off and the next one on
  digitalWrite(PhaseC, HIGH);
  delay(stepdelay); 
  digitalWrite(PhaseC, LOW);    // turn the phase off and the next one on
  digitalWrite(PhaseD, HIGH);
  delay(stepdelay); 
  digitalWrite(PhaseD, LOW);    // turn the phase off and the next one on
} /* leftturnstep */

 

I originally decided that it would not need any form of calibrating limit switch for the stepper motor as I thought I could just manually move the stepper motor shaft to the correct initial position. I can do this but I hadn't really thought that the stepper motor will always think that the power-on position will be step zero and that will be the same stepper motor shaft position whenever it was powered off. The result is that every time I power off or reprogram the Nano the Grideye sensor starts from a new zero position. At present I hold the Nano reset button down and manually adjust the stepper motor shaft position until it is correct but that is not easy to do and not all that practical so I think I will have to add some sort of limit switch or sensor.

 

The scanner module also makes a 'noise' as it is scanning which is not going to be that helpful as it might scare away the cats I am trying to detect. I can step at a much slower speed which will reduce the noise but then I will not be able to track the cat as it is moving about. I might have to include some sound-proofing.

 

I have not yet made the connections to the Grideye sensor yet so that will be the next step. I will need to download the library for it and try out the example programme provided in order that I can start to understand what the Grideye can do and what the data will look like.

 

Dubbie

  • Sign in to reply

Top Comments

  • genebren
    genebren over 6 years ago +3
    Dubbie, The 3D prints look very nice. Did you achieve a tight press fit of the stepper motor into the base? Seems like it would not be to difficult to include mountings on either side of the housing to…
  • dubbie
    dubbie over 6 years ago in reply to genebren +2
    Gene, The original 3D printed part to hold the step motor was a push tight fit - a bit too push tight, it wouldn't go in. I had forgotten that TinkerCAD uses piecewise linear approximations to curves and…
  • three-phase
    three-phase over 6 years ago +2
    Good update to you project. Are you sure the noise isn't being amplified by the hard surface of the desk it is sitting on? On a softer surface it may naturally quieten down a bit. Kind regards.
  • dubbie
    dubbie over 6 years ago in reply to three-phase

    Donald,

     

    Yes, the hard surface of the desk did amplify the noise but there was still a definite buzz from the step motor. I'm not entirely sure how quiet the garden is at night, it is much quieter than during the daylight hours but there is still probably some noise. It will depend on whether the system I noisier than the ambient noise. Cats do have very good hearing so may hear it. If it is too noisy I might have to just use it without scanning. This will be an interesting part of the experiment.

     

    Dubbie

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • three-phase
    three-phase over 6 years ago

    Good update to you project. Are you sure the noise isn't being amplified by the hard surface of the desk it is sitting on? On a softer surface it may naturally quieten down a bit.

     

    Kind regards.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • dubbie
    dubbie over 6 years ago in reply to genebren

    Gene,

     

    The original 3D printed part to hold the step motor was a push tight fit - a bit too push tight, it wouldn't go in. I had forgotten that TinkerCAD uses piecewise linear approximations to curves and circles. So I increased the internal diameter slightly - slightly too much as it turned out, and now the step motor fits but it is just slightly loose. However, it does the job so I'm not printing another one at present. The step motor does have fittings for screws so I could have used those but I'm experimenting with just push fit parts where possible, just to see what can be achieved.

     

    I hadn't thought of micro-stepping the motor to reduce vibration, I will keep that in mind. Nor had I thought about using an optical limit sensor, that's a definite possibility.

     

    Dubbie

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • genebren
    genebren over 6 years ago

    Dubbie,

     

    The 3D prints look very nice.  Did you achieve a tight press fit of the stepper motor into the base?  Seems like it would not be to difficult to include mountings on either side of the housing to allow the stepper motor to be screwed into the housing. Just a thought.

     

    You might be able to address the vibrations/noise by microstepping the motor, if the driver and the nano can support that.  On the topic of limit switches, there are many way to handle this.  A simple method might be to use an optosensor and a small flag on the angle bracket (more reliable that limit switches?).

     

    Good luck on your continued development!

     

    Gene

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube