The Alpha Geek – Geeking Out

Micro OLED

Project #12: Robotics – Micro OLED – Mk26

——

#DonLucElectronics #DonLuc #Robotics #MicroOLED #AdafruitMETROM0Express #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant

——

Micro OLED

——

Micro OLED

——

Micro OLED

——-

Micro OLED

Micro OLED displays are silicon-based OLED display that use a monocrystalline silicon wafer as the actively driven backplane, so it is easier to achieve high PPI (Pixel Density), a high degree of integration, and small size. This ensures they are easy to carry, have good anti-seismic performance, and have ultra-low power consumption.

DL2305Mk02

1 x Adafruit METRO M0 Express
1 x ProtoScrewShield
1 x SparkFun Micro OLED Breakout (Qwiic)
1 x Thumb Joystick
1 x SparkFun Thumb Joystick Breakout
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 SparkFun Solderable Breadboard – Large
1 x SparkFun Cerberus USB Cable

Adafruit METRO M0 Express

SCL – Digital 21
SDA – Digital 20
JH – Analog A0
JV – Analog A1
JS – Digital 2
DIR – Digital 7
SPR – Digital 8
DIL – Digital 9
SPL – Digital 10
LED – Digital 13
VIN – +3.3V
VIN – +5V
GND – GND

——

DL2305Mk02p.ino

/* ***** Don Luc Electronics © *****
Software Version Information
Project #12: Robotics - Micro OLED - Mk26
12-26
DL2305Mk02p.ino
1 x Adafruit METRO M0 Express
1 x ProtoScrewShield
1 x SparkFun Micro OLED Breakout (Qwiic)
1 x Thumb Joystick
1 x SparkFun Thumb Joystick Breakout
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 SparkFun Solderable Breadboard - Large
1 x SparkFun Cerberus USB Cable
*/

// Include the Library Code
// Arduino
#include <Arduino.h>
// DRV8834 Stepper Motor Driver
#include <BasicStepperDriver.h>
#include <MultiDriver.h>
// Wire communicate with I2C / TWI devices
#include <Wire.h>
// SparkFun Micro OLED
#include <SFE_MicroOLED.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 7
#define STEP_X 8
// Y Stepper motor
#define DIR_Y 9
#define STEP_Y 10
// 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);

// Joystick
#define JH A0
#define JV A1
#define JS 2

// Variable for reading the button
int JSState = 0;
// Adjusted Value
int adjustedValue = 0;
int adjustedValue2 = 0;

// LED Yellow
int iLED = 13;

// SparkFun Micro OLED
#define PIN_RESET 9
#define DC_JUMPER 1
// I2C declaration
MicroOLED oled(PIN_RESET, DC_JUMPER);

// Software Version Information
String sver = "12-26";

void loop() {
  
  // Button
  isButton();

  // Joystick
  isThumbJoystick();
  
  // Stepper
  isStepper();

  // Micro OLED
  isMicroOLED();
 
}

getButton.ino

// Button
// Button Setup
void isButtonSetup() {
  
  // Make the button line an input
  pinMode(JS, INPUT_PULLUP);
  // Initialize digital pin iLED as an output
  pinMode(iLED, OUTPUT);
  
}

// Button
void isButton(){

  // Read the state of the button
  JSState = digitalRead(JS);

  // Check if the button is pressed.
  // If it is, the JSState is HIGH:
  if (JSState == HIGH) {
    
    // Button
    // Turn the LED on HIGH 
    digitalWrite(iLED, HIGH);
    
  } else {
    
    // Button
    // Turn the LED on LOW 
    digitalWrite(iLED, LOW);
    
  }

}

getMicroOLED.ino

// SparkFun Micro OLED
// Setup Micro OLED
void isMicroOLEDSetup() {

  // Initialize the OLED
  oled.begin();
  // Clear the display's internal memory
  oled.clear(ALL);
  // Display what's in the buffer (Splash Screen SparkFun)
  oled.display();

  // Delay 1000 ms
  delay(1000);

  // Clear the buffer.
  oled.clear(PAGE);
  
}
// Micro OLED
void isMicroOLED() {

  // Text Display FreeIMU
  // Clear the display
  oled.clear(PAGE);
  // Set cursor to top-left
  oled.setCursor(0, 0);
  // Set font to type 0
  oled.setFontType(0);
  // Horizontal
  oled.print("Horizontal");
  // Horizontal
  oled.setCursor(0, 13);
  oled.print( adjustedValue );
  // Vertical
  oled.setCursor(0, 24);
  oled.print("Vertical");
  // Vertical
  oled.setCursor(0, 37);
  oled.print( adjustedValue2 );
  oled.display();

}

getStepper.ino

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

}
// Stepper
void isStepper() {

  // Stepper => Controller rotate
  controller.rotate(adjustedValue, adjustedValue2);
  
}

getThumbJoystick.ino

// Thumb Joystick
void isThumbJoystick() {

  // Joystick JH
  // Horizontal
  // Joystick Pot Values JH
  int potValue = analogRead(JH);
  int potValues = 0;
  // Adjusted Value
  potValues = map(potValue, 0, 1023, 1000, -1000);
  if (potValues > 300) {

    adjustedValue = potValues;

  } else if (potValues < -300) {

    adjustedValue = potValues;

  } else {

    adjustedValue = 0;

  }

  // Joystick JV
  // Vertical
  // Joystick Pot Values JV
  int potValue2 = analogRead(JV);
  int potValues2 = 0;
  // Adjusted Value2
  potValues2 = map(potValue2, 0, 1023, 1000, -1000);
  if (potValues2 > 300) {

    adjustedValue2 = potValues2;

  } else if (potValues2 < -300) {

    adjustedValue2 = potValues2;

  } else {

    adjustedValue2 = 0;

  }

}

setup.ino

// Setup
void setup()
{
  
  // Wire communicate with I2C / TWI devices
  Wire.begin();

  // Setup Micro OLED
  isMicroOLEDSetup();
   
  // Button Setup
  isButtonSetup();
  
  // DRV8834 Stepper Motor Driver
  isStepperSetup();

}

——

People can contact us: https://www.donluc.com/?page_id=1927

Technology Experience

  • Programming Language
  • Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
  • IoT
  • Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
  • Robotics
  • Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
  • Unmanned Vehicles Terrestrial and Marine
  • Machine Learning
  • RTOS
  • Research & Development (R & D)

Instructor, E-Mentor, STEAM, and Arts-Based Training

  • Programming Language
  • IoT
  • PIC Microcontrollers
  • Arduino
  • Raspberry Pi
  • Espressif
  • Robotics

Follow Us

Luc Paquin – Curriculum Vitae – 2023
https://www.donluc.com/luc/

Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/

Don Luc

Categories
Archives