serial communication software

What is serial communication software epicon?

  • epicon is a Linux serial communication software.

  • In practice IOT House uses the thermo-hygrometer AM2321 sensor and AI/DIO for control with TOCOS TWE-Lite via serial communication from the USB connection ToCoStick of Raspberry Pi.

  • I think that network devices such as Switch and Router that can be configured with serial ports and console PCs can be used regardless of manufacturer or model.

  • When automating the settings, Cisco Switch and Router copy and paste the text data created in advance and fill in the config.
    At this time, it is important to send delay of characters and line breaks to prevent the config data from being missed.

  • epicon supports the transmission delay of important characters and line breaks as this serial console, and you can copy and paste the config with confidence.

  • In addition, file transfer software such as simple telnet and zmodem, shell, macro, start of external software, etc. CUI, but it is multifunctional and compact.

  • Installation
    Download
    https://osdn.net/projects/pepolinux/releases/p3211

    1
    2
    3
    4
    5
    6
    7
    # tar xvfz epicon-XX.XX.tar.gz
    # cd epicon
    # ./configure
    # make
    # make install
    uninstall
    # make uninstall
  • How to use

    • Startup, no options (com1: / dev / ttys0 port, 9600bps, 8bit non-parity)
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      # epicon

      ** Welcome to epicon Version-5.2 Copyright Isamu Yamauchi compiled:Feb 24 2021 **
      exec shell ~!
      send binary files ~f
      send break ~b
      call rz,sz,sx,rx ~rz,~sz,~sx,~rx
      call kermit ~sk,~rk
      external command ~C
      change speed ~c
      exit ~.
      Connected /dev/ttyS0
    • How to exit
      Enter~.
    • Communication state->to shell->コマンド入力->Return to the original communication state with exit
      Enter~!
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
        epicon wait
      # ls
      AUTHORS README configure.ac install-sh
      COPYING aclocal.m4 depcomp missing
      ChangeLog autom4te.cache epicon.c patch-gkermit1.0+counter-CentOS4.2
      INSTALL config.h epicon.h patch-gkermit1.0+counter1.2.1
      Makefile.am config.h.in epicon.nr sample.scr
      Makefile.in config.status epicon_main.c stamp-h1
      NEWS configure epicon_uty.c
      # exit
      epicon run
    • Switch settings and options available (/dev/ttyUSB0,19200bps, character delay:30ms, CR delay:50ms) In my old experience, setting this delay will not cause the config to be missed.
      1
      # epicon -d 30 -D 50 -s 19200 -l /dev/ttyUSB0
    • Switch settings and options available (telnet, character delay:20ms, CR delay:50ms)
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14
      15
      16
      # epicon -d 20 -D 50 -n 192.168.0.1:23

      ** Welcome to epicon Version-5.2 Copyright Isamu Yamauchi compiled:Feb 24 2021 **
      exec shell ~!
      send binary files ~f
      send break ~b
      call rz,sz,sx,rx ~rz,~sz,~sx,~rx
      call kermit ~sk,~rk
      external command ~C
      change speed ~c
      exit ~.

      Telnet Server 1.10 All rights reserved.


      login :
  • “-c” option: Specify external script

    • mono-wireless Thermo-hygrometer AM2321 sensor, analog input, digital input/output signal from a remote location with wireless modules TWELITE and MONOSTICK Programs for remote monitoring and control It is used in pepotocsctl .twelite_dip_monostick
    • The following creates a script that reads the temperature and humidity from the AM2321 sensor and starts epicon.
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14
      15
      16
      17
      18
      19
      20
      21
      22
      23
      24
      25
      26
      # /usr/local/bin/epicon -s 115200 -ql /dev/ttyUSBTWE-Lite -c $CMD
      # cat $CMD
      #!/bin/bash
      RETRY=5
      I2CRD="-1"
      while [ ${RETRY} -ne 0 ];do
      retry_time=`echo -en $RANDOM |cut -c 1-2`
      echo -en ":7888AA015C0000X\r\n"
      msleep 50
      read -s -t 1 I2CRD || I2CRD="-1"
      echo -en ":7888AA015C03020004X\r\n"
      msleep 50
      read -s -t 1 I2CRD || I2CRD="-1"
      msleep
      echo -en ":7888AA025C0006X\r\n"
      msleep 50
      read -s -n 28 -t 1 I2CRD || I2CRD="-1"
      TMP=`echo -en ${I2CRD} | wc -c`
      [ ${TMP} -eq 28 ] && break
      RETRY=$((${RETRY} - 1))
      [ ${RETRY} -eq 0 ] && break
      RETRY=$((${RETRY} - 1))
      msleep $retry_time
      I2CRD="-1"
      done
      echo -en ${I2CRD} >/dev/stderr
  • Manual excerpt

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    # man epicon

    epicon(1) epicon Manuals

    NAME
    epicon is Easy Personal Interface Console terminal software. First I
    am sorry. Because my English linguistic power is very shabby, this sen‐
    tence is being translated by the machine. Because of that, read it in
    the interpretation which it is tolerant of though it thinks that it is
    a little funny translation.

    SYNOPSIS
    usage:
    epicon [-options [argument] [-options [argument]]
    [-b ] <--escape cannot be used
    [-c external_command]
    [-d send_charcacter_delay(ms)]
    [-D send_CR_delay(ms)]
    [-e escape_char]
    [-f send_file]
    [-F send_file_effective_delay]
    [-m ] <--input echo mode
    [-M ] <--line mode
    [-l com_port]
    [-L output_log_file]
    [-n ip_address[:port]]
    [-p [server_port]]
    [-q ] <--quiet mode
    [-s speed]
    [-v ] <--show version
    [-x bit_length (5|6|7) parity(o|e|n) stop_bit (1|2)]
    [-z ] <--auto rz prohibition

    defaults:
    speed: 9600b/s (Higest of 460800)
  • Please check the source code below
    https://github.com/kujiranodanna/IOT-House/tree/master/raspberrypi/usr/src/epicon

Smell sensor

What is pepoiaq2led

  • Gas resistance value read from environmental gas sensor BME680 50 counts every 5 minutes Average value 80%, temperature 10%, humidity 10% Air quality calculated from: IAQ (indoor air quality) 0 to 500 The browser is good (with numerical values) It is expressed in green)~ very_bad (red) colors.
