pwm signal override

Status
Not open for further replies.

Thread Starter

ets23

Joined Jan 26, 2021
29
Hello,

i've a motor controlled by a pwm signal from a computer. I've already developed the right Arduino code to control this motor. What I would like to do know is to choose if the motor has to be controlled by the original source or by the Arduino so I need something like a switch to choose the source running the motor. I need this to be remotely controlled so BLE (the Arduino has already ble built-in) or using one of those RF relays board. How do you think should I achieve this? What's the most best and most efficient way?

Thank you
 

djsfantasi

Joined Apr 11, 2010
9,156
Hello,

i've a motor controlled by a pwm signal from a computer. I've already developed the right Arduino code to control this motor. What I would like to do know is to choose if the motor has to be controlled by the original source or by the Arduino so I need something like a switch to choose the source running the motor. I need this to be remotely controlled so BLE (the Arduino has already ble built-in) or using one of those RF relays board. How do you think should I achieve this? What's the most best and most efficient way?

Thank you
What is the second source? Have you considered programming the Arduino to use a switch to either run the motor with PWM or straight-through (no PWM?)
 

KeithWalker

Joined Jul 10, 2017
3,063
The simplest way to switch the motor between power sources will be with a relay. You are already using an arduino with BLE, so use it to switch the relay on or off.
 

Thread Starter

ets23

Joined Jan 26, 2021
29
so maybe I can connect the relay to an arduino output pin and to the original source, and then connect the pin generating the pwm together with the relay out. The relay is turned on and off with the arduino and if it's on I keep the pwm from the arduino LOW, if it's off I send the pwm with the Arduino. I don't know if I was clear, I attach a very rough scheme because I've never worked with relays so I don't know the wiring
Schermata 2021-01-26 alle 18.53.55.png
 

KeithWalker

Joined Jul 10, 2017
3,063
Use a relay that has NO/C/NC change over contacts.
Connect the motor to C, The default source to NO and the Arduino PWM out to NC.
 

Thread Starter

ets23

Joined Jan 26, 2021
29
I have a doubt regarding how to connect the GND to the motor, the motor works at +12v so I have to use a mosfet to amplify the pwm signal and I'm using this board to do it
11fbb26e8d3010f5524a48b0794f24ded205a14e_original.jpeg
I'm not sure how to wire the gnd coming out from the board to the motor. Can I connect directly to the motor to the GND coming from the default source?
This is the schematic of my full circuit using the relay to have the motor controlled by the default computer or by the arduino
Is the wiring correct? How should I close the circuit?

Schermata 2021-01-30 alle 01.05.18.png

Thank you
 

KeithWalker

Joined Jul 10, 2017
3,063
There is very little information on the IRF 540 Module but I finally figured out how it should be connected.IRF540.jpg
For your application, using a relay:
Connect the motor and 12V + and - as shown.
Connect the Arduino 5V + and - as shown.
There is an opto-isolator on it so you don't need to connect the 12V- to the Arduino 5V- .

On your relay which selects the source:
Connect MOSFET module IP to "COM"
Connect the Computer PWM output to "NC"
Connect the Arduino PWM output to "NO"

Good luck.
 
Last edited:

Thread Starter

ets23

Joined Jan 26, 2021
29
hello, that makes sense! So I should use the MOSFET even if i'm not controlling the motor from the computer right?
It should be like this, is it correct?Schermata 2021-01-30 alle 09.35.44.png
 

Thread Starter

ets23

Joined Jan 26, 2021
29
I've tried doing this but i've got smoke coming from the diode on the mosfet board and it got burned, that's very strange and I don't understand why
 

Attachments

Thread Starter

ets23

Joined Jan 26, 2021
29
I'm also thinking that the original pwm is at 12v and I don't think the board can get +12v on the Signal input.

There's no way to make the first circuit without connecting the original source to the mosfet?
 

LesJones

Joined Jan 8, 2017
4,174
Here are a few comments on the problem.
In the first few posts the TS did not make it clear that the motor had a permanent 12 volt supply AND ALSO A PWM signal input. I think this is only a control signal (It does not directly supply current to the motor.) We have not been told the amplitude of this signal and it's drive capability.

If the circuit was wired as in post #9 I don't see how the back emf diode on the mosfet board could have been damaged. I think the actual circuit did not correspond to the diagram.

IF the PWM signal level is 0 to +12 volts then I think the diagram in post #9 should work EXCEPT FOR THE FACT that the mosfet board can only pull it's output down. A pull up resistor will be required to make it work.

I think djsfantasi's solution in post #2 is a much better one than using the relay.

Has it been proved that the Arduino and mosfet driver board work standalone with the motor ? I don't think it has due as the lack of a pull up resistor would have prevented it from working.

Edit . I've just seen the circuit in post #12. This will not work as the load + is internally connected to the supply + on the mosfet board.

Les.
 
Last edited:

Thread Starter

ets23

Joined Jan 26, 2021
29
Hello Les, thank you for your reply.
The motor as +12 and the pwm as a control signal
In the beginning I was thinking to the same as post #2 but to avoid using always the Arduino to control it I was thinking about using the relay.
If not using the relay how should it work? Should I put the signal coming from the source to a pin of the Arduino using a voltage divider and then read it and send it to the output pin of the Arduino? Then send it to the mosfet to bring the signal back to +12v?
I need to use the mosfet board because the output from the Arduino is ~3v but the motor needs a 12v signal to work

Thank you
 

LesJones

Joined Jan 8, 2017
4,174
I agree with the small software modification for the Arduino. I have no idea how your motor will behave with the PWM input tied to +12 volts and applying the PWM to it's negative terminal. You will need to supply FULL details of the electronics inside the motor and confirm that the PWM signal is 12 volts amplitude. You will also have to find how much current drive the PWM signal has to provide. You could set the original computer to give 100% PWM output and measure the current in the PWM line. Plese provide all the information on the computer and motor.

Les.
 

Thread Starter

ets23

Joined Jan 26, 2021
29
Hello Les, it's a bit complicated, it's actually an exhaust valve of a car. The car open and closes the valve depending on the throttle position and other factors so I can't change its values.
What I know is that at 10% the valve opens and at 90% the valve closes at 200hz and the signal is at 12v
 

LesJones

Joined Jan 8, 2017
4,174
I have not done any work with car engines since the valves were just opened and closed by camshafts. There are other members of the forum that know more about modern car engine design.

Les.
 

Thread Starter

ets23

Joined Jan 26, 2021
29
It's nothing complicated it's just a control pwm signal at 12v I've already seen projects like this but they were ignoring the car's pwm signal and just setting the valve open or closed. Do you think it may work using a voltage divider to read the car signal inside the arduino?
 

LesJones

Joined Jan 8, 2017
4,174
A voltage divider should work to feed the pwm signal into the Arduino. Assuming a 4 cylinder engine at 6000 RPM each exhaust valve will be opening and closing every 5 mS. If you get the timing wrong the valves will collide with the pistons requiring a VERY expensive engine rebuild. I am curious as to the types of motor that can position the valve so quickly.

Les.
 
Status
Not open for further replies.
Top