Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 9
» Latest member: chinop121
» Forum threads: 66
» Forum posts: 68

Full Statistics

Online Users
There are currently 19 online users.
» 0 Member(s) | 18 Guest(s)
Google

Latest Threads
Buy Driver’s License,(htt...
Forum: Gigs and Collaborations
Last Post: chinop121
5 hours ago
» Replies: 0
» Views: 1
Buy Driver’s License,(htt...
Forum: Website and Forum
Last Post: chinop121
5 hours ago
» Replies: 0
» Views: 1
Buy Driver’s License,(htt...
Forum: General Discussion
Last Post: chinop121
5 hours ago
» Replies: 0
» Views: 1
Digital Marketing Online ...
Forum: General Discussion
Last Post: Wenexamedia
Yesterday, 10:19 AM
» Replies: 0
» Views: 5
Doorstep Payday Loans | h...
Forum: General Discussion
Last Post: Wenexamedia
Yesterday, 10:15 AM
» Replies: 0
» Views: 5
Payday Loans Online Same ...
Forum: General Discussion
Last Post: Wenexamedia
Yesterday, 10:11 AM
» Replies: 0
» Views: 5
Payday Loans For People o...
Forum: General Discussion
Last Post: Wenexamedia
Yesterday, 10:01 AM
» Replies: 0
» Views: 5
Payday Loans no Debit Car...
Forum: General Discussion
Last Post: Wenexamedia
Yesterday, 09:08 AM
» Replies: 0
» Views: 5
The Peguino Bot 1
Forum: Exhibition / Gallery
Last Post: Peguinohero
07-02-2019, 01:36 PM
» Replies: 0
» Views: 656
This is my first testentr...
Forum: Suggestions to the Peguino - how we can make it better?
Last Post: Jack
01-26-2019, 12:14 PM
» Replies: 2
» Views: 773

 
Welcome Guest!
Select the forum of your interest below. You may have to register before you can post your topic...

  Peguino Proximity Brick
Posted by: Peguinohero - 11-09-2018, 02:58 PM - Forum: Introductory tutorials for Peguino Bricks and more - No Replies

Peguino Proximity Brick

This unit houses and delivers a proximity brick which measures distance with ultrasonic Doppler Effect waves enabling your self driving robot to avoid walls.

[Image: Brick_Proximity_01b.png]


Examples for Peguino Uno Nano and ESP32 V1:

Connect the Proximity Brick to the Peguino Uno Brick Port A. Copy and paste the code below into the Arduino IDE and upload it to the Peguino Uno Brick board.

1. Code example for the Peguino Uno Nano version:

Code:
/*
  Proximity Brick
  (C) 2018 by Peguino LTD
  Connect the Proximity Brick to port A
  Version 1
 
  Note: Use the Serial Plotter to see the values


  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          
*/
 
int trigPin = 15;     // Trigger Signal
int echoPin = 14;     // Echo
long duration, cm, inches;
 
void setup() {
  //Serial Port begin
  Serial.begin (9600);        // Press Ctrl+Shift+M and set the serial monitor to the same baud rate!
  //Define inputs and outputs
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
}
 
void loop() {
  // The sensor triggers by a HIGH pulse of 10 or more microseconds - a short LOW pulse first ensures a clean HIGH pulse:
  digitalWrite(trigPin, LOW);
  delayMicroseconds(5);
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);
 
  // Signal readout: The HIGH pulse duration is the time (in microseconds) from sending ping to receiving the echo bumping from an object.
  pinMode(echoPin, INPUT);
  duration = pulseIn(echoPin, HIGH);
 
  // Convert time of flight to distance
  cm = (duration/2) / 29.1;     // Divide by 29.1
  inches = (duration/2) / 74;   // Divide by 74
 
  Serial.print(inches);
  Serial.print("in, ");
  Serial.print(cm);
  Serial.print("cm");
  Serial.println();
  delay(200);
}



2. Code example for the Peguino Uno ESP 32 version:

Code:
/*
 Proximity Brick
 (C) 2018 by Peguino LTD
 Connect the Proximity Brick to port A
 Version 1
 
 Note: Use the Serial Plotter to see the values


 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          
*/

int trigPin = 2;      // Trigger Signal
int echoPin = 15;     // Echo
long duration, cm, inches;

void setup() {
 //Serial Port begin
 Serial.begin (115200);        // Press Ctrl+Shift+M and set the serial monitor to the same baud rate!
 //Define inputs and outputs
 pinMode(trigPin, OUTPUT);
 pinMode(echoPin, INPUT);
}

void loop() {
 // The sensor triggers by a HIGH pulse of 10 or more microseconds - a short LOW pulse first ensures a clean HIGH pulse:
 digitalWrite(trigPin, LOW);
 delayMicroseconds(5);
 digitalWrite(trigPin, HIGH);
 delayMicroseconds(10);
 digitalWrite(trigPin, LOW);

 // Signal readout: The HIGH pulse duration is the time (in microseconds) from sending ping to receiving the echo bumping from an object.
 pinMode(echoPin, INPUT);
 duration = pulseIn(echoPin, HIGH);

 // Convert time of flight to distance
 cm = (duration/2) / 29.1;     // Divide by 29.1
 inches = (duration/2) / 74;   // Divide by 74
 
 Serial.print(inches);
 Serial.print("in, ");
 Serial.print(cm);
 Serial.print("cm");
 Serial.println();
 delay(200);
}

Print this item

  Peguino Microservo Brick
Posted by: Peguinohero - 11-09-2018, 02:47 PM - Forum: Introductory tutorials for Peguino Bricks and more - No Replies

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);
}