bme680_iaq_img
  • You can turn on the 3-color LED from the GPIO output with pepoiaq2led.
  • If it is always running, it can be used as an odor sensor appliance.
  • pepoiaq2led is started via daemontools with the following command.
    1
    2
    3
    4
    # cd /www/pepolinux
    # ln -s /usr/local/bin/pepoiaq2led iaqled
    # cd /service/
    # ln -s /www/pepolinux/iaqled iaqled
  • pepoiaq2led started by daemontools is stopped/started/confirmed by the following command.
    1
    2
    3
    # svc -d /www/pepolinux/iaqled
    # svc -u /www/pepolinux/iaqled
    # svstat /www/pepolinux/iaqled
  • Raspberry pi’s BME680 and 3-color LED detect the smell of garlic in a tube Demo video

pepotocsctl

What is GPIO wireless?

  • What is pepotocsctl?mono-wireless The thermo-hygrometer AM2321 sensor, analog input, and digital input/output signals are separated by the wireless modules TWELITE and MONOSTICK. It is a program that can be remotely monitored and controlled from a location.
    twlite_img
    pepotocsctl alone does not work, you need a separate epicon. You can operate the GPIO and AM2321 sensors of the Tocos wireless module with commands.
    1
    2
    # pepotocosctl
    usage /usr/local/bin/pepotocosctl read->chno:0-6 | write->chno:0-6 [DO:0|1|f] to 300000ms
    Read for 4 ports of DI (digital input)
    1
    # pepotocsctl 0 7
    The most port read of DI (digital input)
    1
    # pepotocsctl 1 1
    DO (Digital Out Pout) Light 1 to the first port
    1
    2
    # pepotocsctl 1 1
    1
    DO (Digital Out Pout) Write 1 to the first port and hold for 5 seconds
    1
    2
    # pepotocsctl 1 1 5000
    0
    I2C thermo-hygrometer AM2321 sensor read
    1
    2
    # pepotocsctl 5
    2016/01/20,19:16:19,4.0℃,75.4%
    Analog input read
    1
    2
    # pepotocosctl 6
    4080,4080,4080,4080
    Light after read
    1
    2
    # pepotocosctl 0 0
    7;4080,4080,4080,4080
    Digital input and analog input read
    1
    2
    # pepotocosctl 7
    f;1952,4080,4080,4080
    Wait for the read, DI change for the specified time
    1
    2
    # pepotocosctl 7 120
    e;4080,4080,4080,4080
  • Please check the source code below
    https://github.com/kujiranodanna/IOT-House/blob/master/raspberrypi/usr/local/bin/pepotocosctl

pepogpioctld

