The board was developed for Josanino's Final Project to connect the sensors and the nema stepper motor.

Capacitor 10 uF

Regulador 3.3 -0.1 A

AT SAMD IIC

Programmable header for our card

Header

Capacitor 10 uF

Resistor 0 OHMS

Resistor 10k OHMS

Bridge

In this assignment I develop the emitter and receiver plates of the phototransistor as well as its programming.

For this work, the Eagle software was used to design the board and the Josanino board was used as a base (see additional information at the end), but several components were added that will be useful for the Final Project. The components that were added were:

  • Pololu
  • Headers for connecting phototransistor sensor boards
  • Resistor 0 OHMS
  • DC Jack for power

const int dirPin = 15; //direction pin

const int stepPin = 14; //pwm pin

const int ledpin = 2; //led probe

int sensor = 4;

const int EchoPin = 9;

const int TriggerPin = 8;

int stepDelay = 12500; // vel motor

int signalsensor;

        void setup() // configuration global

        {

          Serial.begin(115200);

          pinMode(dirPin, OUTPUT);  //output direction pin

          pinMode(stepPin, OUTPUT); // outpur pwm pin

          pinMode(ledpin, OUTPUT);  // output led probe

          pinMode(TriggerPin, OUTPUT);

          pinMode(EchoPin, INPUT);

          pinMode(sensor, INPUT);   // input signal sensor

 

        }

        void loop()

        {

          digitalWrite(ledpin,HIGH);  //turn on led probe

          int cm = ping(TriggerPin, EchoPin);

          Serial.print("");

          Serial.println(cm);

          if (cm >30 && cm<50)

          {

            //digitalWrite(ledpin,LOW);

            digitalWrite(dirPin, LOW); //direction mot (HIGH spin left and LOW spin right)

            digitalWrite(stepPin, HIGH); //four lines generate pwm

            delayMicroseconds(stepDelay);

            digitalWrite(stepPin, LOW);

            delayMicroseconds(stepDelay);

            signalsensor = digitalRead(sensor);

            if (signalsensor = 1)

            {

              digitalWrite(ledpin,HIGH);

              delay(1000);

              digitalWrite(ledpin,LOW);

              delay(1000);

              digitalWrite(ledpin,HIGH);

              delay(1000);

              digitalWrite(ledpin,LOW);

            }

          }

        }

 

   int ping(int TriggerPin, int EchoPin)

   {

   long duration, distanceCm;

 

   digitalWrite(TriggerPin, LOW);  //to generate a clean pulse we set LOW 4us

   delayMicroseconds(4);

   digitalWrite(TriggerPin, HIGH);  //we generate Trigger (trigger) of 10us

   delayMicroseconds(10);

   digitalWrite(TriggerPin, LOW);

 

   duration = pulseIn(EchoPin, HIGH);  //we measure the time between pulses, in microseconds

 

   distanceCm = duration * 10 / 292/ 2;   //we convert distance, in cm

   return distanceCm;

}

Final PCB project was developed in output device

Phototransistor sensor emitter and receiver boards developed in this assignment whose function will be to stop the motor when the ball falls for the final project