Skip to main content

Featured

RELAY

RELAY A relay is like a switch that can be controlled electronically. Relays are very simple devices and can be used to control devices with higher loads(Like AC controlled devices and devices that require heavy voltages to operate). Relay modules can be used mainly in IOT projects and home automation. Relays can be used to make useful hobby projects.  A two channel relay. *Dealing with high voltages may cause injuries or even death, please use relays with utmost care. Working of Relays. Relays work like electromagnets, when a voltage is applied the coil,  the coil gets charged and acts like an electromagnet and moves the switch to the desired position. In simple terms, relays act as magnets when a signal is applied or removed. Basic circuit of a relay Connections. +5V of Arduino-  5V of relay module. GND of Arduino- GND of relay module. Pin no. 8 of Arduino- In1 of relay module. Basic connection of a relay module CODE void setup() { pinMode(8, OUTPUT); } void loop() { digitalWrite(8,

HOW TO MAKE AN SMARTPHONE CONTROLLED CAR USING ARDUINO?

SPC*C

So now that we know how to use the Bluetooth module and the H-Bridge we can start off making our own smartphone-controlled Arduino car, and for the ones who didn’t understand what SPC*C is, it means smartphone controlled car.

GETTING STARTED
We will need the following parts
1.Arduino Uno.
2.HC-05.
3.L298D H-Bridge driver.
4. Motors 500RPM(4 nos.).
5. A 12 v battery(lead-acid battery).
6. Be creative with the body and make something as a body for your car.







jhgvfcdxfsdftfyugi9i0o-.jpg
Maybe something as crazy as this car here.


THE CONNECTIONS

  • For two motors, the connection is way simpler. You connect the two motors to the two output pins of the H-Bridge motor driver.
  • Or, you can just do your connections as shown in the picture below.
semi
P.S: If you want to do a 4 wheeled Arduino car you would want to first connect two motors on either side and you would check if the motors attached to the same side move in the same direction. i.e if both the motors move in clockwise or anti-clockwise directions if the current is supplied.



The Code
#include<SoftwareSerial.h>
const int in1= 6;
const int in2= 5;
const int in3= 4;
const int in4= 3;
char i ;
void setup()
{
Serial.begin(9600);
pinMode(in1,OUTPUT);
pinMode(in2,OUTPUT);
pinMode(in3,OUTPUT);
pinMode(in4,OUTPUT);
}
void loop()
{
if(Serial.available()>0)
{
delay(100);
i=Serial.read();
if(i==’b’)
{
digitalWrite(in1,LOW);
digitalWrite(in2,HIGH);
digitalWrite(in3,HIGH);
digitalWrite(in4,LOW);
}
if(i==’r’)
{
digitalWrite(in1,HIGH);
digitalWrite(in2,LOW);
digitalWrite(in3,LOW);
digitalWrite(in4,LOW);
}
if(i==’l’)
{
digitalWrite(in1,LOW);
digitalWrite(in2,LOW);
digitalWrite(in3,LOW);
digitalWrite(in4,HIGH);

}
if(i==’f’)
{
digitalWrite(in1,HIGH);
digitalWrite(in2,LOW);
digitalWrite(in3,LOW);
digitalWrite(in4,HIGH);
}
if(i==’s’)
{
digitalWrite(in1,LOW);
digitalWrite(in2,LOW);
digitalWrite(in3,LOW);
digitalWrite(in4,LOW);
}
}
}
With some tweaks with the HIGHS  and LOWS, you can make your arduino car, that is controlled by your smart phone.
PS: If you want to know what the code means or you have any other doubts, please Dm me on Instagram(h_jain_23) or leave a mail at robotherapyy@gmail.com

Comments

Popular Posts