The Alpha Geek – Geeking Out

Pololu

Pololu

Project #14: Components – Pololu 5V Step-Up Voltage Regulator – Mk01

——

Components

——

Components

——

Pololu Item: 2564

5V Step-Up Voltage Regulator U1V10F5

This tiny (0.35″×0.45″) U1V10F5 switching step-up (or boost) voltage regulator efficiently generates 5 V from input voltages as low as 0.5 V. Unlike most boost regulators, the U1V10F5 automatically switches to a linear down-regulation mode when the input voltage exceeds the output. The pins have a 0.1? spacing, making this board compatible with standard solderless breadboards and perfboards.

Follow Us

J. Luc Paquin – Curriculum Vitae
https://www.donluc.com/DLHackster/LucPaquinCVEngMk2020a.pdf

Web: https://www.donluc.com/
Web: http://www.jlpconsultants.com/
Web: https://www.donluc.com/DLHackster/
Web: https://www.hackster.io/neosteam-labs
Web: http://neosteamlabs.com/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Facebook: https://www.facebook.com/neosteam.labs.9/
Instagram: https://www.instagram.com/neosteamlabs/
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Twitter: https://twitter.com/labs_steam
Etsy: https://www.etsy.com/shop/NeoSteamLabs

Don Luc

Project #12: Robotics – 5-Way Switch – Mk04

——

Robotics

——

Robotics

——

Robotics

——

Robotics

——

Robotics

——

Robotics

——

SparkFun 5-Way Tactile Switch Breakout

This 5-way tactile switch (up, down, left, right, and center click) allows for joystick-like control in a very small package.

DL1912Mk03

1 x Adafruit RGB LCD Shield 16×2 Character Display
1 x Arduino UNO – R3
1 x ProtoScrewShield
2 x EasyDriver – Stepper Motor Driver
1 x Small Stepper Motor
1 x Pololu Mounting
1 x Symbol Stepper Motor
2 x RC Servo Motor
2 x Potentiometer 1M Ohm
2 x Knob
2 x LED Red
1 x Rocker Switches
1 x Laser Red
1 x SparkFun 5-Way Tactile Switch Breakout
1 x LED Green
1 x LED Bi-Colour
1 x LED Yellow
17 x Jumper Wires 3″ M/M
31 x Jumper Wires 6″ M/M
4 x Half-Size Breadboard

Arduino UNO

SP1 – Digital 3
DI1 – Digital 2
SP2 – Digital 5
DI2 – Digital 4
SV1 – Digital 6
PO1 – Analog A0
SV2 – Digital 7
PO2 – Analog A1
VIN – +5V
GND – GND

DL1912Mk03.ino

// ***** Don Luc Electronics © *****
// Software Version Information
// Project #12: Robotics - 5-Way Switch - Mk04
// 12-03
// DL1912Mk02p.ino 12-04
// Arduino UNO
// Screw Shield
// Adafruit RGB LCD Shield
// 1 x Small Stepper Motor
// 1 x Symbol Stepper Motor
// 2 x EasyDriver
// 2 x RC Servo Motor
// 2 x Potentiometer
// 2 x LED Red
// 1 x Rocker Switches
// 1 x Laser Red
// 1 x SparkFun 5-Way Tactile Switch Breakout
// 1 x LED Green
// 1 x LED Bi-Colour
// 1 x LED Yellow

// include the library code:
#include <Adafruit_RGBLCDShield.h>
#include <Servo.h>

// Adafruit RGB LCD Shield
Adafruit_RGBLCDShield RGBLCDShield = Adafruit_RGBLCDShield();

// These #defines make it easy to set the backlight color
#define OFF 0x0
#define RED 0x1
#define YELLOW 0x3
#define GREEN 0x2
#define TEAL 0x6
#define BLUE 0x4
#define VIOLET 0x5
#define WHITE 0x7

// Momentary Button
int yy = 0;
uint8_t momentaryButton = 0;

// 2 x EasyDriver
int dirPinR = 2;                           // EasyDriver Right
int stepPinR = 3;                          // stepPin Right
int dirPinL = 4;                           // EasyDriver Left
int stepPinL = 5;                          // stepPin Left
int i = 0;

// 2 x RC Servo Motor
// 2 x Potentiometer
Servo isRCServo1;                          // Create servo object to control a RCServo1
int servo1 = 6;                            // Servo 1
int iPot1 = A0;                            // Analog Potentiometer 1
int iVal1;                                 // Variable - Analog Potentiometer 1
Servo isRCServo2;                          // Create servo object to control a RCServo2
int servo2 = 7;                            // Servo 2
int iPot2 = A1;                            // Analog Potentiometer 2
int iVal2;                                 // Variable - Analog Potentiometer 2

void loop() {

  // Clear
  RGBLCDShield.clear();
   
  // Momentary Button
  momentaryButton = RGBLCDShield.readButtons();

  switch ( yy ) {
    case 1:
    
      // Up
      isSwitch1();
      
      break;
    case 2:
    
      // Down
      isSwitch2();
      
      break;
    case 3:

      // Right
      isSwitch3();
      
      break;
    case 4:

      // Left
      isSwitch4();
      
      break;
    case 5:

      // Stop
      isSwitch5();
      
      break;
    default:

      // Stop
      yy = 5;
      RGBLCDShield.setBacklight(RED);
      isSwitch5();

   }
   
   if ( momentaryButton ) {
    
    if ( momentaryButton & BUTTON_UP ) {
      
      yy = 1;
      // Up
      RGBLCDShield.setBacklight(GREEN);
      
    }
    
    if ( momentaryButton & BUTTON_DOWN ) {
      
      yy = 2;
      // Down
      RGBLCDShield.setBacklight(VIOLET);
      
    }
    
    if ( momentaryButton & BUTTON_LEFT ) {
      
      yy = 3;
      // Right
      RGBLCDShield.setBacklight(TEAL);
      
    }
    
    if ( momentaryButton & BUTTON_RIGHT ) {

      yy = 4;
      // Left
      RGBLCDShield.setBacklight(YELLOW);
    }
    
    if ( momentaryButton & BUTTON_SELECT ) {

      yy = 5;
      // Stop
      RGBLCDShield.setBacklight(RED);
   
    }
    
  }
  
}

getServo.ino

// Servo
// isServoSetup
void isServoSetup() {

  // 2 x RC Servo Motor
  isRCServo1.attach( servo1 );
  isRCServo2.attach( servo2 );
  
}
// isServo1
void isServo1() {

  // EasyDriver
  isStepperStop();
   
  // Potentiometer RC Servo Motor 1
  iVal1 = analogRead( iPot1 );              // Reads the value of the iPot1 (Value between 0 and 1023)
  iVal1 = map(iVal1, 0, 1023, 0, 180);      // Scale it to use it with the isRCServo1 (Value between 0 and 180)
  isRCServo1.write( iVal1 );                // isRCServo1 sets the servo position according to the scaled value
  delay(15);    

  // Display
  // Set the cursor to column 0, line 0  
  RGBLCDShield.setCursor(0,0);
  RGBLCDShield.print("RC Servo 1");         // RC Servo 1
  // Set the cursor to column 0, line 1
  RGBLCDShield.setCursor(0, 1);
  RGBLCDShield.print( iVal1 );              // Reads the value iVal1
  
  delay(500);

}
// isServo2
void isServo2() {

  // EasyDriver
  isStepperStop();
   
  // Potentiometer RC Servo Motor 1
  iVal2 = analogRead( iPot2 );              // Reads the value of the iPot2 (Value between 0 and 1023)
  iVal2 = map(iVal2, 0, 1023, 0, 180);      // Scale it to use it with the isRCServo2 (Value between 0 and 180)
  isRCServo2.write( iVal2 );                // isRCServo2 sets the servo position according to the scaled value
  delay(15);    

  // Display
  // Set the cursor to column 0, line 0  
  RGBLCDShield.setCursor(0,0);
  RGBLCDShield.print("RC Servo 2");         // RC Servo 2
  // Set the cursor to column 0, line 1
  RGBLCDShield.setCursor(0, 1);
  RGBLCDShield.print( iVal2 );              // Reads the value iVal2
  
  delay(500);

}

