Making and Sharing of Robot Fish

1. Motor function description

      The example in this article will realize the function that the pectoral fin of the R330 prototype robotic fish can flexibly swing up and down.

2. Structure description

      This prototype uses the servo module to design the structure of the bionic robotic fish.

pectoral fins
complete machine

 3. Electronic hardware

      In this example, we use the following hardware, please refer to:

main control board

Basra main control board (compatible with Arduino Uno )

expanding board

Bigfish2.1 expansion board‍

Battery 7.4V lithium battery

      Circuit connection: Connect the servo to the D4 port of the Bigfish expansion board.

4. Realization of motion function

      Programming environment: Arduino 1.8.19

The following provides a reference routine (fishQi.ino) for the up and down movement of the robot fish's pectoral fins. For the experimental results, please refer to the demonstration video on the official website.

/*------------------------------------------------------------------------------------

  版权说明:Copyright 2023 Robottime(Beijing) Technology Co., Ltd. All Rights Reserved.

           Distributed under MIT license.See file LICENSE for detail or copy at

           https://opensource.org/licenses/MIT

           by 机器谱 2023-05-23 https://www.robotway.com/

  ------------------------------*/

#include <Servo.h>


int _ABVAR_1_angle_current2 = 0 ;

int _ABVAR_2_num = 0 ;

Servo servo_pin_4;

int _ABVAR_3_angle_current1 = 0 ;


void up_down();

void down_up();


void setup()

{

  servo_pin_4.attach(4);

}


void loop()

{

  down_up();

  up_down();

}


void down_up()

{

  _ABVAR_1_angle_current2 = 30 ;

  for (_ABVAR_2_num= 1; _ABVAR_2_num<= ( 16 ); _ABVAR_2_num++ )

  {

    _ABVAR_1_angle_current2 = ( _ABVAR_1_angle_current2 + 5 ) ;

    servo_pin_4.write( _ABVAR_1_angle_current2 );

    delay( 50 );

  }

}


void up_down()

{

  _ABVAR_3_angle_current1 = 110 ;

  for (_ABVAR_2_num= 1; _ABVAR_2_num<= ( 16 ); _ABVAR_2_num++ )

  {

    _ABVAR_3_angle_current1 = ( _ABVAR_3_angle_current1 - 5 ) ;

    servo_pin_4.write( _ABVAR_3_angle_current1 );

    delay( 50 );

  }

}

       Next, I will provide you with a reference routine (fishTail.ino) for the swing of the robot fish tail. You can try to rewrite the parameters of the swing angle of the servo to make the fish tail of the robot swing flexibly.

/*------------------------------------------------------------------------------------

  版权说明:Copyright 2023 Robottime(Beijing) Technology Co., Ltd. All Rights Reserved.

           Distributed under MIT license.See file LICENSE for detail or copy at

           https://opensource.org/licenses/MIT

           by 机器谱 2023-05-23 https://www.robotway.com/

  ------------------------------*/

#include <Servo.h>


int _ABVAR_1_angle_right = 0 ;

int _ABVAR_2_num = 0 ;

Servo servo_pin_4;

int _ABVAR_3_angle_left = 0 ;


void Right_Left();

void left_Right();


void setup()

{

  servo_pin_4.attach(4);

}


void loop()

{

  left_Right();

  Right_Left();

}


void Right_Left()

{

  _ABVAR_1_angle_right = 70 ;

  for (_ABVAR_2_num= 1; _ABVAR_2_num<= ( 8 ); _ABVAR_2_num++ )

  {

    _ABVAR_1_angle_right = ( _ABVAR_1_angle_right + 5 ) ;

    servo_pin_4.write( _ABVAR_1_angle_right );

    delay( 100 );

  }

}


void left_Right()

{

  _ABVAR_3_angle_left = 110 ;

  for (_ABVAR_2_num= 1; _ABVAR_2_num<= ( 8 ); _ABVAR_2_num++ )

  {

    _ABVAR_3_angle_left = ( _ABVAR_3_angle_left - 5 ) ;

    servo_pin_4.write( _ABVAR_3_angle_left );

    delay( 100 );

  }

}

For program source code and prototype 3D file information, see Robot Fish - Overview

Guess you like

Origin blog.csdn.net/Robotway/article/details/131110907