FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

14455 questions

17168 answers

28195 comments

0 members

We are migrating to our new platform at https://community.teltonika.lt. Moving forward, you can continue discussions on this new platform. This current platform will be temporarily maintained for reference purposes.
0 votes
393 views 3 comments
by anonymous

I have an application where we need to count the pulses from a kWh (Electricity) meter and then html post the contents of the counter register to our server periodically (once every 10 mins).

We use the RUT240 as standard on most of our sites, is this possible with the digital input on the RUT240?

If not, is there a different VPN equipped Teltonika product we could use?

1 Answer

+1 vote
by anonymous

Hello,

There currently is no solution available that would count impulses from an I/O but there are plans to release something like this is the far future.

As far as the impulse counting goes, what you could set up is a simple shell script, that upon triggering the input would write down a value and you would then create an I/O juggler action which would execute this script on trigger. A script example:

#!/bin/ash

counter="/tmp/impulse_count"

if [ ! -f $counter ]

then

touch $counter

echo 0 > $counter

fi

count=$(cat $counter)

new_count=$(($count + 1))

echo $new_count > $counter

Simply create a .sh file and upload it to the router when configuring the I/O action.

For the HTML posting, we currently don't have a way to extract file contents with HTTP request or that router would manually post it unless you could try to use a custom modbus register and then use data to server to send that register data (which would be your count) using HTTP

You can read more about the custom modbus register block here.

by anonymous
Any idea what would be the minimal pulse width in seconds for this script to be triggered by the I/O juggler?
by anonymous
Arround a seccond
by anonymous

You can create a custom file .sh, on any dir: counter_.sh
in my case, I used /bin/ 
Using the same code as @Paulius.
Also, point the impluse_count to bin : counter="/bin/impulse_count"
On the IO juggler, add path : /bin/counter_.sh,
For a high-speed counter of about 1 per Sec, use a falling edge (dry input)