You are on page 1of 6

Username

HOME

TRAINING

WORKSHOP

PROJECTS

KNOWLEDGE CENTRE

ELECTROSHOP

ABOUT US

search...

4 Wire Resistive Touch Screen Controlled Robot with ATmega32


Posted in Robotics

The objective of this project/tutorial is to build a 4 wire Resistive Touch Screen controlled Robot with ATmega32 microcontroller. Here, the 4 wire resistive touch screen sensor act as the
input device, ATmega32 microcontroller act as the processing unit, DC Motor Driver act as the driver for the motors connected to the Robot, the 16X2 alphanumeric LCD acts as the display
device. The ATmega32 microcontroller reads the analog output values(x and y-axis values of the touch point) of the 4 wire resistive touch screen sensor and converts that analog values to
digital values with its analog to digital converter. Then, the digital values are processed by the ATmega32 microcontroller and according to the point of touch in the 4 wire resistive touch
screen, the ATmega32 microcontroller drives the Robot in forward, reverse, left, right direction and stops it. The 16X2 alphanumeric LCD displays the x and y-axis values of the 4 wire
resistive touch screen sensor and the direction of movement of Robot. The direction of the Robot changes if the connection of motors to the DC Motor Driver are changed.

Hardwares Required
AVR Trainer Board-100-1pcs
AVR USB Programmer-1pcs
12V DC Adapter-1pcs
Touch Screen Sensor-1pcs
16X2 Alphanumeric LCD(JHD322A)-1pcs
DC Motor Driver-1pcs
Robot-1pcs
1 to 1 Connector-9pcs
10 to 10 FRC Female Connectors-2pcs
USB AM-AF Cable(Optional)-1pcs

Softwares Required
AVR Studio 4
WinAVR -2010
SinaProg Hex Downloader
USBasp Driver

Circuit Diagram

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

C Program
//System Clock

:1MHz

//AVR Compiler

:AVR-GCC 4.3.2

#include<avr/io.h>
/*Includes io.h header file where all the Input/Output Registers and its Bits are defined for AVR microcontroller*/
#define

F_CPU

1000000

/*Defines a macro for the delay.h header file. F_CPU is the microcontroller frequency value for the delay.h header file. Default value of F_CPU in delay.h header file is 1000000(1MHz)*/
#include<util/delay.h>
/*Includes delay.h header file which defines two functions, _delay_ms (millisecond delay) and _delay_us (microsecond delay)*/
#define

LCD_DATA_PORT

PORTB

/*Defines a macro for the lcd.h header File. LCD_DATA_PORT is the microcontroller PORT Register to which the data pins of the LCD are connected*/
#define LCD_CONT_PORT

PORTD

/*Defines a macro for the lcd.h header File. LCD_CONT_PORT is the microcontroller PIN Register to which the control pins of the LCD are connected*/
#define LCD_RS

PD0

/*Defines a macro for the lcd.h header file. LCD_RS is the microcontroller Port pin to which the RS pin of the LCD is connected*/

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

#define LCD_RW

PD1

/*Defines a macro for the lcd.h header file. LCD_RW is the microcontroller Port pin to which the RW pin of the LCD is connected*/
#define LCD_EN

PD2

/*Defines a macro for the lcd.h header file. LCD_EN is the microcontroller Port pin to which the EN pin of the LCD is connected*/
#include<avr/lcd.h>
/*Includes lcd.h header file which defines all the functions for all Alphanumeric LCD*/
#include<avr/adc.h>
/*Includes adc.h header file which defines all the functions for Analog to Digital Converter*/
#include<avr/touchscreen.h>
/*Includes touchscreen.h header file which defines all the functions for Touch Screen*/

