Using multiple Vibrating Mini Motor

Gluce:
what you mean by "One chip can do eight"? I could use just 1 chip for 8 motors? :open_mouth:

Yes.

The L293D can drive four motors.
Leo..

Thanks for the attempt to use the Fritzing schematic view. To make it easier to read, there's some simple things you can do to improve it:

  1. Orient components with positive up or inputs on the left and outputs on the right.
  2. Use only 90-degree corners in the lines.
  3. Use ground symbols and power symbols instead of lines because almost every component needs to connect to these two and you don't need to show those lines crossing over everything.
  4. Try to minimise the number of lines crossing. You can forget rule #1 if it makes it look neater.
  5. Never join lines at a cross. A cross is for lines crossing without connecting. Make two "T" joins instead.

MorganS:
5. Never join lines at a cross. A cross is for lines crossing without connecting. Make two "T" joins instead.

Isn't it acceptable to use a dot to show a cross is a connection?

No, because the dot is usually small enough to be overlooked. A T is unambiguous, with or without the dot.

MorganS:
No, because the dot is usually small enough to be overlooked. A T is unambiguous, with or without the dot.

Good point.

Hi,
Its the same with 8.2K 8K2 is better cos the . might get lost in a 5 or 6th generation photocopy.
2.2uF 2u2F

You see on PCB overlays 3V3 for 3.3V

Tom.. :slight_smile:

Wawa:
Yes.

The L293D can drive four motors.
Leo..

Ok, great. Thank you for the clarification.

MorganS:
Thanks for the attempt to use the Fritzing schematic view. To make it easier to read, there's some simple things you can do to improve it:

  1. Orient components with positive up or inputs on the left and outputs on the right.
  2. Use only 90-degree corners in the lines.
  3. Use ground symbols and power symbols instead of lines because almost every component needs to connect to these two and you don't need to show those lines crossing over everything.
  4. Try to minimise the number of lines crossing. You can forget rule #1 if it makes it look neater.
  5. Never join lines at a cross. A cross is for lines crossing without connecting. Make two "T" joins instead.

Thank you. I will try to follow your suggestions in the future, although I have to study it a little bit. The schematic view is not very clear to me. It was automatically drawn by Fritzing. Anyway, I will try to do better in the future.

Regarding the circuit, I was still trying to understand what is wrong with the Mosfet that I have (the IRF520N). Now, please notice, I am not ignoring your advice, but the all point of doing the circuit myself was to learn something (other than to make it cheaper). Also, I don't know how to use an H-Bridge or something like the TPIC6B595. I will try to understand how to use it as the next step, in the meantime, I wanted to understand what's wrong with the IRF520N.

Please, bear with me a little:

  1. as far as I understand, the IRF520N is an N-Type Mosfet. Meaning that the Mos is Negative-Positive-Negative. This means that I need to apply a positive current to the gate in order to establish a connection between source and drain. You said:

TomGeorge:
The IRF520N is not a logic level MOSFET, so it will not be turned fully ON with 5V gate voltage.

Tom... :slight_smile:

If I understand the img, it means that I have to supply at least 2V in order to fully turn on the Mosfet (and no more than 4 or it will burn).

And yet, in project 9 of the Arduino, they used exactly that MOSFET and they say, quote:

"Connect digital pin 9 to the left pin of the transistor. This pin is called the gate. A change in voltage on the gate makes a connection between the other two pins". It kind of sounds that I can apply whatever voltage.

Now, I understand that this is not a logical Mosfet, as you showed, but why does my motor still turn on? And, what is the problem if the MOSFET does not fully turn on considering that it appears to be working fine (as I said, with 1 motor connected, the motor does vibrate)?

Please remember, I am a beginner and I am just trying to understand/learn.

  1. According to this video:
    https://www.youtube.com/watch?v=fex79DvbZvg&t=196s
    the N-Type Mosfet is doing exactly what I thought I needed. That is: it operates as a switch. I push the switch, it connects the drain to source. Quote: "I apply 5 volts, it conducts".

