Go Down

Topic: Help getting started with a project: Stepper motor and pir sensors (Read 275 times) previous topic - next topic

SwiftyRich

Hi,

New to arduino, I think I've jumped in the deep end with a project and am quite overwhelmed... Thought it'd be a lot more simple than it is, and that once I'd bought all the components, I could play with some code samples and work it out myself... Ill cut to the chase:

Im trying to use a stepper motor to turn a small platform 45 degrees either way from a centre point to make my nixie clock thats sitting on it face 2 different points in the room.

Im planning to place 2 PIR sensors (HC-SR501), one at my desk and one facing the lounge area, to sense movement and activate the stepper motor (28BYJ-48) to face that direction and stop.

Getting in to it I realised I'd need to make each pir sensor deactivate/stop sensing movement once it had activated the stepper motor once and turned the platform into its set position.

Is this viable or even possible using these parts?

Ive seen basic "Use a PIR sensor to activate a Stepper/Servo" but not anything tailored to what im trying to do.

Any suggestions on code, starter literature or other similar projects would be greatly appreciated.

wildbill

Getting in to it I realised I'd need to make each pir sensor deactivate/stop sensing movement once it had activated the stepper motor once and turned the platform into its set position.
Not really. You just need to keep track of whether you pointed the nixie at the lounge or your desk. If it's pointing to the lounge and you get triggers from the lounge, just do nothing. Only move if you get a trigger from the desk pir.

If both PIRs fire, you will need to decide what to do. Personally, I'd leave it pointing where it is.

BikerMark

Not really. You just need to keep track of whether you pointed the nixie at the lounge or your desk. If it's pointing to the lounge and you get triggers from the lounge, just do nothing. Only move if you get a trigger from the desk pir.
That makes sense.
It's that simplicity of practiced coders, which I start to get a bit nowadays. The fewer complexity the better;)

SwiftyRich

Not really. You just need to keep track of whether you pointed the nixie at the lounge or your desk. If it's pointing to the lounge and you get triggers from the lounge, just do nothing. Only move if you get a trigger from the desk pir.

If both PIRs fire, you will need to decide what to do. Personally, I'd leave it pointing where it is.
Thanks for the replies.

To keep track of the stepper position would i need something like a reed switch or similar? Ive heard that stepper motors haave no way of communcating their position or do they have a centre point as reference.

I think im gonna have to go and read up on scripts and whatnot so i can at least get the stepper moving a set amount each time a pir triggers.

wildbill

You need something to give you an indication of position at power up. Often that's done with limit switches. Spin the motor until you find one and now you know where you are.

The power cable may be problematic. You will want to avoid wrapping it round the nixie. It's probably worth having four or more limit switches so you don't have to go so far to find one.

Alternatively, you could just have two. One for desk and one for lounge.

Go Up