Go Down

Topic: Use Arduino to Run 24v Motor with Microswitch  (Read 428 times) previous topic - next topic

azor32

Oct 12, 2018, 02:32 pm Last Edit: Oct 12, 2018, 02:35 pm by azor32
Hi there,

I'm looking to control a number of 24 volt dc motors with an Arduino. The motors need to do a full 360 degree turn when activated. When rotating the microswitch is depressed, and not depressed when it reaches it's home position. I've attached a circuit pic. Having some trouble working out how the microswitch signals the controller when to stop sending 24 volts to the motor. Then I need to find the best code to modify so the arduino can control it correctly. I'm a bit puzzled as to why I measured 4 volts dc in the circuit before and after the motor is activated by the original controller.

Robin2

Images from Original Post so we don't have to download them. See this  Simple Image Guide





...R
Two or three hours spent thinking and reading documentation solves most programming problems.

Robin2

Having some trouble working out how the microswitch signals the controller when to stop sending 24 volts to the motor.
That sounds like the mechanism used in a screen wiper motor to make it park at the right position.

In a screen wiper when you turn on the wiper-switch it provides power to the motor in parallel with the microswitch - effectively overriding the OFF position of the microswitch so the motor moves. Then, if you turn off the wiper-switch when the wipers are not at the park position the microswitch keeps supplying power until the park position is reached.

If that has any relevance then you need to tell us what role you want the Arduino to play.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

adwsystems

Neither of those pictures help with answering your question about the 4V readings. FOr that you will need to draw and post a wiring drawing.

What is the microswitch connected to?

Too many people try to jump to programming without thinking through the process if done by hand (ie., without programming). This may be a bit hard to explain but will result in a well working circuit. You can test this before hand as well. The goal is to run the power for the motor through the DPST microswitch in such a way that the motor stops itself.

Without the Arduino:
24V Power to Microswitch COM
Microswitch NC (normally closed) contact to motor power.
Motor ground to 24V ground.
and
Connect 24V power to a push button switch, then from the switch to the motor power.

When the motor is home, the microswitch is open stopping the motor from getting power. Pressing the push button switch bypasses the microswitch and causes the motor to run. As soon as the microswitch closes, release the pushbutton and the motor will continue until it rotates to the home position and cause the microswitch to open again.

Swap the push button with a relay and connect to your Arduino. Close the relay long enough to get the micro switch to close and then open the relay. If you need to know the position of the microswitch, connect the microswitch NO contact use a zener diode-resistor-optocoupler combination to reduce from 24V signal to 5V for the Arduino to read on a digital input pin.

azor32

If that has any relevance then you need to tell us what role you want the Arduino to play.

...R
It's taking over the role of vending machine controller for a compact vending machine.

azor32

Without the Arduino:
24V Power to Microswitch COM
Microswitch NC (normally closed) contact to motor power.
Motor ground to 24V ground.
and Connect 24V power to a push button switch, then from the switch to the motor power.

When the motor is home, the microswitch is open stopping the motor from getting power. Pressing the push button switch bypasses the microswitch and causes the motor to run. As soon as the microswitch closes, release the pushbutton and the motor will continue until it rotates to the home position and cause the microswitch to open again.
I don't have a switch handy, but with 24v going directly from a power supply the microswitch didn't stop the motor from getting power in the home position. Testing the microswitch with a multimeter, it read a closed circuit when the button was or wasn't pressed. I don't have an oscilloscope to check what might be getting sent back to the vending machine controller to switch off the 24v supply.

adwsystems

Testing the microswitch with a multimeter, it read a closed circuit when the button was or wasn't pressed.
If you are checking continuity (ohms) from COM to NO then it should be open when not pressed and closed when pressed. If this is not the case, then the switch is kaput. (You should also check COM to NC with the opposite actions on the switch)

Robin2

#7
Oct 12, 2018, 05:15 pm Last Edit: Oct 12, 2018, 05:17 pm by Robin2
It's taking over the role of vending machine controller for a compact vending machine.
That does not tell me if my description of the process has any relevance,

Neither does it answer my question about the role of the Arduino in relation to the motor.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

azor32

That does not tell me if my description of the process has any relevance,

Neither does it answer my question about the role of the Arduino in relation to the motor.

...R
I'll try to answer your questions. If I'm misunderstanding let me know. I'm not very knowledgeable about wind screen wipers but I'd imagine that whatever motor used would need to go back and forth with a variable speed control switch. My application is for a single direction 360 degree turn, once off activation. The activation (and deactivation) of the motor is to be controlled by an arduino. The purpose of which is to vend a food or drink item from a vending machine(spiral coil).

Once I can get this part of the process to work I need to put together a set of conditions that the arduino uses to vend based on user input and sufficient funds.

Paul_KD7HB

I'll try to answer your questions. If I'm misunderstanding let me know. I'm not very knowledgeable about wind screen wipers but I'd imagine that whatever motor used would need to go back and forth with a variable speed control switch. My application is for a single direction 360 degree turn, once off activation. The activation (and deactivation) of the motor is to be controlled by an arduino. The purpose of which is to vend a food or drink item from a vending machine(spiral coil).

Once I can get this part of the process to work I need to put together a set of conditions that the arduino uses to vend based on user input and sufficient funds.
You do misunderstand, then. The motor only turns one way. The back and forth motion of the wiper is because of the crank mechanism attached to the gear box of the assembly. Do you have the gear mechanism still attached to the motor?

Paul

azor32

If you are checking continuity (ohms) from COM to NO then it should be open when not pressed and closed when pressed. If this is not the case, then the switch is kaput. (You should also check COM to NC with the opposite actions on the switch)
Not sure if what I'm seeing is correct, but it looks like the NC and NO terminals on the microswitch are wired together. Running a probe from no/nc and a probe to com shows there is continuity, however there is a spike in resistance when pressing the button, and when releasing the button on the microswitch. Wonder if this could be what the regular vending machine controller is looking for to turn it off?

azor32

#11
Oct 12, 2018, 06:29 pm Last Edit: Oct 12, 2018, 06:30 pm by azor32
You do misunderstand, then. The motor only turns one way. The back and forth motion of the wiper is because of the crank mechanism attached to the gear box of the assembly. Do you have the gear mechanism still attached to the motor?
Hi Paul, I had to remove the gear mechanisms in order to take the picture of the inner circuit of the dc motor housing. When assembled they turn the central hole which turns the coil.

Robin2

#12
Oct 12, 2018, 07:12 pm Last Edit: Oct 12, 2018, 07:12 pm by Robin2
I'll try to answer your questions. If I'm misunderstanding let me know. I'm not very knowledgeable about wind screen wipers but I'd imagine that whatever motor used would need to go back and forth with a variable speed control switch.
Speed control is a modern development.

What I am trying to get from you is confirmation, or a definite denial, that I have properly described how the microswitch in your system is intended to work to control the position at which the motor stops. I fully realize it is not a windscreen wiper - but the principle seems to be similar.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

Paul_KD7HB

Let's forget the windscreen wiper idea. Got me confused! Does the shaft that presses on the push button of the micro-switch have a flat spot that releases the button as the shaft revolves?

Paul

azor32

#14
Oct 13, 2018, 10:29 am Last Edit: Oct 13, 2018, 10:33 am by azor32
Let's forget the windscreen wiper idea. Got me confused! Does the shaft that presses on the push button of the micro-switch have a flat spot that releases the button as the shaft revolves?

Paul

The shaft has a flat spot for the button to release. I've attached a pic.


Go Up