A small error in the electrical circuit and the program code. Arduino pin 8 is not a PWM pin. Pin 10 (PWM) can be used, with the corresponding modification of the wiring diagram and the program code: /* Board No 1 for right motor IBT-2 pin 1 (RPWM) to Arduino pin 5(PWM) IBT-2 pin 2 (LPWM) to Arduino pin 6(PWM) IBT-2 pins 3 (R_EN), 4 (L_EN), 7 (VCC) to Arduino 5V pin IBT-2 pin 8 (GND) to Arduino GND IBT-2 pins 5 (R_IS) and 6 (L_IS) not connected Board No 2 for left motor IBT-2 pin 1 (RPWM) to Arduino pin 9(PWM) IBT-2 pin 2 (LPWM) to Arduino pin 10(PWM) IBT-2 pins 3 (R_EN), 4 (L_EN), 7 (VCC) to Arduino 5V pin IBT-2 pin 8 (GND) to Arduino GND IBT-2 pins 5 (R_IS) and 6 (L_IS) not connected */ int RPWM1_Output = 5; // Arduino PWM output pin 5; connect to IBT-2 pin 1 (RPWM) MOTOR1 int LPWM1_Output = 6; // Arduino PWM output pin 6; connect to IBT-2 pin 2 (LPWM) MOTOR1 int RPWM2_Output = 9; // Arduino PWM output pin 9; connect to IBT-2 pin 1 (RPWM) MOTOR2 int LPWM2_Output = 10; // Arduino PWM output pin 10; connect to IBT-2 pin 2 (LPWM) MOTOR2 int motorSpeedA = 0; void setup() { pinMode(A0,INPUT) ; // connected to CH2 Forward and Reverse pinMode(A1,INPUT); // connected to CH1 turn Left and Right Serial.begin(9600); pinMode(RPWM1_Output, OUTPUT); // Rigth side pinMode(LPWM1_Output, OUTPUT); pinMode(RPWM2_Output, OUTPUT); // Left side pinMode(LPWM2_Output, OUTPUT); } void loop() { { int rcValue1 = pulseIn(A0 , HIGH); int rcValue2 = pulseIn(A1 , HIGH); if (rcValue1 >= 1500 and rcValue1 < 1900) // Reverse { motorSpeedA = map(rcValue1 , 1500, 1900, 1 , 255); analogWrite(RPWM1_Output, motorSpeedA); // analogWrite(LPWM1_Output, 0); analogWrite(RPWM2_Output, 0); // analogWrite(LPWM2_Output, motorSpeedA); } else if (rcValue1 >=1000 and rcValue1 = 1000 and rcValue2 = 1500 and rcValue2
dear friend, i wish to make a similar project and i bought all the necessary. On the electronic side, I repeated all the connections between arduino, bts7960, flysky i6x and fsai6b receiver and charged your sketch: all seems correct, but when i try the system (with one battery 12 v 12 ah full charged ) only one motor goes automatically (only in one direction) and flysky throttle doesn't drive nothing (the receiver is correctly bound). I don't think that the reason is only the battery (in my project i had to connect two other batteries because the motors are 350w 36 v) I am not expert of electronics and Arduino and simply have replied your scheme. What is wrong?
A small error in the electrical circuit and the program code. Arduino pin 8 is not a PWM pin. Pin 10 (PWM) can be used, with the corresponding modification of the wiring diagram and the program code: /* Board No 1 for right motor IBT-2 pin 1 (RPWM) to Arduino pin 5(PWM) IBT-2 pin 2 (LPWM) to Arduino pin 6(PWM) IBT-2 pins 3 (R_EN), 4 (L_EN), 7 (VCC) to Arduino 5V pin IBT-2 pin 8 (GND) to Arduino GND IBT-2 pins 5 (R_IS) and 6 (L_IS) not connected Board No 2 for left motor IBT-2 pin 1 (RPWM) to Arduino pin 9(PWM) IBT-2 pin 2 (LPWM) to Arduino pin 10(PWM) IBT-2 pins 3 (R_EN), 4 (L_EN), 7 (VCC) to Arduino 5V pin IBT-2 pin 8 (GND) to Arduino GND IBT-2 pins 5 (R_IS) and 6 (L_IS) not connected */ int RPWM1_Output = 5; // Arduino PWM output pin 5; connect to IBT-2 pin 1 (RPWM) MOTOR1 int LPWM1_Output = 6; // Arduino PWM output pin 6; connect to IBT-2 pin 2 (LPWM) MOTOR1 int RPWM2_Output = 9; // Arduino PWM output pin 9; connect to IBT-2 pin 1 (RPWM) MOTOR2 int LPWM2_Output = 10; // Arduino PWM output pin 10; connect to IBT-2 pin 2 (LPWM) MOTOR2 int motorSpeedA = 0; void setup() { pinMode(A0,INPUT) ; // connected to CH2 Forward and Reverse pinMode(A1,INPUT); // connected to CH1 turn Left and Right Serial.begin(9600); pinMode(RPWM1_Output, OUTPUT); // Rigth side pinMode(LPWM1_Output, OUTPUT); pinMode(RPWM2_Output, OUTPUT); // Left side pinMode(LPWM2_Output, OUTPUT); } void loop() { { int rcValue1 = pulseIn(A0 , HIGH); int rcValue2 = pulseIn(A1 , HIGH); if (rcValue1 >= 1500 and rcValue1 < 1900) // Reverse { motorSpeedA = map(rcValue1 , 1500, 1900, 1 , 255); analogWrite(RPWM1_Output, motorSpeedA); // analogWrite(LPWM1_Output, 0); analogWrite(RPWM2_Output, 0); // analogWrite(LPWM2_Output, motorSpeedA); } else if (rcValue1 >=1000 and rcValue1 = 1000 and rcValue2 = 1500 and rcValue2
hello, I wanted to congratulate you on the project, I'm also trying to do it, but I can't go forward or backward .. my robot only turns right and left .. I also have the FLYSKY can you help me?
Thank you for your interest in my project. Have you used the bts7960 motor drive board and arduino board like my project? I have shown the code at the first comment. You can upload code to arduino board immediately without any modification, you can control both motors to go forward or backward and turn left and right with flysky remote control. Have fun !!
@@alessandro_sgarbi Sorry! .I have no experience with sabortooth before but I 've ever seen the tutorial clip how to set up sabortooth with analog signal at ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-fR3JFGUBZuU.html . May be helpful for you .
@@alessandro_sgarbi you need to check cable connection. I had the same issue and later found out that the cables were connected wrong. read the sabertooth instruction and you'll figure it out.