Go Down

Topic: Maker seeking Arduino guidance: Proximity sensor + stepper/servo (Read 8080 times)previous topic - next topic

derekbruno

First post please forgive my ignorance on all fronts...

For my first real Arduino project, I am currently prototyping a piece that aims to use a Max Sonar EZ0 sensor to control a stepper motor.

Having said this, I am in way over my head when it comes to programming in C. I have been pouring over all of the information I can find, and yet I remain unable to turn basic input into output. I guess I am looking for any  resources that might have eluded me thus far, and possibly someone who has time to do some basic mentoring.

Any and all advice is appreciated. thank you for your patience and consideration...

/d

johnwasser

You would start by describing exactly how you want the stepper or servo position to depend on distance info from the ultrasonic sensor.
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp

Grumpy_Mike

I would suggest you start off by learning how to drive a stepping motor.
Then you learn how to print out the results from your sensor.
Then you put the two codes together.

derekbruno

thank you both for the quick responses:

I guess at this point my struggle is combining the two components:  I have been successful in getting PW input from the sensor, I am currently working on what it will take to get my stepper to function...

What i am looking to accomplish is a linear rpm change based on distance. so if an object was 10 feet away the motor would spin at 1rpm and then increase rationally to 500 rpm at 1 foot.

it is this part of coding ( i suppose its a series of 'if' rules) that i do not quite understand....

My hunch is that there is a way to place min and max variables without coding an exact speed for each possible distance... but again, I do not yet understand how to do this....

Grumpy_Mike

Quote
i suppose its a series of 'if' rules

No it is just a matter of taking the number from the sensor and applying it to control of the motor.
It is kindergarten maths but if you are not up to it look at the map function:-
http://arduino.cc/en/reference/map

derekbruno

thank you thank you.

Go Up