Hi, i´m just a guy on the forum, so...
I use some RUT955 to measure and log water levels. So i´m used to use the analouge inputs of the device. Maybe there´s another automotive device from Teltonika that could measure frequency directly, but i don´t know. Also i think it should be possible to write a script the makes it possible.
As an inspiration here´s what chatGPT has to offer (no warranty!!! but it helped me with my scripts alot :)
code
#!/bin/sh
# Set the GPIO pin number of the digital input
gpio_pin=6
# Configure the GPIO pin as an input
echo $gpio_pin > /sys/class/gpio/export
echo in > /sys/class/gpio/gpio$gpio_pin/direction
# Measure the frequency of the input signal
while true; do
num_rising_edges=$(cat /sys/class/gpio/gpio$gpio_pin/uevent | grep "GPIO_EVENT=0x01" | wc -l)
frequency=$((num_rising_edges / 2)) # Divide by 2 because we're counting rising edges
echo "Input frequency: $frequency Hz"
sleep 1
done
# Clean up by unexporting the GPIO pin
echo $gpio_pin > /sys/class/gpio/unexport |
This script uses the sysfs interface to access the digital input of the Teltonika RUT955 router. It first exports the GPIO pin number (in this case, 6) and sets it as an input. Then, it continuously reads the uevent file for the GPIO pin to count the number of rising edges (i.e., transitions from 0 to 1) that occur over a 1-second interval. The number of rising edges is then divided by 2 to calculate the frequency of the input signal in Hz. The script then prints the current frequency and sleeps for 1 second before repeating the process.
To run the script, save it as a file (e.g., measure_input_frequency.sh), make it executable (chmod +x measure_input_frequency.sh), and then execute it with ./measure_input_frequency.sh from a terminal on the Teltonika RUT955 router. Note that this script assumes that the input signal is a square wave with a 50% duty cycle. If the duty cycle is different, the frequency calculation will need to be adjusted accordingly.