OptoEndstop 2.1

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



Replacement Design - As the H21LOB is no longer in production, this design is deprecated. A design with the same electrical characteristics is the Gen7 Endstop 1.3.1.

Given appropriate cabling, Gen7 endstops work correctly with Gen3 electronics.

Overview

Cache-2867495207 3c80c968f0.jpg

RepRap'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 RepRap, we use one opto-switch for each axis to define its position. The opto switches also help protect the machine from moving past its intended range and damaging itself.

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


Files

Cache-2924914133 72aaed21f4.jpg

You can download the electronics files from Sourceforge.

This file contains the following:

  • GERBER files for getting it manufactured
  • PDF files of the schematic, copper layers, and silkscreen
  • Eagle source files for modification
  • 3D rendered image as well as POVRay scene file
  • exerciser code to test your board.


Schematic

Cache-2932013987 41d0a71c53 o.png

Interface

Cache-2867493355 0fcbb6c30d.jpg

Debug LED

The debug LED is a visual indicator of the actual state of the switch. Please note: due to the constraints of the circuit, the LED status is inverted from the actual signal. What this means is that when the output is high, the LED is off and when the output is low, the LED is on. See the table below for more information:

Output

The output of the switch is a binary value that represents the state of the switch. LOW = 0v/GND and HIGH = 5V. The output of the circuit depends on the particular model of opto switch used. RepRap has recently switched from the H21LOI to the H21LOB due to the wider availability of the H21LOB.

The H21LOI and H21LOB are identical, except their outputs are inverted respective to each other. This requires a change in firmware to interpret the input appropriately. Below are truth tables that describe the different outputs the circuits provide.

H21LOB Truth Table

Status Output LED
Open HIGH Off
Closed LOW On

H21LOI Truth Table

Status Output LED
Open LOW On
Closed HIGH Off

Physical Connection

The v2.x series of Opto Endstop is an experiment in standardization of connectors. One of the major problems with the previous v1.0 design is that it required the end user to construct their own connectors which was a tedious and error prone process. The new v2.x design has 2 different connector footprints: the old .100" spaced connector as well as an RJ45 connector. It is up to the end user to decide which connector they would like to use.

RJ45 Connector

Say it with me:

The opto endstop v2.x design does not support ethernet!
The opto endstop v2.x design does not support ethernet!
The opto endstop v2.x design does not support ethernet!

What we are doing is hijacking a common and very cheap connector for our own purposes. RJ45 patch cables and jacks are ubiquitous, versatile, robust, and cheap. We've considered and rejected many other connector technologies (RJ11, 3.5mm audio cables, etc) but in the end, RJ45 is the best for our needs. If you have another source of high quality premade cables (that we have not already rejected) please bring it to our attention in the forums (see General FAQ#wires and connectors). Please do not complain about being forced to use these cables, as there is a simple on-board alternative (see below).

Below you will find a pin out table containing the pin-out information on a standard RJ45 patch cable.

Pin Color Function
4 and 5 Blue and Blue/White 5V supply
6 Green Signal
7 and 8 Brown and Brown/White Ground

.100" Spaced Header

Cache-2947047493 d8317e3e9f.jpg

In order to maintain backwards compatibility, as well as giving the user the freedom to chose their desired connector technology, we have included a standard, .100" pitch connector footprint that you may populate as desired. The pins are clearly labeled, and you may wire it however you like. You can solder wires directly to the board, solder in right-angle headers, normal headers, or any other number of technologies. Its up to you as a user to decide. Shown here is an example of using a right-angle .100" spaced header.


Build It

Circuit Board

Cache-2867508785 25c94e37f7.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 PCB ready for soldering. Its also cheap, only $0.75 USD.


Components

Cache-2867505539 835838c67c.jpg

Soldering Instructions

Cache-2867504341 7f61e0778a.jpg

R1 - 10K ohm (Brown - Black - Orange)

Insert the resistor in any orientation. Double check the colour bands.


Cache-2867503109 4844782d84.jpg

R2 - 220 ohm (Red - Red - Brown)

There are three through-hole resistors that you need to solder. They are organised on the board from left to right as: R3 R2 R1. Insert the first resistor (R1, 220 ohm) in any orientation into the rightmost position. Double check the colour bands.



Cache-2868333984 89b50702f3.jpg

R3 - 1K ohm (Brown - Black - Red)

Insert the resistor in any orientation. Double check the color bands.



Cache-2867501803 d676c46b5e.jpg

Blocked/Debug LED

The LED must be inserted in the proper orientation. Insert the short leg (negative) into the hole closest to the printed text and the long leg (positive) into the hole closest to the opto switch.


Cache-2868332588 1c0560c7a3.jpg

H21LOB

This is the opto switch. It can only be inserted in one direction. Insert it and solder it into place.


Power and signal Connector

Cache-2947048697 1489a330a0.jpg

There are many different types of alternative connectors you could use: You could solder wires directly to the board. You could solder .100" spaced pin headers (both straight and 90 degree), you could solder in a keyed header, or you could solder in female headers. Its all up to you. Shown here is a board with right angle pin headers soldered in. This (or, better, with a straight connector) is how it should be wired for RepRap.


Cache-2868331138 bfcb802723.jpg



RJ45 Jack

