2,5V digitalpin OUTPUT Arduino

Hello! I am new in Arduino. Sorry my English.
Making RC Car with TB6612 motor driver board
Schematic and code added.
My first own code digitalpin output is only 2,5v.

Simple led blinking code out for all pins are 5V.
What is wrong?
Forward/back?
Need new code or electronic level translator Arduino out to TB6612 input?

//Arduino RC Car driver TB6612 for Left and Right DC motor
//Arduino all OUTPUT  Pins HIGH is ONLY 2,5v!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// Arduino simple Led blinkig code HIGH is for all OUTPUT pins 5v
//may be a problem REVERSE or go FURTHER / BACK?
// HOW TO make right reverse code?
//OR make electronic levels translator for 6612 board?
//RC Receiver:
//https://www.aliexpress.com/item/433Mhz-UNO-Wireless-Decoding-Kit-5V-RF-Remote-Control-EV1527-Keyfob-for-Arduino-Mega2560-DUE/32333340717.html
//TB6612 board:
// Chinas https://www.sparkfun.com/products/9457
//motor
//https://www.aliexpress.com/item/2pcs-TT-Motor-130motor-Smart-Car-Robot-Gear-Motor-for-Arduino-DC3V-6V-DC-gear-motor/32823576024.html



//RCcar  4 DRIVE Buttons:Right Forward, Right back , Left forward , Left back in CHina remote TX: A B C D

                //LEFT futher     //Right Forward
                // LEFT BACK   // RIGHT BACK
//Motor 1 Left
int pinAIN1 = 2; //Direction.  D2 via 510 ohm resistor to TB6612 Board pin AIN1
int pinAIN2 = 4; //Direction   D4 via 510 ohm resistor to TB6612 Board pin AIN2
int pinPWMA = 3; //Speed       D3 via 510 ohm resistor to TB6612 Board pin PWMA

//Motor 2 Right
int pinBIN1 = 7; //Direction  Arduino D7 via 510 ohm resistor to TB6612 Board pin BIN1
int pinBIN2 = 6; //Direction
int pinPWMB = 5; //Speed
int pinSTBY = 8; //Not used
const int Pin9 = 9;     // D9 via 510 ohm resistor to decoding kit. Arduino D9 pulldown with 4k7 resistor to GND
const int Pin10 = 10;   // D10 via 510 ohm resistor to decoding kit. Arduino D10 pulldown with 4k7 resistor to GND
const int Pin11 = 11;   //D11 via 510 ohm resistor to decoding kit. Arduino D11 pulldown with 4k7 resistor to GND 
const int Pin12 = 12;   // D12 via 510 ohm resistor to decoding kit. Arduino D12 pulldown with 4k7 resistor to GND
const int ledPin = 13;  // the number of the LED pin
int buttonState9 = 0;   // variable for reading decoder pin status 
int buttonState10 = 0;  // variable for reading decoder pin status   
int buttonState11 = 0;  // variable for reading decoder pin status  
int buttonState12 = 0;  // variable for reading decoder pin status
void setup() {
  
//Set the PIN Modes
  pinMode(pinPWMA, OUTPUT);
  pinMode(pinAIN1, OUTPUT);
  pinMode(pinAIN2, OUTPUT);
  pinMode(pinPWMB, OUTPUT);
  pinMode(pinBIN1, OUTPUT);
  pinMode(pinBIN2, OUTPUT);
  pinMode(pinSTBY, OUTPUT);
  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);
  // initialize the pushbutton pin as an input:
  pinMode(Pin9, INPUT); //RF Decoder out pin +5v active
  pinMode(Pin10, INPUT); //RF Decoder out pin +5v active
  pinMode(Pin11, INPUT); //RF Decoder out pin +5v active
  pinMode(Pin12, INPUT); //RF Decoder out pin +5v active
}
void loop() {
  // put your main code here, to run repeatedly:

  
   
buttonState9 = digitalRead( Pin9);

  // check if LEFT motor need to go FURTHER
  if (buttonState9 == HIGH){ 
    // turn LED on:

     digitalWrite(ledPin, HIGH); //Led: Rf Command received
     digitalWrite(pinSTBY,HIGH); //
    digitalWrite( pinAIN1, LOW);
     digitalWrite( pinAIN2, HIGH);
      analogWrite( pinPWMA,127);  ////6612 Board input pins PWM for LEFT motor going FORWARD
  }
     else if  (buttonState9 == LOW){

     digitalWrite(ledPin, LOW);  //Led: Rf Command received
      digitalWrite(pinSTBY,LOW);
    digitalWrite( pinAIN1, LOW);
     digitalWrite( pinAIN2, LOW); 
      analogWrite( pinPWMA,0);

     
  }
   
     
/////////////////////////////////

 // read the state of the decoder  value:
buttonState10 = digitalRead( Pin10);

  // check if the RIGHT motor need to go FURTER
  if (buttonState10 == HIGH){ 
    // turn LED on:{
   

     digitalWrite(ledPin, HIGH);  //Led: Rf Command received
      digitalWrite(pinSTBY,HIGH); //6612 Board input pins for RIGHT motor going FORWARD
    digitalWrite( pinBIN1, HIGH);
     digitalWrite( pinBIN2, LOW);
     analogWrite( pinPWMB,127);
  }
   else if  (buttonState10 == LOW){

     digitalWrite(ledPin, LOW); //Led: Rf Command received
      digitalWrite(pinSTBY,LOW);
    digitalWrite( pinBIN1, LOW);
     digitalWrite( pinBIN2, LOW);
      analogWrite( pinPWMB,0);
   }

  //
buttonState11 = digitalRead( Pin11);

  // check if the RIGHT motor need to go BACK
  if (buttonState11 == HIGH){ 
    // turn LED on:{
   

     digitalWrite(ledPin, HIGH); // Led: Rf Command received
      digitalWrite(pinSTBY,HIGH);
    digitalWrite( pinAIN1, HIGH);
     digitalWrite( pinAIN2, LOW);
     analogWrite( pinPWMA,255);
    // digitalWrite( pinPWMA, HIGH); 
  }
   else if  (buttonState11 == LOW){

     digitalWrite(ledPin, LOW); //Led: Rf Command received
      digitalWrite(pinSTBY,LOW);
    digitalWrite( pinAIN1, LOW);
     digitalWrite( pinAIN2, LOW);
      analogWrite( pinPWMA,0);
     // digitalWrite( pinPWMA, LOW);
   }  
   
 // 
buttonState12 = digitalRead( Pin12);

  //check if the LEFT need to go BACK
  if (buttonState12 == HIGH){ 
    // turn LED on:{
   

     digitalWrite(ledPin, HIGH);  //Led: Rf Command received
      digitalWrite(pinSTBY,HIGH);
    digitalWrite( pinBIN1, LOW);
     digitalWrite( pinBIN2, HIGH);
    analogWrite( pinPWMB,255); 

     //digitalWrite( pinPWMB, HIGH);
  }
   else if  (buttonState12 == LOW){

     digitalWrite(ledPin, LOW); // Led: Rf Command received
      digitalWrite(pinSTBY,LOW);
    digitalWrite( pinBIN1, LOW);
     digitalWrite( pinBIN2, LOW);
      analogWrite( pinPWMB,0);
//digitalWrite( pinPWMB, LOW);
      
   }

    


}

