DIY Spectrometer) Explore the Unknown ->

98,861

635

73

Introduction: DIY Spectrometer) Explore the Unknown ->

Hey YOU! Yeah, I'm talking to you who is reading this. Send me ideas for instructables, like thin...

Hey Guys! A Spectrometer is useful for detecting impurities in water and in other substances, or even just telling us what wavelength something is! If you have a mystery laser and you want to know the wavelength, you grab a laser with a known wavelength, and calibrate the Spectrometer, simply by taking measurements and then poof, a scan is done and then you know the wavelength. Spectrometers are super useful in optics, and you can tell the different wavelengths of light.

**Please click on the orange vote ribbon in the upper right-hand corner of this page if you enjoy this Instructable.**

I have attached at the end of this tutorial documents related to the construction and development of this spectrometer. Also, a special thanks to Altium for sponsoring the project! Altium provides circuit design software and you can visit their website at http://www.Altium.com/

Also Altium will be releasing their new Hobby Software for FREE, check it out at: circuitmaker.com!

Now you can download the files for this PCB on the Second Last Step of this Instructable!

Step 1: What You Will Need

There a various supplies that you will need for this project; this project takes about an hour or two to build. You Will need:

A CD Drive to take apart appx. $20 (Example: http://www.newegg.com/Product/Product.aspx?Item=N8... )

MSP430 or Arduino ($10 MSP430 or $10 Arduino Pro Mini [or equivalent e.g. Leonardo, Mega, UNO])

EasyDriver Stepper Motor Driver $15

A CD/DVD (Example: http://www.newegg.com/Product/Product.aspx?Item=N8... )

Two 90 Degree surfaces (Can be even be two small boxes)

PhotoTransistor/LDR to detect light $1.50->$5.00 (I used a phototransistor and a photodiode)

Lots of Breadboard Wires/Jumpers (Male and Female or Male/Female

A USB Serial Converter or even just your Arduino/MSP Board $15 (I prefer a Serial Converter)

Several Screwdrivers (One needs to be the tiny sort used for eyeglasses repair $1)

Male Headers (Better to have more of these than you need for just this project)

Solder

A Soldering Iron

Hot Glue Gun

Double Sided Tape

A USB mini-B cord

Small BreadBoard

Tweezers or Xacto-Knife

Twist Ties

Reminder: You can probably get all of these items for a much lower price at Amazon and/or Ebay, but these are some of the distributors which will most likely have these products for some time.

Step 2: Now to Take Apart the CD Drive

First you will need to take apart the CD Drive to use the parts for the project. There are many valuable parts in the disk drive and I'd recommend keeping all of the extra harvested motors, optics and parts (There is even a Laser Diode)

So all you need for now is the CD Drive and a Phillips Screw Driver

Step 3: Unscrew the First Set of Screws

On the Bottom of the CD Drive there should be a set of four screws to allow for one to access the drive.

Step 4: Take the Top Off

Now that you have removed the screws, you can now simply take off the Panel. This Flat(ish) panel will be used at a later time to mount all of the parts.

Note: You may not actually have to pry off the top, but in my two cases I needed to.

Step 5: Now Start Taking Out the Circuit Boards

Now start removing the circuit boards inside of the CD Drive. It should be relatively easy; mine did not have any screws, but only clips. Depending on the CD drive that you have will be dependent on what you actually need to do to take out the circuit board. You can also start disconnecting the wires. Try not to break the wires. (I know sometimes it is hard not to accidentally break a wire, but is not really a requirement, but do not break the stepper Motor wire)

Step 6: Now to Get the Metal Frame Off...

Now very simply get a screwdriver to push the two tabs on each side of the disk drive, then you should be able to pry the drive open from the top side. Take the metal frame off; you will not need this for the project (unless you want to use it as a 90 degree mount...) It might be a little hard at first to take off, but if you try to pry if off and it starts coming out, it might just a bit hard to take off.

Step 7: Now Make the Disk Drive Go Out.

Take a battery and attach it to the two leads of the DC motor. This will allow for the motor to spin in a direction. If the motor is running and the disk tray is not coming out, then try switching the Polarity (+ and - of the the Battery on the motor) The tray should come out.

Step 8: Take Out the Sensor Bay

Unscrew screws mounting down the Sensor Bay. Then Take out the Sensor bay.

Step 9: Unscrew the Brushless Motor

Unscrew the Brushless Motor. You will not need this for this project, but you can save it for later. In this case though, the Stepper motor is attached to the brushless motor subassembly and you will need to desolder the connector at a later time to wire the Stepper Motor.

Step 10: Grab Your Small Screwdriver

Now you need to grab your small screwdriver to take out the current sensor and laser array.

Step 11: Take Out the Sensor/Laser Array

Start unscrewing all of the screws that are holding down the sensor array and Laser diode. Then pry the boards off, because they are glued to the assembly. Be careful it might be a good idea to not break any of the connections just in case you want to use some of the parts for another project.

Step 12: Take Out the Rubbery Things and the Beamsplitter Lens

First take out all of the large rubber things in the mounting holes, then take out the beamsplitter inside of the assembly head.

Step 13: Glue Your Sensor

Depending on what intensity you are expecting, and the angles that you want to hit your sensor, you can either mount it on the front, where there is a greater chance of being hit by light, or inside of the assembly head where there are less chances of being hit by a beam of light.

Step 14: Mount the Linear Assembly

Grab your 90 Degree mount and the base that you took off before and then the assembly. Glue all of the parts together in such a fashion that the long-ways of the assembly is up and the short-ways of the assembly is parallel to the short-ways of the base-plate.

Step 15: Grab Your CD/DVD and Tweezers

Get your CD and tweezers because its time to take apart a CD/DVD!

Step 16: Taking Apart the CD/DVD

First grab your tweezers or X-acto knife and a CD/DVD. Simply separate the disk into two by placing the tweezers between the two layers from the center hole of the disk. Then go all the way though and soon you will have two disks.

Step 17: Getting Your Diffraction Grating

Now get the disk that does not have the picture on it, and cut a part of the disk that does not have any silvery material on it. This will be your diffraction Grating. (It might not be purple, it depends on the CD/DVD)

Step 18: Placing the Grating

Grab your second mounting block and put double sided sticky tape on the diffraction grating and the and 90 Degree mount. Then in order to be able to adjust the location of the mount put double sided sticky tape on the bottom too so that the grating can be moved for one position to another.

Step 19: Starting With the Electronics

Remember that Connector that I told you to hold onto? Well now you need the Stepper Motor connector so that you can interface with the Stepper Motor. So desolder the connector and solder it to Four header leads so that it can be accessed more easily. After soldering, then reattach the connector to the Stepper Motor.

Step 20: Set Up the Stepper Controller

Grab the Stepper Motor controller and some header that are One 1x4 pin One 1x3 pin and Two 1x2 pin headers. Solder these headers onto the Motor Ports A and B; M+ and GND; GND, DIR and STEP; and 5V pins. VERY IMPORTANT: IF YOU ARE USING THE MSP430 THEN YOU WILL NEED TO ALSO SHORT THE 3/5V JUMPPER SO THAT THE MSP430 IS SAFE.

Step 21: Readying the Chip and the Stepper Controller

Put the MSP430G2553 and Stepper Driver on a Breadboard. Mount the breadboard to the base plate.

Step 22: Wire the Stepper Motor

Now wire the Stepper Motor. Read the pictures for a better description, but basically you just need to attach wires from the stepper to the Stepper A ports and Stepper B ports.

Step 23: Wire the GNDs and VCCs

Now just wire each GND to the Negative Rail and M+ to the right positive rail and All of the rest of the VCCs to the left Positive Rail.

Step 24: Wire the Stepper Control to MSP430

Connect STEP to P2_4 and DIR to P2_5. Then the control for the Stepper is established.

Step 25: Attaching the Sensor

Now attach one of the two wires to the GND or VCC (User Preference) and the other to P1_3.

Step 26: Attach the Serial Conveter

Connect RX from the Serial Converter to the fourth pin on the left of the MSP430G2553 (P1_2) and TX to the Third pin on the left of the MSP430G2553 (P1_1). And attach GND to one of the - rails.

Step 27: Calibrate Your Machine!

Grab your calipers or measuring utensil and measure two distances: Distance between the center dot and the diffracted dot and the distance from the grating to the assembly (X Axis). First measure the distance to the Assembly head. Next shine your laser at the diffraction grating and mark where the bottom dot is and move the assembly head to where to top dot is. Measure this distance; make sure to record these distances, you will need them in the next step.

Step 28: The Code

This code can be ported to Arduino IDE From Energia and works perfectly on both platforms.

You can download energia here: http://energia.nu/download/

CHANGE THE x AND THE D AND THE nm VARIABLES TO MATCH YOUR RESULTS FROM THE LAST STEP! Otherwise your calibration will be my calibration for my machine, not yours. It will then fail to provide accurate data.

The Below Code is for use with an SD card and Live stream.


#include "SPI.h" 
#include "pfatfs.h"

#define cs_pin      10             // chip select pin 
#define read_buffer 128             // size (in bytes) of read buffer 

  unsignedshortint bw, br;//, i;
  char buffer[read_buffer];
  int rc;
  DIR dir;				/* Directory object */
  FILINFO fno;			/* File information object *///I/O Belowconstint StepperMotor = P2_4;
constint StepperDirection = P2_5;
constint Sensors[] = {P1_3}; // Add more sensors here!\//Constants for calibration below!constdouble nm = 405; // Known Calibration source Frequencyconstdouble x = 33.28; // Distance of point above the "Screen"constdouble D = 48.78; // distance to the "Screen"constdouble degreesperstep = 18; // Degrees per step for the stepper motorconstdouble microstepping = 8; // This allows for you to determine how often you want the Sample to be taken (inverse microstep)constdouble mmPerRotation = 2.76; // This is the distance between the two teeth of the spindle which moves the sensor up and downconstdouble heightofTray = 38.00; // Under estimate this a bitconstdouble starty = 32.35;
constboolean SDCARD = false;

/////////////////////////Fiddle with the below at your own risk!///////////////////////////////////////////constdouble stepsperrotation = 360/degreesperstep;
constdouble microstepsuntilend = heightofTray/mmPerRotation * stepsperrotation * (microstepping);
constdouble d = (nm*1e-9)/sin(atan(x/D));
//const double d = 720e-9;//const double x = (nm*1e-9*d);int wavelengthvIntensity[sizeof(Sensors)-1];
int datafile = 0;
double cnt = 0;
char buf[30];
double tempnm = 0;
double currenty = 0;
constdouble zero = starty-x;
char ksk = '0';

voidsetup() {                
  pinMode(PUSH2, INPUT_PULLUP);
  pinMode(StepperMotor, OUTPUT);     
  pinMode(StepperDirection, OUTPUT);
  digitalWrite(StepperMotor, LOW);
  digitalWrite(StepperDirection, LOW);
  Serial.begin(9600);            // initialize the serial terminal
  if (SDCARD == true){
  FatFs.begin(cs_pin);             // initialize FatFS library calls
  }
   for (int i=0;i<sizeof(wavelengthvIntensity);i++) {
     pinMode(Sensors[i], INPUT);
   }
   for (int i = 0; i < microstepsuntilend; i++) {
    digitalWrite(StepperMotor, HIGH);
    delayMicroseconds(250);          
    digitalWrite(StepperMotor, LOW); 
    delayMicroseconds(250);   
   }
   digitalWrite(StepperDirection, HIGH);
}
void die (int pff_err){
         Serial.println();Serial.print("Failed with rc=");Serial.print(pff_err,DEC);
         for (;;) ;
  }
void writedata() {
        rc = FatFs.open("Data.csv");
	if (rc) die(rc);

	Serial.println();
        Serial.println("Writing scan Data");
        delay(100);
        bw=0;
        for (int i=0;i<sizeof(wavelengthvIntensity);i++) {
                sprintf( buf, "%lu, ",wavelengthvIntensity[i]);
                int StringLength =  strlen(buf);
		rc = FatFs.write(buf, StringLength, &bw);
                if (rc || !bw) break;
	}
        
        sprintf( buf, "%lu\n\r",tempnm);
        int StringLength =  strlen(buf);
	rc = FatFs.write(buf, StringLength, &bw);
	if (rc) die(rc);
	rc = FatFs.write(0, 0, &bw);  //Finalize write
        if (rc) die(rc);
        rc = FatFs.close();  //Close fileif (rc) die(rc);
}
voidloop() {
  if (ksk == '1') {
    ksk = 0;
    cnt = 0;
 while (cnt < microstepsuntilend) {
  for (int i=0;i<sizeof(wavelengthvIntensity)-1;i++) {
    wavelengthvIntensity[i] = analogRead(Sensors[i]);
    Serial.print(wavelengthvIntensity[i]);
    Serial.print(", ");
  }
  Serial.println(tempnm);
  if (SDCARD == true) {
    writedata();
  }
  digitalWrite(StepperMotor, HIGH);
  delayMicroseconds(1);          
  digitalWrite(StepperMotor, LOW); 
  delayMicroseconds(1);       
  cnt++;
  //Serial.println(currenty);
  currenty = zero+((cnt/microstepsuntilend)  * heightofTray);
  tempnm = d*sin(atan((x+currenty)/D))*(1e9);
  }
  digitalWrite(StepperDirection, LOW);
  for (int i = 0; i < microstepsuntilend; i++) {
    digitalWrite(StepperMotor, HIGH);
    delayMicroseconds(250);          
    digitalWrite(StepperMotor, LOW); 
    delayMicroseconds(250);   
   }
   digitalWrite(StepperDirection, HIGH);
  Serial.println("$");
  }
  ksk = Serial.read();
}

The Code Below is the Code for the spectrometer: Live Mode Only.

//I/O Belowconstint StepperMotor = P2_4;
constint StepperDirection = P2_5;
constint Sensors[] = {P1_3}; // Add more sensors here!\//Constants for calibration below!constdouble nm = 405; // Known Calibration source Frequencyconstdouble x = 37.65; // Distance of point above the "Screen"constdouble D = 50.00; // distance to the "Screen"constdouble degreesperstep = 18; // Degrees per step for the stepper motorconstdouble microstepping = 8; // This allows for you to determine how often you want the Sample to be taken (inverse microstep)constdouble mmPerRotation = 2.76; // This is the distance between the two teeth of the spindle which moves the sensor up and downconstdouble heightofTray = 38.00; // Under estimate this a bitconstdouble starty = 32.35;

/////////////////////////Fiddle with the below at your own risk!///////////////////////////////////////////constdouble stepsperrotation = 360/degreesperstep;
constdouble microstepsuntilend = heightofTray/mmPerRotation * stepsperrotation * (microstepping);
constdouble d = (nm*1e-9)/sin(atan(x/D));
//const double d = 720e-9;//const double x = (nm*1e-9*d);int wavelengthvIntensity[sizeof(Sensors)-1];
int datafile = 0;
double cnt = 0;
char buf[30];
double tempnm = 0;
double currenty = 0;
constdouble zero = starty-x;
char ksk = '0';

voidsetup() {                
  pinMode(PUSH2, INPUT_PULLUP);
  Serial.begin(9600);  // Hah, I forgot to add this in Special thanks to tommy_goh1997 for spotting the bug!
  pinMode(StepperMotor, OUTPUT);     
  pinMode(StepperDirection, OUTPUT);
  digitalWrite(StepperMotor, LOW);
  digitalWrite(StepperDirection, LOW);
   for (int i=0;i<sizeof(wavelengthvIntensity);i++) {
     pinMode(Sensors[i], INPUT);
   }
   for (int i = 0; i < microstepsuntilend; i++) {
    digitalWrite(StepperMotor, HIGH);
    delayMicroseconds(250);          
    digitalWrite(StepperMotor, LOW); 
    delayMicroseconds(250);   
   }
   digitalWrite(StepperDirection, HIGH);
}
voidloop() {
  if (ksk == '1') {
    ksk = 0;
    cnt = 0;
 while (cnt < microstepsuntilend) {
  for (int i=0;i<sizeof(wavelengthvIntensity)-1;i++) {
    wavelengthvIntensity[i] = analogRead(Sensors[i]);
    Serial.print(wavelengthvIntensity[i]);
    Serial.print(", ");
  }
  Serial.println(tempnm);
  digitalWrite(StepperMotor, HIGH);
  delayMicroseconds(1);          
  digitalWrite(StepperMotor, LOW); 
  delayMicroseconds(1);       
  cnt++;
  //Serial.println(currenty);
  currenty = zero+((cnt/microstepsuntilend)  * heightofTray);
  tempnm = d*sin(atan((x+currenty)/D))*(1e9);
  }
  digitalWrite(StepperDirection, LOW);
  for (int i = 0; i < microstepsuntilend; i++) {
    digitalWrite(StepperMotor, HIGH);
    delayMicroseconds(250);          
    digitalWrite(StepperMotor, LOW); 
    delayMicroseconds(250);   
   }
   digitalWrite(StepperDirection, HIGH);
  Serial.println("$");
  }
  ksk = Serial.read();
}

Step 29: Python

First download python: https://www.python.org/downloads/. The packages that you will need for Matplotlib (to Graph) are: (Matplotlib), numpy, libpng, freetype, six, serial, dateutil, and pyparsing. If you are running debian/ubuntu you can apt-get them with sudo apt-get build-dep python-matplotlib If you are running windows then you can download all of them from http://www.lfd.uci.edu/~gohlke/pythonlibs/ That is what I use because of convince. All of the packages for windows are practically all on the same page, just do a ctrl+F and then you can find any of the packages you need.

Then you should be able to use my code for Graphing the information.

Edit the COM port in "Write Data.py" and run test6.py to run the Spectrometer. Press Rescan to read from the spectrometer.

Step 30: Enjoy!

Now you should have a working Spectrometer!

Enjoy!

If you need help or if I didn't explain something well, feel free to ask and I shall happily help you!

Thanks

Have a Great Day!

Step 31: PCB Files

Attached are the Altium Project files and in the "Project Outputs for Spectrometer" Folder are the Drill Files and Gerber files for the 1 Layer board. This board consolidates all of the wiring steps into a simple PCB board that you just have to solder basic connectors on. You can get some here: https://oshpark.com/ or any other PCB manufacturer.

Step 32: References

Formlabs Contest

Grand Prize in the
Formlabs Contest

Share

Recommendations

  • Water Contest

    Water Contest
  • Metalworking Contest

    Metalworking Contest
  • Tiny Home Contest

    Tiny Home Contest

73 Discussions

Usually no one answers me but here it goes anyway...

First of all, amazing instructable! I really wish to make one (or several) of this just for the fun of it.

I have a question... I've been searching for ir for a while now. I am trying to make a fixed wavelength spectrometer with a LED and a LDR. The simplest way to do so may be using a multimeter to read the LDR, for example, although I use an Arduíno interfaced with a software I made so I don't have to register all the values and make thousands of calculations... I can use it to calculate concentrations when comparing the absorbances of my samples with standards, of known concentrations. But, the molar extinction coefficients of the compounds I'm studying are not the same as I would get in a normal laboratory spectrometer (I have access to them, so I can even compare results with the same standards in the two equipments).

I'm happy with the results but quite distressed about this molar extinction diferences. Can anyone help me or have any idea why this happens?

Thank you! ;)

3 more answers

Hi,

This instructable doesn't exactly do calibration any justice. So what you are going to need to do is, find the spectral efficiency curve, and multiply the values from this curve to your data. You probably will want only a few, so find your LED's wavelengths. I recommend using an RGB LED so that you can select which wavelength you are using. Then you can use a Look Up Table to be able to determine wavelength. Next, after that, you MUST model the nonlinear function for light irradiance. So if you just took your values and took the ratio, then you wouldn't get anywhere because the operation curves of the photodiodes, phototransistors and LDRs are nonlinear. Finally, I would recommend using the entire detector area to ensure you are measuring the irradiance.

Just a few thoughts I had this morning,

Good luck!

Simon

Hello!

Thank you so much for your answer! I have made several experiences and have now some spectrometers with red and blue light, and another one with RGB.

When I was investigating the wavelengths I've come across the data sheets of the LEDs with an emission percentage versus wavelength. Is this what you mean by the spectral efficiency curve?

Being the absorbance calculated as a logarithm of intensities, even if there is an efficiency influencing my raw data, it should not change my end result, given that the value is the same for Io and I.

Or... I am making a really ugly mistake somewhere... And it may be this, because I'm using the measured resistance as Intensity to make the calculations...

Hope I am not being too much boring to you, but could you give me some references where I could see how to make this models of the nonlinear function for light irradiance? I guess I have a lot to learn and work before I put my spectrometers to work...

Thank you again very much for your time and thoughts.

Have a nice week!

Best regards,

Vasco

Resistance in an LDR is a highly nonlinear function typically, and CANNOT be used as "Intensity" (Which I am pretty sure you mean irradiance here).

Irradiance is simply Unit of Power per Unit Area per Solid Angle. So if you look at some of the SPIE Radiometry Field Guides, they should help you to understand briefly how to go about calculating this. And yes you can use approximations, but they need to be the correct ones and you will need to make certain assumptions about your incoming light.

(Field Guide to Radiometry

What I mean by spectral efficiency is not of the light emitted, but of the detector. If you know the Quantum Efficiency of your Photodiode or your general Spectral efficiency of your LDR, then you can level the signal properly. This is generally a very nonlinear function.

Think of the Human Eye We see more Green than we do blue or red. Green has a higher

Also, Curious side note, If I were to make a Kit would you be interested? Because I had wanted to make one a few years ago, but I hadn't the time.

(Instructables does not alert me when I get a new message for some reason sorry about the long wait)

An excellent 'ible.

I might just have a go at this one once mywebcam spectro project is finished.

Spooling out a set of numbers is infinitely easier than playing musical jpegs! I might even add a second Arduino to handle a small graphical display.

Hello Simon,

Iam trying to make this as my project.Can you please help me with software part how to download library files and thier execution.

what sesnors do i use to get the wavelenth as my x axis and the intesnsity as my y axis

Hey hey, I'm a bit of a noob at this so I'm not sure if this is a really stupid question, but where and how exactly do you connect this to the computer? Your instructions contain no information on this as far as I've found. Do you solder some of the wires to the mini USB? I'm pretty confused. I'll probably get back to you with some other questions soon.

1 reply

There is a USB to serial converter that is wired up to the UART pins of the MSP430G2553 (Then its a COM port)

hello , i am building a spectrometer using an camera but i am not able to plot the image wavelength to intensity graph ,can you help me out.This is what i am looking for to obtain.

VisibleSpectrum.png
1 reply

RaviP6, How far have you gotten towards that? Do you have an image like the top part? If so, I think you can use ImageJ (which you can download free) to get the bottom half from the top half.

Hello:

I have been working on this for about a month and I have a few question. In step #24 why do you have a gear motor attached to the long cylinder shaped object? Also does the long cylinder shape object just hold the separated cd? In step 27 the separated cd is attached to something completely different (clear and black box) and a laser placed on top of it. Is this they way to do this step or do I use the long cylinder shaped object and place the laser on top of it? I am at the point I need to place my separated cd and laser but I am confused in how to do so and if I need to place a geared motor for some reason. Can you please make this a little clearer.

BTW I like this design.

Thanks

~GA

3 replies

It actually doesn't make a difference, The geared Motor is just there and is not needed for the project. What happened was that I was building the project originally for myself, but then halfway into it, I was like, Let me write an instructable so that others could make spectrometers too, so a few of the materials changed, but The long cylinder shaped object is a 90 degree mount, or box, as is the part holding the moving head, sorry for the confusion, if you need anything else cleared up, just let me know, I'll be happy to help! :)

-Simon

Thank you for getting back to me.

In the first picture of this post there is a black object on the right hand side of the vertical frame (opposite side of the stepper motor). Is this just a brace or does it serve another purpose for this project?

Kind regards,

~GA

Hey! I really like your design and am planning to make it. I am doing a research on the impurities present in hard water in different areas in my town. I am planning to use this spectrometer to find out the impurities (from the wavelengths) and the concentrations of the ions. How can I do it using this instrument? You mentioned in the beginning of the instructable that this is possible. Please help me out here! Thanks!

2 replies

Also, I am looking for an alternative to the stepper motor controller. Is there a way to interface the motor with Arduino? (I am using Arduino UNO for the whole project). Can you describe the details of the circuit in case of the Arduino Controller? What components go to which pins?

To measure the concentration of impurities first you need to take a sample of pure water, passing a laser through it, Then you need to put a known quantity of impurities into the water, the wavelength. You will have to do this repeatedly at different dosages, then interpolate the data. The more the data the better your interpolated model. I am working on some software to take care of things like that, but it is no where near ready. (A few Months at least!) No, Arduino does not provide enough current (and good luck with getting microsteps). You need a motor controller to drive your stepper motor. The pin differences are up to you, they honestly don't really matter too much (If you want just use what I have provided below). You still need to switch the pins in the code though. Instead of:

const int StepperMotor = P2_4;

const int StepperDirection = P2_5;

const int Sensors[] = {P1_3}; // Add more sensors here!\

Use for example:

const int StepperMotor = 4;

const int StepperDirection = 5;

const int Sensors[] = {3}; // Add more sensors here!\