Print this item

  Peguino Buzzer Brick
Posted by: Peguinohero - 11-09-2018, 01:38 PM - Forum: Introductory tutorials for Peguino Bricks and more - No Replies

Peguino Buzzer Brick

This unit houses and delivers a piezo speaker to deliver acoustic signals eg. door bell alarm or a ringtone.

[Image: Brick_Buzzer_01b.png]


Examples for Peguino Uno Nano and ESP32 V1:

Connect the Buzzer Brick to the Peguino Uno Brick Port C2. Copy and paste the code below into the Arduino IDE and upload it to the Peguino Uno Brick board: Peguino Uno Nano or Peguino Uno ESP32 V1.


1. Code example for the Peguino Uno Nano version:

Code:
/*
  Buzzer Brick
  (C) 2018 by Peguino LTD
  Connect the Buzzer Brick to port C2
  Version 1
 
  Note: Use the Serial Plotter to see the values

  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         
*/

int freq = 150;
int auf = 0;
int ab = 0;

void setup() {
#define PIN 23;
int speakerPin = 2;        // Digital 2 or Port
pinMode(speakerPin, OUTPUT);
}

void loop ()

{int speakerPin = 2;
  // Whoop up
  for(int hz = 440; hz < 1000; hz=hz+12){
    tone(speakerPin, hz, 50);
    delay(5);
  }
  noTone(speakerPin);

  // Whoop down
  for(int hz = 1000; hz > 440; hz=hz-9){
    tone(speakerPin, hz, 50);
    delay(5);
  }
  noTone(speakerPin);
}




2. Code example for the Peguino Uno ESP 32 version:
Code:
/*
  Buzzer Brick
  (C) 2019 by Peguino LTD
  Connect the Buzzer Brick to port C2
  Version 1
 
  Note: The ESP32 generates sound by PWM (Pulse Width Modulation) which has to be assigned to the associated pin

  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          
*/

int freq = 440;     // its the initial frequency in Hz
int channel = 0;    // ESP32 speciality
int resolution = 8; // ESP32 speciality - it means 8 Bits resolution to count from 0 - 255
int whizzer = 0;    // the counter of whizz sound cycles
int whizz = 0;      // the sound frequency we use
void setup() {
 
 // Serial.begin(115200);
  ledcSetup(channel, freq, resolution);   //ESP32 speciality - PWM function to control a buzzer
  ledcAttachPin(23, channel);             //ESP32 speciality - attach it at Pin23
 
}
 
void loop() {
while (whizz <= 3){
      whizz +=1;
      for(int freq = 440; freq <= 2000; freq = freq + 30){
          ledcWriteTone(channel, freq);
         delay(5);
      }
      whizzer +=1;
   }
if (whizzer = 4){
  ledcWriteTone(channel, -1);         //ESP32 speciality - turn off sound
  }
}

Print this item

  Peguino Miniprox Brick
Posted by: Peguinohero - 11-09-2018, 01:14 PM - Forum: Introductory tutorials for Peguino Bricks and more - No Replies

Peguino Miniprox Brick

This unit houses and delivers a passive infrared reflexive sensor to detect close objects or brightness differences enable your project e.g. to drive a robot above a black line on a white ground.

[Image: Brick_Miniprox_01b.png]

Schematic:

[Image: Miniprox_schematic_01b.png]

Examples for Peguino Uno Nano and ESP32 V1:
Connect the Microprox Brick to the Peguino Uno Brick Port C3. You could add a RGB LED Brick on port F. Copy and paste the code below into the Arduino IDE and upload it to the Peguino Uno Brick board.


1. Code example for the Peguino Uno Nano version:

