Skip to main content

Easy read data from COM ports and send them over the server(net) example in your arduino or raspberrypi project

Project description

Easy Read data from com port and send them to the server Easier

Project Description Its hard to read data from the serial communication and send the data over your server, especially with us students, hence using a python script we can read the data written over the communication port and manipulate them as we want Example: Read serial data from proteus virtual terminal or your arduino project or raspberry pi

Installation

pip install read_comports_tonet

Requirements || dependecies

Pyserial >= 2.20.0
requests >= 3.0
schedule >= 1.0.0

Note

The comport should be there if it's for simulation one can use the virtual ports emulators like Vspe

Usage

Import the module and inside there is the class named ReadFromComPorts then instatiate it like below passing two parameter comportname example COM1 and baudarate e.g 9600

from read_comports_tonet import ReadFromComPorts
COM1 = ReadFromComPorts("<comport name e.g COM1>", baudrate)

Testing if comport is open Use the COM object created the method below

COM1.checkifTheComportisOpen()

Reading the line

The method here return data that have been decoded ready and in list if you have sent them and separated them for obtain various data from the same string < parameters: optional but if you have written a string like 33*667*67 for separating your data then you can separate them to obtain the data using this method

data = COM1.readLineOfData(splitter="<eg. ** its optional")

Reading the single character return the character

charObtained = COM1.readCharacterData()

Post data to the server Here the http post method is used hence one

have to provide the payload Parameter: Url || payload should be a dictionary

COM.postDataToServer("<url e.g thingspeak.com/post" , payload:dict)

Perform the GET request The methods perform the get request and also

it can be used for pposting the data using the Route parameters Parameters: url e.g Github routes RouteParameter: type dict e.g {'api_key' = "shms24" }

COM.getRequest("<url e.g thingspeak.com/post" , payload:dict)

Schedule sending the data or fetching the data Scheduling the

sending of data to the server is easier since the package under the hood uses the schedule module too, here both GET & POST methods can be automated also setting the time your want to data to be sent Parameters: time (type float)-> Seconds that will be taken before calling the same function for fetching the data or sending the data Method: here its http method it can be POST or GET Payload (type-Dict-Optional): the data to be sent if its posting

COM.scheduleSending("<url e.g thingspeak.com/post", time, "method e.g Post"  payload:dict(optional))

Scheduling sending of the data without passing payload, package will

fetch the data from com port provided example Proteus The package was inspired by this feature since students struggle taking of the data from the various softwares they are using to the server that they can be saved to the database, the package will fetch data under the hood and be posting them basing on the time you have scheduled Parameters: method: POST || GET *keys: ("e.g temp" , "hum") // Should be tuple

COM.scheduleSendingDataFromPorts("<url e.g thingspeak.com/post", time, "method e.g Post", "splitterstring e.g xx to separate data", *keys)

Powered By: Yosia Lukumai

Github Account: https://github.com/yosiaLukumai

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

read_comports_tonet-0.0.1.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

read_comports_tonet-0.0.1-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file read_comports_tonet-0.0.1.tar.gz.

File metadata

  • Download URL: read_comports_tonet-0.0.1.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.7.2

File hashes

Hashes for read_comports_tonet-0.0.1.tar.gz
Algorithm Hash digest
SHA256 2d1af815f4fbcecc1675985f38057b37a80bc95d3d9aa06607e2c6a946d3762a
MD5 2c1438d77a52fbae1d4edb437bce8622
BLAKE2b-256 c143574370f4e37b149dfa5a09b023dc03e968b2ba8c62b406ae64c849fa9c4a

See more details on using hashes here.

File details

Details for the file read_comports_tonet-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for read_comports_tonet-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 615ff873f77d48dc0d52c5864a8c69c83c9a5a717de7497037e1ba3362e6de35
MD5 bb8e75c242f390353ba414bd9e00066d
BLAKE2b-256 b15b23a0b41d193eae315a47776009eb40f01b65f612c4b5eb57d801740f32ff

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page