It also says: "There is no current flow between the source and the gate".
So, if I understand, I can use the 5 V to turn on the Mosfet, and then the 9V battery to turn on the Motor, and, since I am using a Mosfet (AND a Diode), the current will not go back to the Arduino. Right? This is probably the most important point. I DO NOT WANT TO BURN MY ARDUINO :slight_smile:

  1. If I use the 5 Volts to turn on the Mosfet, but the current does not go to the motor, where does that current go? Is it used by the MOSFET and it dies in there? I am using 2 resistance (as you can see) but I see that the guy uses one 10K resistance. Should I do the same?

  2. Looking at the Datasheet:
    IRF520N datasheet(1/2 Pages) ISC | isc N-Channel MOSFET Transistor
    it says: VGS Rated at ±20V. Does it mean that I can apply a maximum of 20V on the gate? So, let's say that I apply 5 V on the gate to power it, I should be fine(?): the Mosfet turns on and connect source to drain. So the Motor will start drawing current from the battery and vibrates. This leads to the next question.

  3. Once again, if I use a 9V battery to power the motor (rather than the Arduino), should I use a much greater resistance? If the motor is 3V, where do the remaining 6 Volts go?
    This is something I did not get also in Project 9. They use a 9V battery and a 6V motor. What about the 3V left? Isn't that going to damage the system?

