开发者

Controlling serial port through a webapp(PHP, javascript) using MySQL and Python

开发者 https://www.devze.com 2023-03-22 19:18 出处:网络
Wanted to get some feedback on this implementation. I\'m developing an application on the PC to send and receive data to the serial port.

Wanted to get some feedback on this implementation.

I'm developing an application on the PC to send and receive data to the serial port.

开发者_高级运维

Some of the data received by the application will be solicited, while other data unsolicited.

Controlling the serial port and processing messages would be handled by a Python application that would reside between the serial port and the MySQL database. This would be a threaded application with one thread handling sending/receiving using the Queue library and other threads handling logic and the database chores.

They MySQL database would contain tables for storing data received from the serial port, as well as tables of outgoing commands that need to be sent to the serial port. A command sent out may or not be received, so some means of handling retries would be required.

The webapp using HTML, PHP, and javascript would provide the UI. Users can query data and send commands to change parameters, etc. All commands sent out would be written into an outgoing table in the database and picked up by the python app.

My question: Is this a reasonable implementation? Any ideas or thoughts would be appreciated. Thanks.


It seems there's a lot of places for things to go wrong.

Why not just cut out PHP all together and use python?

e.g. Use a python web framework & let your JavaScript communicate with that and while also reading the serial port and logging to MySQL.

That's just me though. I'd try and cut out as many points where it could fail as possible and keep it super simple.


You might also want to check out pySerial (http://pyserial.sourceforge.net/). You might also want to think about you sampling rates, i.e. how much data are you going to be generating and at what frequency. in other words how much data are you planning to store. Will give you some idea of system sizing.

0

精彩评论

暂无评论...
验证码 换一张
取 消