Gyro Sensor Controlled Car

by prayag nao in Circuits > Robots

5750 Views, 22 Favorites, 0 Comments

Gyro Sensor Controlled Car

Capture1.PNG

Had you ever played games by gyro Sensor on your mobile device ? Of course yes.

You can also use mobile gyro sensor to control any thing(i.e. cars,robots)in real life.you only need few things...

1)A Bluetooth module(HC-05).

2)A Micro controller development board(i am using AVR ATmega16).

3)A 12 volts battery.

4)Four DC geared motors & 4 wheels.

5)A chassis.

6)Some 1-2-1 Connector Wires.

7)A Android/Windows/ios Mobile/Tablet.

Chassis Construction

Capture4.PNG

If you have a car then you can skip this part.

you just need to assemble motors on chassis by bolts.Now mount wheels on motors shaft.your car is ready.

Electronics

fg.jpg
Capture8.PNG
Capture5.PNG
Capture6.PNG
Capture3.PNG
Capture2.PNG

Now connect bluetooth module to your microcontrollers Rx & Tx pin.Connect motors terminal to motor driver IC.

Now you just need to program your controller and connect to battery.

Programming

This is a simple program for AVR ATmega16.......

#define F_CPU 1000000UL

#include

#include

#define USART_BAUDRATE 1200 // Baud Rate value

#define BAUD_PRESCALE ((F_CPU / (USART_BAUDRATE * 16UL)) - 1)

voidusart_init()

{

UCSRB |= (1 << RXEN)|(1<

UCSRC |= (1 << URSEL) | (1<

UBRRL = BAUD_PRESCALE;

UBRRH = (BAUD_PRESCALE >> 8);

}

unsignedintusart_getch()

{

while ((UCSRA & (1 << RXC)) == 0);

{

}

return UDR;

}

voidusart_putch(unsigned char send)

{ while(!(UCSRA & (1<

{

}

UDR=send;

}

voidputstr(unsigned char *str)

{

int i=0;

while(str[i]!='\0')

{

usart_putch(str[i]);

_delay_ms(100);

i++;

}

}

void main()

{

usart_init();

DDRC=0xff;

PORTC=0xff;

while(1)

{

int a= usart_getch();

if(a=='F')

{

PORTC=0b00000101;

}

if(a=='B')

{

PORTC=0b00001010;

}

if(a=='R')

{

PORTC=0b00000110;

}

if(a=='L')

{

PORTC=0b00001001;

}

}

}

Final Step

Screenshot_2015-02-03-21-31-38.png
Capture1.PNG

Now you just need to download a app called Arduino Bluetooth RC Car from play store.

when you tilt your mobile it send data to bluetooth and bluetooth send data to microcontroller.

Turn on power of Car and have fun :)

If you have any query please comment below.