Code:
/*
 Microprox Brick
 (C) 2018 by Peguino LTD
 Connect the Microprox Brick to port C3
 Connect the RGB LED Brick to port F
 Version 1

 Note: Use the Serial Plotter to see the values


 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            
*/




#define ANALOG_PIN_0 2               // Analog Input from A_2 which is physically located on Pin 6 and available on Port C3
int analog_value = 0;
int triggerline = 0;

const int ledPin1 = 12; // red
const int ledPin2 = 11; // green
const int ledPin3 = 13; // blue


void setup()
{
 // initialize digital pin ledPin as an output.
 pinMode(ledPin1, OUTPUT);
 pinMode(ledPin2, OUTPUT);
 pinMode(ledPin3, OUTPUT);
 digitalWrite(ledPin1, HIGH);
 digitalWrite(ledPin2, HIGH);
 digitalWrite(ledPin3, HIGH);

 Serial.begin(115200);                 // Press Ctrl+Shift+L and set the serial monitor to the same baud rate!
 delay(1000);                          // give me time to bring up serial monitor
 Serial.println("Microprox 1");
}

void loop()
{
analog_value = analogRead(ANALOG_PIN_0);
 Serial.print(analog_value);          // the first variable for plotting
 Serial.print(",");                   // seperator
 Serial.println(triggerline);

 if (analog_value > 600) {           // number taken by measuring white paper sheet. A black line might below this value....    
     triggerline = 800;          
     digitalWrite(ledPin1, LOW);     // Red light on
     digitalWrite(ledPin2, HIGH);    // Green light off
     }
else{
     triggerline = 0;
     digitalWrite(ledPin1, HIGH);    // Red light off
     digitalWrite(ledPin2, LOW);     // Green light on
     }
 delay(100);
}



2. Code example for the Peguino Uno ESP 32 version:
Code:
/*
  Microprox Brick
  (C) 2018 by Peguino LTD
  Connect the Microprox Brick to port C3
  Connect the RGB LED Brick to port F
  Version 1
 
  Note: Use the Serial Plotter to see the values


  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          
*/




#define ANALOG_PIN_0 36               // Analog Input from GPIO 36 which is physically located on Pin 17 and available on Port C3
int analog_value = 0;
int triggerline = 0;

// ledPin refers to ESP32 GPIO 12, 13 and 14
const int ledPin1 = 13; // blue
const int ledPin2 = 12; // green
const int ledPin3 = 14; // red


void setup()
{
  // initialize digital pin ledPin as an output.
  pinMode(ledPin1, OUTPUT);
  pinMode(ledPin2, OUTPUT);
  pinMode(ledPin3, OUTPUT);
  digitalWrite(ledPin1, HIGH);
  digitalWrite(ledPin2, HIGH);
  digitalWrite(ledPin3, HIGH);
 
  Serial.begin(115200);                 // Press Ctrl+Shift+L and set the serial monitor to the same baud rate!
  delay(1000);                          // give me time to bring up serial monitor
  Serial.println("Microprox 1");
}

void loop()
{
analog_value = analogRead(ANALOG_PIN_0);
  Serial.print(analog_value);          // the first variable for plotting
  Serial.print(",");                   // seperator
  Serial.println(triggerline);

  if (analog_value > 800) {           // number taken by measuring white paper sheet. A black line might below this value....    
      triggerline = 1000;          
      digitalWrite(ledPin1, LOW);     // Red light on
      digitalWrite(ledPin2, HIGH);    // Green light off
      }
 else{
      triggerline = 0;
      digitalWrite(ledPin1, HIGH);    // Red light off
      digitalWrite(ledPin2, LOW);     // Green light on
      }
  delay(100);
}

Print this item

  Peguino Potentiometer Brick
Posted by: Peguinohero - 11-09-2018, 01:02 PM - Forum: Introductory tutorials for Peguino Bricks and more - No Replies

Peguino Potentiometer Brick


This unit houses and delivers a variable 10kOhm (resistor) control unit to deliver specific adjustable input to your project, eg. a light dimmer.

[Image: Brick_Potentiometer_01b.png]


Schematic:

[Image: Potentiometer_schematic_01b.png]


Examples for Peguino Uno Nano and ESP32 V1:

Connect the Potentiometer Brick to the Peguino Uno Brick Port D2. Copy and paste the code below into the Arduino IDE and upload it to the Peguino Uno Brick board.



1. Code example for the Peguino Uno Nano version:

Code:
/*
 Potentiometer Brick
 (C) 2018 by Peguino LTD
 Connect the Potentiometer Brick to port D2
 Version 1
 
 Note: Use the Serial Plotter to see the values


 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            
*/