void main(void)
{
DDRB=0xff;
/*All pins of PortB are declared output (data pins of LCD are connected)*/
DDRD=0x07;
/*PD0, PD1 and PD2 pins of PortD are declared output (control pins of LCD connected)*/
DDRC=0x0f;
/*PC0,PC1,PC2,PC3 pins of PortC are declared output ( i/p1,i/p2,i/p3,i/p4 pins of DC Motor Driver are connected )*/
int x,y;
/*Variable declarations*/
adc_init();
/*ADC initialization*/
lcd_init();
/*LCD initialization*/
lcd_string_write("ABLab Solutions");
/*String display in LCD*/
_delay_ms(500);
_delay_ms(500);
_delay_ms(500);
_delay_ms(500);
/*2 seconds delay*/

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

/*Start of infinite loop*/


while(1)//Start of Infinite loop.
{
lcd_command_write(0x01);
/*clear screen*/
x=read_touchscreen_x_coordinate();
/*Reading x-axis value*/
lcd_number_write(x,10);
/*x-axis value display in LCD*/
lcd_string_write(" ");
/*Two empty space display in LCD*/
y=read_touchscreen_y_coordinate();
/*Reading y-axis value*/
lcd_number_write(y,10);
/*y-axis value display in LCD*/
lcd_command_write(0xc0);
/*Cursor moves to 2nd row 1st column of LCD*/
if((x>250) && (x<400) && (y>450) && (y<680))
{
lcd_string_write("FORWARD ");
/*Displays FORWARD in the 2nd row of LCD*/
PORTC=0x0a;
/*Robot will move forward*/
}
else if((x>250) && (x<400) && (y>80) && (y<200))
{
lcd_string_write("REVERSE");
/*Displays REVERSE in the 2nd row of LCD*/
PORTC=0x05;
/*Robot will move backward*/
}
else if((x>450) && (x<650) && (y>250) && (y<420))
{

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

lcd_string_write("RIGHT ");
/*Displays RIGHT in the 2nd row of LCD*/
PORTC=0x08;
/*Robot will move towards right*/
}
else if((x>90) && (x<200) && (y>250) && (y<420))
{
lcd_string_write("LEFT ");
/*Displays LEFT in the 2nd row of LCD*/
PORTC=0x02;
/*Robot will move towards left*/
}
else if((x>250) && (x<400) && (y>250) && (y<420))
{
lcd_string_write("STOP ");
/*Displays STOP in the 2nd row of LCD*/
PORTC=0x00;
/*Robot will stop*/
}
else;
_delay_ms(300);
}
}
/*End of Program*/

Connection Guide
The step-by-step procedure for 4 wire Resistive Touch screen controlled Robot with Atmega32 are as follows:
Insert the DC Pin of 12V DC Adapter to the DC Socket of AVR Trainer Board-100.
Connect PORTB Header with LCD Data Header of AVR Trainer Board-100 with a 10 to 10 FRC Female Connector.
Connect RS, RW & EN pin of LCD Control Header with PD0, PD1 & PD2 pin of PORTD Header respectively of AVR Trainer Board-100 with 1 to 1 Connectors.
Connect the ISP Header of AVR Trainer Board-100 with AVR USB Programmer Header with a 10 to 10 FRC Female Connector.
Connect the 16X2 Alphanumeric LCD to the LCD Header of AVR Trainer Board-100.
Connect the Pin1, Pin2, Pin3, Pin4 and GND pins of Touch screen Sensor with PA0, PA1, PA2, PA3 and GND pins of AVR Trainer Board-100 with 1 to 1 connectors.
Connect the 12V pin of PWM & Motor Voltage Header of DC Motor Driver with the 12V Header of AVR Trainer Board-100 with a 1 to 1 Connector.
Connect the Input Header of DC Motor Driver with PORTC Header of AVR Trainer BOar-100 with a 10 to 10 FRC Female Connector.
Connect the Robot connector to the Output Header of the DC Motor Driver.
Switch off the Mode Switch of DC Motor Driver.
Connect the AVR USB Programmer to the PC/Laptop's USB Port.
Switch on the power with the help of Power Switch of AVR Trainer Board-100.
Download the 4 wire Resistive Touch screen controlled Robot with Atmega32 Hex file to AVR Trainer Board-100.

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

See the result.

Like

Training

Workshops

Robotics

Robo-Manual

Advanced Robotics

Robo-Begin

Embedded Systems

Robo Sumo

Advanced Embedded

Robo-Mobile

Systems

Robo-PC

Mobile Making

Robo-Touch

Wireless Communication

Robo-Gravity

PCB Designing

Projects
Dual Tone Multiple
Frequency
RS-232 Communication
IR Communication
GPS and GSM
Communication
Bluetooth Communication

Identification

Robo-Tracker

Biometric Finger Print

Robo-BTooth
MSYS-Mobile
PCB Design

About Us
About Us

Sample Codes

Our Clients
Business Associates

Facebook
ABLab Solutions
Like
1,201 people like ABLab Solutions.

Photo Gallery
Careers
Contact Us

Radio Frequency

Robo-SMS

Robo-iRemote

Knowledge
Centre

Fac ebook s oc ial plugin

Sensor
Touch Screen Sensor
Accelerometer Sensor
Temp., Humidity, Heart Beat
& Gas Sensors
IR & Ultrasonic Sensors
Keypad
Robotics
RF Communication
ZigBee Communication

Privacy Policy

Sitemap

Copyright 2013 Ablab Solutions. All Rights Reserved

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

You might also like