The Alpha Geek – Geeking Out

Unmanned Vehicles

Project #12: Robotics – Unmanned Vehicles 1h – Mk12

——

Robotics

——

Robotics

——

Robotics

——

Robotics

——

Pololu Stepper Motor Bipolar, 200 Steps/Rev, 2.8V, 1.7 A/Phase

This hybrid bipolar stepping motor has a 1.8° step angle (200 steps/revolution). Each phase draws 1.7 A at 2.8 V, allowing for a holding torque of 3.7 kg-cm. The motor has four color-coded wires terminated with bare leads: black and green connect to one coil; red and blue connect to the other.

DL2003Mk05

1 x SparkFun RedBoard Qwiic
2 x Pololu DRV8834 Low-Voltage Stepper Motor Driver Carrier
2 x Electrolytic Decoupling Capacitors – 100uF/25V
2 x Pololu Stepper Motor Bipolar, 2.8V, 1.7 A/Phase
2 x Pololu Universal Aluminum Mounting Hub for 5mm Shaft, M3 Holes
1 x Adafruit Perma-Proto Half-sized Breadboard PCB
14 x Wire Solid Core – 22 AWG
1 x SparkFun Cerberus USB Cable

SparkFun RedBoard Qwiic

SP1 – Digital 9
DI1 – Digital 8
SP2 – Digital 7
DI2 – Digital 6
VIN – 3.3V
GND – GND

DL2003Mk05Rp.ino

// ***** Don Luc Electronics © *****
// Software Version Information
// Project #12: Robotics - Unmanned Vehicles 1h - Mk12
// 03-05
// DL2003Mk05Rp.ino 12-12
// Receiver
// 1 x SparkFun RedBoard Qwiic
// 2 x Pololu DRV8834 Low-Voltage Stepper Motor Driver Carrier
// 2 x Electrolytic Decoupling Capacitors - 100uF/25V
// 2 x Pololu Stepper Motor Bipolar, 2.8V, 1.7 A/Phase
// 2 x Pololu Universal Aluminum Mounting Hub for 5mm Shaft, M3 Holes
// 1 x Adafruit Perma-Proto Half-sized Breadboard PCB

// Include the library code:
// DRV8834 Stepper Motor Driver
#include <BasicStepperDriver.h>
#include <MultiDriver.h>

// DRV8834 Stepper Motor Driver
// Stepper motor steps per revolution. Most steppers are 200 steps or 1.8 degrees/step
#define MOTOR_STEPS 200
// Target RPM for X axis stepper motor
#define MOTOR_X_RPM 800
// Target RPM for Y axis stepper motor
#define MOTOR_Y_RPM 800
// Since microstepping is set externally, make sure this matches the selected mode
// If it doesn't, the motor will move at a different RPM than chosen
// 1=full step, 2=half step etc.
#define MICROSTEPS 1
// X Stepper motor
#define DIR_X 8
#define STEP_X 9
// Y Stepper motor
#define DIR_Y 6
#define STEP_Y 7
// BasicStepperDriver
BasicStepperDriver stepperX(MOTOR_STEPS, DIR_X, STEP_X);
BasicStepperDriver stepperY(MOTOR_STEPS, DIR_Y, STEP_Y);
// Pick one of the two controllers below each motor moves independently
MultiDriver controller(stepperX, stepperY);

// Software Version Information
String sver = "12-12";
// Unit ID information
String uid = "";

void loop() {

   controller.rotate(360, 360);
   
}

getStepper.ino

// Stepper
// isStepperSetup
void isStepperSetup() {    
  
  // Set stepper target motors RPM.
  stepperX.begin(MOTOR_X_RPM, MICROSTEPS);
  stepperY.begin(MOTOR_Y_RPM, MICROSTEPS);

}

setup.ino

// Setup
void setup() {

  // DRV8834 Stepper Motor Driver
  isStepperSetup();

}

Technology Experience

  • Research & Development (R & D)
  • Desktop Applications (Windows, OSX, Linux, Multi-OS, Multi-Tier, etc…)
  • Mobile Applications (Android, iOS, Blackberry, Windows Mobile, Windows CE, etc…)
  • Web Applications (LAMP, Scripting, Java, ASP, ASP.NET, RoR, Wakanda, etc…)
  • Social Media Programming & Integration (Facebook, Twitter, YouTube, Pinterest, etc…)
  • Content Management Systems (WordPress, Drupal, Joomla, Moodle, etc…)
  • Bulletin Boards (phpBB, SMF, Vanilla, jobberBase, etc…)
  • eCommerce (WooCommerce, OSCommerce, ZenCart, PayPal Shopping Cart, etc…)