#define ANALOG_PIN_0 3   // Analog Input A_3 which is physically located on Pin 7 and available on Port D2
int analog_value = 0;


void setup()
{
 Serial.begin(115200);   // Press Ctrl+Shift+L and set the serial monitor to the same baud rate!
 delay(1000);            // give me time to bring up serial monitor
 Serial.println("Lightsensor 1");
}

void loop()
{
 analog_value = analogRead(ANALOG_PIN_0);
 Serial.println(analog_value);
 delay(100);
}



2. Code example for the Peguino Uno ESP 32 version:
Code:
/*
 Potentiometer Brick
 (C) 2018 by Peguino LTD
 Connect the Potentiometer Brick to port D2
 Version 1
 
 Note: Use the Serial Plotter to see the values


 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          
*/


#define ANALOG_PIN_0 25   // Analog Input from GPIO 25 which is physically located on Pin 23 and available on Port D2
int analog_value = 0;


void setup()
{
 Serial.begin(115200);   // Press Ctrl+Shift+L and set the serial monitor to the same baud rate!
 delay(1000);            // give me time to bring up serial monitor
 Serial.println("Lightsensor 1");
}

void loop()
{
 analog_value = analogRead(ANALOG_PIN_0);
 Serial.println(analog_value);
 delay(100);
}

Print this item

  Peguino Lightsensor Brick
Posted by: Peguinohero - 11-09-2018, 11:40 AM - Forum: Introductory tutorials for Peguino Bricks and more - No Replies

Peguino Lightsensor Brick

This unit houses and delivers a light sensor to detect environmental light and input it to your Peguino Uno central unit. You can automatically light up your toy brick castle as darkness falls. It is also possible to detect a bold black marker on white paper sheet.


[Image: Brick_Lightsensor_01b.png]


Schematic:

[Image: Lightsensor_schematic_01b.png]

Example:

Connect the Lightsensor Brick to the Peguino Uno Brick Port D2. Copy and paste the code below into the Arduino IDE and upload it to the Peguino Uno Brick board.

Code example:

Code:
/*
 Lightsensor Brick
 (C) 2018 by Peguino LTD
 Connect Lightsensor Brick to port D2
 Version 1
 
 Note: Use the Serial Plotter to see the values


 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          
*/


#define ANALOG_PIN_0 25   // Analog Input from GPIO 25 which is physically located on Pin 23 and available on Port D2
int analog_value = 0;


void setup()
{
 Serial.begin(115200);   // Press Ctrl+Shift+L and set the serial monitor to the same baud rate!
 delay(1000);            // give me time to bring up serial monitor
 Serial.println("Lightsensor 1");
}

void loop()
{
 analog_value = analogRead(ANALOG_PIN_0);
 Serial.println(analog_value);
 delay(100);
}

Print this item

  The Peguino Uno PCB Superflex Board
Posted by: Peguinohero - 11-07-2018, 07:43 PM - Forum: Introductory tutorials for Peguino Bricks and more - No Replies

The Peguino Uno PCB Superflex Board

Peguino Uno Brick PCB-Board Rev. 1.2 Specs

Capable for using Arduino Nano, ESP 8266 and ESP32 Dev. Boards and Pin-compatible boards

[Image: peguino_pcb_1.2_01.png]


Sockets and Pins (Numbering always counter clockwise):

A, B, E, F:

4 x RJ11 6P6C Sockets

C1, C2, C3, D1, D2, D3:

6 x 2,54mm Pinheader Male Plugs, internal called “Servo Plugs” (Multi-Usage; eg. to connect  Peguino Microservo Brick, Microprox Brick, Buzzer Brick...)

30 x 2,54mm Pinheader Female Sockets: 1 – 30
3 x 2,54mm Pinheader Female Sockets: A,B,C, connected with Pinheader Socket: 1 (Contains 3.3V when using a Peguino Uno Brick ESP 32 Development Board V1 )

1 x 2,54mm red Pinheader Male Plug to connect the Peguino Switch Brick
1 x 2,54mm black Pinheader Male Plug to connect the Peguino 4AA Power Brick
2 x 2,54mm blue Pinheader Male Plug with Jumper to configure the type of board
2 x 2,54mm yellow Pinheader Male Plug with Jumper to configure power out


Note:
The blue Jumpers need to aligned left while using an Arduino Nano. For ESP8266 and ESP32 aligned right.

The yellow Jumpers aligned to the right power C1, C2, C3, D1, D2, and D3.

Is the power connector turned to the left (ground left and +5V in middle) then the Switch Brick can be plugged aligned left to the black Pinheader Male Plug (above the red Pinheader Male Plug).

