Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PeguinoheroPeguino Microservo Brick
#1
Peguino Microservo Brick

This Brick exists in two different versions and can be separated by the wrapper on the plug:
    1. Standard 270º Servo  (has no wrapper on the plug)
    2. 360º rotating Servo  (has a white wrapper on the plug)

[Image: Brick_Microservo_01b.png]


Standard Servo Type 1:
This unit houses and delivers precise servo mechanical movement into your project. With its unique designed case it can be used standing upright or lying down to allow a broad range of project integration variations. Use the Peguino axle adaptor to integrate it into all rotating and moving parts e.g. to move the arm of your robot project.

Rotating Servo Type 2:
This unit houses and delivers a seamless motor to drive the wheels on any project. It integrates a 360º rotating Servo to provide strong low rotation force.Use the Peguino axle adaptor to integrate it into all rotating bits, wheels and gears e.g. to spin the wheels on your car project.


The Axle Adaptor
[Image: Brick_Microservo_Axleadaptor_01.png]


Examples A (standard) and B (360º rotating) Servo Brick for the Peguino Uno Nano version:
The only difference between the following versions of the scripts for Nano and the ESP32 Dev V1 version boards is the different Servo libraries and the assigned ports.


Example A - the normal Microservo Brick / Peguino Uno Nano version:
Code:
/*
Microservo Brick
(C) 2018 by Peguino LTD
Connect the Microservo Brick to port C1
Version 1

Note: Use the Serial Montiro to see the values Press: Ctrl+Shift+M

 Peguino Uno Nano Board Pinout
            ┌─╥─┐
    D_13  1 │     │ 30  D_12
   3.3 V  2 │     │ 29  D_11
    AREF  3 │     │ 28  D_10
D_14 A_0  4 │     │ 27  D_9
D_15 A_1  5 │     │ 26  D_8
D_16 A_2  6 │     │ 25  D_7
D_17 A_3  7 │     │ 24  D_6
D_18 A_4  8 │     │ 23  D_5
D_19 A_5  9 │     │ 22  D_4
     A_6 10 │     │ 21  D_3
     A_7 11 │     │ 20  D_2
      5V 12 │     │ 19  GND
   Reset 13 │     │ 18  Reset
     GND 14 │     │ 17  D_0 RX
Power In 15 │     │ 16  D_1 TX
            └───┘
 Visit https://www.peguino.com          
*/      

// In this example the Peguino Microservo Brick on Port C1 turns continuously in both directions

//#include <ESP32Servo.h>                       // for ESP32 Development Board V1
#include <Servo.h>                              // for Arduino Nano

Servo servo1;
Servo servo2;
int minUs = 500;
int maxUs = 2400;
int servo1Pin = 5;
int pos1 = 0;                                 // position in degrees


void setup()
{
Serial.begin(115200);                        // Press Ctrl+Shift+M and set the serial monitor to the same baud rate!
servo1.attach(servo1Pin, minUs, maxUs);      // In this example we use Port C1      
}


void loop() {

for (pos1 <= 0; pos1 <= 180; pos1 += 1) {    // sweep from 0 degrees to 180 degrees
  servo1.write(pos1);  
  Serial.println(pos1);
  delay(5);                                  // wait a bit for the servo to reach the position
}
for (pos1 >= 180; pos1 >= 0; pos1 -= 1) {    // sweep from 180 degrees to 0 degrees
  servo1.write(pos1);
  Serial.println(pos1);
  delay(5);      
}
}

