Changes

no edit summary
Line 104: Line 104:  
   | [[File:Networking_{{lc:{{{series}}}}}_manual_input_output_status.png|border|class=tlt-border]]
 
   | [[File:Networking_{{lc:{{{series}}}}}_manual_input_output_status.png|border|class=tlt-border]]
 
}}
 
}}
 +
 
You can invert an Input pin by clicking the on/off slider under the "Inversion" column or switch the state of an Output pin by clicking the on/off slider under the "State" column.
 
You can invert an Input pin by clicking the on/off slider under the "Inversion" column or switch the state of an Output pin by clicking the on/off slider under the "State" column.
   −
{{#switch:{{{series}}}
  −
| TRB2 = ===Status from command line===
  −
----
  −
You can also obtain the status of the input or output from the command line. List of ubus possible <b>values</b> in {{{name}}} devices:
  −
  −
ioman.adc.adc0
  −
ioman.gpio.dio0
  −
ioman.gpio.dio1
  −
ioman.gpio.dio2
  −
  −
Call command <b>ubus call <u>value</u> status </b>:
  −
root@Teltonika-{{{name}}}:~# ubus call ioman.gpio.dio0 status
  −
{
  −
        "value": "0",
  −
        "direction": "out",
  −
        "bi_dir": true,
  −
        "invert_input": false
  −
}
  −
  −
<ul>
  −
    <li><b>dio0</b> is configurable input / output:
  −
        <ul>
  −
            <li>"value": "<b>0</b>" means low level state.</li>
  −
            <li>"value": "<b>1</b>" means high level state.</li>
  −
        </ul>
  −
    </li>
  −
    <li><b>adc0</b> is analog input:
  −
        <ul>
  −
            <li>"value": "<b>0.54</b>" means 0.54V.</li>
  −
        </ul>
  −
    </li>
  −
</ul>
  −
| TRB1 = {{#ifeq:{{{name}}}|TRB141
  −
| ===Status from command line===
  −
----
  −
You can also obtain the status of the input or output from the command line. List of ubus possible <b>values</b> in {{{name}}} devices:
  −
  −
ioman.acl.acl0
  −
ioman.adc.adc0
  −
ioman.dwi.dwi0
  −
ioman.dwi.dwi1
  −
ioman.gpio.dio0
  −
ioman.gpio.dio1
  −
ioman.gpio.iio
  −
ioman.gpio.onewire
  −
ioman.relay.relay0
  −
ioman.relay.relay1
  −
  −
In order to read value use '''''status''''' command.
  −
  −
ubus call ioman.gpio.dio0 status
  −
ubus call ioman.relay.relay0 status
  −
  −
To change input settings use '''''update''''' command and write the value.
  −
  −
ubus call ioman.gpio.dio0 update '{"value":"0"}'
  −
ubus call ioman.gpio.dio0 update '{"value":"1"}'
  −
  −
To change relay settings use '''''update''''' command and write state.
  −
  −
ubus call ioman.relay.relay0 update '{"state":"open"}'
  −
ubus call ioman.relay.relay0 update '{"state":"closed"}'
  −
  −
===Reading I/O values from directory===
  −
----
  −
  −
You can also collect I/O values straight from directories in your device.
  −
  −
====Digital inputs, Relay outputs====
  −
----
  −
  −
Following is a list of I/O directories in '''''/sys/class/gpio/''''':
  −
  −
dwi1(dry wet) input 14; toggle 12 (to read value refer to gpio14, to change state dry/wet refer to gpio12)
  −
dwi2(dry wet) input 15; toggle 38 (to read value refer to gpio15, to change state dry/wet refer to gpio38)
  −
relay open 20; closed 22; (turn off gpio20 set to 0, turn on gpio22 set value to 1; and visa versa)
  −
latching relay open 23; close 21 (turn off gpio23 set to 0, turn on gpio21 set value to 1; and visa versa)
  −
dio0 (power socket) input 13; output 16 (direction can be changed, to read input use gpio13, to control output use gpio16)
  −
dio1 (power socket) input 17; output 78 (direction can be changed, to read input use gpio17, to control output use gpio78)
  −
iio (isolated input) input 1021 (to read value refer to gpio1021)
  −
  −
In order to read digital input value use '''''cat''''' command.
  −
  −
cat /sys/class/gpio/gpio14/value
  −
cat /sys/class/gpio/gpio15/value
  −
cat /sys/class/gpio/gpio1021/value
  −
  −
To change input state use '''''echo''''' command where "1" is "dry" state and "0" is "wet" state.
  −
  −
echo 0 > /sys/class/gpio/gpio12/value
  −
echo 1 > /sys/class/gpio/gpio38/value
  −
  −
When one Relay output is open, other one is closed, so turning on/off the output you will have to change value on both pins. For that '''''echo''''' command is used. Same principle applies to Latching Relay output.
  −
  −
echo 1 > /sys/class/gpio/gpio20/value & echo 0 > /sys/class/gpio/gpio22/value
  −
echo 1 > /sys/class/gpio/gpio23/value & echo 0 > /sys/class/gpio/gpio21/value
  −
  −
====ADC (Analog Input)====
  −
----
  −
  −
ADC (Analog input) can be read from different directory, '''''/sys/devices/qpnp-vadc-8/mpp4_vadc''''' also using '''''cat''''' command, but received Result value has to be divided by 126582 to get number in volts.
  −
  −
cat /sys/devices/qpnp-vadc-8/mpp4_vadc
  −
  −
====One-wire====
  −
----
  −
  −
To read one-wire sensor data you will need to follow these steps:
  −
  −
Set one-wire sensor '''''value''''' to '''''1''''' using '''''ubus''''' command.
  −
  −
  ubus call ioman.gpio.onewire update '{"value":"1"}'
  −
  −
After that list out connected one-wire devices in directory '''''/sys/bus/w1/devices''''' with '''''ls''''' command.
  −
  −
  ls /sys/bus/w1/devices
  −
  −
Choose sensor that you want to know values off and using '''''cat''''' command read them from '''''/sys/bus/w1/devices/&#60;device_name&#62;/w1_slave''''' directory.
  −
  −
  cat /sys/bus/w1/devices/&#60;device_name&#62;/w1_slave
  −
  −
  −
| <!--    For TRB1    -->
  −
===Status from command line===
  −
----
  −
You can also obtain the status of the input or output from the command line. List of ubus possible <b>values</b> in {{{name}}} devices:
  −
  −
ioman.gpio.din1
  −
ioman.gpio.dout1
  −
  −
Call command <b>ubus call <u>value</u> status </b>:
  −
root@Teltonika-{{{name}}}:~# ubus call ioman.gpio.dout1 status
  −
{
  −
        "value": "0",
  −
        "direction": "in",
  −
        "bi_dir": false,
  −
        "invert_input": false
  −
}
  −
  −
<ul>
  −
    <li><b>din1</b> is the input:
  −
        <ul>
  −
            <li>"value": "<b>0</b>" means low level state.</li>
  −
            <li>"value": "<b>1</b>" means high level state.</li>
  −
        </ul>
  −
    </li>
  −
    <li><b>dout1</b> is the output:
  −
        <ul>
  −
            <li>"value": "<b>0</b>" means low level state.</li>
  −
            <li>"value": "<b>1</b>" means high level state.</li>
  −
        </ul>
  −
    </li>
  −
</ul>
  −
}}
  −
| <!--    For RUTX      -->
   
===Status from command line===
 
===Status from command line===
 
----
 
----
You can also obtain the status of the input or output from the command line. List of ubus possible <b>values</b> in {{{name}}} devices:
+
You can also obtain the status of input and output pins via the command line (CLI or SSH). List of possible ubus values in {{{name}}} devices:
 
  −
ioman.gpio.dio0
  −
ioman.gpio.dio1
  −
 
  −
Call command <b>ubus call <u>value</u> status </b>:
  −
root@Teltonika-{{{name}}}:~# ubus call ioman.gpio.dio0 status
  −
{
  −
        "value": "0",
  −
        "direction": "in",
  −
        "bi_dir": false,
  −
        "invert_input": false
  −
}
     −
<ul>
+
{{#ifeq: {{{name}}} | TRB141
    <li><b>din1</b> is the input:
+
  | {{Template:Networking_trb141_manual_input_output_status}}
        <ul>
+
  | {{Template:Networking_{{lc:{{{series}}}}}_manual_input_output_status}}
            <li>"value": "<b>0</b>" means low level state.</li>
  −
            <li>"value": "<b>1</b>" means high level state.</li>
  −
        </ul>
  −
    </li>
  −
    <li><b>dout1</b> is the output:
  −
        <ul>
  −
            <li>"value": "<b>0</b>" means low level state.</li>
  −
            <li>"value": "<b>1</b>" means high level state.</li>
  −
        </ul>
  −
    </li>
  −
</ul>
   
}}
 
}}
  

Navigation menu