DF9GMS 180° 微型舵机

简介

由DFRobot 出品的DF9GMS 180°微型舵机,该舵机采用高强度ABS透明外壳配以内部高精度尼龙齿轮组,加上精准的控制电路、高档轻量化空心杯电机使该微型舵机的重量只有9克,而输出力矩达到了惊人的1.6kg/cm。

技术规格

工作电压:4.8V 转矩:1.6kg/cm(4.8V) 速度:0.14秒/60度(4.8V) 使用温度:-30~+60摄氏度 死区宽度:0.5毫秒 外形尺寸:23x12.2x29mm 重量:9g

组成结构及工作原理

PWM控制原理

连接图

示例代码

/* Sweep
  by BARRAGAN <https://barraganstudio.com>
  This example code is in the public domain.

  modified 8 Nov 2013
  by Scott Fitzgerald
  https://www.arduino.cc/en/Tutorial/Sweep
*/

#include <Servo.h>

Servo myservo;  // create servo object to control a servo
// twelve servo objects can be created on most boards

int pos = 0;    // variable to store the servo position

void setup() {
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object
}

void loop() {
  for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
    // in steps of 1 degree
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }
  for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }
}

Mind+ 上传模式编程

  1. 下载及安装软件。下载地址:https://www.mindplus.cc 详细教程:Mind+基础wiki教程-软件下载安装
  2. 切换到“上传模式”。 详细教程:Mind+基础wiki教程-上传模式编程流程
  3. “扩展”中选择“主控板”中的“Arduino Uno”,“执行器”中加载“舵机模块”。 详细教程:Mind+基础wiki教程-加载扩展库流程
  4. 进行编程,程序如下图:
  5. 菜单“连接设备”,“上传到设备”

结果

代码上传完成后,舵机从0度到180度再到0度循环转动。

Mind+ Python模式编程(行空板)

Mind+Python模式为完整Python编程,因此需要能运行完整Python的主控板,此处以行空板为例说明

连接图

注意:

1、初始化舵机引脚仅支持 P0、P2、P3、P8、P9、P10、P16、P21、P22、P23,积木块中标注 “ ~ ” 的引脚

2、如果使用的是大舵机,因为大舵机需要的电流较大,所以应该使用扩展板连接并独立供电

操作步骤

1、下载及安装官网最新软件。下载地址:https://www.mindplus.cc 详细教程:Mind+基础wiki教程-软件下载安装

2、切换到“Python模式”。“扩展”中选择“官方库”中的“行空板”和“pinpong库”中的”pinpong初始化“和“舵机”。切换模式和加载库的详细操作链接

3、进行编程

4、连接行空板,程序点击运行后,可在终端查看数据。行空板官方文档-行空板快速上手教程 (unihiker.com)

代码编程

以pinpong库为例,行空板官方文档-行空板快速上手教程 (unihiker.com)

#  -*- coding: UTF-8 -*-

# MindPlus
# Python
from pinpong.extension.unihiker import *
from pinpong.board import Board,Pin
from pinpong.board import Board
from pinpong.board import Servo
import time


Board().begin()
servo1 = Servo(Pin((Pin.P21)))
pos = 0

while True:
    while not ((pos == 180)):
        servo1.write_angle(pos)
        pos = (pos + 1)
        time.sleep(0.1)
    while not ((pos == 0)):
        servo1.write_angle(pos)
        pos = (pos - 1)
        time.sleep(0.1)

常见问题

还没有客户对此产品有任何问题,欢迎通过qq或者论坛联系我们!

<File:nextredirectltr.png>购买 DF9GMS 180° 微型舵机(SKU:SER0006)