getStepper.ino

// Stepper
// isStepperSetup
void isStepperSetup() {

  // 2 x EasyDriver
  pinMode(dirPinR, OUTPUT);
  pinMode(stepPinR, OUTPUT);
  pinMode(dirPinL, OUTPUT);
  pinMode(stepPinL, OUTPUT);

}
// isStepper1
void isStepper1(){

   // set the cursor to column 0, line 0
   RGBLCDShield.setCursor(0,0);
   RGBLCDShield.print("EasyDriver");        // EasyDriver  
   RGBLCDShield.setCursor(0,1);    
   RGBLCDShield.print("Small Stepper");     // Small Stepper
   delay(500);

   // EasyDriver
   digitalWrite(dirPinR, LOW);              // Set the direction.
   delay(100);

   for (i = 0; i<300; i++)                 // Iterate for 1000 microsteps.
   { 

     digitalWrite(stepPinR, LOW);           // This LOW to HIGH change is what creates the
     digitalWrite(stepPinR, HIGH);          // "Rising Edge" so the easydriver knows to when to step.
     delayMicroseconds(170);                // This delay time is close to top speed.

   } 
   
}
// isStepper2
void isStepper2(){

   // set the cursor to column 0, line 0
   RGBLCDShield.setCursor(0,0);
   RGBLCDShield.print("EasyDriver");        // EasyDriver  
   RGBLCDShield.setCursor(0,1);    
   RGBLCDShield.print("Symbol Stepper");    // Symbol Stepper
   delay(500);

   // EasyDriver
   digitalWrite(dirPinL, HIGH);              // Set the direction.
   delay(100);

   for (i = 0; i<300; i++)                 // Iterate for 1000 microsteps.
   { 
     
     digitalWrite(stepPinL, LOW);           // This LOW to HIGH change is what creates the
     digitalWrite(stepPinL, HIGH);          // "Rising Edge" so the easydriver knows to when to step.
     delayMicroseconds(170);                // This delay time is close to top speed.
     
   } 
   
}
// isStepperStop
void isStepperStop() {

   // 2 x EasyDriver
   digitalWrite(dirPinR, LOW);              // Set the direction.
   delay(100);
   digitalWrite(dirPinL, LOW);              // Set the direction.
   delay(100);
   digitalWrite(stepPinR, LOW);             // This LOW to HIGH change is what creates the
   digitalWrite(stepPinL, LOW);             // This LOW to HIGH change is what creates the 

}

getSwitch.ino

// Switch
// Switch 1
void isSwitch1(){

   // Small Stepper
   yy = 1;

   // EasyDriver
   isStepper1();

}
// Switch 2
void isSwitch2(){

   // Symbol Stepper
   yy = 2;

   // EasyDriver
   isStepper2();
   
}
// Switch 3
void isSwitch3(){

   // RC Servo Motor 1
   yy = 3;

   // Potentiometer RC Servo Motor 1
   isServo1();
   
}
// Switch 4
void isSwitch4(){

   // RC Servo Motor 2
   yy = 4;

   // Potentiometer RC Servo Motor 2
   isServo2();
   
}
// Switch 5
void isSwitch5(){

   // Stop
   yy = 5;

   // set the cursor to column 0, line 0
   RGBLCDShield.setCursor(0,0);
   RGBLCDShield.print("Robotics");         // Robotics 
   RGBLCDShield.setCursor(0,1);    
   RGBLCDShield.print("Stop");

   delay( 500 );

   // EasyDriver
   isStepperStop();
       
}

setup.ino

// Setup
void setup() {

  // Adafruit RGB LCD Shield
  // Set up the LCD's number of columns and rows: 
  RGBLCDShield.begin(16, 2);
  RGBLCDShield.setBacklight(GREEN);
  
  // Display
  // Set the cursor to column 0, line 0  
  RGBLCDShield.setCursor(0,0);  
  RGBLCDShield.print("Don Luc Electron");         // Don luc Electron
  // Set the cursor to column 0, line 1
  RGBLCDShield.setCursor(0, 1);
  RGBLCDShield.print("Robotics");                // EasyDriver

  delay(5000);

  // Clear
  RGBLCDShield.clear();

  // 2 x EasyDriver
  isStepperSetup();
  
  // 2 x RC Servo Motor
  isServoSetup();

}

Follow Us

Web: https://www.donluc.com/
Web: http://www.jlpconsultants.com/
Web: https://www.donluc.com/DLHackster/
Web: https://www.hackster.io/neosteam-labs
Web: http://neosteamlabs.com/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Facebook: https://www.facebook.com/neosteam.labs.9/
Instagram: https://www.instagram.com/neosteamlabs/
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Twitter: https://twitter.com/labs_steam
Etsy: https://www.etsy.com/shop/NeoSteamLabs

Don Luc

Project #12: Robotics – RC Servo Motor – Mk02

——

Robotics

——

Robotics

——

Robotics

——

Robotics

——

Robotics

——

Robotics

——

Robotics

——

Robotics

——

Servo (Radio Control)

Servos (also RC servos) are small, cheap, mass-produced servomotors or other actuators used for radio control and small-scale robotics.
Radio control servos are connected through a standard three-wire connection: two wires for a DC power supply and one for control, carrying a pulse-width modulation (PWM) signal. Each servo has a separate connection and PWM signal from the radio control receiver. This signal is easily generated by simple electronics, or by microcontrollers such as the Arduino. This, together with their low-cost, has led to their wide adoption for robotics and physical computing.

DL1912Mk01

1 x Adafruit RGB LCD Shield 16×2 Character Display
1 x Arduino UNO – R3
1 x ProtoScrewShield
2 x EasyDriver – Stepper Motor Driver
2 x Small Stepper Motor
2 x Pololu Mounting
2 x RC Servo Motor
2 x Potentiometer 1M Ohm
2 x Knob
4 x Jumper Wires 3″ M/M
22 x Jumper Wires 6″ M/M
3 x Half-Size Breadboard

Arduino UNO

SP1 – Digital 3
DI1 – Digital 2
SP2 – Digital 5
DI2 – Digital 4
SV1 – Digital 6
PO1 – Analog A0
SV2 – Digital 7
PO2 – Analog A1
VIN – +5V
GND – GND

DL1912Mk01.ino

// ***** Don Luc Electronics © *****
// Software Version Information
// Project #12: Robotics - RC Servo Motor - Mk02
// 12-01
// DL1912Mk01p.ino 12-02
// Arduino UNO
// Screw Shield
// Adafruit RGB LCD Shield
// 2 x Small Stepper Motor
// 2 x EasyDriver
// 2 x RC Servo Motor
// 2 x Potentiometer

// include the library code:
#include <Adafruit_RGBLCDShield.h>
#include <Servo.h>

// Adafruit RGB LCD Shield
Adafruit_RGBLCDShield RGBLCDShield = Adafruit_RGBLCDShield();

// These #defines make it easy to set the backlight color
#define OFF 0x0
#define RED 0x1
#define YELLOW 0x3
#define GREEN 0x2
#define TEAL 0x6
#define BLUE 0x4
#define VIOLET 0x5
#define WHITE 0x7

// Momentary Button
int yy = 0;
uint8_t momentaryButton = 0;

// 2 x EasyDriver
int dirPinR = 2;                           // EasyDriver Right
int stepPinR = 3;                          // stepPin Right
int dirPinL = 4;                           // EasyDriver Left
int stepPinL = 5;                          // stepPin Left
int i = 0;

// 2 x RC Servo Motor
// 2 x Potentiometer
Servo isRCServo1;                          // Create servo object to control a RCServo1
int servo1 = 6;                            // Servo 1
int iPot1 = A0;                            // Analog Potentiometer 1
int iVal1;                                 // Variable - Analog Potentiometer 1
Servo isRCServo2;                          // Create servo object to control a RCServo2
int servo2 = 7;                            // Servo 2
int iPot2 = A1;                            // Analog Potentiometer 2
int iVal2;                                 // Variable - Analog Potentiometer 2

