Bluetooth Robot-3

December 18, 2014 § Leave a comment

The final physical looking of the Blueooth robot.

DSC02007DSC02006

This thing looks like a toy, isn’t it? Well, this(robot chassis/mechanism) is taken from two toy cars. Then the extra portion are cut off and glued together and then formed like a chassis. I will post images later. This is done to save some cash and waste more time in thinking and making a chassis on own hand.

DSC02005DSC02004

Due to the reason that i am not capable of spending a lot of money to my projects i have made this myself. The commercially available chassis are of too much costly for me.

DSC02002DSC02001

Though the has 4 wheels, it has no conventional steering. How would it take a turn? The answer is simple. The chassis work in the same basic principle like a tank. When wheels of both side moves on same speed, the car goes straight. When either of the side wheels are slowed down/stopped, it will take turn in that side. It can also take turn on its own position by moving the side wheels in opposite direction.

You see, I have added two optical reflection sensor on both front and back side to avoid collision.  when the car is about to collide a wall in front/back of it, it stops and moves to opposite direction to avoid collision. It can sense approx.1-2 cm distance depends on the wall/obstacle color. I will upload the code with the two sensors and explain about the codes later.

 

Bluetooth Robot-2

February 16, 2014 § 2 Comments

I will discuss the circuit diagram and mechanical description of the bluetooth robot now.

Here is the previous post that contains the program.

Actually, It’s not a robot. It’s some kind of remote controlled car that can be controlled over bluetooth from a laptop or PC.

The power of the microcontrollers are too low compared to the modern laptop or desktop. There is no huge computing power, no scope for image processing, no scope for huge amount of data logging, no scope for multitasking(Although there is some multitasking OS available for microcontrollers, They are complex, Time consuming, Requires a lot processing power to achieve multitasking.) and other limitations.

So, My concept was Why not build a slave device that is controlled from a central server that has huge processing power.

You can say that why not build such big robot that can carry a whole laptop inside it? Then the answer maybe The CPU requires a lot more power, Adds an extra weight to carry, has restrictions for harsh/rough environments and more…

OK, Enough now i will come to the main point.

The robot chasis is like normal tank principle. It has two treads attached with two geared motors. When both motors move forward, the chasis will go forward, opposite applies for backward movement, and when one motor is running and the other one is stopped, it will take a turn. I will add detailed images about the robot chasis later.

Now, about the circuit..

BT-robo

The heart of the circuit is the atmega8 microcontroller, which gets commands from the hc-06 bluetooth module and drives a l293d motor controller Which controls the speed and direction of the motor. The speed of the motor is controlled by pwm dc motor speed control method. You can get brief of it into the codes.

Oh.. Sorry

A correction. I have drawn this circuit with fritzing. The HC-06 bluetooth module i can’t found in fritzing but used here RN-41 module. The connection is same for HC-06.

Bluetooth Robot

January 6, 2014 § 1 Comment

I am testing around a bluetooth module. And this is the result of the test.

I have recently bought a HC-06 bluetooth module, and after couple of hours of searching in the internet, I’ve figured out how to use the module. Detailed info and source here.

hc06-top-side

The module runs on 3.3v-5v, default pairing code 1234 and baudrate is 9600, N, 8,1. For only communication purposes, you don’t need to mess about the AT commands(it is in the online also).

hc-06-and-hc-05-source-wavesen-data-sheet

If you want to test the module if it works or not, i have a way, Download PUTTY here, you need another USB>Serial converter(I’ve used PL2303) and a bread board. Then connect TXD(pl-2303)>>RXD(HC-06), RXD(pl-2303)>>TXD(HC-06),  GND(pl-2303)>>GND(HC-06),  VCC 3.3v(pl-2303)>>VCC(HC-06).

jy-mcu-bt_board-v1-05-bottom-side

Run Putty,  from connection type radio button, select serial,  From Serial line, Edit that to com6(in my case), click open. This will open the desired bluetooth com port.  Run putty again, from connection type radio button, select serial,  From Serial line, Edit that to com8(in my case), click open. This will open serial port of pl-2303. And you can transmit and receive your keystrokes.

