Skip to content

Devices

Yannik Friedrich edited this page Nov 22, 2022 · 2 revisions
<style> table { width: 100%; } </style>

Devices

Devices are the representation of actuators and sensors attached to the TXT and the TXT itself.
For the C interface, the header ftalloc.h defines functions to allocate and deallocate the devices while the header ftop.h implements their functionalities. The C++ interface implements the devices as classes.

Devices
Inputs
      Switch
      Digital
      Resistor
      Voltmeter
      Ultrasonic
      NTC-Thermistor
      TrailFollower
      ColorSensor
Counter
Output
Motors
      Motor
      Encoder
Servo

TXT

Implementation of the TXT 4.0 controller itself.

Inputs - Generic

The universal input connectors allow a large variety of different sensors to be attached. Each input can be configured by specifying a measurement mode and the resolution.

Measurement modes:

Mode Description
active TXT measures an externally applied voltage.
passive TXT measures the resistance.
ultrasonic fischertechnik's ultrasonic sensor uses a special protocol to transmit the distance to the TXT.

Resolutions:

Mode Values
analog 0-4096 (12-bit ADC)
digital 0 or 1

Switch

A switch measures whether the circuit is open or closed. It returns true if the circuit is closed (the switch is pressed) and false if the circuit is open (the switch is not pressed).

Connectors: I1 - I8, C1 - C4
Configuration: passive digital

Example: switch, light barrier, reed contact

Digital

Detects whether a voltage is applied or not. Returns true if a voltage is applied and false if no voltage is applied.

Connectors: I1 - I8
Configuration: active digital

Example: trail sensor

Resistor

Measures the component's resistance in Ω.

Connectors: I1 - I8
Configuration: passive analog

Example: resistor, photoresistor, potentiometer

Voltmeter

Measures the externally applied voltage in mV.

Connectors: I1 - I8
Configuration: active analog

Example: power supplies like batteries etc.

Inputs - Specialized

Besides the generic devices that can be used to implement various custom sensors, the interface offers specialized devices for the standard fischertechnik sensors.

Ultrasonic

Measures the distance of a fischertechnik ultrasonic sensor.

Connectors: I1 - I8
Configuration: ultrasonic analog

NTC-Thermistor

Implementation of fischertechnik's 1,5 NTC on top of Resistor.

Connectors: I1 - I8
Configuration: passive analog

TrailFollower

Implementation of the trail sensor based on Digital.

Note: The fischertechnik trail sensor has two diodes for trail detection. Both of them need to be initialized.

Connectors: I1 - I8
Configuration: active digital

ColorSensor

Implementation of the color sensor.

Connectors: I1 - I8
Configuration: active analog

Counter

Counters are digital input devices that count the number of changes between the two states 1 and 0. The detection rate is 1 kHz. The counter value is incremented on the falling edge, when the state changes from 1 to 0. Both the counter value and the current state can be returned. The counter value can also be resetted.

Connectors: C1 - C4

Example: switch, encoder motor

Output (Lamp)

Outputs (called Lamp by the interface) are actuators that are powerd by the TXT. The power can be adjusted by PWM in the interval [0, 512]. The direction of the current is fixed and cannot be changed.

Connectors: O1 - O8

Example: LED, lamp, unidirectional motor, electromagnet, magnet valve

Motors

Motors are actuators where the direction of the current can be changed. Like outputs, the power supply is controlled by PWM using the interval [-512, 512].

Connectors: M1 - M4

Motor

The standard motor offers an interface to start and stop the motor and change speed and direction.

Encoder

The encoder motor combines a regular motor and a fast counter. This counter must be connected to C1 - C4. This opens a large range of finer control options. It allows the motor to move for a certain distance and further allows up to four encoders to be synchronized.

Servo

Servos can be connected to the S1 - S3 pins. The PWM control features the same 9 bit resolution [0, 512], where PWM = 256 is the central position).

Connectors: S1 - S3