Control of the serial port via a web application (PHP, javascript) using MySQL and Python


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.