RC_beta.ino (4.28 KB)

Need a wiring diagram and links / info on motor(s) and motor driver. Also, which Arduino?

Not solving your problem, but names like Pin9, Pin10 etc do not make sense. More so for buttonState variables.

They have a function; e.g. something like buttonLeft and buttonStateLeft.

Which pin(s) above isn't achieving the correct voltage? What is connected to it? If you disconnect that thing, does it go to the full 5v? Did you make sure to set it OUTPUT? Your post topic implies you did, but you have not provided enough information for us to confirm...

A schematic would be helpful here.

All needed data and links to hardware is in the code. Please solve my problem. Thanks.

Those links tell us nothing about how your project is wired, provide a legible wiring diagram if you expect help.

What are you using to power the car ?

Hi,
You have to understand, the fact that you can get the outputs to go to 5V, HIGH.
But when you connect your circuit you only get 2.5V, seems to point to a hardware problem.

  • Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
  • Can you post a picture of your project please, I think those controller boards do not come with ready soldered pins on them.
  • Are all your output pins showing 2.5V or just pin3 and pin5?
  • Do you have some simple code that just puts the driver through it paces, forget about the button presses. Just write some code that JUST makes the driver work.
  • Have you at any stage had the driver working and your motors running.

Thanks… Tom… :slight_smile:

Please see the problem. Schema and code added to the first post. In the coming days I will add LED test code too.

Hi,
OPs diagram.
6612_RCcar.JPG
Thankyou… Tom… :slight_smile:

Hi,
Can you post some pictures of your project so we can see your component layout?

Thanks.. Tom.. :slight_smile:

My guess it't the SOS with measuring the voltage of a PWM pin with a digital volt meter instead of an oscilloscope.

Paul

Hi,
Have you tried using the test circuit first, before connecting the TB6612?
testcircuit.jpg
The common cathode connection would connect to gnd.
Tom… :slight_smile:

Thank You answering! TB6612 input is not problem, i think. Problem is in simple reverse code? I have not time in this moment make simple led blinking code ONLY for test pinAIN1, pinAIN2 etc. connecting WITH TB6612 input. Sorry!

Hi,
Which pins only go to 2,5V?
What pin numbers?