void loop() {

  // Clear
  RGBLCDShield.clear();
   
  // Momentary Button
  momentaryButton = RGBLCDShield.readButtons();

  switch ( yy ) {
    case 1:
    
      // Up
      isSwitch1();
      
      break;
    case 2:
    
      // Down
      isSwitch2();
      
      break;
    case 3:

      // Right
      isSwitch3();
      
      break;
    case 4:

      // Left
      isSwitch4();
      
      break;
    case 5:

      // Stop
      isSwitch5();
      
      break;
    default:

      // Stop
      yy = 5;
      RGBLCDShield.setBacklight(RED);
      isSwitch5();

   }
   
   if ( momentaryButton ) {
    
    if ( momentaryButton & BUTTON_UP ) {
      
      yy = 1;
      // Up
      RGBLCDShield.setBacklight(GREEN);
      
    }
    
    if ( momentaryButton & BUTTON_DOWN ) {
      
      yy = 2;
      // Down
      RGBLCDShield.setBacklight(VIOLET);
      
    }
    
    if ( momentaryButton & BUTTON_LEFT ) {
      
      yy = 3;
      // Right
      RGBLCDShield.setBacklight(TEAL);
      
    }
    
    if ( momentaryButton & BUTTON_RIGHT ) {

      yy = 4;
      // Left
      RGBLCDShield.setBacklight(YELLOW);
    }
    
    if ( momentaryButton & BUTTON_SELECT ) {

      yy = 5;
      // Stop
      RGBLCDShield.setBacklight(RED);
   
    }
    
  }
  
}

getServo.ino

// Servo
// isServoSetup
void isServoSetup() {

  // 2 x RC Servo Motor
  isRCServo1.attach( servo1 );
  isRCServo2.attach( servo2 );
  
}
// isServo1
void isServo1() {

  // EasyDriver
  isStepperStop();
   
  // Potentiometer RC Servo Motor 1
  iVal1 = analogRead( iPot1 );              // Reads the value of the iPot1 (Value between 0 and 1023)
  iVal1 = map(iVal1, 0, 1023, 0, 180);      // Scale it to use it with the isRCServo1 (Value between 0 and 180)
  isRCServo1.write( iVal1 );                // isRCServo1 sets the servo position according to the scaled value
  delay(15);    

  // Display
  // Set the cursor to column 0, line 0  
  RGBLCDShield.setCursor(0,0);
  RGBLCDShield.print("isRCServo 1");        // isRCServo 1
  // Set the cursor to column 0, line 1
  RGBLCDShield.setCursor(0, 1);
  RGBLCDShield.print( iVal1 );              // Reads the value iVal1
  
  delay(500);

}
// isServo2
void isServo2() {

  // EasyDriver
  isStepperStop();
   
  // Potentiometer RC Servo Motor 1
  iVal2 = analogRead( iPot2 );              // Reads the value of the iPot2 (Value between 0 and 1023)
  iVal2 = map(iVal2, 0, 1023, 0, 180);      // Scale it to use it with the isRCServo2 (Value between 0 and 180)
  isRCServo2.write( iVal2 );                // isRCServo2 sets the servo position according to the scaled value
  delay(15);    

  // Display
  // Set the cursor to column 0, line 0  
  RGBLCDShield.setCursor(0,0);
  RGBLCDShield.print("isRCServo 2");        // isRCServo 2
  // Set the cursor to column 0, line 1
  RGBLCDShield.setCursor(0, 1);
  RGBLCDShield.print( iVal2 );              // Reads the value iVal2
  
  delay(500);

}

getStepper.ino

// Stepper
// isStepperSetup
void isStepperSetup() {

  // 2 x EasyDriver
  pinMode(dirPinR, OUTPUT);
  pinMode(stepPinR, OUTPUT);
  pinMode(dirPinL, OUTPUT);
  pinMode(stepPinL, OUTPUT);

}
// isStepper1
void isStepper1(){

   // set the cursor to column 0, line 0
   RGBLCDShield.setCursor(0,0);
   RGBLCDShield.print("EasyDriver");        // EasyDriver  
   RGBLCDShield.setCursor(0,1);    
   RGBLCDShield.print("Up");
   delay(500);

   // 2 x EasyDriver
   digitalWrite(dirPinR, LOW);              // Set the direction.
   delay(100);
   digitalWrite(dirPinL, LOW);              // Set the direction.
   delay(100);

   for (i = 0; i<300; i++)                 // Iterate for 1000 microsteps.
   { 
     digitalWrite(stepPinR, LOW);           // This LOW to HIGH change is what creates the
     digitalWrite(stepPinR, HIGH);          // "Rising Edge" so the easydriver knows to when to step.
     delayMicroseconds(170);                // This delay time is close to top speed.
     digitalWrite(stepPinL, LOW);           // This LOW to HIGH change is what creates the
     digitalWrite(stepPinL, HIGH);          // "Rising Edge" so the easydriver knows to when to step.
     delayMicroseconds(170);                // This delay time is close to top speed.
   } 
   
}
// isStepper2
void isStepper2(){

   // set the cursor to column 0, line 0
   RGBLCDShield.setCursor(0,0);
   RGBLCDShield.print("EasyDriver");        // EasyDriver  
   RGBLCDShield.setCursor(0,1);    
   RGBLCDShield.print("Down");
   delay(500);

   // 2 x EasyDriver
   digitalWrite(dirPinR, HIGH);              // Set the direction.
   delay(100);
   digitalWrite(dirPinL, HIGH);              // Set the direction.
   delay(100);

   for (i = 0; i<300; i++)                 // Iterate for 1000 microsteps.
   { 
     digitalWrite(stepPinR, LOW);           // This LOW to HIGH change is what creates the
     digitalWrite(stepPinR, HIGH);          // "Rising Edge" so the easydriver knows to when to step.
     delayMicroseconds(170);                // This delay time is close to top speed.
     digitalWrite(stepPinL, LOW);           // This LOW to HIGH change is what creates the
     digitalWrite(stepPinL, HIGH);          // "Rising Edge" so the easydriver knows to when to step.
     delayMicroseconds(170);                // This delay time is close to top speed.
   } 
   
}
// isStepperStop
void isStepperStop() {

   // 2 x EasyDriver
   digitalWrite(dirPinR, LOW);              // Set the direction.
   delay(100);
   digitalWrite(dirPinL, LOW);              // Set the direction.
   delay(100);
   digitalWrite(stepPinR, LOW);             // This LOW to HIGH change is what creates the
   digitalWrite(stepPinL, LOW);             // This LOW to HIGH change is what creates the 

}

getSwitch.ino

// Switch
// Switch 1
void isSwitch1(){

   // Up
   yy = 1;

   // 2 x EasyDriver
   isStepper1();

}
// Switch 2
void isSwitch2(){

   // Down
   yy = 2;

   // 2 x EasyDriver
   isStepper2();
   
}
// Switch 3
void isSwitch3(){

   // Right
   yy = 3;

   // Potentiometer RC Servo Motor 1
   isServo1();
   
}
// Switch 4
void isSwitch4(){

   // Left
   yy = 4;

   // Potentiometer RC Servo Motor 2
   isServo2();
   
}
// Switch 5
void isSwitch5(){

   // Stop
   yy = 5;

   // set the cursor to column 0, line 0
   RGBLCDShield.setCursor(0,0);
   RGBLCDShield.print("Robotics");         // Robotics 
   RGBLCDShield.setCursor(0,1);    
   RGBLCDShield.print("Stop");

   delay( 500 );

   // EasyDriver
   isStepperStop();
       
}

setup.ino

// Setup
void setup() {

  // Adafruit RGB LCD Shield
  // Set up the LCD's number of columns and rows: 
  RGBLCDShield.begin(16, 2);
  RGBLCDShield.setBacklight(GREEN);
  
  // Display
  // Set the cursor to column 0, line 0  
  RGBLCDShield.setCursor(0,0);  
  RGBLCDShield.print("Don Luc Electron");         // Don luc Electron
  // Set the cursor to column 0, line 1
  RGBLCDShield.setCursor(0, 1);
  RGBLCDShield.print("Robotics");                // EasyDriver

  delay(5000);

  // Clear
  RGBLCDShield.clear();

  // 2 x EasyDriver
  isStepperSetup();
  
  // 2 x RC Servo Motor
  isServoSetup();

}

