The break beam sensor is connected to the Gateway using the I/O pins located opposite the USB ports.
Note: The “Assembly Break Beam Sensor” app is another helpful resource that comes with every Factory Kit subscription. It will walk you through the initial setup of the break beam sensor and has a built-in unit test.
If you haven’t already, we recommend taking a couple minutes to check it out. It can be used as a companion to this article or standalone. You’ll see the “Assembly Break Beam Sensor” among the list of available apps that came with your account.
To set up the break beam, you will need to have a 3.5mm flat-head screwdriver.
The break beam sensor needs two things to work with Tulip:
- A 12v power supply
- Connectivity to the gateway
There are several ways to provide power to the break beam sensor. The simplest way, and the way that will be demonstrated in this article, is to supply the power directly from a pin on the gateway.
To power the break beam directly from the gateway, you will need to:
- Connect the power wire of the break beam to an output connector on the Gateway.
- Set that pin to be 'on' via Triggers
To wire the break beam (power from gateway)
Begin break beam setup by unplugging the IoT Gateway power. This will ensure you are safe during setup.
Remove a green connector from the Gateway. It should be one of the two connectors labeled I/O. A or B is fine so long as there is 1 free slot.
Next, remove the Output Connector from the unpowered Gateway.
Note that there is only 1 output section on the Gateway. Ensure that it is the connector with 10 slots.
In the next steps, you will connect the wires from the break beam to the phoenix adapter and terminal blocks.
Prep the OUTPUT connector
Use the screwdriver to loosen the screws on the output connector. The output connector has 10 slots. Loosen the 5th slot.
Wire the OUTPUT connector
The BROWN breakbeam wire goes to power. That goes in the 10th open slot that corresponds to pin 8. Insert the wire and tighten the screw.
Prep the INPUT connector
Use the screw driver to loosen the screws on the I/O connector. The output connector has 9 slots. Loosen the 1st slot.
Wire the INPUT connector.
The BLACK break beam wire goes to the pin GPIO. That goes in the 1st open slot. Insert the wire and tighten the screw.
The BLUE breakbeam wire goes to return. That goes in the 9th open slot (last one) and lines up with return. Insert the wire and tighten the screw.
Reattach Green connectors to gateway, making sure the BLUE wire lines up with return.
You can now plug the 3 pin connector to the gateway power and watch the gateway lights come on.
Turning on the power to the gateway using Triggers
Log into Tulip and navigate to the step where you want to use the break beam sensor.
Add a new step trigger with the following logic:
When “step is opened”
- “run gateway function”
- “set digital output”
- at “this station”
- on pin “static value”,
- to state “static value”,
- “boolean”, “yes”
Here's a zoomed-in version of the "then" statement-
The trigger fires when the step is opened. That sends power to pin 8 (thus to the break beam).
For any app (or step) using a break beam that is powered in this way, this trigger MUST exist. It can be in the step or in Master Layout.
Any pin can be the power output and it is defined in the trigger logic.
How to use the break beam sensor to drive app logic
Now that your break beam sensor is wired, you can use it to drive your application.
The basic structure of a trigger is:
- outputs at “this station”
- with events “Pin changed”
- enter the action you would like to take
Note: if you have multiple pins changing on a step, you will need to add a condition specifying the pin the break beam is connected to.
An example of how to display a simple message to indicate the status of the break beam is below.
That’s all you need to do to be able to get started with your break beam sensor.
Next we are going to look at setting up the light stack included in your Factory Kit.