34
Review report for project on D.C. MOTOR CONTROL USING VOICE COMMANDS Siksha 'O' Anusandhan University Institute Of Technical Education and Research Faculty of Engineering And Technology Jagamohan Nagar ,Khandagiri Bhubaneswar-751030,India Department Of Applied Electronics & Instrumentation

D.C Motor Control Using Voice Commands

Embed Size (px)

Citation preview

Page 1: D.C Motor Control Using Voice Commands

Review report for project on

D.C. MOTOR CONTROL USING

VOICE COMMANDS Siksha 'O' Anusandhan University Institute Of Technical Education and Research Faculty of Engineering And Technology

Jagamohan Nagar ,Khandagiri Bhubaneswar-751030,India

Department Of Applied Electronics & Instrumentation

UNDER THE GUIDANCE OF : SUBMITTED BY :

Mr. Shubendu Kumar Sarangi Deepak Nayak(0811015087)

Pritish Pradhan(0811015098)

Pallavi Sinha(0811015022)

Sobhan Pattanaik(0811015099) DECLARATION

Page 2: D.C Motor Control Using Voice Commands

“I hereby declare that this submission is my own work and that, to the best of my knowledge and belief, it contains no material previously published or written by another person nor material which has been accepted for the award of any other degree or diploma of the university or other institute of higher learning, except where due acknowledgment has been made in the text.”

DEEPAK NAYAK (0811015087)

PRITISH PRADHAN (0811015098)

PALLAVI SINHA (0811015022)

SOBHAN PATTANAIK (0811015099)

Page 3: D.C Motor Control Using Voice Commands

CERTIFICATE This is to certify that project entitled “D.C MOTOR CONTROL USING VOICE COMMANDS” submitted by Deepak Nayak(0811015087), Pritish Pradhan(0811015098), Pallavi Sinha(0811015022), Sobhan Pattanaik(0811015099), to Institute of Technical Education & Research, Siksha ’O’ Anusandhan University, Bhubaneswar towards partial fulfillment for the award of the degree of Bachelor of Technology in the specialization of Applied Electronics And Instrumentation Engineering is a bonafide record of the work done in my supervision and guidance.

Date: Mr. shubendu kumar sarangi Assistant Professor, Department of AE&I Institute of Technical Education & Research Siksha ‘O’ Anusandhan University, Bhubaneswar-751030

Page 4: D.C Motor Control Using Voice Commands

ACKNOWLEDGEMENT

We have taken efforts in this task. However, it would not have been possible without the able support and kind help of our project guide, Mr. Shubendu Kumar Sarangi. We are highly indebted to him for his guidance, encouragement and constant supervision, and would like to express our special gratitude and sincere thanks. We would like to express our special gratitude and thanks to our HOD Prof. Mihir Narayan Mohanty for his kind co-operation and encouragement.

DEEPAK NAYAK (0811015087)

PRITISH PRADHAN (0811015098)

PALLAVI SINHA (0811015022)

SOBHAN PATTANAIK (0811015099)

Page 5: D.C Motor Control Using Voice Commands

INTRODUCTION

Humans interact with machines using keystrokes or mouse movement. Hence interacting with a machine is not the same as communicating with other humans. For this reason, the technology to talk to a machine is the future of human-machine interaction.

Such voice responding computer and systems will revolutionize the way we get our work done through computers and free humans from the hassle of keyboards or switches. It will also make computers more accessible and even computer illiterates or laymen can fully exploit the potentials of a machine. Furthermore voice assisted or responding machines can help the old, children or handicapped persons to just ‘talk’ to a machine to get their work done.

Such technologies are already in use in the cockpit systems of 4th generation fighter jets (F35 Lightning II), toy robots (R2D2), training air traffic controllers, video games such as LIFELINE etc.

In this project we have tried to control a D.C. Motor using voice commands. The hardware implementation was successful.

Page 6: D.C Motor Control Using Voice Commands
Page 7: D.C Motor Control Using Voice Commands

SPEECH ACQUISITION

Voice commands for Motor control are given through the Microphone to the Computer.