Follow Us

Web: https://www.donluc.com/
Web: http://neosteamlabs.com/
Web: http://www.jlpconsultants.com/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Facebook: https://www.facebook.com/neosteam.labs.9/
Instagram: https://www.instagram.com/neosteamlabs/
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Twitter: https://twitter.com/labs_steam
Etsy: https://www.etsy.com/shop/NeoSteamLabs

Don Luc

Project #12: Robotics – EasyDriver – Mk01

——

Robotics

——

Robotics

——

Robotics

——

Robotics

——

Robotics

——

Small Stepper Motor

Stepper motors are great motors for position control. They can be found in desktop printers, plotters, 3D printers, CNC milling machines, and anything else requiring precise position control. Steppers are a special segment of brushless motors. They are purposely built for high-holding torque. This high-holding torque gives the user the ability to incrementally “step” to the next position. This results in a simple positioning system that doesn’t require an encoder. This makes stepper motor controllers very simple to build and use. These small steppers are a great way to get things moving, especially when positioning and repeatability is a concern. This is a Bipolar motor.

Pros

Excellent position accuracy
High holding torque
High reliability
Most steppers come in standard sizes

Cons

Small step distance limits top speed
It’s possible to “skip” steps with high loads
Draws maximum current constantly

DL1911Mk04

1 x Adafruit RGB LCD Shield 16×2 Character Display
1 x Arduino UNO – R3
1 x ProtoScrewShield
2 x EasyDriver – Stepper Motor Driver
2 x Small Stepper Motor
2 x Pololu Mounting
4 x Jumper Wires 3″ M/M
10 x Jumper Wires 6″ M/M
2 x Half-Size Breadboard

Arduino UNO

SP1 – Digital 3
DI1 – Digital 2
SP2 – Digital 5
DI2 – Digital 4
VIN – +5V
GND – GND

DL1911Mk04.ino

// ***** Don Luc Electronics © *****
// Software Version Information
// Project #12: Robotics - EasyDriver - Mk01
// 11-04
// DL1911Mk04p.ino 12-01
// Arduino UNO
// Screw Shield
// Adafruit RGB LCD Shield
// 2 x Small Stepper Motor
// 2 x EasyDriver

// include the library code:
#include <Adafruit_RGBLCDShield.h>

// Adafruit RGB LCD Shield
Adafruit_RGBLCDShield RGBLCDShield = Adafruit_RGBLCDShield();

// These #defines make it easy to set the backlight color
#define OFF 0x0
#define RED 0x1
#define YELLOW 0x3
#define GREEN 0x2
#define TEAL 0x6
#define BLUE 0x4
#define VIOLET 0x5
#define WHITE 0x7

// Momentary Button
int yy = 0;
uint8_t momentaryButton = 0;

// 2 x EasyDriver
int dirPinR = 2;                           // EasyDriver Right
int stepPinR = 3;                          // stepPin Right
int dirPinL = 4;                           // EasyDriver Left
int stepPinL = 5;                          // stepPin Left
int i = 0;

void loop() {

  // Clear
  RGBLCDShield.clear();
   
  // Momentary Button
  momentaryButton = RGBLCDShield.readButtons();

  switch ( yy ) {
    case 1:
    
      // Up
      isSwitch1();
      
      break;
    case 2:
    
      // Down
      isSwitch2();
      
      break;
    case 3:

      // Right
      isSwitch3();
      
      break;
    case 4:

      // Left
      isSwitch4();
      
      break;
    case 5:

      // Stop
      isSwitch5();
      
      break;
    default:

      // Stop
      yy = 5;
      RGBLCDShield.setBacklight(RED);
      isSwitch5();

   }
   
   if ( momentaryButton ) {
    
    if ( momentaryButton & BUTTON_UP ) {
      
      yy = 1;
      // Up
      RGBLCDShield.setBacklight(GREEN);
      
    }
    
    if ( momentaryButton & BUTTON_DOWN ) {
      
      yy = 2;
      // Down
      RGBLCDShield.setBacklight(VIOLET);
      
    }
    
    if ( momentaryButton & BUTTON_LEFT ) {
      
      yy = 3;
      // Right
      RGBLCDShield.setBacklight(TEAL);
      
    }
    
    if ( momentaryButton & BUTTON_RIGHT ) {

      yy = 4;
      // Left
      RGBLCDShield.setBacklight(YELLOW);
    }
    
    if ( momentaryButton & BUTTON_SELECT ) {

      yy = 5;
      // Stop
      RGBLCDShield.setBacklight(RED);
   
    }
    
  }
  
}

getSwitch.ino

// Switch
// Switch 1
void isSwitch1(){

   // Up
   yy = 1;

   // set the cursor to column 0, line 0
   RGBLCDShield.setCursor(0,0);
   RGBLCDShield.print("EasyDriver");        // EasyDriver  
   RGBLCDShield.setCursor(0,1);    
   RGBLCDShield.print("Up");

   // 2 x EasyDriver
   digitalWrite(dirPinR, LOW);              // Set the direction.
   delay(100);
   digitalWrite(dirPinL, LOW);              // Set the direction.
   delay(100);

   for (i = 0; i<1000; i++)                 // Iterate for 1000 microsteps.
   { 
     digitalWrite(stepPinR, LOW);           // This LOW to HIGH change is what creates the
     digitalWrite(stepPinR, HIGH);          // "Rising Edge" so the easydriver knows to when to step.
     delayMicroseconds(170);                // This delay time is close to top speed.
     digitalWrite(stepPinL, LOW);           // This LOW to HIGH change is what creates the
     digitalWrite(stepPinL, HIGH);          // "Rising Edge" so the easydriver knows to when to step.
     delayMicroseconds(170);                // This delay time is close to top speed.
   }  

}
// Switch 2
void isSwitch2(){

   // Down
   yy = 2;

   // set the cursor to column 0, line 0
   RGBLCDShield.setCursor(0,0);
   RGBLCDShield.print("EasyDriver");         // EasyDriver  
   RGBLCDShield.setCursor(0,1);    
   RGBLCDShield.print("Down");

   // 2 x EasyDriver
   digitalWrite(dirPinR, HIGH);              // Set the direction.
   delay(100);
   digitalWrite(dirPinL, HIGH);              // Set the direction.
   delay(100);

   for (i = 0; i<1000; i++)                 // Iterate for 1000 microsteps.
   {
     digitalWrite(stepPinR, LOW);           // This LOW to HIGH change is what creates the
     digitalWrite(stepPinR, HIGH);          // "Rising Edge" so the easydriver knows to when to step.
     delayMicroseconds(170);                // This delay time is close to top speed.
     digitalWrite(stepPinL, LOW);           // This LOW to HIGH change is what creates the
     digitalWrite(stepPinL, HIGH);          // "Rising Edge" so the easydriver knows to when to step.
     delayMicroseconds(170);                // This delay time is close to top speed.
   } 

}
// Switch 3
void isSwitch3(){

   // Right
   yy = 3;

   // set the cursor to column 0, line 0
   RGBLCDShield.setCursor(0,0);
   RGBLCDShield.print("EasyDriver");        // EasyDriver  
   RGBLCDShield.setCursor(0,1);    
   RGBLCDShield.print("Hight");

   // 2 x EasyDriver
   digitalWrite(dirPinR, LOW);               // Set the direction.
   delay(100);
   digitalWrite(dirPinL, HIGH);              // Set the direction.
   delay(100);

   for (i = 0; i<1000; i++)                 // Iterate for 1000 microsteps.
   {
     digitalWrite(stepPinR, LOW);           // This LOW to HIGH change is what creates the
     digitalWrite(stepPinR, HIGH);          // "Rising Edge" so the easydriver knows to when to step.
     delayMicroseconds(170);                // This delay time is close to top speed.
     digitalWrite(stepPinL, LOW);           // This LOW to HIGH change is what creates the
     digitalWrite(stepPinL, HIGH);          // "Rising Edge" so the easydriver knows to when to step.
     delayMicroseconds(170);                // This delay time is close to top speed.
   }    
  
}
// Switch 4
void isSwitch4(){

   // Left
   yy = 4;

   // set the cursor to column 0, line 0
   RGBLCDShield.setCursor(0,0);
   RGBLCDShield.print("EasyDriver");        // EasyDriver  
   RGBLCDShield.setCursor(0,1);    
   RGBLCDShield.print("Left");

   // 2 x EasyDriver
   digitalWrite(dirPinR, HIGH);             // Set the direction.
   delay(100);
   digitalWrite(dirPinL, LOW);              // Set the direction.
   delay(100);

   for (i = 0; i<1000; i++)                 // Iterate for 1000 microsteps.
   {
     digitalWrite(stepPinR, LOW);           // This LOW to HIGH change is what creates the
     digitalWrite(stepPinR, HIGH);          // "Rising Edge" so the easydriver knows to when to step.
     delayMicroseconds(170);                // This delay time is close to top speed.
     digitalWrite(stepPinL, LOW);           // This LOW to HIGH change is what creates the
     digitalWrite(stepPinL, HIGH);          // "Rising Edge" so the easydriver knows to when to step.
     delayMicroseconds(170);                // This delay time is close to top speed.
   }    
    
}
// Switch 5
void isSwitch5(){

   // Stop
   yy = 5;

   // set the cursor to column 0, line 0
   RGBLCDShield.setCursor(0,0);
   RGBLCDShield.print("EasyDriver");        // EasyDriver  
   RGBLCDShield.setCursor(0,1);    
   RGBLCDShield.print("Stop");

   delay( 1000 );

   // 2 x EasyDriver
   digitalWrite(dirPinR, LOW);              // Set the direction.
   delay(100);
   digitalWrite(dirPinL, LOW);              // Set the direction.
   delay(100);
   digitalWrite(stepPinR, LOW);             // This LOW to HIGH change is what creates the
   digitalWrite(stepPinL, LOW);             // This LOW to HIGH change is what creates the 
    
}