What is pepogpioctld

  • It is a daemon that quantifies the air quality based on the input / output control of gpio and the data of the environmental gas sensor BME680.

  • When the BME680 sensor is connected, the gas resistance value is 50 counts every 5 minutes from the 2021/02/04/17:22: 23,10.2,43.0,1018.9,3436 value created by pepobme680. Based on the average value of 80%, temperature of 10%, and humidity of 10%, the following air quality: IAQ (indoor air quality) is calculated and added.

  • IAQ is Sample 0(Good) to 500(Hazardous) Temperature(17-28℃):10% Humidity(40-70%):10% Gas(Gas±Gas_base/Gas_base):80%

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    [iot00f:root#] cat /www/remote-hand/tmp/.pepobme680
    2021/02/04/17:22:23,10.2,43.0,1018.9,3436
    Date/time, temperature, humidity, pressure, gas resistance

    [iot00f:root#] cat /www/remote-hand/tmp/.gpiodi_read_data
    di[0]=1
    di[1]=1
    di[2]=1
    di[3]=0
    gpio_i2c=17:25:15,10.2,43.0,1019,3436,21
    Date/time, temperature, humidity, pressure, gas resistance, air quality
    [iot00f:root#] cat /www/remote-hand/tmp/.gpiodo_write_data
    do[0]=0
    do[1]=0
    do[2]=0
    do[3]=0

    Connect the BME680 environmental gas sensor to display a graph

  • Please check the source code below
    https://github.com/kujiranodanna/IOT-House/blob/master/raspberrypi/usr/local/bin/pepogpioctld

pepoalexado

What is pepoalexado

  • Created to turn on / off the lights with Alexa and listen to the temperature, get GPIO output and json data to the Raspberry Pi distributed in the IOT house
    pepoalexado
    usage /usr/local/bin/pepoalexado host user password [write->chno:0-17 [DO:0|1] [timer->1 to 300000ms]] or read->json_name

  • GPIO 3 ON
    pepoalexado iot001.local remote hand 3 1

  • GPIO 3 OFF
    pepoalexado iot001.local remote hand 3 0

  • Acquire json data of I2C gas sensor BME680
    pepoalexado iot001.local remote hand gpio_i2c
    { “date”: “08:47:11”, “temp”: “27.5℃”, “hum”: “79.7%”, “pres”: “1006hPa”, “gas”: “2055427Ω”, “iaq”: “17” }

  • Acquire barometric pressure data of I2C gas sensor BME680
    pepoalexado iot001.local remote hand gpio_i2c.pres
    1020hPa

  • Get low / high outdoor illuminance-> Use for judgment such as turning on the lights in the room when the outdoor illuminance becomes dark pepoalexado iot01f.local remote hand ai2di12
    low

  • GPIO port 4 input of iot01f.local low-> high Execute the event registered command dio3high
    dio3high has registered a module camera 10 second video mail, which can activate the module camera of Raspberry Pi connected to another camera from the GPIO input event without camera connection
    Used to activate security cameras on Alexa at Practical IOT House
    pepoalexado iot02f.local remote hand dio3high

  • While a browser such as chrome is browsing https://iot01f, the browser returns voice operation and response with the registered wording.
    pepoalexado iot01f.local remote hand voice_req Turn off the light-> Turn off the light and execute
    pepoalexado iot01f.local remote hand voice_req Tell me the room temperature-> The room temperature is 24.0 ℃

  • Alexaのhomebridge/config.json Setting Example

    Alexa, turn on the dining

    Alexa, dining Turn off the lights

    Alexa, security camera on

    Alexa, security camera off

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    {{{
    "platforms": [
    {
    "platform": "Alexa",
    "name": "Alexa",
    "username": "user",
    "password": "pass"
    }
    ],
    "accessories": [
    {
    "accessory": "CMD",
    "name": "dining",
    "on_cmd": "sudo /usr/local/bin/pepoalexado iot001.local remote hand 3 1",
    "off_cmd": "sudo /usr/local/bin/pepoalexado iot001.local remote hand 3 0"
    },
    {
    "accessory": "CMD",
    "name": "security camera",
    "on_cmd": "sudo /usr/local/bin/pepoalexado iot03f.local remote hand dio3low",
    "off_cmd": "sudo /usr/local/bin/pepoalexado iot02f.local remote hand dio3high"
    },
    }}}
  • Please check the source code below
    https://github.com/kujiranodanna/IOT-House/blob/master/raspberrypi/usr/local/bin/pepoalexado