Example B - the 360 deg. Rotating Microservo Brick / Peguino Nano version:
Code:
/*
Microservo Brick / 360 deg. rotating Servo
(C) 2018 by Peguino LTD
Connect the 360 deg. rotating version of the Microservo Brick on Port D3
Version 1

Note: Use the Serial Monitor to see the values Press: Ctrl+Shift+M

 Peguino Uno Nano Board Pinout
            ┌─╥─┐
    D_13  1 │     │ 30  D_12
   3.3 V  2 │     │ 29  D_11
    AREF  3 │     │ 28  D_10
D_14 A_0  4 │     │ 27  D_9
D_15 A_1  5 │     │ 26  D_8
D_16 A_2  6 │     │ 25  D_7
D_17 A_3  7 │     │ 24  D_6
D_18 A_4  8 │     │ 23  D_5
D_19 A_5  9 │     │ 22  D_4
     A_6 10 │     │ 21  D_3
     A_7 11 │     │ 20  D_2
      5V 12 │     │ 19  GND
   Reset 13 │     │ 18  Reset
     GND 14 │     │ 17  D_0 RX
Power In 15 │     │ 16  D_1 TX
            └───┘
 Visit https://www.peguino.com          
*/

// The 360 deg. rotation version of the Peguino Microservo Brick on Port D3 rotates in both directions.

//#include <ESP32Servo.h>                             // for ESP32 Development Board V1 - the default Peguino Uno board
#include <Servo.h>                               // for Arduino Nano

Servo servo2;
int minUs = 500;
int maxUs = 2400;
int servo2Pin = 6;
int pos1 = 0;                                       // position in degrees
int stoppit = 92;    
int forward = 180;
int backward = 0;
int spd1 = 0;

void setup()
{
Serial.begin(115200);                              // Press Ctrl+Shift+M and set the serial monitor to the same baud rate!
servo2.attach(servo2Pin, minUs, maxUs);            // In this example we use only Port D3  
}


void loop() {


servo2.write(forward);
Serial.println("Forward");              
delay(1000);                      

servo2.write(stoppit);
Serial.println("Stop");
delay(500);      

servo2.write(backward);
Serial.println("Backward");
delay(1000);

servo2.write(stoppit);
Serial.println("Stop");
delay(500);    

Serial.println("Variable Speed back, stop and forward...");
while (spd1 <= 179)
{  
  spd1 += 1;
  servo2.write(spd1);
   Serial.println(spd1);
  delay(25);  
}
spd1 = 0;
delay(100);                                        // give the servo time to exhale...

servo2.write(stoppit);
Serial.println("Stop");
delay(500);
}



Examples A (standard) and B (360º rotating) Servo Brick for the Peguino Uno ESP 32 version:

To use the Microservo Bricks with the Arduino IDE and the Peguino Uno Brick using the ESP 32 Development Board you have to include the proper ESP32 Servo function library which can be done with this  simple steps:
  1. Press CTRL + SHIFT + I to open the Library Manager
  2. Type "ESP32_Servo" in the search field and then select "ESP32Servo by John K. Bennett, Kevin Harrington", click Install and then Close the window.

Example A - the normal Microservo Brick / Peguino Uno ESP 32 version:
Code:
/*
 Microservo Brick
 (C) 2018 by Peguino LTD
 Connect the Microservo Brick to port C1
 Version 1
 
 Note: Use the Serial Montiro to see the values Press: Ctrl+Shift+M

 Peguino Uno ESP 32 Development Board Pinout
           ┌─╥─┐
 3.3     1 │     │ 30  5V
 GND     2 │     │ 29  GND
 GPIO15  3 │     │ 28  GPIO13
 GPIO2   4 │     │ 27  GPIO12
 GPIO4   5 │     │ 26  GPIO14
 GPIO16  6 │     │ 25  GPIO27
 GPIO17  7 │     │ 24  GPIO26
 GPIO5   8 │     │ 23  GPIO25
 GPIO18  9 │     │ 22  GPIO33
 GPIO19 10 │     │ 21  GPIO32
 GPIO21 11 │     │ 20  GPIO35
 GPIO3  12 │     │ 19  GPIO34
 GPIO1  13 │     │ 18  GPIO39
 GPIO22 14 │     │ 17  GPIO36
 GPIO23 15 │     │ 16  Chip enable
           └───┘
 Visit https://www.peguino.com          
*/