Instructor

  • DOS, Windows, OSX, Linux, iOS, Android, Multi-OS
  • Linux-Apache-PHP-MySQL
  • Robotics
  • Arduino
  • Raspberry Pi
  • Espressif

Follow Us

The Alpha Geek

Why “The Alpha Geek”?

Aphasia
https://www.donluc.com/?page_id=2149

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
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/

Don Luc

Project #12: Robotics – Unmanned Vehicles 1f – Mk10

——

Robotics

——

Robotics

——

Robotics

——

Robotics

——

Robotics

——

Robotics

——

Robotics

——

Robotics

——

Transmitter

DL2002Mk07

1 x Arduino UNO – R3
1 x ProtoScrewShield
1 x Adafruit RGB LCD Shield 16×2 Character Display
1 x XBee S1
1 x SparkFun XBee Explorer Regulated
1 x Slide Pot (Small)
1 x Knob
1 x Acrylic Blue 5.75in x 3.75in x 1/8in
24 x Screw – 4-40
12 x Standoff – Metal 4-40 – 3/8″
7 x Wire Solid Core – 22 AWG
1 x SparkFun XBee Explorer USB
1 x DIGI XCTU Software
1 x SparkFun Cerberus USB Cable

Arduino UNO

TX0 – Digital 1
RX0 – Digital 0
LP1 – Analog A0
VIN – +5V
GND – GND

XBee S1: Transmitter

CH Channel: C
PAN Id: 3333
SH Serial Number: 13A200
SL Serial Number: 40717A1F
CE Coordinator: Coordinator
BD: 9600

DL2002Mk07p.ino

// ***** Don Luc Electronics © *****
// Software Version Information
// Project #12: Robotics - Unmanned Vehicles 1f - Mk10
// 02-07
// DL2002Mk01p.ino 12-10
// Arduino UNO - R3
// ProtoScrewShield
// Adafruit RGB LCD Shield 16×2 Character Display
// EEPROM with Unique ID
// Transmitter
// XBee S1
// Stepper
// Slide Pot (Small)
// Knob

// Include the library code:
// EEPROM library to read and write EEPROM with unique ID for unit
#include <EEPROM.h>
// Adafruit RGB LCD Shield
#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;

// Communication
unsigned long dTime = 50;

// Slide Pot (Small)
int iSP1 = A0;                           // Select the input pin for the slide pot
int iValue = 0;                          // Variable to store the value

// The current address in the EEPROM (i.e. which byte we're going to  read to next)
// Version
String sver = "12-10.p";
// Unit ID Information
String uid = "";

void loop() {

  // Clear
  RGBLCDShield.clear();

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

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

  switch ( yy ) {
    case 1:
    
      // Forward
      isSwitch1();
      
      break;
    case 2:
    
      // Reverse
      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;
      // Forward
      RGBLCDShield.setBacklight(GREEN);
      
    }
    
    if ( momentaryButton & BUTTON_DOWN ) {
      
      yy = 2;
      // Reverse
      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);
   
    }
    
  }

  // Read the value
  iValue = analogRead( iSP1 );

  // Process Message
  isProcessMessage();

  delay( dTime );
   
}

getEEPROM.ino

// EEPROM
// isUID
void isUID()
{
  
  // Is Unit ID
  uid = "";
  for (int x = 0; x < 5; x++)
  {
    uid = uid + char(EEPROM.read(x));
  }
  
}

getProcessMessage.ino

// ProcessMessage
// isProcessMessage
void isProcessMessage() {
  
    // Loop through serial buffer
    while ( Serial.available() ) 
   {

      // Print = "<" + yy + "|" + sver + "|" + iValue + "*"
      
      Serial.print( '<'  );
      Serial.print( yy );
      Serial.print( '|' );
      Serial.print( iValue );
      Serial.println( '*' );
         
   }
     
}

