Skip to main content

22 posts tagged with "sensor"

View All Tags

Break-Beam Sensor Counter

We got a mini-golf for the office, which meant we had to find a way to keep track of how many times we actually scored.

Hardware

Sensors

There are several ways a system can detect the presence of an object (a rolling ball, a box on a conveyor belt, assembly line counting, inventory management, intruder detection...).

  1. Break-beam sensors have two ends, an emitter and a transmitter. The emitter sends out a beam of invisible infrared light and the receiver tells the device (in our case a TPS using Tibbit #00_1) if the light can be received or not. One drawback with IR sensors is that they can be affected by sunlight, but since we will only use the mini-golf indoors, that's not a problem. Other IR-based sensors can also detect proximity, but that's not required for our application.
  2. Sonar sensors could also be used (check here and here) but the break beam sensor is cheaper, faster, and smaller, making it more suitable for this application. Sonar sensors give the distance between the object and the sensor, which is also not required by this application.
  3. Ambient light sensors output a signal proportional to the intensity of received light. In theory, we could use one by placing it at floor level, pointing up, on the expected path of the ball, but the install process is too hands on, and the sensor readings could be very easily impacted by debris collected by the sensor.
  4. Pressure pads also a very valid alternative, although that would require more testing and callibration, as well as more physical modifications to the mini-golf track.

For this project, we decided to go for the break-beam sensor, as its fast, cheap, and easy to mount.

Note

We use a Tibbit #00-1 for this project, but a much better alternative is either Tibbit #04-X (optically isolated inputs) or Tibbit #54 (four optically isolated dry contact inputs), for their noise and voltage protection.

Power

The break-beam sensor doesn't use much power at all, so a Tibbit #10 is enough for our application. We also use a Tibbit #00-3 to deliver power to both ends of the break-beam sensor, which makes the wiring a little more convenient for the 3D-printed TPS mount.

Mounting

Our mini-golf system looks a lot like the one in the image below. It has two "entry holes" and one "exit hole". The sensors are mounted inside of the wooden housing, right at the exit hole (check image for reference).

AppBlocks mini-golf

Wiring

The #00-1's 4th line is used to get input from the receiver's end of the sensor (the white wire). The fourth line of the #00_1 has four different modes (Input, Output, Keyboard Input, and Interrupt). Interrupt mode is faster than keyboard mode, but keyboard mode is more than enough to detect very fast moving balls. Additionally, keyboard mode is debounced, which means we don't have to handle inputs on our own.

Note

We use a 9 terminal block to power the TPS (as opposed to the more 'conventional' Power Input Tibbit) to prevent the ball from accidentally hitting the ball. The Tibbit system is incredibly flexible, remember that when building your own systems!

Check out the following diagram to wire the sensor to the TPS.

TPS to break-beam sensor diagram

Now that the hardware layout is done, we must configure line 4 of Tibbit #00-1 to use it as a button input. Click on the hardware tab of the editor, and on Tibbit #00-1

Tibbit #00-1 configuration
Note

Check this tutorial for a more in-depth explanation of the different input modes.

Features

In features, there's not too much we need to worry about, we just need to enable the LCD, create a screen and add images for each digit 0-9.

Blocks

With all our hardware set up and ready to go, we can now start defining the logic of our system.

Main:

  1. score keeps track of how many balls have gone in one of the holes, and goes back to zero when the score is over 99 (although I really doubt we can get there)
  2. The On Button Pressed Event: T00_1_S1_L4_kp represents the keyboard input (4th line of Tibbit #00-1). To the TPS, the ball interrupting the IR beam is just a button press, and it increases the value of score every time it's "pressed".

7 Segment Display

The render_display command is triggered everytime the score changes, and it updates the images shown in the screen according to the digits in the tens and ones positions of score.

Manual Score Tracking

These controls are there in case we ever need to manually update the score.

Your smart mini-golf is now ready to roll!

Sensors - Liquid Level (Tibbit 01 + Tibbit 13)

In this project we learn how to use a Tibbit #01 to control a MaxBotix MB7851-B2A TankSensor.

Components

  1. Tibbit #01: an RS232 transceiver, this Tibbit allows the TPS and the sensor to communicate.
  2. MaxBotix TankSensor: an ultrasound-based ranging device, which means it uses sound to measure distance. These distance sensors have multiple applications, ranging from navigation to intrusion detection.

How To

For liquid level detection, the sensor is placed at the top of a water tank, pointing towards the bottom of the tank. Then, the device can connect to a TPS to report its measurements.

First, we need to wire the sensor to the TPS. Within the TankSensor's datasheet, you'll find a table explaining the function of each colored wire. You can also check the following diagram as a reference.

Note

We used a TPP3 but a TPP2 can also house the Tibbits required for this project.

CP02

After the wiring is done, make sure you configure Tibbit #01 as specified by the sensor's datasheet.

CP02

The sensor has two operation modes: FREERUN and TRIGGER. For this specific application, we will use the TRIGGER mode (FREERUN mode means that the sensor is always running, and is active when the green wire is HIGH or left floating). To enable the trigger mode, we will use the "On Timer" and "On Command" blocks.

To probe the sensor, the TPS will set the FREERUN/TRIGGER pin (green wire) to 1 through Tibbit #00_3 and start a timer. When the timer reaches zero, the FREERUN pin will be set back to zero. We will trigger this functionality with an "On Command" block, so we can probe the sensor on a shedule or through a button on the dashboard (the dashboard can be either configured through AppBlocks Cloud or the device's Web Console).

In the end, your dashboard should look like this.

CP02

The reading is updated every hour. Additionally, you can update it manually by pressing the dashboard button.

Card Access Control with AppBlocks Cloud

This project uses Tibbit #08 to scan cards with a Wiegand reader and report access metrics to AppBlocks Cloud.

4-20mA CO2 Monitoring

This project uses Tibbit #61-1 to connect to a Telaire T5100 CO2 sensor. Every 1 second the sensor value from line 1 of #61-1 is read, formatted to get the PPM (particles per million) value, and then printed to the console.

Remote Relay with AppBlocks Cloud

This project demonstrates how the TPS can be used to reboot a computer remotely.

The idea is to leverage the TPS to control the reboot or power pins in a computer to allow the user of the main computer (the target machine) to reboot the machine remotely.

The approach is to use the TPS + Tibbit #03-1 to short the reboot/reset pins in the target computer's motherboard after a button is pressed in the AppBlocks Cloud dashboard.

The relay Tibbit #03-1 will be connected to the reset pins exposed by the target computer's motherboard. Most motherboards reset when the reset pin is pulled HIGH, so our TPS will mimic this behavior by setting one of its relay lines to HIGH.

In our example, we have a command which sets the relay to "0", and starts a timer. The timer is set to one second (long enough for most use cases), and when the timer ends, the variable is set back to "1".

To enable the 'remote' part of our project, we have created a dashboard containing a button which executes the reboot_signal command.

AC Voltage Detection

This project prints whether or not Tibbit #63-1 is connected to 110V AC power, and also buzzes the TPS if it is.

Modbus Flood/Leak Detection (Bus Probe 05)

This project prints BP#05's two holding registers (FLOOD_FLAG and FLOOD_SENSITIVITY) along with the current time.

Please see our BP Sensors to LCD Graph tutorial to learn how to setup slave Modbus devices in AppBlocks.

Sensors - RTD Temperature (Tibbit 22)

This project shows how to use Tibbit #22 with an RTD sensor.

RTD sensors excel in applications that require a broad measurement range. Certain RTDs supported by TPS can measure from –200°C to +1000°C, covering temperatures that integrated-circuit (IC) sensors cannot handle.

In this project, there are two variables:

  • temp_rtd, a "float" data type variable.
    • Automatically generated when Tibbit #22 is added to the board.
    • Corresponds to the connected RTD sensor's temperature.
  • max_temp, a "value(number)" data type variable.
    • User-defined.
    • Used for triggering a warning when temperatures exceed its value.

The logic behind this project is simple. Every five seconds, if temp_rtd is above max_temp, a warning message is printed and TPS beeps three times. If if temp_rtd is below max_temp, then max_temp is printed with no beeping.

1-Wire/Single-Wire Tibbit (62) Test Project

This project shows how to use Tibbit #62. Tibbit #62 features two identical individually configurable 1-wire/single-wire channels. Each channel can accommodate up to sixteen 1-wire sensors or one single-wire sensor.

Running on just two or three wire connections and supporting long cable lengths, 1-wire digital temperature sensors offer a reliable and cost-effective solution for building automation, precision agriculture, industrial control, and other applications requiring multipoint temperature measurement. Where temperature and humidity sensing are called for, installers can opt for single-wire DHT11 and DHT22 devices.

The following walkthrough shows the step-by-step creation of this project:

Read the related blog post

Modbus Scan

This utility project scans the range of possible modbus sensor ids and prints out the ids of the sensors that respond to the query. The project is useful for identifying the modbus id of a sensor.

Photos below illustrate the test arrangement. All sensor Tibbits are plugged into the same socket S1.

MQTT Publish Sensor Data

This project demonstrates how to upload temperature readings from a modbus temperature sensor to the cloud via MQTT.

The temperature sensor data is polled automatically, and is sent over MQTT to a MQTT broker every 20 seconds.

You can also manually trigger the data upload by pressing the MD button.

Modbus Temperature Sensor (Bus Probe 01)

This project outputs sensor measurements using sys.debugprint, therefore it needs to run in debug mode.

Modbus TCP Master Device

This project shows how to use modbus TCP to poll a sensor value of a modbus slave device over TCP.

This project is to be used with the Modbus TCP Slave example project.

Modbus TCP Slave Device (Bus Probe 01)

This project shows how to use modbus TCP to transmit a sensor value to a modbus tcp master.

This project is to be used with the Modbus TCP Master example project.