So, I'm trying to make a dc motor act like a switch so that whenever it is turned and produces a positive voltage, it will activate another sensor or turn on a light, basically acting as a replacement of a button or a switch. Any tip on how to make it?
A button or switch does not produce a voltage. It either makes or breaks a connection.
A brushed DC motor is a generator and will produce a voltage, positive or negative, depending on which direction the shaft is rotated.
jremington:
A brushed DC motor is a generator and will produce a voltage, positive or negative, depending on which direction the shaft is rotated.
And the voltage will almost certainly be outside the safe working range (0-5v) for an Arduino.
...R
Use a relay
hammy:
Use a relay
? ? ?
...R
Use a relay as a switch instead of a rotating motor
Use a relay as a switch instead of a rotating motor
? ? ?
Maybe feed it to a full wave bridge rectifier followed by a zener to clamp the input voltage?
Use a relay as a switch instead of a rotating motor
Are you suggesting using the voltage generated by turning the motor to energize the relay? - Scotty
No I’m suggesting you dump the motor and drive a relay with an Arduino output . Use the relay contacts to switch your load .
hammy:
No I’m suggesting you dump the motor and drive a relay with an Arduino output . Use the relay contacts to switch your load .
You seem to have the wrong end of the stick.
AFAIK the OP wants to use the motor as an INPUT device.
...R
This is relatively easy to do, tie one side of the motor to two 10k resistors, one going to GND, one to +5V.
The other side of the motor can then go to an analog pin. Treat it like a joystick.
Probably a good idea to stick 100nF or so across the motor contacts to reduce spikes, but the 10k resistors
should protect for any reasonable speed of turning.