Free Essay

Digital Tachometer with Use of Dragon Board-12

In:

Submitted By chiyixuan
Words 1999
Pages 8
Digital Tachometer with Use of Dragon Board-12

Table of Contents
Abstract-------------------------------------------------------------------(3)
Introduction--------------------------------------------------------------(3)
Main Result---------------------------------------------------------------(4)
Conclusion----------------------------------------------------------------(7)
Future Work-------------------------------------------------------------(7)
References----------------------------------------------------------------(8)
Appendix A--------------------------------------------------------------(9)
Appendix B--------------------------------------------------------------(10)

Abstract
We introduce one method of addressing the problem of finding the Revolutions per minute of a DC motor without the use of a commercial tachometer, through the use of Dragon Board-12 embedded system. The method we chose to use involved setting up a low pass filter circuit to reduce noise and voltage to a level that the safe for use with the Dragon Board-12. The output from the low-pass filter was then passed through an analog to digital converter which was coded using C code, to convert the signal into a machine readable input. The input was then converted into revolutions per minute and then stored for 15ms, at which time an average was taken (to reduce noise) and then sent to the LCD screen as the tachometer output in revolutions per minute.
Introduction
In modern days, with the increased usage of Dragon 12-plus USB trainer in universities, more and more applications have been created on the board. The Dragon 12-plus USB trainer is a low cost, featured-packed training board for the new Freescale HCS12 microcontroller family. The board is compatible with the Freescale 9S12DP256EVB board and other similar development boards on the market today, but it also incorporates many on-board peripherals that make this board a popular trainer in universities around the world. The DC motor is also widely used in many applications in modern days, and is in integral part in many pieces off equipment such as toys and disk drives, steel rolling mills, and paper machines
In this project, we are going to introduce a method to set up the dragon 12-plus board as a tachometer that can measure the rotation speed of a DC motor instead of using traditional tachometers. In order to achieve this goal, the first step is to find out the linear relationship between the voltage input and revolutions per minute output for the DC motor we chose to use. Once a relationship can be established, C code can then be written to program the Dragon 12-plus board to do the actual conversions and display the revolutions per minute.
Main Result
A digital tachometer was designed with the use of principles of embedded systems and systems control. The main design consisted of using the Freescale Dragon Board-12 system; which includes many features including a timer, analog to digital converter, and a LCD screen (1: in Figure 1), along with a DC motor (4: in Figure 1) and power supply to create a digital device that would read an analog voltage input from the DC motor and then create a digital output which could be displayed on the LCD screen of the Dragon Board-12 system.

Figure 1: Digital Tachometer Setup
When designing this system the first factor that was taken into consideration was to confirm the manufactures voltage gradient factor of 1.9V per 1000 RPM. To confirm the voltage gradient we applied the system (2) shown below in which the DC motor is connected to a power supply and a low-pass filter, which is used to reduce the machine noise in dc motor. For the best noise reduction in dc motor, we choose to set up a low pass filter circuit with a resistance 20 ohms and a capacitance of 100 uF. The values were chose to achieve a cutoff frequency of 500Hz(shown) which is 6.25 times greater than the maximum rotation speed of the dc motor(4500rpm=80Hz), this allows for the reduction of most of the noise of the output frequency displayed on oscilloscope.

Figure 2: System for measure the relation of voltage and freq.
This low-pass filter set up allowed for a for a voltage gradient of 1.9 Volts per 1000 Revolution per minute to be attained. This voltage gradient data allowed for the programming structure to be completed. The programming structure that was set up follows the flow chart is the attached in appendix A. The first step in creating the digital aspect of the tachometer was initializing the LCD in which the code can be found in the LCD section of the source code in Appendix B. Once the LCD is initialized and ready to accept data, the analog to digital converter is then initialized and set to do a continuous scan on PAD 8(3: in Figure 1) which is the channel that was used in this particular case and convert to an 8-bit number. Once both the LCD and Analog to digital converter are initialized the scan and conversion aspect of the digital tachometer can take place. In this phase of the digital tachometer the voltage input into PAD 8 is taken and then converted from an analog voltage signal to an 8-bit number which ranges from 0-255. Once the analog voltage signal is converted to the digital 8-bit number the conversion back to display the digital number as a readable voltage and revolution per minute string on the LCD can take place. During this phase of the digital tachometer code the digital 8-bit number is divided by 51 to get the digital signal back into the analog voltage number, which in this case gives a maximum voltage of 5 volts and a minimum voltage of 0 volts which is the factor default configuration for the Freescale Dragon Board-12. Once the analog voltage is again determined from the digital 8-bit number the result is then stored in the 10th element of the voltage display array, in which the ones place of the voltage is displayed. Then to display the decimal part of the analog voltage the remainder of the digital 8-bit signal is taken and then multiplied by 10 and divided by 51 at which time this value is stored in the voltage character array in element 12. The same process is used when converting the 8-bit digital voltage number to Revolutions per minute except for the fact that the signal must be multiplied by the voltage gradient provided by the DC motor and storing this value in the revolutions per minute character array. Once both arrays have data they are then sent to the LCD screen on the Dragon-Board-12 to be displayed to the user. and works by taking a voltage input from the tachometer that is built into the DC motor, and throwing that input data to PAD 8 on the dragon board which is an analog to digital input channel. Once the conversion is complete the data stored in the character arrays is then constantly updated at an interval of 50 milliseconds by use of a delay loop and continuous scan of the analog to digital converter.

Conclusion
The dragon board 12 was successfully used as a platform to build a digital tachometer off of by use of the analog to digital conversion feature, as well as the on board LCD. In combination with these parts C code was written to tie all of the different components together to make a functioning product . The C code employed taking a digital number and reconverting back into a readable analog voltage output and ten converting this voltage output with the voltage gradient factor of 1.9 Volts per 1000 Revolutions per minute. The dragon board 12 is a great tool for use from projects such as creating a digital tachometer, but there is even more features which are to be incorporated in future works. One such feature is the wireless capability of the dragon board 12. With the wireless capability it would be possible to transmit tachometer data wirelessly to a server and store that data so the tachometer could be viewed over the internet at an offsite location.

Future Work
The Digital Tachometer project has much room for improvement and expansion. One such avenue of expansion that is currently underway is developing an overlay that would digitally allow for a user to control the Digital Tachometer attached to the Dragon Board -12 over the internet. This would work by creating an overlay in which the user can remotely set a voltage or RPM, which would cause the Dragon Board-12 to adjust the current power settings for the DC motor to match the levels indicated by the user.

Reference
Huang, Han-Way. HCS12/9S12 An Introduction to Software and Hardware Interfacing. 2nd ed. Delmar Colege Learning, 2010. Print.

Appendix A
Flow Chart
END
Delay 50 milliseconds
Send Array Data to LCD
Convert to Voltage and RPM and store in char Array
Convert Analog voltage to Digital Number
Continuous Scan on PAD 8
Delay for Initialization
Initialize ADC
Initialize LCD

Appendix B
Source Code:
/******************************AUTHORS*****************************************/
/* KYLE STOKES */
/* YIXUAN CHI */
/******************************************************************************/

#include <hidef.h> /* common defines and macros */
#include <mc9s12dp256.h> /* derivative information */
#include <stdio.h>
#include "lcd.h"

/****************************************CONFIGURE LCD****************************/ void openlcd(void)
{
LCD_DIR = 0xFF; /* configure LCD_DAT port for output */ delay_1ms(100); /* Wait for LCD to be ready */ put2lcd(0x28,CMD); /* set 4-bit data, 2-line display, 5x7 font */ put2lcd(0x0F,CMD); /* turn on display, cursor, blinking */ put2lcd(0x06,CMD); /* move cursor right */ put2lcd(0x01,CMD); /* clear screen, move cursor to home */ delay_1ms(2); /* wait until "clear display" command is complete */
}
/*****************************GIVE LCD CHAR DATA********************************/ void puts2lcd (char *ptr)
{
while (*ptr) { /* While character to send */ put2lcd(*ptr,DATA); /* Write data to LCD */ delay_50us(1); /* Wait for data to be written */ ptr++; /* Go to next character */
}
}
/****************************SELECT LCD BIT DATA*********************************/ void put2lcd(char c, char type)
{
char c_lo, c_hi; c_hi = (c & 0xF0) >> 2; /* Upper 4 bits of c */ c_lo = (c & 0x0F) << 2; /* Lower 4 bits of c */ if (type == DATA) LCD_DAT |= LCD_RS; /* select LCD data register */ else LCD_DAT &= (~LCD_RS); /* select LCD command register */ if (type == DATA)
LCD_DAT = c_hi|LCD_E|LCD_RS; /* output upper 4 bits, E, RS high */ else LCD_DAT = c_hi|LCD_E; /* output upper 4 bits, E, RS low */
LCD_DAT |= LCD_E; /* pull E signal to high */
__asm(nop); /* Lengthen E */
__asm(nop);
__asm(nop);
LCD_DAT &= (~LCD_E); /* pull E to low */ if (type == DATA)
LCD_DAT = c_lo|LCD_E|LCD_RS; /* output lower 4 bits, E, RS high */ else LCD_DAT = c_lo|LCD_E; /* output lower 4 bits, E, RS low */

LCD_DAT |= LCD_E; /* pull E to high */
__asm(nop); /* Lengthen E */
__asm(nop);
__asm(nop);
LCD_DAT &= (~LCD_E); /* pull E to low */ delay_50us(1); /* Wait for command to execute */
}
#define D50US 133 /* Inner loop takes 9 cycles; need 50x24 = 1200 cycles */
/*******************************DELAY LOOPS******************************/ void delay_50us(int n)
{
volatile int c; for (;n>0;n--) for (c=D50US;c>0;c--) ;
}
void delay_1ms(int n)
{
for (;n>0;n--) delay_50us(200);
}

/******************************CONVERTER**************************************/ void main( void )
{
unsigned int i; //loop counter unsigned int remainder; //used for calculating voltage char display[17] = "Voltage = x.x "; // initalize string char converted[14] = "RPM = xxxx "; unsigned int c; unsigned int leftover; unsigned int leftover100; unsigned int leftover10;

openlcd(); // Enable the LCD display ATD1CTL2 = 0x80; //normal A2D operation initialization for(i = 0; i < 1000; i++); //delay for initialization ATD1CTL3 = 0x08; // 1 conversion per scan ATD1CTL5 = 0x20; //continuous scan on AD1 channel 0 (PAD8)

while(1)//keep running { while(!(ATD1STAT0 & 0x80)); //wait for scan conversion to complete /***************************************GET VOLTAGE*****************************/ display[10] = '0' + ATD1DR0H / 51; // divide to find ones place (255 / 5 = 51) remainder = ATD1DR0H % 51; //calculate remainder display[12] = '0' + (remainder * 10) /51; //multiply remainder by 10 and divide to find tenths place puts2lcd(display); //write to screen delay_1ms(48); put2lcd(0x01,CMD); delay_1ms(2); put2lcd(0XC0, CMD);
/***********************************GET RPM********************************/ c = ((ATD1DR0H*100)/51) *(526/100) ; // using arry values from display cal RPM from voltage using given conversion converted[6]= '0' + c /1000; leftover= c %1000; converted[7]= '0' + leftover /100; leftover100=leftover % 100; converted[8]= '0' + leftover100 /10; leftover10=leftover100 % 10; converted[9]= '0' + leftover10; puts2lcd(converted);//write to screen * } }

Similar Documents

Premium Essay

Labor Law

...CHAPTER 9 LABOUR PRACTICES AND WORKING CONDITIONS IN TNCS: THE CASE OF TOYOTA KIRLOSKAR IN INDIA KRISHNA SHEKHAR LAL DAS & SOBIN GEORGE 1. INTRODUCTION The study on the working conditions and labour practices in Toyota Kirloskar in India is part of the network research on Transnational Corporation Monitoring in Asia. Since 2002 the Asian Transnational Corporation (ATNC) Monitoring Network has been operational to build up a regional network through which labour organisations in different Asian countries can pursue concrete solidarity actions to improve working conditions of workers employed in transnational corporations (TNC). Against this backdrop, it is aimed to have a closer look at the labour management and forms of employment in automobile and electronics sectors invested by Asian TNCs in Asia. As part of this endeavour, the Centre for Education and Communication (CEC), New Delhi collaborated with the network research coordinated by Asia Monitor Resource Centre (AMRC), Hong Kong to observe the labour practices of Asian TNCs invested in India. In the first phase the network research focused on the movement of capital and its impact on labour by engaging desk research on foreign direct investment (FDI) flows and related aspects. In the current phase, emphasis is on specific cases of labour practices and labour conditions in selected ATNCs. 1.1 Methodology The present study is situated in the wider context of the dichotomy between labour and capital. The changes of production...

Words: 32270 - Pages: 130

Free Essay

Right

...ight Right Word Wrong Word Words and structures confused and misused by learners of English L. G. Alexander LONGMAN Addison Wesley Longman Limited Edinburgh Gate, Harlow Essex CM20 2JE, England and Associated Companies throughout the world. © Longman Group UK Limited 1994 All rights reserved; no part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, electronic, mechanical, photocopying, recording or otherwise, without the prior written permission of the Publishers. First published 1994 Fifth impression 1997 Illustrated by Chris Ryley British Library Cataloguing in Publication Data Alexander, L. G. Right Word Wrong Word: Words and Structures Confused and Misused by Learners of English. - (Longman English Grammar Series) I. Title II. Ryley, Chris III. Series 428.24 ISBN 0-582-21860-8 Library of Congress Cataloging-in-Publication Data Alexander, L.G. Right word wrong word: words and structures confused and misused by learners of English/L.G. Alexander. p. cm. Includes bibliographical references and index. ISBN 0-58221860-8 1. English language-Usage. 2. English language-Errors of usage. I. Title. PE1460.A48 1993 428.2'4-dc20 93-11963 CIP We have been unable to trace the copyright holder of the text for Exercise 52 Everybody, Somebody, Anybody, Nobody and would appreciate any information that would enable us to do so. Set in Times New Roman, TrueType Produced through Longman Malaysia, ETS ISBN 0 582 21860 8 ...

Words: 150405 - Pages: 602