setup.ino

// Setup
void setup() {

  // Adafruit RGB LCD Shield
  // Set up the LCD's number of columns and rows: 
  RGBLCDShield.begin(16, 2);
  RGBLCDShield.setBacklight(GREEN);
  
  // Display
  // Set the cursor to column 0, line 0  
  RGBLCDShield.setCursor(0,0);  
  RGBLCDShield.print("Don Luc Electron");         // Don luc Electron
  // Set the cursor to column 0, line 1
  RGBLCDShield.setCursor(0, 1);
  RGBLCDShield.print("EasyDriver");               // EasyDriver

  delay(5000);

  // Clear
  RGBLCDShield.clear();

  // 2 x EasyDriver
  pinMode(dirPinR, OUTPUT);
  pinMode(stepPinR, OUTPUT);
  pinMode(dirPinL, OUTPUT);
  pinMode(stepPinL, OUTPUT);

}

Follow Us

Web: https://www.donluc.com/
Web: http://neosteamlabs.com/
Web: http://www.jlpconsultants.com/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Facebook: https://www.facebook.com/neosteam.labs.9/
Instagram: https://www.instagram.com/neosteamlabs/
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Twitter: https://twitter.com/labs_steam
Etsy: https://www.etsy.com/shop/NeoSteamLabs

Don Luc

Project #11: ESP32 Feather – PIR Motion Sensor – Mk11

PIR Motion Sensor

——

——

PIR Motion Sensor

——

PIR Motion Sensor

——

PIR Motion Sensor

——

PIR Motion Sensor

——

PIR Motion Sensor

Passive infrared (PIR) sensors are motion-detecting devices used in security systems across the world, even though you may not see them, they probably see you.

This is a simple to use motion sensor. Power it up and wait 1-2 seconds for the sensor to get a snapshot of the still room. If anything moves after that period, the ‘alarm’ pin will go low.

Pololu Adjustable Boost Regulator 2.5-9.5V

This powerful, adjustable boost regulator can generate an output voltage as high as 9.5 V from an input voltage as low as 1.5 V, all in a compact, 0.42″ x 0.88″ x 0.23″ package. A trimmer potentiometer lets you set the boost regulator’s output voltage to a value between 2.5 and 9.5 V.

DL1911Mk02

1 x Adafruit HUZZAH32 ESP32 Feather
1 x Adafruit SHARP Memory Display
1 x Adafruit Adalogger FeatherWing – RTC + SD
1 x CR1220 12mm Lithium Battery
1 x 8Gb Micro SD Card
1 x RHT03 Humidity and Temperature Sensor
1 x GPS Receiver GP-20U
1 x LED Green
1 x Rocker Switches
1 x 100 Ohm
1 x 10K Ohm
1 x 3.3M Ohm
1 x Antenna
1 x Lithium Ion Battery – 2.5Ah
1 x PIR Motion Sensor
1 x Pololu Adjustable Boost Regulator 2.5-9.5V
1 x LED Green 1
14 x Jumper Wires 3″ M/M
10 x Jumper Wires 6″ M/M
2 x Wire
1 x Full-Size Breadboard
2 x Breadboard
1 x SparkFun Cerberus USB Cable

Adafruit HUZZAH32 ESP32 Feather

LG0 – Digital 21
RO1 – Digital 16
RHT – Digital 17
SCK – Digital 13
MOS – Digital 12
SSD – Digital 27
SDA – Digital 23
SCL – Digital 22
SD1 – Digital 33
SC2 – Digital 5
MO2 – Digital 18
MI2 – Digital 19
GPS – Digital 4
EMF – Analog A0
BAT – Analog A13
MOT – Digital 32
LG1 – Digital 14
GND – GND
VIN – +3.3V

DL1911Mk02.ino

// ***** Don Luc Electronics *****
// Software Version Information
// Project #11: HUZZAH32 ESP32 Feather - PIR Motion - Mk11
// 11-02
// DL1911Mk02p.ino 11-11
// Adafruit HUZZAH32 ESP32 Feather Board
// SHARP Display
// LED Green
// Adalogger FeatherWing - RTC + SD
// EEPROM
// RHT03 Humidity and Temperature Sensor
// Rocker Switches
// GPS Receiver
// EMF Meter (Single Axis)
// Lithium Ion Battery - 2.5Ah
// PIR Motion
// Pololu Adjustable Boost Regulator 2.5-9.5V
// LED Green 1

// include Library Code
// SHARP Memory Display
#include <Adafruit_SharpMem.h>
#include <Adafruit_GFX.h>
// Date and Time
#include "RTClib.h"
// EEPROM library to read EEPROM with unique ID for unit
#include "EEPROM.h"
// RHT Humidity and Temperature Sensor
#include <SparkFun_RHT03.h>
// SD Card
#include "FS.h"
#include "SD.h"
#include "SPI.h"
// GPS Receiver
#include <TinyGPS++.h>
#include <HardwareSerial.h>

// SHARP Memory Display
// any pins can be used
#define SHARP_SCK  13
#define SHARP_MOSI 12
#define SHARP_SS   27
// Set the size of the display here, e.g. 144x168!
Adafruit_SharpMem display(SHARP_SCK, SHARP_MOSI, SHARP_SS, 144, 168);
// The currently-available SHARP Memory Display (144x168 pixels)
// requires > 4K of microcontroller RAM; it WILL NOT WORK on Arduino Uno
// or other <4K "classic" devices!
#define BLACK 0
#define WHITE 1
int minorHalfSize; // 1/2 of lesser of display width or height

// LED Green
int iLEDGreen =  21;                 // LED Green

// PCF8523 Precision RTC 
RTC_PCF8523 rtc;
String dateRTC = "";
String timeRTC = "";

