I need to have 2 inputs (+, -, 12 volts) that trigger an action when one side is positive and then when the other side is positive (polarity reversal). This is a motor controller that goes forward and reverse by changing polarity.
So 2 plugs/inputs (2 wires) from my controller, positive and negative. When plug 1 is positive, do this. And when plug 2 is positive, do this.
FYI: I am doing this with 2 buttons at the moment. But the buttons are 5 volts (powered from the UNO) and they share a common ground. My solution right now has no practical application so the next step is to integrate the actual motor controller. No appreciable current will flow through the trigger switches since my motor shield will draw power for the motors from a dedicated 12 volt, high current input.
You can use 2 resistors, named voltage divider, or You can use an opto copler to keep electrical noice away.
What Arduino do You use? 5 volt or 3.3 volt?
Divide the voltage to just below Vcc, 5 or 3.3 volt. Then it can be connected to the Arduino.
Railroader:
You can use 2 resistors, named voltage divider, or You can use an opto copler to keep electrical noice away.
What Arduino do You use? 5 volt or 3.3 volt?
Divide the voltage to just below Vcc, 5 or 3.3 volt. Then it can be connected to the Arduino.
Thank for the quick reply! I'm sorry, I don't understand what you are saying. I am new to Arduino. Are you saying to reduce the input voltage from my controller to 5 volts? If so, how would I do that?
What is the "named voltage divider"?
I am using an Arduino UNO R3 (actual Arduino brand). It is set for 5 volts I think.
But importantly, are you saying that I cannot connect 12 volts directly to the trigger inputs (currently using digital PWM)?
I just checked out that optocoupler and that might be the way to go. In fact, I think I might be able to just replace my 2 switches with the outputs of an optocoupler. Not sure they will reverse polarity, however, based on what they see on their input. Do you know?
ardgate:
Thank for the quick reply! I'm sorry, I don't understand what you are saying. I am new to Arduino. Are you saying to reduce the input voltage from my controller to 5 volts? If so, how would I do that?
What is the "named voltage divider"?
I am using an Arduino UNO R3 (actual Arduino brand). It is set for 5 volts I think.
But importantly, are you saying that I cannot connect 12 volts directly to the trigger inputs (currently using digital PWM)?
Yes. Don't connect any voltage higher then 5 volt to any input pin.
An opto copler will need 2 resistor so it takes more place but is sometimes prerable to keep eventual electrical noice away from the Arduino.
ardgate:
I just checked out that optocoupler and that might be the way to go. In fact, I think I might be able to just replace my 2 switches with the outputs of an optocoupler. Not sure they will reverse polarity, however, based on what they see on their input. Do you know?
Don't bother about the polarity! That's easily handled by negating the input pin reading!
Railroader:
Don't bother about the polarity! That's easily handled by negating the input pin reading!
Thanks. I am still a little confused. I have a motor controller for a linear actuator. When I click a remote control button for "forward", the controller outputs LeadA positive, when I click "reverse", it sends out LeadB positive. I have an Arduino program that accepts a trigger on pin4 to instruct the motor to go forward and pin5 to go reverse. It also uses a common GND for both switches. I am looking to build a circuit where I can connect my 2 12 volt, variable polarity controller leads and activate a 5 volt trigger for pin4 or pin5, as needed. Can I use the optocoupler for that?
Could You grab a pen and paper and make a drawing, and post it?
You have a controler that receives Blutooth commands and then sends out power to the motor, fwd or bwf? Is that correct?
I don't get it regarding ""where I can connect my 2 12 volt, variable polarity controller leads. Is that the leads feeding the motor?
Railroader:
Could You grab a pen and paper and make a drawing, and post it?
You have a controler that receives Blutooth commands and then sends out power to the motor, fwd or bwf? Is that correct?
I don't get it regarding ""where I can connect my 2 12 volt, variable polarity controller leads. Is that the leads feeding the motor?
Yep see image. I am calling the output of the motor controller the "variable polarity controller leads". Normally, those would connect directly to the linear actuator. But I found the MegaMoto Arduino shield that is able to precisely measure motor current so that I can create a safety mechanism if the actuator were to get jammed. So now I just want to use the output of the motor controller as the control inputs to activate the Arduino solution which will power the motor (from its own power supply).
This is the code I am trying to modify to work with my existing controller. https://www.instructables.com/Monitoring-Load-Feedback-of-an-Actuator/ It was kind of not finished and in its current state it has no real practical solution. I am trying to finish that program and make it actually useful.
I would think the outputs from the motor controller should go to the motor (linear actuator), NOT to the Arduino, the outputs from Arduino to the inputs on motor controller. Please post links to your motor controller and actuator.
Replace that motor controller with stuff that both receives the remote signal and via a motor driver controls the motor. That's the way to let an Arduino control the motor.
JCA34F:
I would think the outputs from the motor controller should go to the motor (linear actuator), NOT to the Arduino, the outputs from Arduino to the inputs on motor controller. Please post links to your motor controller and actuator.
They normally would but with the MegaMoto shield controller, it has to power the actuators so that it is able to read the current and allow disabling for over-current situations.
Forget applying an Arduino between that controller and the motor. The over current protection must be handled within the Arduino controlled motor driver.
Railroader:
Forget applying an Arduino between that controller and the motor. The over current protection must be handled within the Arduino controlled motor driver.
Right this is my whole point. If you take a look at that link I posted, I just need to replace those 2 buttons with the output from the controller as it gives me the remote control that I need.
I don't see "those 2 buttons" in You drawing so I don't understand Your idea. Know the difference between signal handling buttons and motor power handling.
Railroader:
Replace that motor controller with stuff that both receives the remote signal and via a motor driver controls the motor. That's the way to let an Arduino control the motor.
Yes I think this may be the solution. Let Arduino control everything start to finish. In researching the solution I want to use, it would appear that it is the unicorn of motor control in that everyone wants it but no one seems to know how to implement it. Darn frustrating as it seems a super simple matter to do from a layman's perspective!
Essentially I am replacing one control system with another. I will look for an RF module for Arduino and see if I can program that to do what I need. Any suggestions? I just want a simple 2 or 4 button RF remote that I can put on my breadboard to provide 2 or 4 unique inputs to the Sketch.
Railroader:
I don't see "those 2 buttons" in You drawing so I don't understand Your idea. Know the difference between signal handling buttons and motor power handling.
In the link I posted to the Sketch code for the Moto controller.
ardgate:
Right this is my whole point. If you take a look at that link I posted, I just need to replace those 2 buttons with the output from the controller as it gives me the remote control that I need.