This post ends with OREO Yu 2021-9-14 14:50 edit
Mini Writing Machine
preface: Have you ever tried using a laser cutting machine to cut mechanical parts, such as phone stands, small decorations, pen holders, and other items that are assembled through card slots? thisThis project utilizes servo motors in conjunction with laser cutting mechanical parts to achieve precise marking and writing control with a marker pen. We believe that through the design concept of this project, we can create more creative maker works.
*To ensure a reading experience, it is recommended to use a computer to view the tutorial section of this page *It is recommended to read all tutorial sections in their entirety before starting to purchase parts
agreement: This work adopts the Creative Commons Attribution-Non commercial use-Sharing in the same way 4.0 International license agreement for licensing.
When you use the drawings or source code related to this work, it is deemed that you agree to and comply with the contents of this agreement.
Project Information:
LaserMakerSource file: Contains laser cutting drawings for shell, internal mechanical structural parts, etc
MicroPythonControl board source code: including control board program source code
Computer side program: includes a computer side font parsing program, used in conjunction with the control board *Please download the updated content and historical versions of this version at the end of this post"Update content"View in the middle
Material Preparation/Software installation:
Material List:
[Attention]The program is based onmicroPythonWrite, but do not guarantee all runsmicroPythonThe platform can run the code normally.
The program has currently been adapted for the following hardware/Verify and ensure the normal operation of the program:
Control board:
Sheng SiLABPLUSControl board, firmware versionV2.3.0Purchase address:https://m.tb.cn/h.fYCjvsX?sm=c6a13a
DFROBOTControl board, firmware versionV2.1.0Purchase address:https://www.dfrobot.com.cn/goods-1902.html
Tool List: Software used:
tutorial production/Demonstration effect: Notes: ·[supplement
add
replenish
complement]Copper columns should use hexagonal parts20mmLength, excluding external thread length ·When tightening the locking nut, do not tighten it too tightly. The friction between the parts should be based on the fact that when only one of them is held, the other can slide freely ·Before installing the servo, be sure to use the control board to power on and reset the servo to the default angle Pin definition: ·Dot the servo:0 ·Swing arm servo:1 ·Stepper motorA:13 ·Stepper motorB:14 ·Stepper motorC:15 ·Stepper motorD:16 If the phone cannot redirect, please copy to the browser address and open: - https://www.bilibili.com/video/BV1Lg411V7Vp/
Copy code[Attention]This link is a diversity connection, please click "Gobilibili”Link Jump Play View Full Tutorial Video
Usage tutorial:
Mini Writing Machine Menu Button Instructions:
P: Previous option
Y:Paper return (only available on specific interfaces)
T:retain
H:retain
O:Paper feed (only available on specific interfaces) N: Next option
A: Confirm
B: Return
Parameter Adjustment Tutorial: Follow the upload steps in the video tutorial to modify the source code of the control boardconfig.pyAfter uploading the internal parameters, simply upload them back to the control board 1.Adjust the step delay of the swing arm servo and dot servo to a larger value first(200ms)Left and right, ensure that the servo has sufficient operating time: Swing arm servo -> Step delay:200Or higher Dot the servo motor -> Lift delay:200Or higher Dot the servo motor -> Descent delay:200Or higher 2.Disable compensation algorithm Before starting the adjustment, please set all the parameters related to the compensation algorithm to0To prevent the intervention of compensation algorithms from affecting the adjustment effect: Swing arm servo -> Dead zone compensation:0 Swing arm servo -> angel_fix: Within the array16All numbers are set as0 Dot the servo motor -> angel_fix:0 3.Select the dot calibration test in the development and debugging tool, adjust the servo parameters until the pen tip can evenly print error lines and patterns
Adjust the basic parameters first,Finally, adjust the parameters of compensation algorithm Compensation algorithm adjustment sequence: Dot the servo motorAngel fix -> Dead zone compensation for swing arm servo motor -> Swing arm servoAngel fix
For the description of the functions of each parameter, please refer to the comments in the configuration file. Here, we specifically explain the compensation algorithm parameters:
Swing arm servo -> Dead zone compensation: When the swing arm servo moves in the opposite direction (the pen head returns to the first row), the accuracy may decrease due to the dead zone(Baidu Baike Explanation on Dead Zone)Dead zone compensation refers to using the return angle of additional motion to offset the dead zone
Swing arm servo -> angel_fixDuring development, it was discovered that servos have different effects onPWMInconsistent sensitivity of intervals, i.e. outputPWMThe change in servo angle is not linear,Angel fixParameters can affect every step of the program outputPWMPerform individual compensation, from left to right within the array16Number corresponds vertically from top to bottom16Extra compensation for steps (positive value)Down, negative values up)Before adjusting other parameters of the swing arm servo, all values here should be0If any value is not0Please modify and readjust the parameters of the swing arm servo motor,Angel fixIt should be the last step in the parameter adjustment process
Dot the servo motor -> angel_fixCompensate for the tilting of the paper lifting structure caused by installation, which usually occurs when one side of the rudder head is higher and the other side is lower. When the lower part cannot be tapped (the pen tip is not in contact with the paper), set it as a positive value; When the upper part cannot be dotted, set it as a negative value
4.Select the swing arm calibration test in the development and debugging tool, and adjust the step distance of the stepper motorPWMValue until the printed pattern is square 5.Reasonably set the delay of the servo motor to ensure sufficient action time for the servo motor The smaller the delay setting of the servo motor, the faster the printing speed, but the time left for the servo motor to operate is also smaller. When the value is too small, it may cause the servo motor to send a return signal before reaching the specified angle, resulting in a decrease in printing effect Swing arm servo -> Step delay Dot the servo motor -> Lift delay Dot the servo motor -> fall delay
Custom print content:
Using the program folder on the computerexeProgram generates custom text files
Wireless connection (recommended):
firstconfig.pySet up in the middleWiFiAnd computerIPconfiguration,Then select Wireless Connection from the Mini Writing Machine menu(Beta)function,And start the program folder on the computer sideexeProgram, enter text and file name, click the load button to transfer the file to the control board, click print to immediately print the text content
Wired connection:
Start the program folder on the computerexeFile, enter text and file name, click the load button to display successfully, then enteroutputFolder, find the corresponding file name, and then follow the steps in the video tutorial to upload the file generated by the program.binFormat files to the control boardbinIn the folder, restart the control panel to see the new files under the user files.
binOnce the file is uploaded to the control board, it can be printed offline. When printing again, there is no need to connect to a computer, simply select the corresponding file
doubt/Suggestions for improvement/BUGFeedback
Any feedback about this project is welcome through the comment section, and I will reply as soon as I see it.
Supported functions: Pen head path optimization: already supported Pen path prediction: already supported Print Preview: Supported Printing pause: already supported
Menu Function Interface: Supported
Servo dead zone compensation algorithm: already supported
Servo step compensation: Supported Wireless file transfer: Supported
Offline printing: already supported
Automatic screensaver/Auto screen off: already supported
Features to be supported:(There are too many holes dug, fill them slowly haha)
First usemicroPythonProgramming, there are many areas that I haven't figured out yet, take your time to study haha
Bidirectional Printing: Planned Support
Cancel print task: Planned support A flashing program/An update program: Planned support Remote Printing Task: Planned Support
use directlyTCPConnection: Planned Adding custom character editor to computer program: planned mDNSNo lossIPConnect computer:in the plan
Optimization of parsing program: planned Touch key anti misoperation optimization: planned No computer program parsing (offline parsing): Planned
Parameter Adjustment Tutorial: Planned Usage tutorial: Planned
Program Description: The project program uses a multi file structure and calls modules to each other to achieve handwriting functionality. In general, only changes are neededconfig.pyThe parameters in can be used. If there is a need to change the code, please refer to the following information to locate the code that needs to be changed: config.pyThe configuration file lists the parameters that can be changed for the writing machine main.pyMain program, program main loop implemented in this file (including startup, menu content declaration, etc.) printer_core.pyCore program, including the implementation of parsing, printing and other related functions printer_file_system.py: File system function encapsulation printer_global_variable.pyGlobal variables are uniformly stored in this file printer_gui.pyScreen function implementation, including automatic centering of text, automatic updating of display, file preview, etc printer_gui_menu.pyImplementation of menu interface functions printer_info.py: Includes author information, program version, and other related details *Please do not modify the version number arbitrarily, as updates may be implemented according to the version number in subsequent updates printer_input.py: Includes implementation of input event preprocessing printer_network.pyImplementation of network related functions, including network connection, automatic download of local area network files, etc printer_servo.pyImplementation of control functions including dot servo and swing arm servo printer_stepper.pyImplementation of stepper motor control function
Update content: *Please see the latest version above"Project materials"Download in the middle 210914: Control board program: ·Core programstructureoptimize
enhance
improve
refine ·Logic optimization of pen trajectory prediction algorithm ·Optimization of servo motor library ·Optimization of stepper motor library ·Used itloggingUnified management and operation of moduleslog ·Removed screensaver function 210830: Download the old version: Control board program: ·Use parsing program insteadFrameBufferClass parsing, significantly improving parsing speed and significantly reducing storage usage ·Logic optimization of pen trajectory prediction algorithm ·Removed dot calibration mode (due to changes in the core program, this mode is no longer supported in the new architecture, please use dot calibration testing as a replacement) ·Optimization of core program structure (departing from global variable references and using module internal structures instead) Directory structure: ·New Material List ·New Tool List
210828: Download the old version:
·The first open source version of the project
|