Package: seread
Project sereadIN CONSTRUCTION NOW - VERSION 0.1.23+ now may work, 2.3 currentlyREAD serial portssave data to file and influxdbTL;DRstartIf you have a device /dev/ttyACM0Try./bin_seread -D /dev/ttyACM0 -t 2,10 -c wordfrom git directory orseread  -D /dev/ttyACM0 -t 2,10 -c wordfrom pypi install. Supposing,
you have your device on/dev/ttyACM0If you want to serve as an interace to INFLUXDB (may run already)Create a virtual device and run it./bin_seread -D /tmp/virtser_connect. In this case you probably want
to open ports:-sfor TCP/UDP server on 8099/8100see existing decoders lowerWhat it does by now - HWORTEC COUNTER (raw numbers, using thescriptfile )arduino analog pins A0-An (json going out from arduino)arduino DHT sensor (with json output coded)arduino I2C pressure sensorarduino NTC temperature sensors (preprogrammed)What it does by now - SW - port 8099A space after the word...influxmevac- vadim vacuum reportinfluxme- send json - e.g.echo 'influxme [{"measurement":"cmdline","fields":{"crap":11.1}}]'  | nc 127.0.0.1  8099influxmegeo- gps positioninfluxmebeam nfs- generate beamon beamoff image on flashcam
(mmap)ptz- turn raspberry PTZVerify what is written in influxdbinflux
auth
...
use test
show measurements
select * from cmdlineMemory map - commands to local flashcaminfluxmebeam imagenamecommand sent to 8099 will send as a command
to flashcamallowed images: ["BEAMON[", "BEAMOFF",
"DETRDY]{.underline}","DETNRDY"]Examples - basic ideas[______________________________________________________________________]{.underline}
## send UDP ## ## TCP/UDP server ## FILE ## to 0-PC:8081 ##
influxdb ## on 8099/8100 ## ~/DATA/serialNG2udp.logsend UDP to 0-PC:8081This serves to send ORTEC counter values (3) to gregory, waiting on 8081
udp port.The beam current is processed and saved with gregory then.influxdbSend whatever with proper json format to all available influx databases.TCP UDP server 8099 8100Server that waitsinfluxme(net2json)jusst whatever jsoninfluxmegeo(net2json)measurement longitude latitudegregory(net2json)8081 port decode the ratesinfluxmevac(net2json)Vadim vacuum values storage (vacuum + flow)influxmebeam(net2json)BEAM ON/OFF (tentacles to flashcam image)START STOP RUNN (tentacles to gregory)ptzhandlepan tilt zoom command for raspberry hatFILESEREAD - details - descriptionInstallationThe project still develops, changes can be made anytime. The actual
dependencies can be installed by running./pipall.py.The code should be run bysereadBasic usageParameter -tUsage:-t 2,60Read serial inShort period(like 1s or 2s for DHT) and write to TXT
files.Then everyLong period(like 60s, 120s) write to influxdb(s).AND send UDP packets (e.g. to root acquisition running to display
counters - in case of 9009 gregory server).Deprecated in future.~seread  -D /dev/ttyACM0 -t 2,60 -c word~Parameter -D or -lAddress the HW device. List devices withseread.Device can be defined by the ttyXXX or by location.Usage:-l (location_usb_address)-D /dev/ttyUSBXParameter -fUsage:-fWrite data (short time interval) to file.Parameter -iUsage:-iWrite to influx (long time interval).Input/Output filesINPUTINPcalib="~/.seread.calib" INPdiscover=
"~/.sereaddiscover8086" INPpermanent=
"~/.sereadpermanent8086" INPinfluxcred=
"~/.influxuserpassdb" INPudpout= "~/.sereadudpout"
INPscript= "script"~/.seread.calib~/.myservicediscover8086~/.myservicepermanent8086~/.influxuserpassdb~/.sng2udpscriptOUTPUT~/DATA/serialNG2udp.log~/DATA/serialNG2jso.logMEMORY MAP~/config/flashcam/mmapfileseread.calibCalibration after readoutIt is possible to make a calibration after reading the serial values in
json. Check the file~/.seread.calibExample:{
"valuea0":{"a":0.21699,"b":-61.111},
"valuea1":{"a":0.1861328,"b":-40.2}
}Pay attention to commas and double quotes.valuea0is the same name of
the analog value exctracted from the arduino,abare linear
coefficients.sereaddiscover8086This contains IP - one per line - of PCs with influxdb running The user,
pass, database is in the file~/.influx_userpassdbudpoutlines with IP:PORT or without PORT, then 8080 is assumed. The will be
UDP packet sent to IP:PORT (every long period)scriptthis runs one line at a time and repeats the last line forever. The
example starts the ORTEC counter.#EOT:defines line separator#WAIT:defines what seread waits for to complete the line#EOT:\r
#WAIT:%
INIT\r\n
SHOW_VERSION\r\n
SET_COUNT_PRESET 0\r\n
SET_DISPLAY 2\r\n
START\r\n
SHOW_COUNT\rOptions-ttwo time periods, read,writeinflux:-t time1,time2-i-influxyes [true|false]: send to influx if-iis present.Sending will happen on time2:-t time1,time2More functions: (in construction)8099 port serverThis is Vadim's function. Information obtained on this port will
store data in influxdb. Vacuum mainly. For the moment, there are several
interpreters:influxme vac102vac102is a name of measurementecho 'influxme [{"measurement":"geo","fields":{"longitude":15.0,"latitude":50.0}}]'for ((i=0;i<10;i++)); do echo 'influxme [{"measurement":"geo","fields":{"longitude":15.0,"latitude":50.$i}}]' ; doneinfluxme nfsnfsis a name of measurement, FL value for FLOW is present as 3rd
valueinfluxmegeoecho influxmegeo geo 14.28 49.86 | nc 127.0.0.1  8099ptzMay need to install some stuff:sudo apt-get install python3-smbusecho ptz pan +5 | nc 127.0.0.1 8099echo ptz tilt -5 | nc 127.0.0.1 8099influxbeam nfsorderinfluxmebeam   nfs   0002    BEAMOFF[______]{.underline}   14:59:40influxmebeam   nfs   0003    BEAMON_   00                           DGR=00     15:02:46
influxmebeam   nfs   0004    BEAMOFF[______]{.underline}   15:02:50influxmebeam   nfs   0005    DETRDY_   00                           DET=05     15:03:19
influxmebeam   nfs   0006    DETNRDY[______]{.underline}   15:03:230002 BEAM_OFF _________ 14:59:40
0003 BEAM_ON_ 00 DGR=00 15:02:46
0004 BEAM_OFF _________ 15:02:50
0005 DET_RDY_ 00 DET=05 15:03:19
0006 DET_NRDY _________ 15:03:23APPENDIXAdding dialout group to be able to work with USBsudo usermod -a -G dialout $USERthen either reboot of logout/login or
try `newgrp dialout` in terminal.Arduino-modeArduino programming remarksDifferent types need different settings in the original IDE.Chineese NANOTools/ArduinoNano/ATmega328P(old)/ttyUSB0UNO with shieldTools/ArduinoUNO/__/ACM0 with programmer AVRISM mkIIStraight installer in emacs is fastgo to (https://github.com/raxod502/straight.eland prependthe code to the~/.emacsto usestraight-use-packagesay M-xstraight-use-packagearduino-modeinstallauto-minor-modeinstall somehowarduino-clifromhttps://github.com/arduino/arduino-cli) and
[package](https://arduino.github.io/arduino-cli/installation/emacs settingcopyarduino-cli.elfile fromhttps://github.com/motform/arduino-cli-modeto~/.emacs.d/lisp/and add(add-to-list 'load-path "~/.emacs.d/lisp/")and(load "arduino-cli.el")to~/.emacs.BUT as now, I cannot compile, as--fqbnis needed and not given
automatically.IN EMACS say M-xarduino-cli-modeThe~/.emacscontents:(defvar bootstrap-version)
(let ((bootstrap-file
       (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
      (bootstrap-version 5))
  (unless (file-exists-p bootstrap-file)
    (with-current-buffer
        (url-retrieve-synchronously
         "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
         'silent 'inhibit-cookies)
      (goto-char (point-max))
      (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))
;;
;;
(straight-use-package 'arduino-mode)
(add-to-list 'auto-minor-mode-alist '("\\.ino\\'" . arduino-cli-mode))
;;
(add-to-list 'load-path "~/.emacs.d/lisp/")
(load "arduino-cli.el")Arduino-cli commandlinearduino-cli config initarduino-cli core update-indexarduino-cli board listarduino-cli core install arduino:samdarduino-cli core install arduino:avrarduino-cli core listarduino-cli core listallarduino-cli core --fqbn arduino:avr:diecimila  test.inoarduino-cli compile 20200411-logoled-ser1sd0.ino --fqbn arduino:avr:nanoandarduino-cli upload --fqbn arduino:avr:nano -i 20200411-logoled-ser1sd0.ino.arduino.avr.nano.hex -p /dev/ttyUSB0should workreadme in orgPypi has problems with org, see:https://packaging.python.org/specifications/core-metadata/#description-content-type-optionalbinsereadTESTing behavior:no paramters:Expected RESULT:versionuseMODESdevice listX not exists, advice to virtual socket-D realDev -t 2,10 -c wordExpected RESULT:loop entered, check the filesX... NOT FOUND ~/.sng2udpHTTPS is treated without security check#==================== insecure treatment of https is WITHOUT WARNINGS NOW
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)