Hiii Friends. RT-Thread is Launching EmbeddedDev 2021!
Develop a project running Opensource RT-Thread Real-time Operating System to win Cash Prize of 500$ and Free Hardware GiveAway. Enter the Event: bit.ly/3eg2feQ


Back to the Hands Writing Robot Project.


Development Environment

Hardware:ART-PI、arduino、TM4C123GXL
RT-Thread Inside:v3.14
Development Tool:MDK-ARM5.31、VSCode

RT-Thread in this project

Kernel: Thread Scheduling、Resource Allocation、Synchronous Communication、Device-driven Frameworks.
Components: DFS File System、UART Serial Asynchronous Communication、CAN Communication.
Others: UDP Communication、cJSON Codec

Hardware Architecture

Alt Text

Software Architecture

  • Image processing module
  • Motion control module
  • G code generation module

The image processing module is responsible for pre-processing image files such as text images and photographs, removing clutter, and then decoding the image with appropriate algorithms, de-emerging the main information, and then extracting the outline skeleton to fit the machine writing.

The motion control module is one of the most complex modules in a writing robot, responsible for the precise and fast movement of each motion body. After receiving the G-code instruction, it is required to combine all the instruction information received for generating an appropriate initial speed and the maximum running speed of the current instruction, proceed with the linear interpolation according to the motion trajectory, and finally send pulses to the motor according to the SPTA trapezoidal acceleration and deceleration algorithm.

The G-code generation module serializes the image outline and then plans the path, selects a suitable machining precision, and then generates the NC processing file according to the G code specification that commonly used in CNC machining. In addition, for standard DXF files, G code is generated by file resolution.

Software Module Introduction

grbl is a high-performance, low-cost open-source CNC controller that delivers high-speed, precise motor control pulses based on the ATmega 328 chip. It accepts standards-compliant g-code, and includes full acceleration management with look ahead, to deliver smooth acceleration and jerk-free turning action.

As grbl includes full acceleration management with look ahead. That means the grbl controller needs to maintain 16-20 G code instructions. This requires ART-PI to send G-code instructions in a timely manner by reading the grbl controller buffer state to avoid buffer overflows and buffer emptying.

Therefore, RT-Thread real-time operating system is indeed for this project. By reading the NC file on the SD card, and communicate with the grbl controller, to control the devices running smoothly. In addition, RT-Thread has a wealth of human-computer interaction features so you may real-time display the device work path, progress and status on the screen, and may also add the features of resume breakpoint and many others.

Source Code

https://gitee.com/qiao_cg/grbl

Presentation

Alt Text


Presentation Video: 





RT-Thread Contact Info:

Website | Github | Twitter | Facebook | Youtube