getSwitch.ino

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

   yy = 1;

   // Stepper 
   // Forward
   RGBLCDShield.setCursor(0,1);    
   RGBLCDShield.print("Forward");  
   
}
// Switch 2
void isSwitch2(){

   yy = 2;

   // Stepper 
   // Reverse
   RGBLCDShield.setCursor(0,1);    
   RGBLCDShield.print("Reverse");    
      
}
// Switch 3
void isSwitch3(){

   yy = 3;

   // Stepper 
   // Right
   RGBLCDShield.setCursor(0,1);    
   RGBLCDShield.print("Right");    
      
}
// Switch 4
void isSwitch4(){

   yy = 4;

   // Stepper 
   // Left
   RGBLCDShield.setCursor(0,1);    
   RGBLCDShield.print("Left"); 
      
}
// Switch 5
void isSwitch5(){

   yy = 5;
   
   // Stepper 
   // Stop
   RGBLCDShield.setCursor(0,1);    
   RGBLCDShield.print("Stop");
       
}

setup.ino

// Setup
void setup() {
  
  // Open serial port at 9600 baud
  Serial.begin( 9600 );

  // Pause
  delay(5);

  // EEPROM Unit ID
  isUID();
  
  // Pause
  delay(5);
  
  // 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");                 // Robotics

  delay(5000);

  // Clear
  RGBLCDShield.clear();

  // Display
  // Set the cursor to column 0, line 0  
  RGBLCDShield.setCursor(0,0);  
  RGBLCDShield.print("Version: ");                // Version
  RGBLCDShield.print( sver );
  // Set the cursor to column 0, line 1
  RGBLCDShield.setCursor(0, 1);
  RGBLCDShield.print("UID: ");                    // Unit ID Information
  RGBLCDShield.print( uid );

  delay(5000);

  // Clear
  RGBLCDShield.clear();

}

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 – Unmanned Vehicles 1a – Mk05

——

EEPROM

——

EEPROM

——

EEPROM

——

EEPROM

——

EEPROM

——

EEPROM

——

EEPROM

EEPROM stands for electrically erasable programmable read-only memory and is a type of non-volatile memory used in computers, integrated in microcontrollers for smart cards and remote keyless systems, and other electronic devices to store relatively small amounts of data but allowing individual bytes to be erased and reprogrammed.

Transmitter

In electronics and telecommunications a transmitter or radio transmitter is an electronic device which produces radio waves with an antenna. The transmitter itself generates a radio frequency alternating current, which is applied to the antenna. When excited by this alternating current, the antenna radiates radio waves.

Receiver

A modern communications receiver, used in two-way radio communication stations to talk with remote locations by shortwave radio.
In radio communications, a radio receiver, also known as a receiver, wireless or simply radio is an electronic device that receives radio waves and converts the information carried by them to a usable form. It is used with an antenna. The antenna intercepts radio waves (electromagnetic waves) and converts them to tiny alternating currents which are applied to the receiver, and the receiver extracts the desired information.

DL2001Mk01

1 x Arduino Fio
1 x Arduino UNO
1 x SparkFun FTDI Basic Breakout – 3.3V
1 x SparkFun Cerberus USB Cable

Arduino UNO

VIN – +5V
GND – GND

Arduino Fio

VIN – +3.3V
GND – GND

Transmitter => DT001

DL2001Mk01p.ino

// ***** Don Luc Electronics © *****
// Software Version Information
// Project #12: Robotics - Unmanned Vehicles 1a - Mk05
// 01-01
// DL2001Mk01p.ino 12-05
// Arduino UNO
// Screw Shield
// Adafruit RGB LCD Shield
// EEPROM with Unique ID
// Transmitter

// Include the library code:
#include <Adafruit_RGBLCDShield.h>
// EEPROM library to read and write EEPROM with unique ID for unit
#include <EEPROM.h>

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

// These #defines make it easy to set the backlight color
#define GREEN 0x2

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

// Software Version Information
String sver = "12-05";
// Unit ID Information
String uid = "DT001";

