Multiple sensors to control same motor

is this possible?
controlling single 12V motor speed (pwm output from arduino and logic level mosftet driver) from multiple sensors?

so basicly to write analog values to the same pwm pin but to use different inputs (potentiometer, FSR and rain sensor)

is it possible?

Of course you can easily control the same pin from the different parts of your code.
What would prevent you from doing that?

i'm not sure - if only one sensor is activate - outputing data there is no problem.
What would happen if few sensors outputing data together? the motor will change is speed acordingly to the latest active sensor changes?

The most arduinos has only single core so it can't do more than one thing in the time.
Therefore your sensors can't "outputing data together", things will be processed in series

1 Like

Yes.

Why do you open a second thread for the same project?

I was thinking it is needed as it is different subject. Sorry for that as it could be written at the same topic

Of course!

The Arduino takes all the inputs, and uses them as the basis for what to do.

if( sensor1_condition AND sensor2_condition )
{
   do_something();
}

if( sensor1_condition BUT NOT sensor2_condition )
{
   do_something_else();
}

if( sensor3_condition )
{
   do_another_thing();
}

The vast majority of projects are about taking multiple inputs, and doing stuff that depends on all of them ...

you can provide three sketches where you test controlling rotation speed of motor depend on single sensor output, then we help put sketches together.

Hi, @hk_jh

What is your application?
What do you want to accomplish with an array of different sensors and one motor?

Thanks.. Tom.. :smiley: :+1: :coffee: :australia:

I have a Nissan micra windscreen wiper motor That I would like to control is speed using different sensors.(part of an installation)

The thing with this motor is that it got 4 wires while I only worked in the past with motor having 2 wires.
Why it got 4 wires? can I control it using only two of its wires?

Good question, which should be answered before you decide to use the motor. Since OEM auto parts don't come with data sheets, dismantling and reverse engineering the motor is one approach.

Does your wiper have a "parking" position that the wiper goes to when you turn the wiper off?

1 Like

yes.

those 4 wires is for the direction of the rotation or just for speed?

Edit:
So I pretty sure those 4 wires is for controlling 2 speeds of the motor. the question is if I can ignore two wires and use the one that connected for the High speed and control that with arduino?

The actual question is: Why have you not tested your motor so you know what the 4 wires actually do?

1 Like

Check and make sure its not 5, the gnd of the motor could be part of the supply to the motor.

Tom.. :smiley: :+1: :coffee: :australia:

1 Like

Because this motor belong to a friend I'm helping which leave far away and he himself cannot do it.

In the picture my friend send me I can see 4 wires: Red Black Green and Yellow

Can you show us that? Just copy into your post like this

Unfortunately there is little if any consistency bertween car manufacturers for wiring colours
https://www.gomog.com/allmorgan/LucasColours.html

This explains the wiring for a 4 wire motor
http://www.speedyjim.net/schem/wiper2.htm

Have you tried just putting that into your favourite internet search engine?

eg, "Nissan micra windscreen wiper motor"

Do you have Haynes manuals, or an equivalent - they will have wiring diagrams:

https://haynes.com/en-gb/nissan/micra/1995-1996-10-petrol-55251-petrol

As others have said, multiple wires will likely be used for things like different speeds and self-parking.
And remember that the chassis is usually used as one terminal of the 12V supply...

Here is the picture he sent me