Need help to control 4 stepper motors using ultrasonic sensors

I am new to Arduino programming, so i need a little help.
My project requires 4 stepper motors to go in clockwise direction continuous, until the ultrasonic sensor detect any obstruction. Once it detect the obstruction, then after a delay of 5 secs, all the motors go anticlockwise.

For reference, I am using an Arduino UNO, with CNC shield V3 and A4988 stepper motor drivers

Hi,
Is your project an object avoiding robot?
Which CNC shield? Can you post a link to its data/specs.

Have you written any code to just read a single ultrasonic sensor?
This would be a good place to start.
Then once you can read one, write code to read two or more.
Then write code that just controls ONE stepper.
Then once you can control one, write code to control more than one.

If you write your code in distinctive steps and then combine each one at a time, you will arrive at your goal with the minimum of bugs and problems.

Tom... :smiley: :+1: :coffee: :australia:

My Project is a tree climber. I'm using a GRBL CNC Shield Expansion Board V3.0

I'm using Stepper motors (not decided which ones to use), A4988 Stepper Motor Drivers, an Arduino Uno, a standard ultrasonic sensor and a power supply (undecided).

There are existing libraries which let you control stepper motors, and if the ultrasonic sensor is a HC-SR04 style on there are libraries for that too. But for a tree climbing system I think you need to work out a more detailed mechanical plan and what you'll actually be sensing for, before worrying about these sort of specifics. You'll want to work out exactly how you'll hold to the tree, whether it will be powered from a tether cable or onboard battery, and also do some measurements of multiple types of proximity sensor (ultrasonic, infrared...) to see which best detects the sort of obstacles you care about (branches sticking out at too sharp an angle to climb on to?). I suspect adding an accelerometer here may help with some climbing related matters too.

Hi,

I think you might be better off if you draw up the mechanical arrangement of your tree climbing robot before looking at the control and hardware.
You will have to draw out your climbing mechanism, then look at hardware.

The specs of the steppers will depend on the load of the robot, how far you want them to move.
If this is a school or university project and it is a proof of concept, then you may be able to power your robot from the ground with a lead.
This will save mass.

Thanks.. Tom.. :smiley: :+1: :coffee: :australia:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.