The Specifications of the Microphone used are as follows:

Impedance: 2.2k Ohms

Sensitivity: -58dB ±3dB

Directivity: Omni-directional

S/N Ratio: More than 60dB

Operating Voltage: 4.5V

Frequency Response: 100Hz-16 kHz

Page 8: D.C Motor Control Using Voice Commands

Speech processing

Dragon Professional 9.0 software was used for speech processing.

Here, is a brief description of the software.

The Software utilizes a minimal user interface.

As an example, dictated words appear in a floating tooltip as they are spoken, and when the speaker pauses, the program transcribes the words into the active window at the location of the cursor.

The software has three primary areas of functionality: dictation, text-to-speech and command input.

The user is able to dictate and have speech transcribed as written text, have a document synthesized as an audio stream, or issue commands that are recognized as such by the program.

In addition, voice profiles can be accessed through different computers in a networked environment, although the audiohardware and configuration must be identical on both machines.

The Professional version allows creation of custom commands to control programs or functions not built into NaturallySpeaking.

User defined commands were created using the Macro Recorder.

Macro Recorder dialog box records a sequence of mouse movements and keystrokes. When we say the name of the Macro Recorder command Dragon

Page 9: D.C Motor Control Using Voice Commands

NaturallySpeaking plays back these mouse movements and keystrokes in the manner in which you recorded them.

On receiving a user defined command, the sequence of events specified for that command were executed on MATLAB.

COMMAND EXECUTION

MATLAB is used for REAL TIME CONTROL of the movement of motors.

Using MATLAB, “function files” were created for each control command.

The “functional files” in MATLAB have the extension .m .

They are called in MATLAB command window using only their names.

MATLAB COMMANDS USED:

S = SERIAL('PORT','P1',V1,'P2',V2,...)

Page 10: D.C Motor Control Using Voice Commands

Description: S = SERIAL('PORT','P1',V1,'P2',V2,...) constructs a serial port object associated with port, PORT, and with the specified property values. If an invalid property name or property value is specified the object will not be created.

FOPEN(OBJ)

Description: FOPEN (OBJ) connects the serial port object, OBJ, to the device. OBJ can be an array of serial port objects.

FWRITE(OBJ, A)

Description: FWRITE (OBJ, A) writes the data, A, to the device connected to serial port object, OBJ.

FUNCTION [ O/P_ARGS] = UNTITLED( I/P ARGS)

Description: FUNCTION Add new function.

New functions may be added to MATLAB's vocabulary if they are expressed in terms of other existing functions. The commands and functions that comprise the new function must be put in a file whose name defines the name of the new function, with a filename extension of '.m'. At the top of the file must be a line that contains the syntax definition for the new function.

FCLOSE(OBJ)

Description: FCLOSE (OBJ) disconnects the serial port object, OBJ, from the device. OBJ can be an array of serial port objects.

Page 11: D.C Motor Control Using Voice Commands

Function files used are as follows:

FOR RIGHT MOVEMENT OF BOT(right.m)

function [ ] =right ( )ser=serial ('COM5','BaudRate', 9600);fopen(ser);fwrite(ser,[00000000]);fwrite (ser,[00000100]);fwrite (ser,[00000100]);fwrite(ser,[00000100]);fclose (ser);end

FOR LEFT MOVEMENT OF BOT(left.m)

function [ ] =left( )ser=serial ('COM5','BaudRate',9600);fopen(ser);fwrite(ser,[00000001]);fwrite(ser,[00000001]);fwrite(ser,[00000001]);fwrite(ser,[00000001]);fclose(ser);end

FOR FORWARD MOVEMENT OF BOT(go.m)

function [ ] = go( )ser=serial ('COM5','BaudRate',9600);fopen(ser);

Page 12: D.C Motor Control Using Voice Commands

fwrite(ser,[00000101]);fwrite(ser,[00000101]);fwrite(ser,[00000101]);fwrite(ser,[00000101]);fclose(ser);end

FOR BACKWARD MOVEMENT OF BOT(back.m)

