Turtle 2WD connected to 2N2222 NPN Transistors

So the two motors of the Turtle are powered separately, each given their own 3.3 volt batteries. The arduino is turning them off or on via transistors. What it uses is digitalWrite(pin#,HIGH) for on and digitalWrite(pin#,LOW) connected to the base of the transistor(both pins are OUTPUT). However instead of LOW completely stopping the flowage of power it just minimizes it; although, if you hold the wheel wheel and let it go when the wheel would stop moving. Another problem is that the right wheel is significantly slower than the left wheel but this could be happening with the slight difference of votlage on each 3.3v batteries and could be fixed with analog changing the speeds. If you know how to fix this problem please mention it in the forum or personal message, either way is fine with me.

Here is a schematic of my project using the arduino.

https://drive.google.com/open?id=0B3kegwHAip01MHN2QjBDeW85QVU&authuser=0

Here is a link a video that shows the project.

https://drive.google.com/open?id=0B3kegwHAip01djBhTDd0dzVjWms&authuser=0

Stop cross-posting. Other threads removed.

Your design is not correct.

1- Remove the diodes from where they were.
2- start over.
3- connect Transistor EMITTERS to BATT -
4- connect MOTOR + to BATT +
5- connect MOTOR - to transistor COLLECTORS.
6- remove the DIODES from where they were and put one across each motor, CATHODE
to MOTOR + , ANODE to MOTOR -
7- Change the base resistors to 470 ohm.
8-Tell me what arduino pins you are using. I can't read them.

Pin 8 and pin 7. And thanks for the reply, btw why can I not use 10k resistors?

Why did you pick the only two pins that AREN'T PWM pins ?

USE 5 & 6.

What kind of arduino ? (the video link doesn't work)

If you don't have 470 ohm you can parallel two 1 k resistors.

It says arduino Uno, idk what a PDM is and I do not have 470 or 1k ohms right now on me. I can wait until tommorow for the 470 ohms though.

Why are you posting ? Is your circuit working perfectly ? Why not?

Parallel two 1 k
resistors. NO , 10k won't work.

Oh, but your instructions work for what I am trying to do right? Because if they do I will save them in a notepad and try it tommorow when I head to school to pick up the resistors. Thanks dude.

Who designed that circuit ?

Explain WHY you designed it the way you did.

  1. WHY are the transistors wired as emitter followers ?
  2. WHY are the diodes in series ?
  3. WHY are is there a diode before the motor and after the transistor ?
  4. WHY is there NO FLYBACK diode across the motor?
  5. WHY is the BASE resistor 10k ohms (calculate the collector current for a 2n2222 with a 5V input and a
    10k ohm resistor. (show your work) (I'll show you mine if you show me yours)
  6. WHY is this transistor wired this way ?
  1. That was something one of my teamates thought was a good idea.

  2. Trying to achieve less power.

  3. Same concept as question 2, that was something that gave me less power.

  4. Sorry, my mistake.

  5. I thought you could use any resistors, my fault completly.

  6. Based on a lot of Google, teacher does not know much about circuit so I had to figure a lot of this on my own. I am trying your instructions right now. :slight_smile:

Did you do the math ?
3V ? What kind of batteries ?
Read Reply#9 (#5 & #6)
You still haven't posted your code. Why ? (is it at school ?)

// the setup routine runs once when you press reset:
boolean wheelOneState = false;
boolean wheelTwoState = false; 
void setup() {
  Serial.begin(9600);
  pinMode(8, OUTPUT);
  pinMode(7, OUTPUT); 
  wheelOneState = false;
  wheelTwoState = false;
  wheelOne();
  wheelTwo();
}

// the loop routine runs over and over again forever:
void loop() {
   if (Serial.available()) 
  {
     char ser = Serial.read();
     Serial.println(ser);
     switch(ser){
       case 'a':
         if(wheelTwoState)
         {
           wheelTwoState = false;
           wheelTwo();
         }
         wheelOneState = true;
         wheelOne();
         break;
       case 'd':
         if(wheelOneState)
         {
           wheelOneState = false;
           wheelOne();
         }
         wheelTwoState = true;
         wheelTwo();
         break;
       case 's':
         if(wheelOneState)
         {
           wheelOneState = false;
           wheelOne();
         }
         if(wheelTwoState)
         {
           wheelTwoState = false;
           wheelTwo();
         }
         break;
       case 'w':
         wheelOneState = true;
         wheelTwoState = true;
         wheelOne();
         wheelTwo();
         break;
        default:
         break;
     }
               
  }
 
}
void wheelOne()
{
  if(wheelOneState)
  {
    digitalWrite(7, HIGH);
    Serial.println("ON WHEEL ONE"); 
  }
  else
  {
    digitalWrite(7, LOW);
    Serial.println("OFF WHEEL ONE");
  }
}
void wheelTwo()
{
  if(wheelTwoState)
  {
    digitalWrite(8, HIGH);
    Serial.println("ON WHEEL TWO"); 
  }
  else
  {
    digitalWrite(8, LOW);
    Serial.println("OFF WHEEL TWO");
  }
}

idk what a PDM

It's PWM , not PDM.

Change this:

 void wheelOne()
{
  if(wheelOneState)
  {
    digitalWrite(7, HIGH);
    Serial.println("ON WHEEL ONE"); 
  }
  else
  {
    digitalWrite(7, LOW);
    Serial.println("OFF WHEEL ONE");
  }
}
void wheelTwo()
{
  if(wheelTwoState)
  {
    digitalWrite(8, HIGH);
    Serial.println("ON WHEEL TWO"); 
  }
  else
  {
    digitalWrite(8, LOW);
    Serial.println("OFF WHEEL TWO");
  }
}

TO THIS: (and add variables named pwm_1 & pwm_2. Use these variables instead of 255 . (PWM NOT Increment or decrement the variables as needed using FOR loops to accelerate or deccelerate.

 void wheelOne()
{
  if(wheelOneState)
  {
    analogWrite(5, 255);
    Serial.println("ON WHEEL ONE"); 
  }
  else
  {
   analogWrite(5, 0);
    Serial.println("OFF WHEEL ONE");
  }
}
void wheelTwo()
{
  if(wheelTwoState)
  {
    analogWrite(6, 255);
    Serial.println("ON WHEEL TWO"); 
  }
  else
  {
    digitalWrite(6, 0);
    Serial.println("OFF WHEEL TWO");
  }
}

Example:

for(i=0; i<255; i+=32) {
   speedA(i);
   speedB(i);
   delay(500);

Here is a lovely tutorial on how to use a transistor as a switch:
(Courtesy of JohnWasser)

Really confusing but thanks for the help.

Look at this circuit.

and then read this :

A flyback diode (sometimes called a snubber diode, freewheeling diode, suppressor diode, suppression diode, clamp diode or catch diode[1]) is a diode used to eliminate flyback, which is the sudden voltage spike seen across an inductive load when its supply voltage is suddenly reduced or removed.

and this:

A flyback diode solves this starvation-arc problem by allowing the inductor to draw current from itself (thus, "flyback") in a continuous loop until the energy is dissipated through losses in the wire, the diode and the resistor (Figure 3). When the switch is closed the diode is reverse-biased against the power supply and doesn't exist in the circuit for practical purposes. However, when the switch is opened, the diode becomes forward-biased relative to the inductor (instead of the power supply as before), allowing it to conduct current in a circular loop from the positive potential at the bottom of the inductor to the negative potential at the top (assuming the power supply was supplying positive voltage at the top of the inductor prior to the switch being opened).

Do you want to blow up your transistor ? Then don't put the diode in the way I told you.

BTW,
I found a use for your 10k resistor. You can put it from the base of the transistor to GND. (don't ask why)
(in addition to the base resistor I described)

It says arduino Uno

So it does. I didn't notice that the first time because I was too busy cursing your design and throwing a
sissy fit. :wink:

And why is ground of the arduino not connected in the circuit? How will the pins work if you do not have a ground of an arduino connected somewhere in there?

Why are your batteries backwards ?

The NEG BATT terminals should have a common ground with the UNO GND and the transistor EMITTER GND.

All of these

both BATT NEG terminals

both transistor emitters
the arduino GND

should be connected together

Each BATT + should be connected to EACH motor PLUS.
Each MOTOR MINUS should be connected to EACH transistor collector.

And why is ground of the arduino not connected in the circuit? How will the pins work if you do not have a ground of an arduino connected somewhere in there?

I don't know why your asking this. What gave you the impression the Arduino GND shouldn't be connected ? (was it something I said OR didn't say ?)
I didn't say anything about the ground because it is obvious it needs to be connected to everything I
listed above.

Redraw your schematic the way I described. Be sure to follow the instructions in this post.

Quick question? I do not need to use the ground of the arduino anywhere? I thought it needed to be in the circuit for the pin to function?

Yes. it needs to be connected.

Read my last post. (#17)