THIS BOARD DOES NOT SUPPORT ETHERNET! This is the MakerBot configuration. We are using the jack to provide simple, easy, cheap connectors.

Insert the jack (it should snap into place) and solder it into place.


H21LOB Opto Switch Alternatives

You may be able to find other five pin opto-isolators that can serve in place of the H21LOB or H21LOI. Check the data sheet provided to make sure that the pin-outs are the same. One such alternative is the Aleph OS-3502 opto-isolator. It does not have the same mounting tabs as the H21LOB but is otherwise pin-equivalent and can be soldered using the same holes and layout as the H21LOB.


ZD1901 Opto Switch

The board also supports using simpler four-pin opto isolators that may be more prevalent in your area (say New Zealand). One such opto switch is the ZD1901 opto switch. This is a 4-pin opto switch and it is relatively easy to hook up. There are actually instructions on the board which we'll illustrate below:

Cache-2932995950 99823be114.jpg

Step 1: Cut trace marked 'A'

Cut this trace with an exacto knife, dremel, or other suitable sharp instrument. Take care not to hurt yourself or any of the other traces.


Cache-2932997096 41fe1d9320.jpg

Step 2: Jumper holes marked 'B'

In order to get the signal properly routed, take a small piece of wire and solder it in place as shown to connect the two holes together. You may wish to put the link on the other side of the board to let the ZD1901 sit flush on the board's surface.


Step 3: Solder ZD1901 in place

Solder the ZD1901 in place making sure to insert it in the proper orientation.

Test It

If you are building a RepRap, see here for the opto-switch testing procedure.

Cache-2867493355 0fcbb6c30d.jpg

Testing the Opto Switch is very easy: once you have it wired up, all you have to do is block and unblock the opto switch to make sure that it is working. With the integrated LED, this is very easy, as you get a visual indication of the status from the LED. Additonally, you'll want to wire it up to an Arduino or Sanguino to test that the signal is being transmitted successfully.


Wire it up

Cache-2947046101 92506ec307.jpg

There are a few ways to go about this, mainly determined by what set of electronics you have.

If you are using the RJ45 jack / ethernet cable solution:

If you have one of the new Stepper Motor Drivers (v1.2+, v2.0+) that has an integrated RJ45 jack, then you can simply plug the Opto Endstop to the Stepper Motor Driver, and make sure the Stepper Motor Driver is wired to your Arduino and/or Sanguino. If you do this, make sure that you change the pin definition to the appropriate pin for testing.

If you have an older driver, or want to test it manually, then the easiest way is to cut the end off an old ethernet cable, and connect the exposed wires directly to an Arduino / Sanguino directly. Remember to keep a plug on one end, so you have something to plug into the opto endstop. The advantage of this is that you can use the same cannibalized cable to test all of your opto endstops, as well as all of your temperature sensors. If you're using a standard patch cable, then the wire colors should correspond to the table below:

Color Pin
Brown GND
Brown/White GND
Green Signal
Blue VCC
Blue/White VCC

Note that Brown/White-striped-Brown as well as Blue/White-striped-Blue are both connected to each other. You can use either of them, or solder them together. Your call.

Please note also, that the colors listed above are for an Ethernet cable wired to the EIA/TIA 568B standard, which is commonly seen in patch cables. You may also find a cable wired as per EIA/TIA 568A, which is electrically equivalent, but the green and orange pairs are reversed. In that case you'd use the Orange wire for the endstop signal. You can usually see which colors go to which pins by looking through the clear plastic of the RJ45 connector, and you can easily find many references online for the two wiring schemes.

If you are using the .100" spaced headers:

Its up to you! Make sure you know which wires are what, and that you wire the signal wire to the appropriate

Wire it!

Now that you know what wires to use, wire them to the appropriate places:

Pin Arduino/Sanguino Pin
VCC 5v
Signal Digital 2
GND Ground

Upload sketch!

Here is a sketch to upload to your Arduino or Sanguino that will allow you to test your opto endstop. Make sure you set it to use the right pin, and optionally the right chip if you're using a non-standard board.

//what pin are we using?
#define ENDSTOP_PIN 2

//which opto enstop are we using?
//this is for the H21LOB
#define INVERTED 1
//this is for the H21LOI
//#define INVERTED 0

void setup()
{
   pinMode(ENDSTOP_PIN, INPUT);

   Serial.begin(9600);
   Serial.println("Starting opto endstop exerciser.");
}

void loop()
{
   if (digitalRead(ENDSTOP_PIN))
   {
     if (INVERTED)
       Serial.println("open.");
     else
       Serial.println("blocked.");
   }
   else
   {
     if (INVERTED)
       Serial.println("blocked.");
     else
       Serial.println("open.");
   }
   
   delay(500);
}

Use it!

This board is very simple to use: Simply wire it up to your Stepper Motor driver, or wire it directly to your Arduino or Sanguino. When wiring it up for actual use in your RepRap machine, make sure you wire it to the specified pin.

Good luck!

History

Changelog

  • added debug LED
  • added support for ZD1901 opto switches
  • added RJ45 jack
  • added better labels on .100" spacers
  • converted to eagle based design

Previous Versions

  • A bugfix on the Opto Endstop v2.0 (not documented)
  • Which was an incremental improvement of the Opto Endstop v1.0