function [ ] =back( )ser=serial ('COM5','BaudRate',9600);fopen(ser);fwrite(ser,[00000000]);fwrite(ser,[00000010]);fwrite(ser,[00000010]);fwrite(ser,[00000010]);fclose(ser);end

FOR STOPPING THE BOT(stop.m)

function [ ] =stop( )ser=serial ('COM5','BaudRate',9600);fopen(ser);fwrite(ser,[00000000]);fwrite(ser,[00000000]);fwrite(ser,[00000000]);fwrite(ser,[00000000]);fclose(ser);end

The Macro Recorder Command types in the respective “function file” name of the received command in the MATLAB command window and enters it there.

Page 13: D.C Motor Control Using Voice Commands

The .m file is then executed in MATLAB. MATLAB writes the corresponding binary value of the

command into the microcontroller on execution.

DATA TRANSFER

Data transfer between the computer and the microcontroller takes place using a virtual serial port.

The Virtual Serial Port is created using a USB to RS232 Converter Module.

The Serial Port sends the data serially i.e. one bit at a time.

If we have to transmit one byte of data, the serial port will transmit 8 bits as one bit at a time.

The advantage of serial port over parallel port is that, a serial port needs only one wire to transmit the 8 bits whereas a parallel port needs 8 wires.

Here, the converter module has a RXD pin which is used to transmit the data from the computer and a TXD pin which is used to receive the data from the microcontroller.

At the receiver’s side (robot), a microcontroller with UART (Universal Asynchronous Receiver

Page 14: D.C Motor Control Using Voice Commands

Transmitter) is required aboard the robot, to interpret the serial data. Most of the microcontrollers like AVR ATMEGA 16, Atmel/Philips 8051 or PIC microcontrollers have a UART. The UART needs to be initialized to receive the serial data from PC.

Page 15: D.C Motor Control Using Voice Commands

MICROCONTROLLER

ATMEGA 16, which is a 16 bit microcontroller from ATMEL, is used for receiving the serial data from the computer and transferring it to its specified Output port, which is to be used by the motor driver IC for controlling the motors.

The specified output port of the microcontroller is connected to the motor driver IC.

To receive the serial data from the computer, the microcontroller’s UART must be initialized beforehand.

This is done by writing the UART initialization program into the microcontroller. For this purpose we use the following soft wares

and a USB programmer:

1) WINAVR

2) AVR STUDIO

3) SINAPROG HEX DOWNLOADER

WINAVR: Contains the header files used in AVRSTUDIO.

AVRSTUDIO: Is used for programming and debugging for many of the Atmel microprocessors such as the Atmega8, 16, 32, etc.

Page 16: D.C Motor Control Using Voice Commands

Program code is written in C++ language and hex code is generated on compilation.

SINAPROG HEX DOWNLOADER: It is used to download the hex file from the computer to the microcontroller.

USB PROGRAMMER: The HEX file is downloaded to the microcontroller using the USB Programmer.

The RXD pin of the virtual serial port is connected to the RXD pin(PD0) of the microcontroller.

The microcontroller receives the data from the computer using it’s RXD pin(PD0).

USART PINS OF ATMEGA 16 USED FOR SERIAL DATA TRANSFER

Page 17: D.C Motor Control Using Voice Commands

DEVELOPMENT BOARD(ATK200PCB)

Page 18: D.C Motor Control Using Voice Commands

Program code for uart initialization and output port assignment

// 8MHZ fre. of MCU and 9600 baud rate value of UBRR is 51

#include<avr/io.h>

#include<avr/delay.h>

void USART_Init( unsigned char ubrr)

{/* Set baud rate */

UBRRH = 0;

UBRRL = ubrr;

/* Enable receiver and transmitter */

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

/*Set frame format: 8data---ucsz0=1,ucsz1=1, 1stop bit---usbs=0*/

UCSRC |= (1 << URSEL)|(3<<UCSZ0);

}//Transmission

void USART_Transmit( unsigned char data )

{/* Wait for empty transmit buffer */

while ( !( UCSRA & (1<<UDRE)) );

/* Put data into buffer, sends the data */

UDR = data;

Page 19: D.C Motor Control Using Voice Commands

}

