Embedded Notes
Embedded Notes
Bluetooth Module:
1. It is designed to replace cable connections.
2. It uses serial communication to communicate with the electronics
3. It uses the 2.45GHz frequency band
4. The transfer rate of the data can vary up to 1Mbps and is in range of 10
meters
5. It can be operated within 4-6V of power supply.
6. It supports baud rate of 9600, 19200, 38400, 57600, etc.
7. It uses SPP (Serial Port Protocol) which means it communicates with the
Arduino via the Serial Communication.
the line between the Arduino TX (Transmit Pin, which has 5V output) and the
Bluetooth module RX (Receive Pin, which supports only 3.3V) needs to be
connected through a voltage divider in order not to burn the module
HC-06
Code of Bluetooth Module:
char a = 0;
void setup() {
Serial.begin(9600);
pinMode(13, OUTPUT);
}
void loop(){
if(Serial.available() > 0)
{
a = Serial.read();
Serial.print(a);
if(a == '1')
digitalWrite(13, HIGH);
else if(a == '0')
digitalWrite(13, LOW);
}
}
Some terms :
AC = Alternate Current ( 220 -240 V ) 50 Hz - 60Hz
N = Neutral
DC = Direct Current ( No Frequency) (1.5 ,3 , 5,7, 12, 24) V
DC Motor Driver L298N
The L298N is a dual H-Bridge motor driver which allows speed and direction
control of two DC motors at the same time
The module can drive DC motors that have voltages between 5 and 35V, with a
peak current up to 2A.
1. The Input 1 and Input 2 pins are used for controlling the rotation
direction of the motor A.
2. The inputs 3 and 4 are used for the motor B.
3. If input 1 is LOW and input 2 is HIGH the motor will move forward.
4. If input 1 is HIGH and input 2 is LOW the motor will move backward.
5. If both inputs are same, either LOW or HIGH the motor will stop.
6. The same applies for the inputs 3 and 4 and the motor B.
7. You can change the speed with the EN pins using PWM.
8. ENA controls the speed of the left motor and ENB controls the speed of
the right motor.
DC Motor L298N circuit for 1 Motor:
CODE:
void setup(){
pinMode(6,OUTPUT);
pinMode(7,OUTPUT);
}
Void loop(){
// forward
digitalWrite(6, HIGH);
digitalWrite(7, LOW);
delay(3000);
//Backward
digitalWrite(6, LOW);
digitalWrite(7, HIGH);
delay(3000);
}
CODE:
int motor1speed = 3;
void setup(){
pinMode (4, OUTPUT);
pinMode (5, OUTPUT);
pinMode(motor1speed, OUTPUT);
}
Void loop(){
//speed
analogWrite(motor1speed, 100);
// forward
digitalWrite(4, HIGH);
digitalWrite(5, LOW);
delay(3000);
//Backward
digitalWrite(4, LOW);
digitalWrite(5, HIGH);
delay(3000);
}
Servo Motor:
A servo motor is a type of motor that can rotate with great precision
this type of motor consists of a control circuit that provides feedback on the current
position of the motor, this feedback allows the servo motors to rotate with great
precision. If you want to rotate an object at some specific angles or distance, then
you use a servo motor.
It has two angle of rotation 180 degree and 360 degree.
A servo motor consists of:
• DC Motor
• Potentiometer
• Gear Box
• Control Circuit
Wires OF Servo Motor:
Most servo motors have the following three connections:
• Black/Brown ground wire.
• Red power wire (around 5V).
• Yellow or White PWM wire.