void loop() {

  // Display
  // Set the cursor to column 0, line 0  
  RGBLCDShield.setCursor(0,0);    
  RGBLCDShield.print("Don Luc Electron");         // Don luc Electron
  
  momentaryButton = RGBLCDShield.readButtons();

  if ( momentaryButton ) {
    
    if ( momentaryButton & BUTTON_UP ) {
      isEEPROMw();
      yy = 1;
    }
    
    if ( momentaryButton & BUTTON_DOWN ) {
      isUID();
      yy = 2;
    }
    
    if ( momentaryButton & BUTTON_LEFT ) {
      UIDr();
      yy =3;
    }
    
    if ( momentaryButton & BUTTON_RIGHT ) {
      isEEPROMc();
      yy = 4;
    }

  }

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

getEEPROM.ino

// getEEPROM
// Write and Read EEPROM with Unique ID for Unit
// Write EEPROM with Unique ID for Unit
void isEEPROMw() {
  
  // set the cursor to column 0, line 1
  RGBLCDShield.setCursor(0, 1);
  RGBLCDShield.print( "Write" ); 
  
  // EEPROM
  int incb = 0;
  int v = 0;
  String msg = "";
  String emp = "";
  
  // Set Unit ID
  // The message starts with sid then is followed by 5 characters 
  // First clear a string buffer
  emp = "";
  // Loop through the 5 ID characters and write their ASCII (byte) value to the EEPROM
  for (int x = 0; x < 5; x++)
    {
       //Get ASCII value of character
       v = int(uid.charAt(x)); // + 5));
       //Add the actual character to the buffer so we can send it back to the PC
       emp = emp + uid.charAt(x + 5);
       //Write the value to the EEPROM
       EEPROM.write(x, v);
    }

   delay( 5000 );
   
}
// Read EEPROM with Unique ID for Unit
void isUID()
{
  // Unit ID
  String ruid = "";
  for (int x = 0; x < 5; x++)
  {
    ruid = ruid + char(EEPROM.read(x));
  }

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

  delay( 5000 );
  
}
// Read uid
void UIDr()
{

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

   delay( 5000 );
        
}
// Clear EEPROM
void isEEPROMc()
{

   // Clear EEPROM
   for (int i = 0 ; i < EEPROM.length() ; i++) {
      EEPROM.write(i, 0);
   }
    
   // set the cursor to column 0, line 1
   RGBLCDShield.setCursor(0, 1);
   RGBLCDShield.print( "Clear EEPROM" );

   delay( 5000 );
   
}

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("Unique ID");                // Unique ID

  delay(5000);

  // Clear
  RGBLCDShield.clear();

}

Receiver => DR001

DL2001Mk01Rp.ino

// ***** Don Luc Electronics © *****
// Software Version Information
// Project #12: Robotics - Unmanned Vehicles 1a - Mk05
// 01-01
// DL2001Mk01Rp.ino 12-05
// Arduino Fio
// SparkFun FTDI Basic Breakout - 3.3V
// EEPROM with Unique ID
// Receiver

// Include the library code:
// EEPROM library to read and write EEPROM with unique ID for unit
#include <EEPROM.h>

// Software Version Information
String sver = "12-05";
// Unit ID information
String uid = "DR001";

void loop() {
 
  // Write EEPROM with Unique ID for Unit
  int incb = 0;
  int v = 0;
  String emp = "";
  String ruid = "";
    
  // Set Unit ID
  // The message starts with uid then is followed by 5 characters 
  // First clear a string buffer
  emp = "";
  // Loop through the 5 ID characters and write their ASCII (byte) value to the EEPROM
  for (int y = 0; y < 5; y++)
  {
        
     // Get ASCII value of character
     v = int(uid.charAt(y)); // + 5));
     // Add the actual character to the buffer
     emp = emp + uid.charAt(y + 5);
     // Write the value to the EEPROM
     EEPROM.write(y, v);
         
  } 
    
  // Write EEPROM with Unique ID for Unit
  Serial.println( "Write ID Information");

  // Read ID Information
  // Unit ID
  for (int y = 0; y < 5; y++)
  {
    
    ruid = ruid + char(EEPROM.read(y));
    
  }
  
  // Read ID Information
  Serial.print( "Read ID Information: ");
  Serial.println( ruid );
  Serial.println( "Ok!" );
  ruid = "";

  delay( 5000 );
  
}

setup.ino

// Setup
void setup() {

  // Open the serial port at 9600 bps:
  Serial.begin(9600);

  // Serial
  Serial.print( "Software Version Information: ");
  Serial.println( sver );
  Serial.print( "Unit ID Information: ");
  Serial.println( uid );
  
  delay(5000);

}

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

Categories
Archives