Also, what about the amps? Does the motor only draw as much current (amps) as it needs from the battery? The motor is CC 3V, 0.1ADC 1.5V, 0.05A. So, it will draw 1 amp from the battery? According to the Ohm's law, don't I need a 60-ohm resistance? (9V of the battery - 3 Volts of the Vibrating Motor = 6 Volts. 6 Volts/0.1 amp (of the motor), = 60...right?

P.S.
Finally, the datasheet of the IRF520N says: Drain-Source Voltage100V. Does it mean that there can be 100V passing through Drain and Source and the Mosfet will be fine? Shouldn't that be more than enough to protect both the Mosfet and the Arduino?

On a second thought, it also says: Drain Current-Continuous9.7A. So, more than 9,7 amps will damage the Mosfet? And what about the Arduino?

There is confusion in me.

  1. due to manufacturing variations, different examples will just barely begin to turn on somewhere between 2V and 4V. You need to give it 10V to turn it on 'fully'. A 5V Arduino can't do that.

If it's not on fully, then it has a relatively high resistance which dissipates power and heats up the MOSFET. It's like driving a car with your foot resting on the brake pedal. The slight resistance of the brakes heats them up until they burn out.

  1. Yes, the insulated gate of the MOSFET protects the Arduino from ever seeing 9V.

  2. Current is like water flow in a pipe. The pipe has no leaks otherwise you would get zapped. So current leaving the +ve terminal of the battery or power supply is equal to the current entering the -ve terminal. But along the way it can do useful work turning a motor or it can be just squeezing past a tight place in the pipe. All those voltage drops add up to the total supply voltage. If it's getting squeezed in the MOSFET then there's less water pressure available to run the motor.

Two resistors is identical to one larger resistor in every respect.

  1. Yes. No 5V isn't fine for this MOSFET.

  2. A 3V motor will run faster on 9V. It will burn out if run for a long period but that may not be a problem if you only run it for short bursts.

The motor doesn't know that it's a 3V motor. It only has a resistance. You may apply any voltage to get the current flowing as you require. However the common LED does have a fixed voltage. It will allow any amount of current to flow when its voltage is exceeded. That's why LEDs are so different from motors and other components.

Drain-source voltage is almost never a limitation to a design. This is just telling you not to connect it to the 110V household supply.

The specified maximum amps is a significant limitation. This says that under the most ideal laboratory conditions, it will burn out with more amps. But your 5V drive is nowhere near the condition they used to test that. Your MOSFET will be toasted at lower current.

Gluce:
Regarding the circuit, I was still trying to understand what is wrong with the Mosfet that I have (the IRF520N). Now, please notice, I am not ignoring your advice, but the all point of doing the circuit myself was to learn something (other than to make it cheaper).

  1. as far as I understand, the IRF520N is an N-Type Mosfet. Meaning that the Mos is Negative-Positive-Negative. This means that I need to apply a positive current to the gate in order to establish a connection between source and drain. You said:

No, it has an n-type channel. You seem to be confusing a MOSFET with a bipolar junction transistor.

If I understand the img, it means that I have to supply at least 2V in order to fully turn on the Mosfet (and no more than 4 or it will burn).

No, completely wrong. It means some devices turn fully off at 2V, some at 4V. The device is not on until about
7V, and not fully on till 10V. Logic level MOSFETs tend to have threshold voltages of 0.5V or so.

And yet, in project 9 of the Arduino, they used exactly that MOSFET and they say, quote:

"Connect digital pin 9 to the left pin of the transistor. This pin is called the gate. A change in voltage on the gate makes a connection between the other two pins". It kind of sounds that I can apply whatever voltage.

As a switch you typically only apply 0V or 12V to that MOSFET. A logic level MOSFET used as a switch
would have either 0V or 5V applied to the gate. MOSFETs are almost invariably used as switches.

Now, I understand that this is not a logical Mosfet, as you showed, but why does my motor still turn on? And, what is the problem if the MOSFET does not fully turn on considering that it appears to be working fine (as I said, with 1 motor connected, the motor does vibrate)?

Yes, the device can be partially on, and dissipating lots of heat in the process. Its a bit like holding a switch
half-on so it is arcing - you don't do that.

Please remember, I am a beginner and I am just trying to understand/learn.

  1. According to this video:
    https://www.youtube.com/watch?v=fex79DvbZvg&t=196s
    the N-Type Mosfet is doing exactly what I thought I needed. That is: it operates as a switch. I push the switch, it connects the drain to source. Quote: "I apply 5 volts, it conducts".

Then it should be a logic level MOSFET

It also says: "There is no current flow between the source and the gate".
So, if I understand, I can use the 5 V to turn on the Mosfet, and then the 9V battery to turn on the Motor, and, since I am using a Mosfet (AND a Diode), the current will not go back to the Arduino. Right? This is probably the most important point. I DO NOT WANT TO BURN MY ARDUINO :slight_smile:

So long as the device isn't damaged yes, the gate is completely isolated from the source at DC.
The gate and the source act like a capacitor (a non-linear capacitor though). If you exceed the
breakdown voltage of that capacitor the device will be instantly damaged and all bets are off. Typically
the breakdown voltage is 20V or so between gate and source.

  1. If I use the 5 Volts to turn on the Mosfet, but the current does not go to the motor, where does that current go? Is it used by the MOSFET and it dies in there? I am using 2 resistance (as you can see) but I see that the guy uses one 10K resistance. Should I do the same?

There is either current flowing round the circuit or not - the same current around the whole circuit. If the
device is on and no current flows then there is no supply voltage or a break in the circuit

  1. Looking at the Datasheet:
    IRF520N datasheet(1/2 Pages) ISC | isc N-Channel MOSFET Transistor
    it says: VGS Rated at ±20V. Does it mean that I can apply a maximum of 20V on the gate?

No, its telling you to never apply 20V between gate and source. That's an absolute maximum rating,
which you don't ever go near if you want reliable operation.

So, let's say that I apply 5 V on the gate to power it, I should be fine(?): the Mosfet turns on and connect source to drain. So the Motor will start drawing current from the battery and vibrates. This leads to the next question.

That MOSFET will not turn on properly with 5V. 10V or 12V will turn it on.

  1. Once again, if I use a 9V battery to power the motor (rather than the Arduino), should I use a much greater resistance? If the motor is 3V, where do the remaining 6 Volts go?
    This is something I did not get also in Project 9. They use a 9V battery and a 6V motor. What about the 3V left? Isn't that going to damage the system?

Small 9V batteries are inadequate for powering motors (which need lots of current).
With an adequate 9V supply you'll typically burn out a 3V motor, but a 6V motor would survive,
but run faster. Its lifetime would be reduced by being overdriven

Don't assume a random example on the internet is well engineered...

Also, what about the amps? Does the motor only draw as much current (amps) as it needs from the battery?

Yes, all loads do that.

The motor is CC 3V, 0.1ADC 1.5V, 0.05A.

Those specs are very vague. DC motors have a stall current, and a rated current, and these usually differ
considerably.

So, it will draw 1 amp from the battery? According to the Ohm's law, don't I need a 60-ohm resistance? (9V of the battery - 3 Volts of the Vibrating Motor = 6 Volts. 6 Volts/0.1 amp (of the motor), = 60...right?

It will never draw 1A from a small 9V battery, nothing can. Do you mean 0.1A? The stall current of the motor
can be calculated from the resistance of the winding, but the rated current cannot.

P.S.
Finally, the datasheet of the IRF520N says: Drain-Source Voltage100V. Does it mean that there can be 100V passing through Drain and Source and the Mosfet will be fine? Shouldn't that be more than enough to protect both the Mosfet and the Arduino?

Voltage is across, never through. This is an absolute maximum rating, don't go near.

MOSFETs can be damaged by:

over current (ie overheating),
over voltage (on gate-source)
over voltage (drain-source),
static electricity during handling.

On a second thought, it also says: Drain Current-Continuous9.7A. So, more than 9,7 amps will damage the Mosfet? And what about the Arduino?

You'll find that's just a way of saying that at 9.7A the device will be at its maximum power handling
with infinite heatsink. In practice you don't go near that rating (except for short pulses).

Mark and Morgan, thank you both for your comments. I really appreciate your effort to go through all my points (many of which must sound trivial to you).

I decided to work on 2 lines at the same time:

  1. try to make it work with the mosfet that I have
  2. try to use a shift register like the the L293D. If I can make it work I will also buy a TPIC6B595 and try with that.

Now, I understand that apparently using this MOSFET is just a bad idea. I will try the shift register, but I still have many doubts on how to make it work. Anyway, I'll try to design a circuit for that once I finish this post.

In the meanwhile..., let's go back to the circuit with the Mosfet: it looks like the main problem is the power supply:

MorganS:

  1. due to manufacturing variations, different examples will just barely begin to turn on somewhere between 2V and 4V. You need to give it 10V to turn it on 'fully'. A 5V Arduino can't do that.

If it's not on fully, then it has a relatively high resistance which dissipates power and heats up the MOSFET. It's like driving a car with your foot resting on the brake pedal. The slight resistance of the brakes heats them up until they burn out.

  1. Yes. No 5V isn't fine for this MOSFET.

Also:

MarkT:
No, completely wrong. It means some devices turn fully off at 2V, some at 4V. The device is not on until about 7V, and not fully on till 10V. Logic level MOSFETs tend to have threshold voltages of 0.5V or so.

As a switch you typically only apply 0V or 12V to that MOSFET. A logic level MOSFET used as a switch
would have either 0V or 5V applied to the gate. MOSFETs are almost invariably used as switches.

Yes, the device can be partially on, and dissipating lots of heat in the process. Its a bit like holding a switch
half-on so it is arcing - you don't do that.

That MOSFET will not turn on properly with 5V. 10V or 12V will turn it on.Small 9V batteries are inadequate for powering motors (which need lots of current).

If I understand correctly, 12V is the right power supply for that MOSFET. (By the way, if that's the case, I have to say...I am getting a bit disappointed about the Arduino Projects Book and Starter Kit. They make you use a 5V supply and there is no mention to any of that....anyway...).

So, it means that I need to apply 12V on the Gate...correct?

I tried to re-design the circuit using a 12V battery

My apologies about the picture. I know that you suggested me a few things when drawing a circuit, but right now I am trying to learn a whole bunch of new stuff and it is a bit overwhelming. I hope that this is clear enough.

So, here it comes the first doubt:

  1. I need to PW modulate the motor. So, just like before, the gate is connected to a PWM pin.
    So, I am doing something like:
const int motorPin = 4;
 
void setup()
{
pinMode(motorPin,OUTPUT);
}
 
void loop()
{
analogWrite(motorPin, 255);
delay(200);
analogWrite(motorPin, 100);
delay(150);
analogWrite(motorPin, 50);
delay(100);
analogWrite(motorPin, 0);
 
analogWrite(motorPin,0);
delay(1000);
}
 
// End

The code is not very nice but it doesn't matter. This was just to test it. As I mentioned, I am going to use it in Matlab.

So, when I use analogWrite, it is sending a signal from PWM Pin 4 to the Gate. This is only specifiyng what's the duty cicle of the motor, right? It doesn't determine in any way how many V come to the gate, right? So, if current is like water in a pipe, where is the 12V that should go on the gate coming from?

With PWM Pin 4 I am sayng "GATE, OPEN !!" (kind of ^_^), but how do I know that there will be 12V on the gate?

MorganS:
Two resistors is identical to one larger resistor in every respect.

My doubt on this regard was the way the second resistance is wired. I wired it that way following a tutorial that I found online: I Mosfet e Arduino, come pilotare carichi | danielealberti.it

As you can see, turn on the gate with a PWM Pin. Then they put these 2 resistance but I don't really understand why.

So, as you said, current is like water flowing in a pipe. My understanding is that current will flow from a point of higher potential energy (+) to a lower potential energy (-). So, let's say that I turn on pin 4. I would think that current flows from that pin to the gate. On the way it encounters the first resistance and loses energy, protecting the gate (but if the gate needs 12V, then I can get read of that resistance, right?). Something like this:

Then, they put a second resistance going to ground. They say that purpose of that resistance is to connect the gate to ground ensuring that the gate is 0 when it is not operated. They also say this resistance is needed to protect the Mosfet from getting too hot. I have to say, someone in the comments says that this is really crappy and that they should have used a different MOSFET.

But I am pretty sure that this is all wrong. How can this be right if I need 12V on the gate?

  1. At this point, I don't understand whether I have too many Volts for the motor or too few. I could probably stop here and you can spare reading what follows :confused:

MorganS:
3) Current is like water flow in a pipe. The pipe has no leaks otherwise you would get zapped. So current leaving the +ve terminal of the battery or power supply is equal to the current entering the -ve terminal. But along the way it can do useful work turning a motor or it can be just squeezing past a tight place in the pipe. All those voltage drops add up to the total supply voltage. If it's getting squeezed in the MOSFET then there's less water pressure available to run the motor.

  1. A 3V motor will run faster on 9V. It will burn out if run for a long period but that may not be a problem if you only run it for short bursts.

The motor doesn't know that it's a 3V motor. It only has a resistance. You may apply any voltage to get the current flowing as you require. However the common LED does have a fixed voltage. It will allow any amount of current to flow when its voltage is exceeded. That's why LEDs are so different from motors and other components.

MarkT:
DC motors have a stall current, and a rated current, and these usually differ
considerably.It will never draw 1A from a small 9V battery, nothing can. Do you mean 0.1A? The stall current of the motor can be calculated from the resistance of the winding, but the rated current cannot. Voltage is across, never through.

You are right, the specifications of the motor are quite vague. I bought it on Amazon and it is not very clear: https://www.amazon.it/Sourcingmap-a14061100ux0057-millimetri-cellulare-vibrazioni/dp/B00PZYMCT8/ref=pd_sim_147_1?_encoding=UTF8&psc=1&refRID=TPHG7TQJJERMXCG5Z38R
Although, they say: Motore DC Vibrazione; Tensione nominale e attuale: CC 3V, 0.1ADC 1.5V, 0.05A
Literally translated it is something like "Nominal and Actual current
MAYBE these are what you called "stall current and rated current (???).

So, let's assume that the motor needs 3V at most. The battery is 12V. But, as you said current flaws and can be used on the way. So, the current gets squeezed in the Mosfet. How much current will be lost (if any?). You said that the IRF520N needs 12V to turn on. So I would assume that the 12V of the battery are completely used by the Mosfet. So, there should be no push (Volts) left for the motor?

But online I read that the MOSFET poses almost no resistance, so current is basically not lost in it.
I went to the specifications sheet of the IRF520N. I find it very hard to understand it, but it does say: RDS(on) = 0.20Ω. So, when the "connection" between drain and source is established, there is a 0.20Ω resistance? What does it mean for my motor?

...continuation of the last post...

  1. Given that I am so confused about this last point, I just assumed that 12V is too much for my motor. I reasoned that 12V - 3V of my motor = 9V. Once again, if my motor uses 0.1a (yeah, sorry, I made a mistake on my last post), then I need a 90Ω Resistance. So, I put a 100Ω resistance between the drain and the negative end of the Diode.

  2. I put a capacitor between the positive and negative end of the motor, parallel to the diode I did so following the suggestion of Project 5 of the Arduino. Also, online I found people wiring up the motor like this: http://tinkbox.ph/learn/tutorial/how-control-vibration-motor-using-arduino-uno/what-you-need
    I also found people basically saying that the capacitor is helpful in almost any situation.

Now, I don't know how well informed are these people. I just don't know what to do anymore Q__Q

If you have had the patience to go through all this: THANK YOU SO MUCH. Really !!

Ok, as promised I also tried to use a logic shift register. I tried with the L293D that comes with the Arduino starter kit. I think I got it :slight_smile: The only problem is: if this works, I can only use 4 motors. It is not bad, I could still buy a second L293D and wire it up. But if this works, then I will try the TPIC6B595 suggested by WAWA.

In the meanwhile...I made the following circuit, but I have not tested it yet. What do you think? Would this be ok?

This is the scheme of the L293D: https://www.engineersgarage.com/sites/default/files/L293D_1.jpg

This is an example of the code that I would use. It is not very elegant but, whatever. I only need it to work. Then I will implement something in Matlab. Remember, the effect that I am looking for is something like a touch moving on the skin, like a caress.

const int enablePin1 = 46; Pin 1 of L293D
const int enablePin2 = 47; Pin 9 of L293D

const int motor1  = 4;  // Pin 2 of L293D
const int motor2  = 5;  // Pin 7 of L293D
const int motor3  = 9;  // Pin 10 of L293D
const int motor4  = 10;  // Pin 15 of L293D

void setup()
{
  pinMode(enablePin1,OUTPUT);
  pinMode(enablePin2,OUTPUT);  
  pinMode(motor1,OUTPUT);
  pinMode(motor2,OUTPUT); 
  pinMode(motor3,OUTPUT);
  pinMode(motor4,OUTPUT);

  digitalWrite(enablePin1, LOW) // I am setting both the enabling pin to Low.
  digitalWrite(enablePin2, LOW) // This way I should be sure that the motors ar off
                                // During the experiment in Matlab I will write something like
                                // "Wait for the participant to be raady. When he is, move on,
                                // start the motor...whatever...
  
}

void loop()
{
digitalWrite(enablePin1, HIGH)
digitalWrite(enablePin2, HIGH)

  analogWrite(motor1, 200);
  analogWrite(motor2, 0);
  analogWrite(motor3,0);
  analogWrite(motor4,0);

  delay(100);
  
  analogWrite(motor1, 100);
  analogWrite(motor2, 0);
  analogWrite(motor3,0);
  analogWrite(motor4,0);

  delay(100);

  analogWrite(motor1, 0);
  analogWrite(motor2, 200);
  analogWrite(motor3,0);
  analogWrite(motor4,0);
  
  delay(100);

  analogWrite(motor1, 0);
  analogWrite(motor2, 100);
  analogWrite(motor3,0);
  analogWrite(motor4,0);
    
  delay(100);

  analogWrite(motor1, 0);
  analogWrite(motor2, 0);
  analogWrite(motor3,200);
  analogWrite(motor4,0);
    
  delay(100);

  analogWrite(motor1, 0);
  analogWrite(motor2, 0);
  analogWrite(motor3,100);
  analogWrite(motor4,0);

  delay(100);

  analogWrite(motor1, 0);
  analogWrite(motor2, 0);
  analogWrite(motor3,0);
  analogWrite(motor4,200);
  
  delay(100);

  analogWrite(motor1, 0);
  analogWrite(motor2, 0);
  analogWrite(motor3,0);
  analogWrite(motor4,100);
  
  delay(100);

  analogWrite(motor1, 0);
  analogWrite(motor2, 0);
  analogWrite(motor3,0);
  analogWrite(motor4,0);

  delay(1000);
}


// End

If you look at the circuit, I have only used the 5V coming from the Arduino.
I have found examples on the internet where they use external batteries.
E.G. 1) http://www.instructables.com/id/Control-your-motors-with-L293D-and-Arduino/
E.G. 2) http://communityofrobots.com/tutorial/kawal/how-drive-dc-motor-using-l293d-arduino