// RHT Humidity and Temperature Sensor
const int RHT03_DATA_PIN = 17;          // RHT03 data pin Digital 17
RHT03 rht;                              // This creates a RTH03 object, which we'll use to interact with the sensor
float latestHumidity;
float latestTempC;
float latestTempF;

// SD Card
const int chipSelect = 33;              // SD Card
String zzzzzz = "";

// Rocker Switches
int iRow1 = 16;                         // Rocker Switches Digital 16
int iRow1State = 0;                     // Variable for reading the pushbutton status

// ESP32 HardwareSerial
HardwareSerial tGPS(2);

// GPS Receiver
#define gpsRXPIN 4
#define gpsTXPIN 36                     // This one is unused and doesnt have a conection
// The TinyGPS++ object
TinyGPSPlus gps;
float TargetLat;
float TargetLon;
int Status = 0;

// EMF Meter (Single Axis)
#define NUMREADINGS 15                    // Raise this number to increase data smoothing
int senseLimit = 15;                      // Raise this number to decrease sensitivity (up to 1023 max)
int val = 0;                              // Val
int iEMF = A0;                            // EMF Meter
int readings[ NUMREADINGS ];              // Readings from the analog input
int ind = 0;                              // Index of the current reading
int total = 0;                            // Running total
int average = 0;                          // Final average of the probe reading
int iEMFDis = 0;
int iEMFRect = 0;

// LiPo Battery
const int bat = A13;                      // LiPo Battery
uint16_t vbat = 0;
int iBat = 0;

// PIR Motion
const int iMotion = 32;                   // Motion detector
const int iLEDGreen1 = 14;                // LED Green 1
int proximity = LOW;                      // Proximity
String Det = "";

// The current address in the EEPROM (i.e. which byte
// we're going to  read to next)
#define EEPROM_SIZE 64
String sver = "11-2.p";
// Unit ID information
String uid = "";

void loop() {

  // Receives NEMA data from GPS receiver
  // This sketch displays information every time a new sentence is correctly encoded.
  while ( tGPS.available() > 0)
    if (gps.encode( tGPS.read() ))
    {
     displayInfo();
    }
  
  if (millis() > 5000 && gps.charsProcessed() < 10)
  {
    while(true);
  }

  // Date and Time 
  isRTC();
  
  // RHT03 Humidity and Temperature Sensor
  isRHT03();
  
  // SHARP Memory Display On
  isDisplayOn();
  
  // Rocker Switched
  // Read the state of the iRow1 value
  iRow1State = digitalRead(iRow1);

  // EMF Meter (Single Axis)
  isEMF();

  // LiPo Battery
  isBattery();

  // isPIR Motion
  isPIR();

  // Check if the pushbutton is pressed. If it is, the buttonState is HIGH:
  if (iRow1State == HIGH) {

    // iLEDGreen
    digitalWrite(iLEDGreen,  HIGH );
    // SD Card
    isSD();

  } else {

    // iLEDGreen
    digitalWrite(iLEDGreen,  LOW );
  
  }
   
  // Delay 
  delay( 1000 );

}

getBattery.ino

// LiPo Battery
void isBattery() {

  // Battery
  vbat = analogRead(bat);
  vbat = vbat / 2;

  iBat = map( vbat, 1, 1064, 1, 100);
  
}

getDisplay.ino

// SHARP Memory Display On
void isDisplayOn() {

    // Clear Display
    display.clearDisplay();
    // Text display date, time, LED on, Etc...
    display.setRotation(4);
    display.setTextSize(2);
    display.setTextColor(BLACK);
    // Date
    display.setCursor(0,1);
    display.println( dateRTC );
    // Time
    display.setCursor(0,17);
    display.println( timeRTC );
    // Longitude  
    display.setCursor(0,35);
    display.print("Lon: ");
    display.println( TargetLon );
    // Latitude
    display.setCursor(0,55);
    display.print("Lat: ");
    display.println( TargetLat );
    // Humidity
    display.setCursor(0,74);
    display.print("Hum: ");
    display.print( latestHumidity );
    display.println("%");
    // Temp C
    display.setCursor(0,94);
    display.print("Cel: ");
    display.print( latestTempC );
    display.println("*C");
    // EMF Meter
    display.setCursor(0,114);
    display.print("EMF: ");
    display.println( iEMFDis );
    // Battery
    display.setCursor(0,134);
    display.print("Bat: ");
    display.print( iBat );
    display.println( "%" );
    // PIR Motion
    display.println( Det );
    display.setCursor(0,154);
    // Refresh
    display.refresh(); 

}
// SHARP Memory Display - UID
void isDisplayUID() {

    // Clear Display
    display.clearDisplay();
    // text display EEPROM
    display.setRotation(4);
    display.setTextSize(2);
    display.setTextColor(BLACK);
    // EEPROM with Unique ID
    display.setCursor(0,20);
    display.print( "UID: " );
    display.println( uid );
    // Version
    display.setCursor(0,45);
    display.print( "VER: ");
    display.println( sver  );
    // Refresh
    display.refresh();
    delay( 100 );
    
}

getEEPROM.ino

// EEPROM
void GetUID()
{
  
  // Get unit ID
  uid = "";
  for (int x = 0; x < 5; x++)
  {
    uid = uid + char(EEPROM.read(x));
  }
  
}

getEMF.ino

// EMF Meter (Single Axis)
// setupEMF
void setupEMF() {

  // EMF Meter (Single Axis)
  pinMode( iEMF, OUTPUT ); // EMF Meter
  for (int i = 0; i < NUMREADINGS; i++){
    readings[ i ] = 0;     // Initialize all the readings to 0
  }
  
}
// isEMF
void isEMF(){

  // Probe
  val = analogRead( iEMF );                    // Take a reading from the probe
  
  if( val >= 1 ){                              // If the reading isn't zero, proceed

    val = constrain( val, 1, senseLimit );     // Turn any reading higher than the senseLimit value into the senseLimit value
    val = map( val, 1, senseLimit, 1, 1023 );  // Remap the constrained value within a 1 to 1023 range

    total -= readings[ ind ];                  // Subtract the last reading
    readings[ ind ] = val;                     // Read from the sensor
    total += readings[ ind ];                  // Add the reading to the total
    ind = ( ind + 1 );                         // Advance to the next index

    if ( ind >= NUMREADINGS ) {                // If we're at the end of the array...
      ind = 0;                                 // ...wrap around to the beginning
    }  

    average = total / NUMREADINGS;             // Calculate the average

    
   // average = val;
  }
  else
  {
      
    iEMFRect = 0;
    val = 0;
    average = 0;
    
  }

  iEMFDis = average;
  iEMFRect = map( average, 1, 1023, 1, 144 );
    
}

getGPS.ino

// GPS Receiver
void setupGPS() {

  // Setup GPS
  tGPS.begin(  9600 , SERIAL_8N1, gpsRXPIN, gpsTXPIN );
  
}
// GPS Vector Pointer Target
void displayInfo()
{

  // Location
  if (gps.location.isValid())
  {
    
    TargetLat = gps.location.lat();
    TargetLon = gps.location.lng();
    Status = 2;
    
  }
  else
  {

    Status = 0;
    
  }

}

getPIR.ino

// PIR Motion
void setupPIR() {

  // Setup PIR Montion
  pinMode(iMotion, INPUT_PULLUP);
  pinMode(iLEDGreen1, OUTPUT);
  
}
// isPIR Motion
void isPIR() {

  // Proximity
  proximity = digitalRead(iMotion);
  if (proximity == LOW) 
  {

    // PIR Motion Sensor's LOW, Motion is detected
    // LED Green 1 - HIGH
    digitalWrite(iLEDGreen1, HIGH);
    Det = "Motion!";
    
  }
  else
  {

    // PIR Motion Sensor's HIGH
    // LED Green 1 - LOW
    digitalWrite(iLEDGreen1, LOW);
    Det = "****";
    
  }
  
}

getRHT.ino