The Pins A, B, C are connected with ground (GND / minus).

Print this item

  Peguino Uno Brick, Ports and Connectors
Posted by: Peguinohero - 11-07-2018, 07:32 PM - Forum: Introductory tutorials for Peguino Bricks and more - No Replies

Peguino Uno Brick, Ports and Connectors


The Peguino Uno Brick can house the following boards: Arduino Uno, Arduino Nano, ESP 8266, ESP 32.
To house a Arduino Uno the internal PCB board has to be removed. 

If the Brick case contains the Peguino Uno Brick PCB-Board the following boards can be used:

  • Arduino Nano
  • ESP8266
  • ESP32 ( This is the Peguino Uno Brick ESP 32 Development Board V1)
The PCB-Board contains blue Jumper to switch between the boards. More about this see Peguino Uno Brick PCB-Board Rev. 1.2 description: https://www.peguino.com/chat/thread-12.html

Note: Numbering is always counter clockwise!

[Image: PeguinoUnoBrick_Ports_02.png]


If you need more information how to install your program on the Peguino Uno Brick see here: https://www.peguino.com/chat/thread-39.html

Print this item

  The first three steps into Peguino software creation
Posted by: Peguinohero - 11-06-2018, 05:31 PM - Forum: First steps, Software installation & Troubleshooting - No Replies

Your first three steps into Peguino software creation:

1. Connecting your Peguino Bricks together
2. Installation of the Peguino software development tools eg. the Arduino IDE, and Peguino Visuino
3. Creating your own Peguino program and transfer it to your project

The Peguino Uno Brick contains the following connectors:

[Image: PeguinoUnoBrick_Ports_01.png]
To program the board inside the Peguino Uno Brick connect it via the USB Port to your computer. All other ports can be used to connect different types of Peguino Bricks. All ports / connectors are counted counter clockwise as is it usual in electronics. 

Note: Internally the ports and connectors are pre-wired or possibly not. This depends of the Peguino Kit or Peguino Set you own. Of course, you can set your own wires internally.

Step 1: Connect the USB wire to your PC.

Step 2: Follow the instructions at: "The Arduino IDE and Peguino Visuino installation instructions"

Step 3: Follow the instructions at: "How to use the Peguino Uno ESP 32 Board with Visuino"

Print this item

  How to use the Peguino Uno ESP 32 Board with Visuino
Posted by: Peguinohero - 10-11-2018, 05:25 PM - Forum: Peguino Visuino Software development introduction - No Replies

Using Peguino Uno with Visuino

When you start Visuino usually the Arduino Uno is selected as default.
To change the board to the ESP 32 board which can be used in the Peguino Uno Brick click the symbol top right (1) and select “ESP 32 Development Board” (2). Then click “ok” (3).


[Image: Visuino_ESPSelect_01.jpg]

If you change the Board inside the Peguino Uno Brick go ahead in the same way. The Peguino Uno Brick can house three different types of boards: Arduino Uno, Arduino Nano, ESP 8266 and ESP 32 boards. (If you change the boards check or switch the blue jumpers on the Peguino board inside the case).


Transfer your Visuino project to the Peguino Uno Brick (with Visuino):

The process to copy your Visuino project to the Peguino Uno Brick works in three steps:

  1. 1. Generate the programcode (the sourcecode) with Visuino and transfer it to the Arduino IDE.2. Compile the program with the Arduino IDE (to generate the executable program for the tiny computer inside the Peguino Uno brick).3. Transfer the compiled program to the tiny computer-board inside the Peguino Uno. This is done usually via USB connection between your PC and the board.

As long the board stays connected via USB with your PC you can send and receive data from the board. This is useful for finding software bugs or drawing realtime graphs inside Visuino.



Variation 1: The single click approach


In this Version click the “compile and upload” -icon #2. See image below:

[Image: Visuino_Compile_01.jpg]


Variation 2: Or in three steps

If it isn´t working as described above, click “copy to Arduino IDE” icon #1. See image above.
Then the Arduino IDE opens and show you the generated source code. Here click on the green arrow as shown below:

[Image: Arduino_Compile_01.jpg]


Now the program is compiled and transferred to the Peguino Uno -Board. In case of failure check the USB cable and see the error message on the bottom of the Arduino IDE.

Note: To avoid the error message "Failed to connect to ESP32: Timed out waiting for packet header" while upload - press and hold the "BOOT" button on the board while uploading:

[Image: Upload_Arduino_ESP_01.png]


More about see Arduino IDE -Installation here https://www.peguino.com/chat/thread-7.html

Print this item