But I have also found examples where they used the 5V of the Arduino.
E.G. http://www.instructables.com/id/How-to-use-the-L293D-Motor-Driver-Arduino-Tutorial/

I thought that the 5V should be ok in this case because:

  1. I think this was the whole point of using a Logic Switch. It does not require 12V like the Mosfet that I was attempting to use.
  2. In the examples that I posted, they were using big, heavy motors. My motors are very tiny and, as far as I understand, they do not require more than 3V. Larger Voltage coming from the battery could damage them, right?

So, I think this is it.
Thoughts? Do you think that this is going to work? Do I still need to use resistance, diodes or else?

Thank you in advance for your time.

Latest update:
I tried the circuit. It does work. I have tested 2 motors so far (the ones connected to pin 4 and 5 of the arduino...that is, pin 2 and 7 of the L293D), and they turn on.

I don't know whether this is a good solution, whether something is going to blow up at some point, but they turn on and vibrate.

The only problem is that something is reverted. To turn them on I have to use:

digitalWrite(motor1, LOW);

and to turn them off:

digitalWrite(motor1, HIGH);

Does anybody know why this is happening and what can I do? It is not terrible, but I'd rather fix the problem if I can.

Also, any comment on the circuit itself? Do you think this can be a good solution?

Gluce:
The only problem is that something is reverted. To turn them on I have to use:
digitalWrite(motor1, LOW);
and to turn them off:
digitalWrite(motor1, HIGH);
Does anybody know why this is happening and what can I do? It is not terrible, but I'd rather fix the problem if I can.
Also, any comment on the circuit itself? Do you think this can be a good solution?

If you connect the motors between output and ground, then the motors will be ON when the pin is HIGH.

The L293 is is generally a bad chip, because of it's high dropout voltage.
But that is good here if you run 3volt vibrating motors on a 5volt supply.
Leo..

Wawa:
If you connect the motors between output and ground, then the motors will be ON when the pin is HIGH.

The L293 is is generally a bad chip, because of it's high dropout voltage.
But that is good here if you run 3volt vibrating motors on a 5volt supply.
Leo..

You were right. I had imagined that I only had to switch the cables, but I was not sure. It worked =)
Thank you.