// RHT03 Humidity and Temperature Sensor
void isRHT03(){

  // Call rht.update() to get new humidity and temperature values from the sensor.
  int updateRet = rht.update();

  // The humidity(), tempC(), and tempF() functions can be called -- after 
  // a successful update() -- to get the last humidity and temperature value 
  latestHumidity = rht.humidity();
  latestTempC = rht.tempC();
  latestTempF = rht.tempF();
  
}

getRTCpcf8523.ino

// PCF8523 Precision RTC 
void setupRTC() {

  // pcf8523 Precision RTC   
  if (! rtc.begin()) {
    while (1);
  }  
  if (! rtc.initialized()) {
    // Following line sets the RTC to the date & time this sketch was compiled
    rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
    // This line sets the RTC with an explicit date & time, for example to set
    // January 21, 2014 at 3am you would call:
    // rtc.adjust(DateTime(2018, 9, 29, 12, 17, 0));
  }
  
}
// Date and Time RTC
void isRTC () {

  // Date and Time
  DateTime now = rtc.now();
  // Date
  dateRTC = now.year(), DEC; 
  dateRTC = dateRTC + "/";
  dateRTC = dateRTC + now.month(), DEC;
  dateRTC = dateRTC + "/";
  dateRTC = dateRTC + now.day(), DEC;
  // Time
  timeRTC = now.hour(), DEC;
  timeRTC = timeRTC + ":";
  timeRTC = timeRTC + now.minute(), DEC;
  timeRTC = timeRTC + ":";
  timeRTC = timeRTC + now.second(), DEC;
  
}

getSD.ino

// SD Card
void setupSD() {

  // SD Card
    pinMode( chipSelect , OUTPUT );
    if(!SD.begin( chipSelect )){
        ;  
        return;
    }
    uint8_t cardType = SD.cardType();

    if(cardType == CARD_NONE){
        ; 
        return;
    }

    //Serial.print("SD Card Type: ");
    if(cardType == CARD_MMC){
        ; 
    } else if(cardType == CARD_SD){
        ; 
    } else if(cardType == CARD_SDHC){
        ; 
    } else {
        ; 
    } 

    uint64_t cardSize = SD.cardSize() / (1024 * 1024);
  
}
// SD Card
void isSD() {

  zzzzzz = "";

  zzzzzz = uid + "|" + sver + "|" + dateRTC + "|" + timeRTC + "|" + Status + "|" + TargetLon + "|" + TargetLat + "|" + latestHumidity + "|" + latestTempC + "|" + latestTempF + "|" + average + "|" + iBat + "|" + Det + "|\r";

  char msg[zzzzzz.length() + 1];

  zzzzzz.toCharArray(msg, zzzzzz.length() + 1);

  appendFile(SD, "/espdata.txt", msg );
  
}
// List Dir
void listDir(fs::FS &fs, const char * dirname, uint8_t levels){
    dirname;
    File root = fs.open(dirname);
    if(!root){
        return;
    }
    if(!root.isDirectory()){
        return;
    }

    File file = root.openNextFile();
    while(file){
        if(file.isDirectory()){
            file.name();
            if(levels){
                listDir(fs, file.name(), levels -1);
            }
        } else {
            file.name();
            file.size();
        }
        file = root.openNextFile();
    }
}
// Write File
void writeFile(fs::FS &fs, const char * path, const char * message){
    path;
    File file = fs.open(path, FILE_WRITE);
    if(!file){
        return;
    }
    if(file.print(message)){
        ;  
    } else {
        ;  
    }
    file.close();
}
// Append File
void appendFile(fs::FS &fs, const char * path, const char * message){
    //Serial.printf("Appending to file: %s\n", path);
    path;
    File file = fs.open(path, FILE_APPEND);
    if(!file){
        return;
    }
    if(file.print(message)){
        ;  
    } else {
        ;  
    }
    file.close();
}

setup.ino

// Setup
void setup() {

  // EEPROM with Unique ID
  EEPROM.begin(EEPROM_SIZE);
   
  // Get Unit ID
  GetUID();

  // GPS Receiver
  // Setup GPS
  setupGPS();
  
  // SHARP Display start & clear the display
  display.begin();
  display.clearDisplay();

  isDisplayUID();

  delay( 5000 );
  
  // Initialize the LED Green
  pinMode(iLEDGreen, OUTPUT);

  // PCF8523 Precision RTC 
  setupRTC();

  // Date and Time RTC
  isRTC();

  // RHT03 Humidity and Temperature Sensor
  // Call rht.begin() to initialize the sensor and our data pin
  rht.begin(RHT03_DATA_PIN);

  // SD Card
  setupSD();

  // Rocker Switches
  pinMode(iRow1, INPUT);

  // EMF Meter (Single Axis)
  setupEMF();

  // PIR Motion
  setupPIR();

}

Follow Us

Web: https://www.donluc.com/
Web: http://neosteamlabs.com/
Web: http://www.jlpconsultants.com/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Facebook: https://www.facebook.com/neosteam.labs.9/
Instagram: https://www.instagram.com/neosteamlabs/
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Twitter: https://twitter.com/labs_steam
Etsy: https://www.etsy.com/shop/NeoSteamLabs

Project #9: Stepper – EasyDriver – Mk04

EasyDriver – Hook-Up

Once you have all the headers soldered on, it’s time to hook up the EasyDriver to your Arduino. Using the picture below, make all the necessary connections.

Note: The small stepper motor looks different than the one pictured. It should have a 4-pin connector on the end. This will be attached to the 4-pin male header facing upward. Because of the nature of this particular stepper, you can hook up the connector in either orientation, i.e. either the black wire on the left or the yellow wire on the left. It will work either way. If you are using a different motor, consult its documentation to find out which wires should go where.

IMPORTANT: Stepper motors require more power than can be supplied by the Arduino. In this example we will be powering the Uno with a 12V external supply. Notice that the power input (M+) on the EasyDriver is attached to the Vin pin on the Arduino. This will allow you to power both the Arduino and the motor with the same power supply.

DonLuc1807Mk07

1 x RGB LCD Shield 16×2 Character Display
1 x Arduino UNO – R3
1 x ProtoScrewShield
1 x EasyDriver
1 x Small Stepper Motor
1 x Pololu Mounting
3 x Jumper Wires 3″ M/M
4 x Jumper Wires 6″ M/M
1 x Half-Size Breadboard

Arduino UNO

Spe – Digital 3
Dir – Digital 2
VIN – +5V
GND – GND

DonLuc1807Mk07p.ino

// ***** Don Luc *****
// Software Version Information
// Project #9: Stepper - EasyDriver - Mk04
// 7-7
// DonLuc1807Mk07p 7-7
// Stepper
// EasyDriver

// include the library code:
#include <Adafruit_MCP23017.h>
#include <Adafruit_RGBLCDShield.h>

Adafruit_RGBLCDShield RGBLCDShield = Adafruit_RGBLCDShield();
#define GREEN 0x2

// EasyDriver
int dirPin = 2;                           // EasyDriver
int stepPin = 3;                          // stepPin

void loop() {

  // Display
  // Set the cursor to column 0, line 0  
  RGBLCDShield.setCursor(0,0);
  RGBLCDShield.print("EasyDriver");       // EasyDriver
  
  // EasyDriver
  int i;

  // Set the cursor to column 0, line 1
  RGBLCDShield.setCursor(0, 1);
  RGBLCDShield.print("Left");             // Left
  
  digitalWrite(dirPin, LOW);              // Set the direction.
  delay(100);

  for (i = 0; i<4000; i++)                // Iterate for 4000 microsteps.
  {
    digitalWrite(stepPin, LOW);           // This LOW to HIGH change is what creates the
    digitalWrite(stepPin, HIGH);          // "Rising Edge" so the easydriver knows to when to step.
    delayMicroseconds(500);               // This delay time is close to top speed for this
  }                                       // particular motor. Any faster the motor stalls.

  // Set the cursor to column 0, line 1
  RGBLCDShield.setCursor(0, 1);
  RGBLCDShield.print("Right");            // Right
  
  digitalWrite(dirPin, HIGH);             // Change direction.
  delay(2000);

  for (i = 0; i<4000; i++)                // Iterate for 4000 microsteps
  {
    digitalWrite(stepPin, LOW);           // This LOW to HIGH change is what creates the
    digitalWrite(stepPin, HIGH);          // "Rising Edge" so the easydriver knows to when to step.
    delayMicroseconds(500);               // This delay time is close to top speed for this
  }                                       // particular motor. Any faster the motor stalls.

  delay(2000);
  
  // Clear
  RGBLCDShield.clear();
  
}