//RX

unsigned char USART_Receive( void )

{/* Wait for data to be received */

while ( !(UCSRA & (1<<RXC)) );

/* Get and return received data from buffer */

return UDR;

}void main()

{unsigned char x;

USART_Init(51);// 8MHZ fre. of MCU and 9600 baud rate value of UBRR is 51

while(1)

{DDRC=0xff;

x=USART_Receive();

PORTC=x ;}}

Page 20: D.C Motor Control Using Voice Commands

Motor driver

The current provided by the MCU is of the order of 5mA and that required by a motor is ~500mA. Hence, motor can’t be controlled directly by MCU and we need an interface between the MCU and the motor.

A Motor Driver IC like L293D or L298 is used for this purpose which has two H-bridge drivers.

Hence, each IC can drive two motors. Note that a motor driver does not amplify the current; it only acts as a switch (An H bridge is nothing but 4 switches).

Here, L293D motor driver is used.

BLOCK DIAGRAM OF A MOTOR CONTROLLER

H-BRIDGE:

Page 21: D.C Motor Control Using Voice Commands
Page 22: D.C Motor Control Using Voice Commands

MOTOR DRIVER CONNECTIONS WITH THE MOTOR

Drivers are enabled in pairs, with drivers 1 and 2 being enabled by the Enable pin. When an enable input is high (logic 1 or +5V), the associated drivers are enabled and their outputs are active and in phase with their inputs.

When the enable pin is low, the output is neither high nor low (disconnected), irrespective of the input.

Direction of the motor is controlled by asserting one of the inputs to motor to be high (logic 1) and the other to be low (logic 0).

To move the motor in opposite direction just we need to interchange the logic applied to the two inputs of the motors.

Asserting both inputs to logic high or logic low will stop the motor.

Page 23: D.C Motor Control Using Voice Commands

For example:-

0000 Both Motor Stop 1111 Both Motor Stop 0101 Both Motor Forward 1010 Both Motor Backward

D.C MOTORS:

d.c motor working:

Page 24: D.C Motor Control Using Voice Commands

Direction of rotation is controlled by polarity of current/voltage.

Speed of rotation is controlled by average energy (power) fed to the motor.

d.c motor specifications:

Operating Voltage: Recommended voltage for powering the motor.

Operating Current: Current drawn at a certain load on the shaft.

Stall Current: Maximum current drawn when the motor is not allowed to rotate.

Stall Torque: Rotation force needed to hold the motor in stall condition.

D.C MOTOR CHARACTERISTICS:

Free running torque and current are ideally zero. Increased load implies increased torque, current

drawn and power consumption. Power supplied by a motor is the product of the

output shaft’s rotational velocity and torque. D.C motors are high speed, low torque devices. Using gears, the high speed of the motor is traded off

into torque.

Page 25: D.C Motor Control Using Voice Commands

D.C MOTOR CHARACTERISTICS CURVE

Page 26: D.C Motor Control Using Voice Commands

CONCLUSION

The voice control of D.C. Motor is desirable since most of the battery powered appliances run on it. By doing so it is easy to control appliances and robots simply by voice like communicating with other humans. There are many advantages of this system like the voice assisted G.P.S systems on cars or Electronic Cockpit Systems.

But it also has some disadvantages. It there is some noise or extraneous sound at the time of giving the voice command then the system may not fully comprehend it and not work as desired. Interfacing the hardware and software must be perfect. Also the program must be very accurate and give proper delays and ensure the data is given long enough for the machine to understand and react .

Reliability depends on the accuracy of the voice recognition module. Present day systems have become highly reliable with nearly 99% accuracy. Hence voice assisted systems will become standard in future in home an industry.

Page 27: D.C Motor Control Using Voice Commands

REFERENCES

Elementary Introduction to Image Based Robots Ankur Aggarwal.

Beginners Guide to Embedded Systems and Robotics by Sourabh Sankule.

www.wikipedia.com www.google.com www.engineersgarage.com