摘要
在信息化发展迅速的当今时代背景下,人工智能与大数据成为热点话题,吸引了大部 分人的关注,尤其是智能机器人更是令不少人为之折腰。计算机技术的飞速发展,让机器 人渗入的领域更加广泛,代替人类进行的工作种类也越来越多。过快的发展、过多的需求 以及领域的过于广泛反而容易让人们更沉浸于让机器人去代替原本人类进行的简单劳动, 却忘记了一些原本就是大机器做的工作,比如绘图技术方面。绘图技术应用在很多设计方 面,譬如服装设计、工业设计、教育教学、工程设计等。但就我查询得知,在目前很多还 是采用由专业人士绘画出来之后,利用打印机进行打印或者彩印,对于普通的设计人员来 说,并不是合适的选择。因此我们设计了一种更为低成本切对纸张无特殊要求的绘图机。 本设计采用 STM32 单片机作为处理控制的核心单元,结合使用上位机控制软件通过图
像处理将位图转化为笔的路径信息,信息经串口发送到 STM32 控制器。控制器利用 Bresenham 直线算法计算前后的两个坐标之间的线段各点坐标,通过各点的位置转换为驱 动步进电机转动的脉冲量、方向等量,最终达到控制笔头移动。绘图方案为绘制轮廓图。 该设计方案可靠,成本低廉,同时拥有良好的绘图精度,该机器人能够应用于各种草图的 绘制等领域。
关键字:STM32;Bresenham;图像处理;绘图机器人
Abstract
In the current era of rapid development of information technology, artificial intelligence and big data have become hot topics, attracting the attention of most people, especially intelligent robots, which are many people who are bent over. The rapid development of computer technology has made the field of robot penetration more extensive, and there are more and more types of work to replace humans. Too fast development, excessive demand, and too broad a field tend to make people more immersed in letting robots replace the simple labor that humans have done, but forget some work that was originally done by large machines, such as drawing technology. Drawing technology is used in many design aspects, such as fashion design, industrial design, education and teaching, engineering design. However, as far as I can find out, many of them are still used by printers for printing or color printing after being painted by professionals. It is not a suitable choice for ordinary designers. Therefore, we have designed a plotter that has no special requirements for paper at a lower cost.
The design adopts the STM32 single-chip microcomputer as the core unit of processing control. Combined with the upper computer control software, the bitmap is converted into the path information of the pen through image processing, and the information is sent to the STM32 controller through the serial port. The controller uses the Bresenham line algorithm to calculate the coordinates of the points of the line between the two coordinates before and after, and converts the position of each point into the pulse amount and direction of the stepping motor to finally control the movement of the tip. The drawing scheme is to draw a contour map. The design is reliable, low cost, and has good drawing accuracy. The robot can be applied to various sketches and other fields.
Key words: STM32; Bresenham; Image processing; Drafting robot
目录
第一章 绪论 1
1. 基于 stm32 微控制器的绘图机器人研究设计的目的 1
2. 基于 stm32 微控制器的绘图机器人研究设计的设计功能 1
第二章 系统整体方案设计 2
第三章 硬件设计 4
1. 硬件电路资源使用设计 4
1.1 STM32F103RBT6 片上资源 4
1.2 外围芯片资源 4
2. 机械结构设计 5
3. 通信原理 9
第四章 软件设计 11
1. 上位机程序设计 11
1.1 二值化算法 11
1.2 轮廓化算法 13
1.3 描边算法 14
1.4 串口通信数据格式 16
2. 下位机程序设计 17
2.1 缓冲区算法 17
2.2 Bresenham 直线算法 17
2.3 坐标轴的确定 19
第五章 系统调试与实验结果 21
1. 系统调试 21
2. 实验结果 24
参 考 文 献 25
致 谢 26
附 录 27