setup.ino

// Setup
void setup() {

  // set up the LCD's number of columns and rows: 
  RGBLCDShield.begin(16, 2);
  RGBLCDShield.setBacklight(GREEN);
  
  // Display
  // Set the cursor to column 0, line 0  
  RGBLCDShield.setCursor(0,0);  
  RGBLCDShield.print("Don Luc");         // Don luc
  // Set the cursor to column 0, line 1
  RGBLCDShield.setCursor(0, 1);
  RGBLCDShield.print("EasyDriver");      // EasyDriver

  delay(5000);

  // Clear
  RGBLCDShield.clear();

  // EasyDriver
  pinMode(dirPin, OUTPUT);
  pinMode(stepPin, OUTPUT);

}

Don Luc

Project #8: Servo – Potentiometer Servo – Mk01

Servo Motor

A servo motor is a rotary actuator or linear actuator that allows for precise control of angular or linear position, velocity and acceleration. It consists of a suitable motor coupled to a sensor for position feedback. It also requires a relatively sophisticated controller, often a dedicated module designed specifically for use with servo motors.

Servo motors have been around for a long time and are utilized in many applications. They are small in size but pack a big punch and are very energy-efficient. These features allow them to be used to operate remote-controlled or radio-controlled toy cars, robots and airplanes. Servo motors are also used in industrial applications, robotics, in-line manufacturing, pharmaceutics and food services.

Circuit

Servo motors have three wires: power, ground, and signal. The power wire is red, and should be connected to the 5V pin on the Arduino board. The ground wire is black and should be connected to a ground pin on the board. The signal pin is orange and should be connected to pin 9 on the board.

The potentiometer should be wired so that its two outer pins are connected to power (+5V) and ground, and its middle pin is connected to analog input 0 on the board.

DonLuc1805Mk07

1 x RGB LCD Shield 16×2 Character Display
1 x Arduino UNO – R3
1 x ProtoScrewShield
1 x Servo Motor
1 x 100k Ohm Potentiometer
1 x Potentiometer Knob
4 x Jumper Wires 3″ M/M
4 x Jumper Wires 6″ M/M
1 x Half-Size Breadboard

Arduino UNO

Ser – Digital 9
Pot – Analog A0
VIN – +5V
GND – GND

DonLuc1807Mk03.ino

// ***** Don Luc *****
// Software Version Information
// Project #8: Servo Motor - Potentiometer - Mk01
// 7-3
// DonLuc1807Mk03 7-3
// Servo Motor
// Potentiometer Servo

// include the library code:
#include <Adafruit_MCP23017.h>
#include <Adafruit_RGBLCDShield.h>
#include <Servo.h>

Adafruit_RGBLCDShield RGBLCDShield = Adafruit_RGBLCDShield();
#define GREEN 0x2

// Potentiometer Servo Motor
Servo isServo;                            // Create servo object to control a servo
int iPot1 = A0;                           // Analog Potentiometer 1
int iVal;                                 // Variable - Analog Potentiometer 1

void loop() {

  // Potentiometer Servo Motor
  iVal = analogRead(iPot1);               // Reads the value of the iPot1 (Value between 0 and 1023)
  iVal = map(iVal, 0, 1023, 0, 180);      // Scale it to use it with the isServo (Value between 0 and 180)
  isServo.write(iVal);                    // isServo sets the servo position according to the scaled value
  delay(15);    

  // Display
  // Set the cursor to column 0, line 0  
  RGBLCDShield.setCursor(0,0);
  RGBLCDShield.print("Potentiometer");     // Potentiometer
  // Set the cursor to column 0, line 1
  RGBLCDShield.setCursor(0, 1);
  RGBLCDShield.print(iVal);                // Reads the value iVal
  
  delay(500);
  
  // Clear
  RGBLCDShield.clear();
  
}

setup.ino

// Setup
void setup() {

  // set up the LCD's number of columns and rows: 
  RGBLCDShield.begin(16, 2);
  RGBLCDShield.setBacklight(GREEN);
  
  // Display
  // Set the cursor to column 0, line 0  
  RGBLCDShield.setCursor(0,0);  
  RGBLCDShield.print("Don Luc");         // Don luc
  // Set the cursor to column 0, line 1
  RGBLCDShield.setCursor(0, 1);
  RGBLCDShield.print("Potentiometer");   // Potentiometer Servo Motor

  delay(5000);

  // Clear
  RGBLCDShield.clear();

  // Potentiometer Servo Motor
  isServo.attach(9);                     // Attaches the Servo on pin 9 to the Servo Object

}

Don Luc

Pololu – 2-AAA Battery Holder

Pololu 1141 Mk01

Pololu 1141 Mk02

Pololu: 1141

This battery holder features two 6″, 24-gauge leads that have 5 mm of insulation stripped off of the ends.

Description

This battery holder features two 6″, 24-gauge leads that have 5 mm of insulation stripped off of the ends.

Dimensions

  • Size: 53 × 24 × 13 mm
  • Weight: 0.15 oz

General Specifications

  • Lead length: 6 in
  • Cells: 2
  • Cell type: AAA

Don Luc

Pololu – 2-AAA Battery Holder, Enclosed with Switch

Pololu 1143 Mk01

Pololu 1143 Mk02

Pololu: 1143

Enclosed battery holder for two AAA cells. This holder features a lid that slides over the batteries and snaps into place to fully enclose them. It also features a switch that lets you open and close the electrical connection between the batteries and the holder’s leads.

Description

This battery holder features two 6″, 24-gauge leads that have 5 mm of insulation stripped off of the ends.

Dimensions

  • Size: 63 × 26 × 16 mm
  • Weight: 0.45 oz

General Specifications

  • Lead length: 6 in
  • Cells: 2
  • Cell type: AAA

Notes: Switch adds 2 mm to the height.

Don Luc

Pololu – Universal Aluminum Mounting Hub for 3mm Shaft, #4-40 Holes (2-Pack)

Pololu 1078 Mk01

Pololu 1078 Mk02

Pololu 1078 Mk03

Pololu 1078 Mk04

Pololu: 1078

These universal aluminum mounting hubs allow you to mount custom wheels and mechanisms to 3 mm diameter motor shafts. The set includes two hubs, two #4-40 set screws for securing the hubs to motor shafts, and one 0.05? Allen wrench for use with the set screws. Each hub has four threaded mounting holes for #4-40 screws (not included).

We have an assortment of universal mounting hubs available, spanning several shaft sizes and featuring mounting holes threaded for metric or imperial screws: 3mm – #4-40

Description

These universal mounting hubs are designed to work with most 3 mm diameter shafts, including round shafts, “D” shafts, and Tamiya’s 3 mm hexagonal shafts. Each of the two included hubs has four mounting holes for #4-40 screws (not included), letting you mount custom wheels or mechanisms to your motors. The two included #4-40 hex set screws (one for each hub) allow secure coupling of shaft to hub, and a 0.05? hex wrench (often the smallest size in SAE Allen wrench sets) is included for use with the set screws. A dimension diagram of the hub is available under the resources tab.

The picture to the right shows a hub with one of Pololu’s mini metal gearmotors and a Pololu mini metal gearmotor bracket. These hubs will work with any Pololu mini/15.5D mm metal gearmotor or micro metal gearmotor, and they also work with 60 mm, 70 mm, 80 mm, and 90 mm Pololu wheels.

  • Size: 17.5 mm diameter × 5 mm thick
  • Weight: 2.8 g
  • Shaft diameter: 3 mm
  • Mounting hole size: #4-40

Notes:

  • For a single hub only (without set screw)
  • This is also the size of the set screw

Don Luc

Categories
Archives