How to make car with 2 motors go left-forward, etc...

This project is a little simple which restricted a lot of options.

I have an Arduino connected to ht12e connected to RF transmitter, and on the other side the receiver is connected to ht12d (decoder) connected to L293D motor driver that controls two motors.

I can send signals and control the motors just fine.

But since I don't have speed control over the motors, because L293D connected to decoder, I ca't seem to think of a way to make the car go left-forward or right-forward and so on.

I included the circuit schematics.

The code of controlling motors is simple and included (note that iam using mpu6050, so ignore it)

void loop(){  //for the mpu6050 library, calling the refresh function is essential to read different values
              // we don't need the z value for this project
  x = gyro.refresh('A', 'X');  //calling the X-axis from the accelerometer
  y = gyro.refresh('A', 'Y');  //calling the Y-axis from the accelerometer
  Serial.print("AcX = ");
  Serial.print(x);   //printing the x-axis angles for the user
  Serial.print(" | AcY = ");
  Serial.print(y); //printing the y-axis angles for the user

  if (x>-50 && x<50 && y>-50 && y<50) { //if the mpu is close to flat position
  digitalWrite(8,LOW);
  digitalWrite(9,LOW);
  digitalWrite(10,LOW);
  digitalWrite(11,LOW); //turn both motors off
  }
  else if (x < -50) { //since x-axis is forward and backward, if it is a low negative, turn on motors forward
  digitalWrite(8,LOW);
  digitalWrite(9,HIGH);
  digitalWrite(10,LOW);
  digitalWrite(11,HIGH); }
  else if (x > 50) { //if x axis is positive, turn motors in reverse
  digitalWrite(8,HIGH);
  digitalWrite(9,LOW);
  digitalWrite(10,HIGH);
  digitalWrite(11,LOW); }
  else if (y < -50) { //if y axis angle is below -50 turn the car to right
                     //doing this is achieved by turning both motors opposite to each other
  digitalWrite(8,LOW);
  digitalWrite(9,HIGH); //right motor forward
  digitalWrite(10,HIGH);
  digitalWrite(11,LOW);} //left motor in reverse 
  else if (y > 50) { //if y axis angle is above 50 turn the car to left
  digitalWrite(8,HIGH);
  digitalWrite(9,LOW); //right motor in reverse
  digitalWrite(10,LOW);
  digitalWrite(11,HIGH);} //left motor forward
  delay(200);}

I can send signals and control the motors just fine.

What are you sending from the transmitter to control the motors so far? Can't you just expand that thinking to include turning, say send an "L" to turn left? Then at the receiver, when it sees the "L" adjust the relative speeds for the two motors in code.

To answer your question, I send HIGH or LOW signals to the decoder (which is connected to L293D directly)

I got this idea as I was typing the question.
I will try it but it's a little discouraging!

1- the arduino can't send strings to the motor driver (because the L293D isn't a microcontroller)

2- if I connect the mpu to the encoder and get the arduino to the other side, I would still end with two motors (not that much difference from what I already have)

But point 2 might work and allow me to have a servo for steering

Sorry, my bad, in my mind there was a controller at the receiving side as well....

Hi hytham,

well done uploading a picture of the wiring.
Interesting challenge to make it work based on this hardware.
Indeed putting the microcontroller on the receiver-side makes more sense.

The motors need control at high speed (PWM-signal to the LM293 for RPM-control)

The sender is just sending short commands like "speed" turn leftf / right
For futire postings you should attach datasheets of additional hardware. You only can expect that other users have a datasheet or detailed knowledge about the arduino itself. For additional hardware you should attach datasheets.

Is this a project where you are forced to use exactly this hardware?
If not I would consider buying two Wemos D1 Mini boards for around $5 each

You can program them with the arduino IDE after installing additional MCU-board data

For sure some new things to learn but IMHO the ESP8266 / ESP32 is the better "arduino".

or an ESP32 nodeMCU $10

They have WiFi on board and you can use a protocol called ESP-NOW which can send/receive bi-directional datapackets of up to 250 bytes at a speed of up to 200 times per second. Both directions.

best regards Stefan

Holtek-HT2-decoder-datasheet.pdf (153 KB)