OptoEndstop 2 0

From RepRap
Jump to: navigation, search

This page describes something which is no longer the most recent version. For the replacement version see: Gen7 Endstop 1.3.1

Opto Endstop v1.0


<div class="thumb tright">
Cache-2053713286 95af08be87.jpg

Darwin's Cartesian axes all need a datum (also known as home position or end-stop) to reference their movements. At the start of each build each axis needs to back up until the datum point is reached. For Darwin, we use one opto-switch for each axis to define its position. This page tells you how to wire one up to a bracket used in Darwin's design (below).

You will need 3* (three) of these for a basic RepRap machine, and *6 (six) of them for a full machine with both home and end stops.

For those using the ZD1901 opto interrupter prevalent in the Southern Hemisphere, a simple stripboard assembly is required. Details here.

Get It!

Full Kit

Raw Components


You can download the electronics files from Sourceforge. This zip file contains the Kicad source files, PDF's, as well as the GERBER files you can use to build it yourself (or have it manufactured).


<div class="thumb tright">
Cache-2487860833 8dff122e72.jpg


Pin Function
+5 This is the pin to supply +5 volts on.
S This is the signal pin. It will output high (+5) if it is triggered, or low (0v) if it is clear
G This is the ground pin.

Build It

Board Bugs (listed by version)


  • You will need to drill the mounting holes out to 3mm diameter.

v1.0.1 and beyond

  • None yet!! Please report any bugs you encounter in the forums.

Printed Circuit Board

<div class="thumb tright">
Cache-522433432 4941f387b1.jpg

You can either buy this PCB from the RepRap Research Foundation, or you can make your own. The image above shows the professionally manufactured Opto Endstop v1.0.0 PCB ready for soldering. Its also cheap, only $0.75 USD.


<div class="thumb tright">
Cache-2052927873 c2c816c55b.jpg

<iframe src="http://parts.reprap.org/embed/module/Opto+Endstop+v1.0" width="550" height="400" frameborder="0">Visit http://parts.reprap.org/embed/module/Opto+Endstop+v1.0</iframe>

Soldering Instructions

<div class="thumb tright">
Cache-2053713034 a5f9eb2a7a.jpg


Resistors can be inserted in any orientation.


Resistors can be inserted in any orientation.


<div class="thumb tright">
Cache-2052928199 7ee757dbcb.jpg

This is the opto switch. It will only fit in one orientation. Insert it as far as you can.


<div class="thumb tright">
Cache-2053713252 72f9ef1340.jpg

Since the Opto Endstop board essentially plugs into a stepper controller board, the easiest way is to solder the connector wires directly to the Opto Endstop PCB, and then attach a connector to the end of those wires. You will need:

  • 3 wires each of different color, about 2 feet long (an old ethernet cord works well for this purpose.)
  • a 3 pin, .100" pitch connector housing
  • some crimp on connectors

First, strip the ends of each wire. Then you twist the ends of each wire to a point, and tin the ends with a tiny bit of solder. Insert the ends into the hole in the pcb, and solder the wire to the PCB. Take care not to have any strands of the wire cross over to the other soldering points. If this happens, use a knife or tiny screwdriver to break the connection.

Test It

Now that you've built your board, its time to test it. You can easily do so before attaching the PCB connector by plugging the wires directly into an Arduino.

Wire it up!

Connect the wires below to the specified pins on the Arduino.

Opto Endstop Pin Arduino Pin
+5 +5
S Digital 2
G Gnd

Program your Arduino

Copy and paste the code below into your Arduino program. Upload the program to the Arduino, and in a few seconds it will start. Once it has uploaded, open the Serial Monitor. The program will continuously notify you of the status of the opto endstop.

Once its running, simply take a piece of paper, or other flat object and stick it between the upright parts on the endstop. Keep an eye on the terminal and if you wired everything up correctly, it will tell you whether the endstop is open or blocked.

#define ENDSTOP_PIN 2 void setup() { pinMode(ENDSTOP_PIN, INPUT); Serial.begin(9600); Serial.println("Starting opto endstop exerciser."); } void loop() { if (digitalRead(ENDSTOP_PIN)) Serial.println("blocked."); else Serial.println("open."); delay(500); }

Attach PCB Connector

<div class="thumb tright">
Cache-2053713334 33a7b33857.jpg

Now that you've tested your endstop, you will need to crimp on a connector to the end of the wires. This can be tricky, but it is infact do-able with the proper tools (small needle nose pliers, steady hands, patience.) After you have successfully attached connectors onto each wire, insert them into the connector housing as shown below. It is important to get the order right, as the connector must be attached to the board in the proper orientation.