// In this example the Peguino Microservo Brick on Port C1 turns continuously in both directions

#include <ESP32Servo.h>                       // for ESP32 Development Board V1
//#include <Servo.h>                              // for Arduino Nano

Servo servo1;
Servo servo2;
int minUs = 500;
int maxUs = 2400;
int servo1Pin = 27;
int pos1 = 0;                                 // position in degrees


void setup()
{
 Serial.begin(115200);                        // Press Ctrl+Shift+M and set the serial monitor to the same baud rate!
 servo1.attach(servo1Pin, minUs, maxUs);      // In this example we use Port C1       
}


void loop() {
 
 for (pos1 <= 0; pos1 <= 180; pos1 += 1) {    // sweep from 0 degrees to 180 degrees
   servo1.write(pos1);  
   Serial.println(pos1);
   delay(5);                                  // wait a bit for the servo to reach the position
 }
 for (pos1 >= 180; pos1 >= 0; pos1 -= 1) {    // sweep from 180 degrees to 0 degrees
   servo1.write(pos1);
   Serial.println(pos1);
   delay(5);      
 }
}



Example B - the 360 deg. Rotating Microservo Brick / Peguino Uno ESP 32 version:
Code:
/*
 Microservo Brick / 360 deg. rotating Servo
 (C) 2018 by Peguino LTD
 Connect the 360 deg. rotating version of the Microservo Brick on Port D3
 Version 1
 
 Note: Use the Serial Monitor to see the values Press: Ctrl+Shift+M

 Peguino Uno ESP 32 Development Board Pinout
           ┌─╥─┐
 3.3     1 │     │ 30  5V
 GND     2 │     │ 29  GND
 GPIO15  3 │     │ 28  GPIO13
 GPIO2   4 │     │ 27  GPIO12
 GPIO4   5 │     │ 26  GPIO14
 GPIO16  6 │     │ 25  GPIO27
 GPIO17  7 │     │ 24  GPIO26
 GPIO5   8 │     │ 23  GPIO25
 GPIO18  9 │     │ 22  GPIO33
 GPIO19 10 │     │ 21  GPIO32
 GPIO21 11 │     │ 20  GPIO35
 GPIO3  12 │     │ 19  GPIO34
 GPIO1  13 │     │ 18  GPIO39
 GPIO22 14 │     │ 17  GPIO36
 GPIO23 15 │     │ 16  Chip enable
           └───┘
 Visit https://www.peguino.com          
*/

// The 360 deg. rotation version of the Peguino Microservo Brick on Port D3 rotates in both directions.

#include <ESP32Servo.h>                             // for ESP32 Development Board V1 - the default Peguino Uno board
// #include <Servo.h>                               // for Arduino Nano

Servo servo2;
int minUs = 500;
int maxUs = 2400;
int servo2Pin = 33;
int pos1 = 0;                                       // position in degrees
int stoppit = 92;    
int forward = 180;
int backward = 0;
int spd1 = 0;

void setup()
{
 Serial.begin(115200);                              // Press Ctrl+Shift+M and set the serial monitor to the same baud rate!
 servo2.attach(servo2Pin, minUs, maxUs);            // In this example we use only Port D3  
}


void loop() {


 servo2.write(forward);
 Serial.println("Forward");              
 delay(1000);                      

 servo2.write(stoppit);
 Serial.println("Stop");
 delay(500);      

 servo2.write(backward);
 Serial.println("Backward");
 delay(1000);
 
 servo2.write(stoppit);
 Serial.println("Stop");
 delay(500);    

 Serial.println("Variable Speed back, stop and forward...");
 while (spd1 <= 179)
 {  
   spd1 += 1;
   servo2.write(spd1);
    Serial.println(spd1);
   delay(25);  
 }
 spd1 = 0;
 delay(100);                                        // give the servo time to exhale...
 
 servo2.write(stoppit);
 Serial.println("Stop");
 delay(500);
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)