Borislav4
Published © GPL3+

Microscope Manager

Device that manages the USB camera microscope: Make easy focus with DVD stepper motor and light the object with different colors and intens.

IntermediateShowcase (no instructions)6,404
Microscope Manager

Things used in this project

Hardware components

Arduino Pro Mini 328 - 5V/16MHz
SparkFun Arduino Pro Mini 328 - 5V/16MHz
×1
Dual H-Bridge motor drivers L293D
Texas Instruments Dual H-Bridge motor drivers L293D
L293NE
×1
Linear Regulator with Adjustable Output
Linear Regulator with Adjustable Output
×2
General Purpose Transistor NPN
General Purpose Transistor NPN
×2
RGB Diffused Common Cathode
RGB Diffused Common Cathode
Or RGB SMD LED
×1

Story

Read more

Custom parts and enclosures

Power stabilizer

Inside the box

Schematics

Breadboard scheme

Code

Microscope

Arduino
Two buttons comand "Focus" of the microscope. 1 button changes color and 1 changes brightness of the light for the object. Stepper motor driver is connected to pins 7 and 8; RGB LEDs connected to pins 11, 10, 9; LED comand buttons are connected to pins 2 and 3; and stepper motor comand buttons are connected to pins 4 and 5
#include <Stepper.h>

#define motorSteps 100     // change this depending on the number of steps
                           // per revolution of your motor
#define motorPin1 7
#define motorPin2 8

// define pins for RGB light and pins for buttons for control RGB and focus

int data[7][9] = {
  {255,255,160,190,190,80,90,90,34},
  {255,0,0,80,0,0,30,0,0},
  {0,255,0,0,100,0,0,50,0},
  {0,100,255,0,0,255,0,0,170},
  {255,153,0,160,100,0,100,70,0},
  {255,0,200,160,0,100,100,0,35},
  {0,0,0,0,0,0,0,0,0}
};
int redpin = 11; //select the pin for the red LED
int greenpin = 10; // select the pin for the green LED
int bluepin = 9;// select the pin for the blue LED
int i=0;
int j=0;
int col=2;// select the pin for change color
int brg=3;// select the pin for change brightness
int focpl=4;// select the pin for focus plus
int focmin=5;// select the pin for focus minus

// initialize of the Stepper library:
Stepper myStepper(motorSteps, motorPin1,motorPin2); 

void setup() {
  // set the motor speed at 10 RPMS:
  myStepper.setSpeed(10);

  pinMode(redpin, OUTPUT); pinMode(bluepin, OUTPUT); pinMode(greenpin, OUTPUT);
  pinMode(col, INPUT); pinMode(brg, INPUT);
  pinMode(focpl,INPUT); pinMode(focmin,INPUT);
}

void loop() {
  if (((digitalRead(col)) == 1) or ((digitalRead(brg)) == 1)){
led();}  // read buttons and if there is pressed - send to LED function
  if (((digitalRead(focpl)) == 1) or ((digitalRead(focmin)) == 1)){
focus();}  // read buttons and if there is pressed - send to stepper motor function
  }

// LED function
void led(){ 
 analogWrite(redpin, data[i][j]); analogWrite(greenpin, data[i][(j+1)]); analogWrite(bluepin, data[i][(j+2)]);
    delay (600);
  i=(i+digitalRead(col));
  j=(j+(3*digitalRead(brg)));
    delay (20);
     if(i>=7){i=0;}
     if(j>=9){j=0;}
 }

// Focus function
void focus(){
  // Step forward 1 step:
  if (digitalRead(focpl) == 1) {
  myStepper.step(1);}
  delay(100);

  // Step backward 1 step:
  if (digitalRead(focmin) == 1) {
  myStepper.step(-1);}
  delay(100);
}

Credits

Borislav4

Borislav4

0 projects • 3 followers

Comments