1. 功能说明
本文示例将实现R327a样机——一款5工序的小型流水线模型,包含铸锭送料、传送、搬运、模拟加工、码垛5个工序。
2. 结构说明
小型流水线主要是由铸锭送料结构、传送机构、搬运机构、模拟加工机构、码垛机构5部分组成。
3. 电子硬件
在这个示例中,我们采用了以下硬件,请大家参考:
主控板 | Basra主控板(兼容Arduino Uno) |
扩展板 | Bigfish2.1扩展板 |
传感器 | 白标传感器 |
电池 | 7.4V锂电池 |
电路连接:白标传感器连接在Bigfish扩展板的A0;
舵机分别连接在Bigfish扩展板的D4、D3、D8、D11、D7;
电机分别连在Bigfish扩展板的(9,10)、(5,6)接口。
4. 功能实现
编程环境:Arduino 1.8.19
实现思路:实现小型流水线铸锭送料、传送、搬运、模拟加工、码垛的功能。
将参考例程(sketch_may11a.ino)下载到主控板,实验效果可参考官网演示视频。如果没有达到预期的效果,大家可尝试改变例程中的参数进行调试。
/*------------------------------------------------------------------------------------版权说明:Copyright 2023 Robottime(Beijing) Technology Co., Ltd. All Rights Reserved.Distributed under MIT license.See file LICENSE for detail or copy athttps://opensource.org/licenses/MITby 机器谱 2023-05-11 https://www.robotway.com/------------------------------*/#include <Servo.h>Servo servo_pin_4;Servo servo_pin_3;Servo servo_pin_8;Servo servo_pin_11;Servo servo_pin_7;int _ABVAR_1_i = 0 ;void setup(){pinMode( 14, INPUT);servo_pin_4.attach(4);servo_pin_3.attach(3);servo_pin_8.attach(8);servo_pin_11.attach(11);servo_pin_7.attach(7);pinMode( 9 , OUTPUT);pinMode( 10 , OUTPUT);pinMode( 5 , OUTPUT);pinMode( 6 , OUTPUT);servo_pin_4.write( 120 );servo_pin_3.write( 170 );servo_pin_8.write( 80 );servo_pin_11.write( 10 );servo_pin_7.write( 120 );delay( 1000 );}void loop(){if (!( digitalRead(14) )){for (_ABVAR_1_i= 1; _ABVAR_1_i<= ( 70 ); _ABVAR_1_i++ ){servo_pin_4.write( ( 120 - _ABVAR_1_i ) );delay( 10 );}delay( 1000 );for (_ABVAR_1_i= 1; _ABVAR_1_i<= ( 70 ); _ABVAR_1_i++ ){servo_pin_4.write( ( 50 + _ABVAR_1_i ) );delay( 10 );}digitalWrite( 9 , HIGH );digitalWrite( 10 , LOW );delay( 2000 );digitalWrite( 9 , LOW );digitalWrite( 10 , LOW );for (_ABVAR_1_i= 1; _ABVAR_1_i<= ( 110 ); _ABVAR_1_i++ ){servo_pin_3.write( ( 170 - _ABVAR_1_i ) );delay( 20 );}digitalWrite( 5 , HIGH );digitalWrite( 6 , LOW );delay( 1000 );digitalWrite( 5 , LOW );digitalWrite( 6 , LOW );delay( 1000 );for (_ABVAR_1_i= 1; _ABVAR_1_i<= ( 40 ); _ABVAR_1_i++ ){servo_pin_3.write( ( 60 - _ABVAR_1_i ) );delay( 20 );}for (_ABVAR_1_i= 1; _ABVAR_1_i<= ( 79 ); _ABVAR_1_i++ ){servo_pin_8.write( ( 80 - _ABVAR_1_i ) );delay( 20 );}for (_ABVAR_1_i= 1; _ABVAR_1_i<= ( 70 ); _ABVAR_1_i++ ){servo_pin_11.write( ( 10 + _ABVAR_1_i ) );delay( 20 );}for (_ABVAR_1_i= 1; _ABVAR_1_i<= ( 150 ); _ABVAR_1_i++ ){servo_pin_7.write( ( 120 - _ABVAR_1_i ) );delay( 20 );}for (_ABVAR_1_i= 1; _ABVAR_1_i<= ( 70 ); _ABVAR_1_i++ ){servo_pin_11.write( ( 80 - _ABVAR_1_i ) );delay( 20 );}for (_ABVAR_1_i= 1; _ABVAR_1_i<= ( 150 ); _ABVAR_1_i++ ){servo_pin_3.write( ( 20 + _ABVAR_1_i ) );delay( 20 );}for (_ABVAR_1_i= 1; _ABVAR_1_i<= ( 149 ); _ABVAR_1_i++ ){servo_pin_8.write( ( 1 + _ABVAR_1_i ) );delay( 20 );}for (_ABVAR_1_i= 1; _ABVAR_1_i<= ( 60 ); _ABVAR_1_i++ ){servo_pin_11.write( ( 10 + _ABVAR_1_i ) );delay( 20 );}for (_ABVAR_1_i= 1; _ABVAR_1_i<= ( 30 ); _ABVAR_1_i++ ){servo_pin_7.write( ( 70 + _ABVAR_1_i ) );delay( 20 );}for (_ABVAR_1_i= 1; _ABVAR_1_i<= ( 60 ); _ABVAR_1_i++ ){servo_pin_11.write( ( 70 - _ABVAR_1_i ) );delay( 20 );}for (_ABVAR_1_i= 1; _ABVAR_1_i<= ( 70 ); _ABVAR_1_i++ ){servo_pin_8.write( ( 150 - _ABVAR_1_i ) );delay( 20 );}for (_ABVAR_1_i= 1; _ABVAR_1_i<= ( 20 ); _ABVAR_1_i++ ){servo_pin_7.write( ( 100 + _ABVAR_1_i ) );delay( 20 );}}else{servo_pin_4.write( 120 );servo_pin_3.write( 170 );servo_pin_8.write( 80 );servo_pin_11.write( 10 );servo_pin_7.write( 120 );}}
5. 扩展机构
按照这个思路,我们可以利用更多的模组和样机来构建各种流水线,如下图所示:
程序源代码及样机3D文件资料内容详见 小型流水线模型-概述