Mini quadcopter motor with arduino and transistor.

Im making mini toy car that uses mini quadcopter motors. I got this code from web for the car but there is some LCD screen and temperature sensor stuffs in the code so could someone remove them?

Quadcopter motors are 35 000 rpm (3.7v) so car is too fast in 3.3v (i use Atmega168). PWM and voltage have to be adjusted but i cant so could someone add “pwm adjustment stuffs” to this code?
I´ll test different pwm values to get good ones.
It d be awesme if someone could finish this code for me.

What kind of transistor you recommend for this project? Or is there some mini motor drivers or something?

code :

//Including temp sensor library
#include <dht.h>

#define dht_dpin A0 //no ; here. Set equal to channel sensor is on

dht DHT;

//Including lcd library
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
 
 /*CONNECTION FOR LCD
 The circuit:
 * LCD RS pin to digital pin 12
 * LCD Enable pin to digital pin 11
 * LCD D4 pin to digital pin 5
 * LCD D5 pin to digital pin 4
 * LCD D6 pin to digital pin 3
 * LCD D7 pin to digital pin 2
 * LCD R/W pin to ground
 * 10K resistor:
 * ends to +5V and ground
 * wiper to LCD VO pin (pin 3)
 * 
 * 
  */

int input='0'; //input to be used
String input2; //variable for string input


void setup() {
  lcd.begin(16,2);
  pinMode(13,OUTPUT);
  pinMode(9,OUTPUT);
  pinMode(8,OUTPUT);
  pinMode(10,OUTPUT);
  Serial.begin(9600);
 }

void loop() {
  lcd.clear();
if(Serial.available()>0)
 {
  input = Serial.read();
 }
 
// forward
if(input == '1')
  {
  digitalWrite(13,HIGH);
   digitalWrite(9,LOW);
   digitalWrite(8,LOW);
   digitalWrite(10,HIGH);
   }

 //back  
 else if(input == '2')
  {
   digitalWrite(13,LOW);
   digitalWrite(9,HIGH);
   digitalWrite(8,HIGH);
   digitalWrite(10,LOW);
}

//right
else if(input == '3')
  {
   digitalWrite(13,HIGH);
   digitalWrite(9,LOW);
   digitalWrite(8,HIGH);
   digitalWrite(10,LOW);
   }

  //left 
 else if(input == '4')
  {
digitalWrite(13,LOW);
   digitalWrite(9,HIGH);
   digitalWrite(8,LOW);
   digitalWrite(10,HIGH);
   }

   //default state
    else if(input == '0')
  {
digitalWrite(13,LOW);
   digitalWrite(9,LOW);
   digitalWrite(8,LOW);
   digitalWrite(10,LOW);
   lcd.clear();
}

//string to be displayed on lcd
else if(input == '5')
  
  {Serial.flush();
    while(!Serial.available()) ; 
    input2 = Serial.readString();
    strng = input2.length();
    lcd.clear();
   delay(10);
   lcd.setCursor(0, 0);
   lcd.print(input2.c_str());
   delay(1000);
   lcd.clear();
    input = '0';
    }


 //scrolling of text on lcd
 else if(input == '6')
  
  { lcd.clear();
   delay(10);
   lcd.setCursor(16, 0);
   lcd.print(input2.c_str());
   for (int i = 0;i<16+strng;i++) {
    lcd.scrollDisplayLeft(); 
    delay(200);
  }
    lcd.clear();
    input = '0';
    }

    //temp sensor
else if(input = '7')
{
    DHT.read11(dht_dpin);

    Serial.print("Hum= ");
    Serial.print(DHT.humidity);
    Serial.print("%  ");
    Serial.print("Temp= ");
    Serial.print(DHT.temperature); 
    Serial.println("C  ");
  delay(800);
}
  }

Aren't quadcoptor motors 3 phase BLDC? Those need an ESC to drive them.

esmoman:
so could someone remove them?

...

but i cant so could someone add "pwm adjustment stuffs" to this code?

...

It d be awesme if someone could finish this code for me.

This is a place to get help with the code that you write. When you run into issues, ask and we'll help you with answers. This is not the place to get someone to write code for you. That happens over in the "Gigs and Collaborations" section. Expect to have to pay someone for their time there.

Those mini quadcopter motors doesnt have to have esc. They work also with battery stright connected to motor.

Ok. Any tips instead for the project :slight_smile: ?

Do you honestly think that you are the first person using DC motors with an Arduino, and building RC cars?
Search the forum for similar projects, and learn what's needed and how it can be done in code. I highlighted some useful search keys.

As a first decision, do you want your car drive only forwards, or also backwards? This will affect the required motor driver circuit, transistor or H-bridge.

For motor speed control you also need gear boxes and encoders.

Im making especially car with quadcopter motors. And its hard to solve how to add pwm stuffs to just this code.

These are not designed for cars, you need a gearbox PWM alone will not solve your problem.

Another problem is that in normal designed use they have air blowing over them.
They could easily overheat.