Here is a slight little problem. You need to know which com port of your pc is used for communicating with which device. Is it a real problem? No. Just right click Computer>manage>device manager>ports (Com & LPT). And here will show the ports. You can identify the pl2303 port because of it named as prolific or similar. And another confusion is which port is used for bluetooth device? The answer is after pairing with HC-06 you need to try each port one by one in putty. And whenever a successful connection is made. The LED of the HC-06 will stop blinking and it will stay on always.

Ok, Enough .. Here comes the code for arduino(atmega8). Will work on other 168/328 too.

int incomingByte;      // a variable to read incoming serial data into
void setup() {
  // initialize serial communication:
  Serial.begin(9600);
  // initialize the LED pin as an output:
  pinMode(5,OUTPUT);
  pinMode(6,OUTPUT);
  pinMode(7,OUTPUT);
  pinMode(8,OUTPUT);
  pinMode(11,INPUT);
  pinMode(12,INPUT);
  pinMode(13,INPUT);
  pinMode(14,INPUT);
  pinMode(15,INPUT);
  pinMode(16,INPUT);
  pinMode(17,INPUT);
  pinMode(18,INPUT);
    analogWrite(9,80);
    analogWrite(10,80);
}

void loop() {
  // see if there's incoming serial data:
  if (Serial.available() > 0) {
    // read the oldest byte in the serial buffer:
    incomingByte = Serial.read();
    // if it's a capital H (ASCII 72), turn on the LED:
    if (incomingByte == 'w') {
      GoForward();
    }
    // if it's an L (ASCII 76) turn off the LED:
    if (incomingByte == 's') {
      GoBackward();
    }
    if (incomingByte == 'a') {
      TurnLeft();
    }
    if (incomingByte == 'd') {
      TurnRight();
    }
    if (incomingByte == 'i') {
      analogWrite(9,80);
      analogWrite(10,80);
    }
    if (incomingByte == 'u') {
      analogWrite(9,100);
      analogWrite(10,100);
    }
    if (incomingByte == 'y') {
      analogWrite(9,120);
      analogWrite(10,120);
    }
    if (incomingByte == 't') {
      analogWrite(9,140);
      analogWrite(10,140);
    }
    if (incomingByte == 'r') {
      analogWrite(9,180);
      analogWrite(10,180);
    }
    if (incomingByte == 'o') {
    digitalWrite(5, LOW);
    digitalWrite(6, LOW);
    digitalWrite(7, LOW);
    digitalWrite(8, LOW);
    }
  }
}

void GoForward()
{
    digitalWrite(5, LOW);
    digitalWrite(6, HIGH);
    digitalWrite(7, LOW);
    digitalWrite(8, HIGH);
}

void GoBackward()
{
    digitalWrite(5, HIGH);
    digitalWrite(6, LOW);
    digitalWrite(7, HIGH);
    digitalWrite(8, LOW);
}

void TurnRight()
{
    digitalWrite(5, HIGH);
    digitalWrite(6, HIGH);
    digitalWrite(7, LOW);
    digitalWrite(8, HIGH);
}

void TurnLeft()
{
    digitalWrite(5, LOW);
    digitalWrite(6, HIGH);
    digitalWrite(7, HIGH);
    digitalWrite(8, HIGH);
}

void HardLeft()
{
    digitalWrite(5, HIGH);
    digitalWrite(6, LOW);
    digitalWrite(7, LOW);
    digitalWrite(8, HIGH);
}

void HardRight()
{
    digitalWrite(5, LOW);
    digitalWrite(6, HIGH);
    digitalWrite(7, HIGH);
    digitalWrite(8, LOW);
}

Most of the functions are self-explaining. And some of them are unused and for later uses. This hardware was made for one of my previous PID Line follower project and that’s another story 😀 .

The Hardware/Circuit diagram?
You need to wait until my next free time….

Where Am I?

You are currently browsing the Bluetooth category at khairulhasanmd.

%d bloggers like this: