mirror of
https://github.com/m5stack/m5-docs.git
synced 2026-05-20 10:23:01 -07:00
4.9 KiB
4.9 KiB
Module STEPMOTOR {docsify-ignore-all}
📝描述 :octocat:例程 🔌原理图 🛒购买链接
EasyLoader
描述
STEPMOTOR 是M5Stack堆叠模块系列中的一款,步进电机驱动模块.该模块能够通过 GRBL 库同时驱动3个步进电机.因此非常适合应用在运动控制项目.
模块内置MEGA328P,并且搭载GRBL固件,通过I2C(0x70)与M5Core通信.
集成 3 片由 DRV8825 芯片组成的步进电机驱动板,一个简单但非常强大的电路板,可以控制一个双极步进电机,并允许微步进高达1/32步。
产品特性
- 电源输入:9-24V
- 控制3路步进电机 (X, Y, Z)
包含
- 1x Step Motor 模块
- 1x 12V 电源 (选配)
- 1x 5V FAN 模块,用于散热 (选配)
- 产品尺寸:54.2mm x 54.2mm x 12.8mm
- 产品重量:23.5g
应用
- DIY 3D 打印机
- 搭建机械臂
相关链接
EasyLoader
1.EasyLoader是一个简洁快速的程序烧录器,每一个产品页面里的EasyLoader都提供了一个与产品相关的案例程序.
2.下载软件后,双击运行应用程序,将M5设备通过数据线连接至电脑,选择端口参数,点击 "Burn" 即可开始烧录
!>3.EasyLoader烧录前需要安装有CP210X(USB驱动程序),点击此处查看驱动安装教程
例程
1. Arduino IDE
以下代码仅为片段,如需获取完整代码, 请点击此处..
/*
If Button A was pressed,
stepmotor will rotate back and forth at a time
*/
#include <M5Stack.h>
#include <Wire.h>
#define STEPMOTOR_I2C_ADDR 0x70
// initialization
M5.begin();
Wire.begin();
// Controlling Protocol:
// G<n> X<distance>Y<distance>Z<distance> F<speed>
SendCommand(STEPMOTOR_I2C_ADDR, "G1 X20Y20Z20 F500");
SendCommand(STEPMOTOR_I2C_ADDR, "G1 X0Y0Z0 F400");
// Get Data from Module.
Wire.requestFrom(STEPMOTOR_I2C_ADDR, 1);
if (Wire.available() > 0) {
int u = Wire.read();
if (u != 0) Serial.write(u);
}
// Send Data to Module.
while (Serial.available() > 0) {
int inByte = Serial.read();
SendByte(STEPMOTOR_I2C_ADDR, inByte);
}
/*
If Button A was pressed,
stepmotor will rotate back and forth at a time
*/
#include <M5Stack.h>
#include <Wire.h>
#define STEPMOTOR_I2C_ADDR 0x70
// initialization
M5.begin();
Wire.begin();
// Controlling Protocol:
// G<n> X<distance>Y<distance>Z<distance> F<speed>
SendCommand(STEPMOTOR_I2C_ADDR, "G1 X20Y20Z20 F500");
SendCommand(STEPMOTOR_I2C_ADDR, "G1 X0Y0Z0 F400");
// Get Data from Module.
Wire.requestFrom(STEPMOTOR_I2C_ADDR, 1);
if (Wire.available() > 0) {
int u = Wire.read();
if (u != 0) Serial.write(u);
}
// Send Data to Module.
while (Serial.available() > 0) {
int inByte = Serial.read();
SendByte(STEPMOTOR_I2C_ADDR, inByte);
}
2. UIFlow
想要探索最简单的 Step motor 编程驱动方式吗?快试试Blockly编程平台UIFlow.
以下代码仅为片段,如需获取完整代码, 请点击此处..
原理图


