Search code examples
javascriptphphtmluart

Display UART in HTML (web site)


I receive continuously data by uart sérial port. How can i print this data on my html web site and update it dynamically ? I use a raspberry pi 3 with apache server. I can use php, javascript, python... and many languages.


Solution

  • You could create a NodeJS server, with express for example.
    Then use the serialport npm module to get data from your serial port.
    Then send this data through a websocket, create a web page, and use the Websocket Javascript API to retrieve the data from your websocket.

    This way, you can display real-time data from serial port on your website. I've used this 'stack' to build a connected aquaponics system in a Hackathon and it worked well !

    It would even be simplier if you use socket.io, since it provides simple library and code example for both the back-end and the front-end part.

    Hope it helps,
    Best regards