Pages: [1]   Go Down
Author Topic: Maker seeking Arduino guidance: Proximity sensor + stepper/servo  (Read 6082 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 1
Posts: 5
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 212
Posts: 8975
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You would start by describing exactly how you want the stepper or servo position to depend on distance info from the ultrasonic sensor.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 639
Posts: 34725
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 5
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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....
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 639
Posts: 34725
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 5
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

thank you thank you.
Logged

Pages: [1]   Go Up
Jump to: