毕业论文-基于微加速度计的无线鼠标设计.docx_第1页
毕业论文-基于微加速度计的无线鼠标设计.docx_第2页
毕业论文-基于微加速度计的无线鼠标设计.docx_第3页
毕业论文-基于微加速度计的无线鼠标设计.docx_第4页
毕业论文-基于微加速度计的无线鼠标设计.docx_第5页
已阅读5页,还剩9页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

基于微加速度计的无线鼠标设计 学 院: 机械与电气工程 专 业: 电气工程及其自动化 队 长: 队 员: 指导教师: 摘 要 本设计针对传统鼠标只能在桌面上使用的不足,设计出一种基于微加速度计的无线鼠标,它不仅具有教学激光笔上下翻页的功能,而且能在空中依靠鼠标的偏转角度实现电脑桌面光标的移动、鼠标点击的功能,本设计以微加速度计ADXL345 作为信号检测元件,并采用低功耗低成本微控制器STC15L2K60S2和RF 芯片nRF24L01进行信息处理与无线传输, 通过HT82M98A处理后将信息传给计算机,计算机自动完成相应动作。 关键词:微加速度计;无线鼠标;低功耗 目录1.1 总体结构框图- 1 -1.2 系统软件设计- 1 -1.3方案比较- 3 -1.3.1控制器的选择- 3 -1.3.2微加速度计选择- 3 -1.3.3 无线模块的选择- 3 -二、单元模块设计- 4 -2.1 电路的设计- 4 -2.1.1远端控制子系统硬件电路设计- 4 -2.1.2主机端信号接收系统电路设计- 6 -2.2 软件的设计- 6 -2.2.1 ADXL345微加速度计模块程序设计- 6 -2.2.2 HT82M98A鼠标控制器程序设计- 7 -2.2.3 nRF24L01无线模块程序设计- 7 -三、系统调试- 7 -四、设计总结- 8 -参考文献- 8 -附录- 8 -1.远端控制部分电路原理图- 8 -2、主机端接收电路原理图- 9 -一、总体方案设计1.1 总体结构框图本系统主要由无线鼠标发射器、单片机控制系统、无线鼠标接收器和接收系统识别组成。按键单元无线发射微加速度计单片机震动开关(a)远端控制子系统结构框图PC机无线接收单片机 (b)主机端信号接收系统结构框图图1-1 系统框图1.2 系统软件设计(a)远端控制子系统程序流程远端控制用微加速度计获取鼠标的移动信息,每隔5扫描一次。图1-2远端控制子系统程序流程图(b)主机端信号接收系统程序流程 接收电路的主要任务是接收无线鼠标传送的各种数据。接收程序中一次循环所需的时间大约为2.5ms。必须确保在下一个数据包传来之前,完成全部算法及相应处理工作。同时也避免新收到的数据包覆盖前一个数据包。图1-3主机端信号接收系统程序流程图1.3方案比较1.3.1控制器的选择方案一:采用STC89C52.该单片机软件编程灵活、自由度大,功耗低、体积小、技术成熟等优点,得到了广泛应用. 但是51单片内部资源有限,给系统设计过程带来不便。且影响系统控制等各个环节,不便于实时调控。方案二:采用STC15F2K60S2.该单片机包含了89C52的优点,且具有89C52所不具备的一些性能,可不接外部晶振和外部复位电路,使硬件设计更简单;大容量2K字节SRAM;有两个独立串口;内部有8通道高速10位A/D转换器,还具有PWM输出;总的来说,STC15F2K60S2是一种高速,高可靠性,超低功耗的性能更好的单片机。综合以上二种方案,选择方案二。1.3.2微加速度计选择方案一:采用Freescale公司生产的MMA7455L数字输出( IIC/SPI) 微电容调节式加速度感应芯片1。MMA7455L具有X、Y、Z 三个方向的感应轴,X、Y、Z 三个方向上在工作时的参数是不断变化的,代表这一瞬间该芯片在不同方向上移动的趋势,这三个参数通过简单的数学计算可以得到一个空间向量A,向量A 即模拟出了该瞬间芯片在三维真实空间的移动方向,这样,通过不断地采集X、Y、Z的数值,就可以得到鼠标移动的真实轨迹。方案二:采用ADXL345三轴数字加速度传感器,ADXL345 是ADI 公司的三轴数字加速度传感器, 工作原理是首先由前端感应器件感测加速度的大小,然后由感应电信号器件转为可识别的模拟电信号,ADXL345中集成了AD 转换器,可以将此模拟信号数字化,输出的是16 位的二进制补码。最值得一提的它集成了一个32级先进先出(FIFO)存储器管理系统,可用于输出数据的缓冲,降低主机处理器负荷,并降低整体系统功耗。该芯片主要应用于消费电子的微型惯性器件, 最大可感知16 g 的加速度,感应精度可达3.9 mg /LSB,倾角测量典型误差小于1,超低功耗。通过其内置的ADC 将加速度信号转换为数字量存放在片内缓冲区,在实际使用中,为提高输出数据的稳定性,设置感应范围为2 g,感应精度为3.9 mg,可以满足人体动作加速度范围与精度要求。ADXL345可以通过SPI 总线或I2C 总线与单片机连接,本产品选择的单片机STC15F2K60S2 I2C 接口, 但是可以采用I/O 口模拟I2C总线或SPI 总线接口的方法连接。综合以上二种方案,方案二功耗更低,更容易实现,故选之。1.3.3 无线模块的选择在几种短距离无线通信的比较当中,红外方案有一定的方向性,而蓝牙技术比较复杂,价格比较高,而无线射频通信技术无论是从系统开销,电池寿命还是成本方面都占有很大优势,同时它低传输速率的特点,恰恰适合发送信息量非常小的无线鼠标设计。nRF24L01无线射频模块是一款新型单片射频收发器件, 工作于2.4 GHzISM 频段,最高工作速率达2 Mbps,信号空中传输时间很短,极大降低了无线传输中的碰撞现象和电流消耗,该芯片融合了增强型ShockBurst 技术, 能自动处理字头和CRC 效验码,使用方便。该芯片功耗低,在以-6 dBm 的功率发射时,工作电流只有9 mA;接收时,工作电流只有12.3 mA,多种低功率工作模式(掉电模式和空闲模式),使节能设计更方便。二、单元模块设计2.1 电路的设计2.1.1远端控制子系统硬件电路设计远端控制子系统硬件部分主要由主控电路、微加速度计模块电路和无线射频模块电路和按键部分电路等组成。(1)ADXL345 可以通过SPI 总线或I2C总线与单片机连接,我们采用单片机模块STC15L2K60S2的I/O口模拟I2C 总线接口的方法将ADXL345与单片机模块连接起来,SDA连接单片机P4.3口,SCL连接单片机的P4.4口。其具体电路图如图2-1所示。图2-1 ADXL345模块与单片机连接电路原理图(2)NRF24L01的SPI接口可以利用单片机I/O口进行模拟,内部有FIFO可以与各种高低速微处理器接口,便于使用低成本单片机。如图2-2,微控制器通过模拟SPI 总线与nRF24L01 连接,控制信号的接收与处理。图2-2 nRF24L01无线模块与单片机连接电路原理图(3)按键模块主要考虑消抖的问题,我们这里采用软件延时消抖,不过没有采用在主程序中延时,这样很浪费系统资源,而是用定时器延时设置标志变量的方法。按下按键将I/O口电平拉低,具体电路如图2-3所示。图2-3 按键模块电路原理图2.1.2主机端信号接收系统电路设计无线鼠标信号接收电路由无线传输模块nRF24L01、鼠标专用通信芯片HT82M98A、USB 端口及其他外围电路组成。电路如图2-4 所示。图2-4 主机端信号接收系统电路原理图其中,USB端口为HT82M98A提供5 V的电源,无线鼠标信号接收电路中, 其他芯片使用的电源由HT82M98A自带的电压输出端口V33O 提供, 供电电压为3.3 V。无线传输模块接收到发射模块传来的移动信息后由I/O口传递到HT82M98A,HT82M98A 再将数据传送到电脑的USB 口。HT82M98A 的端口USBD+/CLK 连接USB 数据正端;USBD-/DATA连接USB 数据负端。X1、X2 表示鼠标前后移动时(X 方向) 图像的数据;Y1 、Y2 表示鼠标左右移动时(Y 方向) 图像的数据。Z1、Z2 表示鼠标中间滚轮转动的信号数据;M、R、L表示鼠标的左、中、右键按下时的数据;OSC1 、OSC2 外接6 MHz 晶振;RESET 表示复位输入端, 启动时硬件自动复位。2.2 软件的设计2.2.1 ADXL345微加速度计模块程序设计微加速度计ADXL345 与微处理器之间通过I2C 总线连接, 它们之间的数据传输需要遵循I2C 总线协议, 寄存器0x32 至寄存器0x37 分别保存x、y、z 轴输出数据,输出数据为二进制补码,DATAx0 为最低有效字节,DATAx1 为最高有效字节,其中x 代表X、Y 或Z。因为ADXL345 为16 位数据格式,从数据寄存器中获取加速度数据后,用户必须对数据进行重建。我们利用接口函数Multiple_read_ADXL345()多字节连续读取寄存器的数据, 然后将高字节左移8 位和低字节8位相或的方法对数据重建, 且对我们来说, 只需X 和Z 方向的加速度数据即可,程序如下:float temp;dis_data=(BUF38)+BUF2; /合成数据 if(dis_data0)dis_data=-dis_data;temp=(float)dis_data*3.9; /计算数据value_y=temp;2.2.2 HT82M98A鼠标控制器程序设计HT82M98A的Z2、Z1、Y2、Y1、X2、X1分别与单片机的I/O口相连,这6个I/O口输出高低电平状态使鼠标的光标移动,这些移动的序列构成一个状态机,向X1、X2输出图2-5的波形时可以得到如下信息:图2-4 X1/X2的状态机输入在语言程序中用positive a和positive b代表上面的波形。当循环向HT82M98A 的X1、X2引脚输出这组波形时,光标右移。假设获取X 的移动值为50,则光标需要移动50个单位长度,移动过程如下:Initialise_state(void)函数用于初始化状态机:Shifxa=positivea;/204Shifxb=positiveb;/102Shift=0;判断这两个变量的最高位,为1则输出为高,为0则输出为低。判断1次代表移动一个像素,然后X 的值减1;Shifxa和Shifxb向左移一位,用于检测下一个状态值,Shifxa加1代表向左移了1位,为8意味着Shifxa向左移了8位。此时Shifxa=0需要重新赋值并进入下一个循环。2.2.3 nRF24L01无线模块程序设计进行数据传输时,发送方将按照无线通信协议封装后的数据存入发送数据缓冲队列,启动发送,发送完成后,发送方自动转入接收模式,准备接收应答信号。若在设定的等待时间内,接收到应答信号则视为发送成功,则发送方自动清空发送数据缓冲队列,进入下一次发送过程或转入待机模式;若在设定的等待时间内,没有接收到应答信号,则视为发送失败,发送方将自动重发数据,当自动重发次数超过设定值时,产生中断。接收方不断检测射频信号,发现有效数据包时,便将其存入接收数据缓冲队列,并产生中断,接收完成后,自动转入发送模式,发送应答信号。三、系统调试本设计的硬件电路由发射和接收电路组成,其中接收电路安装在电脑附近,由电脑USB接口提供5V电源。发射电路先采用ADXL345加速度传感器检测鼠标的移动信息,然后输出到单片机I/O口,经无线模块将此信息发射到接收电路。接收电路接收到移动信息后,根据鼠标位移状态机解码算法,得到移动信息及按键信息,通过HT81M98A处理后将信息传给计算机,计算机自动完成相应动作。然后不断的循环。每一次鼠标信号处理总时间不大于1,计算机自动识别无线鼠标,不需要额外安装程序,无线鼠标移动灵活。经测试,该电路不仅具备普通有线鼠标的全部功能,还可远距离灵活操纵鼠标。四、设计总结此次的设计,其实也是我们所学知识的一次综合运用,让我深深的认识到了做电子设计要有一定的基础,要有电子技术方面的数字电路和模拟电路等方面的理论基础,特别是数字电路;也要有编程语言的汇编语言或C语言。我们不能学到后面就忘了前面的知识,更应该将所学的知识紧紧的结合在一起,综合运用,所谓设计,就是要求创新,只有将知识综合运用起来才能真正的设计好。参考文献1叶达,程勇,薛庆军.基于2.4GHz 射频通信的多功能鼠标设计J.单片机与嵌入式系统应用,2王海红.双轴加速度传感器ADXL210E 及在三维鼠标中的应用J.科技信息,2010(18):216.3陈义华.基于加速度传感器的定位系统研究D.厦门:厦门大学,2006.附录 电路原理图1.远端控制部分电路原理图2、主机端接收电路原理图为你提供优秀的毕业论文参考资料,请您删除以下内容,O(_)O谢谢!A large group of tea merchants on camels and horses from Northwest Chinas Shaanxi province pass through a stop on the ancient Silk Road, Gansus Zhangye city during their journey to Kazakhstan, May 5, 2015. The caravan, consisting of more than 100 camels, three horse-drawn carriages and four support vehicles, started the trip from Jingyang county in Shaanxi on Sept 19, 2014. It will pass through Gansu province and Xinjiang Uygur autonomous region, and finally arrive in Almaty, formerly known as Alma-Ata, the largest city in Kazakhstan, and Dungan in Zhambyl province. The trip will cover about 15,000 kilometers and take the caravan more than one year to complete. The caravan is expected to return to Jingyang in March 2016. Then they will come back, carrying specialty products from Kazakhstan A small art troupe founded six decades ago has grown into a household name in the Inner Mongolia autonomous region. In the 1950s, Ulan Muqir Art Troupe was created by nine young musicians, who toured remote villages on horses and performed traditional Mongolian music and dances for nomadic families. The 54-year-old was born in Tongliao, in eastern Inner Mongolia and joined the troupe in 1975.He says there are 74 branch troupes across Inner Mongolia and actors give around 100 shows every year to local nomadic people. I can still recall the days when I toured with the troupe in the early 80s. We sat on the back of pickup trucks for hours. The sky was blue, and we couldnt help but sing the folk songs, Nasun says. The vastness of Inner Mongolia and the lack of entertainment options for people living there, made their lives lonely. The nomadic people were very excited about our visits, Nasun recalls. We didnt have a formal stage. The audience just sat on the grass. Usually, the performances became a big party with local people joining in. For him, the rewarding part about touring isnt just about sharing art with nomadic families but also about gaining inspiration for the music and dance. Ulan Muqir literally translates as red burgeon, and todays performers of the troupe still tour the regions villages and entertain nomadic families, but their fame has spread around the world. On May 16 and 17, nearly 100 singers and dancers from the troupe performed at Beijings Poly Theater. Their show, titled Ulan Muqir on the Grassland, depicted the history and development of the art troupe. Being from the region allowed me to embrace the culture of Inner Mongolia and being a member of the troupe showed me where I belonged, Nasun, the art troupes president, who is also a renowned tenor, tells China Daily. During a tour in 1985, he went to a village and met an elderly local man, who told him a story about his friendship with a solider from Shenyang, capital of Northeast Chinas Liaoning province, decades ago. The solider gave the old man a handmade saddle when they bid farewell. The story inspired Nasun to write Carved Saddle, a song that later became one of his most popular numbers. Now, every year, Nasun recruits young singers and dancers for the troupe. The troupe has also designed a new repertoire, which is mostly based on the daily lives of Mongolian people, especially the lives of nomadic families, and has combined contemporary musical elements with folk songs of the region. Haimu, a 25-year-old khoomei (a local variant of overtone singing) singer, joined the troupe three years ago. Along with a six-member band, he performs fast songs and soft ones that he writesall while playing the horse-head fiddle.Although I learned the piano since childhood and grew up listening to various kinds of music, to me, the folk music of Inner Mongolia is the root, he says. Performing in remote villages is pleasant. I feel at home on the boundless grasslands, and the warm people there make me feel fulfilled. The first round of spring auction season in Beijing ended last week, but it failed to create much spring in the art market. Although two pieces of Chinese painting fetched more than 100 million yuan, the decline in trading volume and sale rate showed a downturn this year. In the “Grand View: Chinese Painting Highlight” session at China Guardian 2015 spring auctions, Pan Tianshous representative work Eagle, Rock and Flora hit a record auction price of 279 million yuan, while Li Kerans masterwork Jinggang Mountain fetched 126.5 million yuan, an unexpected high in recent years. However, the trading volume fells to 1.87 billion yuan from 2.22 billion yuan in the same period the year before. The Huangchen 2015 Spring Auctions, which recorded 42.5 million yuan in total sales, experienced the same. The section number went down to 5 from 12 compared to last year. According to expert Shao Jianwu, the art market did not attract much excitement this year due to the booming stock market and the persistent problems of forgery and fake deals. The two pieces of Chinese painting notched up high price this spring due to their own value not due to a revival in the market. The successful transaction of two works with a hammer price of more than 100 million yuan once again confirms that valuable and rare works of high quality always earn the long-lasting high price. Chinese painting and calligraphy is still the pillar of the market. However, the overall sales rate has dropped slightly, which reflects the demand for the ordinary auction goods has weakened,” said the president of China Guardians Hu Yanyan. Besides, the entry of new buyers also makes certain changes to the direction of purchasing. In a word, the overall market trend is very unpredictable. Although China Guardian 2015 Spring Auctions has achieved remarkable results, it does not mean that the market has walked out of the predicament. We still have to wait for the big economic boom to invigorate the art market.” Even so, the hot pursuit of some special items appeared this spring. A special session of China Guardian Spring Auctions titled “Fine GiltBronze Buddhist Images” achieved a great deal with total sales volume of 41.89 million yuan and 92 percent sale rate. The 5th Shamar Rinpoche Statue from 16-17th century of Tibet was sold for 5.06 million yuan. The Beijing Chengxuan Auctions featured almost 2,800 items of coins and stamps in three sessions with good sale rate. The Huachen Auctions also set a special session of photographs under the condition of large-scale decline of auction sessions. There was a palpable dull thud of disappointment that accompanied the return of the imperial entourage of Zhen Huan to her homeland. It followed a couple years of hushed excitement as Chinese fans were fed tidbits about their proud concubine who was supposed to conquer the high ground of the North American market. Zhen Huan is, of course, the title character of The Legend of Zhen Huan, a 2011 television series that swept China off its feet and later took other Asian countries by storm. Two years ago, it was reported that HBO, a premium cable service headquartered in the United States, was going to air it in North America after some modification. Now, a condensed version that provides English subtitles but no dubbing has finally been made available on Netflix for online streaming. This version, highly anticipated as a milestone in Chinas cultural foray overseas, has been widely panned by its home audience. Retitled Empresses in the Palace, the American version has been shortened from its original 76 episodes at 45 minutes each, to six 90-minute episodes. The quick pacing threw off many native viewers, who are accustomed to a more leisurely daytime-soap-style narrative rhythm. (Chinese TV stations would run two or three episodes every day.) I did not finish the full-length version and found the truncated one not difficult to follow. Whats lost, I believe, are the interesting setups and pauses that illuminate the Chinese art of storytelling. Much of the plot is still there. It is the flavor that was sacrificed. The American edition uses the framework of the Empress Dowager in her senior years reminiscing at the beginning and the end of each episode, hinting at whats to come and recapping the key points. This device, not used in the original, is culturally understandable but artistically mediocre. What puzzles me is the two new songs for the opening and end credits. They were written in English, but sung by Chinese with an uncomfortable accent. They were obviously designed to appeal to an English-speaking base, but do not jibe with the Chinese dialogue. Speaking of the dialogue, the English translation, picked apart by some Chinese, is too literal for my taste. I can imagine a typical American hit by a flurry of royal ranks, addresses and greetings, even multiple names and titles for the same person. The first half hour must be a swamp to wade through, very much like my experience of getting through a Tolstoy tome with its endless inflections of names transliterated into lengthy Chinese. I see the choice of verbatim translation as an effort for conveying exotica. It is fairly competent, with no error that I could detect, but fails to rise above words or capture the essence of the language. A cultural product usually crosses over to a foreign territory first by an emphasis on the commonalities. But whether inside or outside China, the temptation to sell it for the differences is just too great. Sure, the sumptuous sets and costumes are a big attraction, but the narrative technique has becomehow shall I put it?a bit anglicized, which is necessary for cultural export. Judging by the responses, this legend, which, contrary to the claim of the English trailer, is totally fictitious, has departed from China but not yet landed on American shores. I am a big fan of Ralph Waldo Emersons essay titled Self-Reliance. If youve not yet read it, I strongly encourage you to do so. In this essay, the venerable Emerson talks about eschewing the trappings of society and finding ones own path. He urges the reader to find rectitude and lead a moral life. He professes that, only by being self reliant, as opposed to relying on the government and being dictated to by society, can one begin leading a decent and purposeful life. He avers that such a life is the only life worth living. I agree with him. This essay was written during a time of social upheaval in America, and it is rather odd that Emerson authored it, as he was a part of the upper crust of society at the time. It just so happened that he looked around him, at the indolence and the wantonness of the people in his circle; he wondered how in the world he came to belong there. Indeed his penning and publishing this essay caused his excommunication from high society and also caused him a lot of legal trouble. The legal trouble came as a result of

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论