Tom.. :slight_smile:

Maybe you should use analog pin or use resistance.

Code for right 5v out: RC_blink

//https://www.aliexpress.com/item/433Mhz-UNO-Wireless-Decoding-Kit-5V-RF-Remote-Control-EV1527-Keyfob-for-Arduino-Mega2560-DUE/32333340717.html
//TB6612 board:
// Chinas https://www.sparkfun.com/products/9457
//motor
//https://www.aliexpress.com/item/2pcs-TT-Motor-130motor-Smart-Car-Robot-Gear-Motor-for-Arduino-DC3V-6V-DC-gear-motor/32823576024.html



//RCcar  4 DRIVE Buttons:Right Forward, Right back , Left forward , Left back in CHina remote TX: A B C D

                //LEFT futher     //Right Forward
                // LEFT BACK   // RIGHT BACK
//Motor 1 Left
int pinAIN1 = 2; //Direction.  D2 via 510 ohm resistor to TB6612 Board pin AIN1
int pinAIN2 = 4; //Direction   D4 via 510 ohm resistor to TB6612 Board pin AIN2
int pinPWMA = 3; //Speed       D3 via 510 ohm resistor to TB6612 Board pin PWMA

//Motor 2 Right
int pinBIN1 = 7; //Direction  Arduino D7 via 510 ohm resistor to TB6612 Board pin BIN1
int pinBIN2 = 6; //Direction
int pinPWMB = 5; //Speed
int pinSTBY = 8; //Not used
const int Pin9 = 9;     // D9 via 510 ohm resistor to decoding kit. Arduino D9 pulldown with 4k7 resistor to GND
const int Pin10 = 10;   // D10 via 510 ohm resistor to decoding kit. Arduino D10 pulldown with 4k7 resistor to GND
const int Pin11 = 11;   //D11 via 510 ohm resistor to decoding kit. Arduino D11 pulldown with 4k7 resistor to GND 
const int Pin12 = 12;   // D12 via 510 ohm resistor to decoding kit. Arduino D12 pulldown with 4k7 resistor to GND
const int ledPin = 13;  // the number of the LED pin
int buttonState9 = 0;   // variable for reading decoder pin status 
int buttonState10 = 0;  // variable for reading decoder pin status   
int buttonState11 = 0;  // variable for reading decoder pin status  
int buttonState12 = 0;  // variable for reading decoder pin status
void setup() {
  
//Set the PIN Modes
  pinMode(pinPWMA, OUTPUT);
  pinMode(pinAIN1, OUTPUT);
  pinMode(pinAIN2, OUTPUT);
  pinMode(pinPWMB, OUTPUT);
  pinMode(pinBIN1, OUTPUT);
  pinMode(pinBIN2, OUTPUT);
  pinMode(pinSTBY, OUTPUT);
  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);
  // initialize the pushbutton pin as an input:
  pinMode(Pin9, INPUT); //RF Decoder out pin +5v active
  pinMode(Pin10, INPUT); //RF Decoder out pin +5v active
  pinMode(Pin11, INPUT); //RF Decoder out pin +5v active
  pinMode(Pin12, INPUT); //RF Decoder out pin +5v active
}
void loop() {
  // put your main code here, to run repeatedly:
 digitalWrite(ledPin, HIGH); //In this example voltage on the TB6612 pin is 5V.  RIGHT!
 digitalWrite(pinSTBY,HIGH); //In this example voltage on the TB6612 pin is 5V.  RIGHT!
 digitalWrite( pinAIN1,HIGH); //In this example voltage on the TB6612 pin is 5V.  RIGHT!
 digitalWrite( pinAIN2, HIGH); //In this example voltage on the TB6612 pin is 5V.  RIGHT!
 analogWrite( pinPWMA,255);    //In this example voltage on the TB6612 pin is 5V.  RIGHT!
 digitalWrite( pinBIN1, HIGH);  //In this example voltage on the TB6612 pin is 5V.  RIGHT!
 digitalWrite( pinBIN2, HIGH); //In this example voltage on the TB6612 pin is 5V.  RIGHT!  
 analogWrite( pinPWMB,127);    //In this example voltage on the TB6612 pin is 2.5V.  RIGHT!
 
}

Code : RC_Rem_LED
My RC Car code . All setup is the same
digitalWrite HIGH output on the TB6612 input pins is are all ½ -2,5V

RC_blink.ino (3.5 KB)

RC_Rem_LED.ino (5.79 KB)

Hi,
If you disconnect the motor controller, what do you get on the output pins?

Tom... :slight_smile:

Thank You ! In time experiments may be motor voltage off too and it is not problem. My reverse car code RC_Rem_LED. ino gives anyway ½ needed output voltage 2,5Vor so on on the arduino pins. Connect with leds or TB6612 board or not with anything.