- If Grove Expansion Board is used, it just needs to stack the Expansion Board on PHPoC and plugs grove interface (male-type) of camera to UART0 grove interface (female-type) of Grove Expansion Board.
- Otherwise, connect pin yellow, white, red and black of grove interface (male-type) of camera to pin U0RX, U0TX, PWR5 and GND of PHPoC, respectively.
The source code includes:
- phpoc.ini: contains memory configuration parameters. This file can be absent if using the default configuration. In this project, image data comes to the receiving UART buffer and is sent to the sending TCP buffer. Since the image size is big, it need to increase these buffer size via this file.
- init.php: it's run when system boots and specifies which file is run next. (in this case is task0.php)
- index.php: This is client side code. When a web browser makes an HTTP request to PHPoC, PHPoC interprets PHP script part in this file and returns an HTML file to web browser. The return file contains java-script code which creates WebSocket connection and handles the incoming data from WebSocket (receiving image data and visualizing it on webpage)
- task0.php: This is server side code. it is run in infinite loop. It reads the image data from camera and sends it to web app via WebSocket
- lib folder : contains libraries code, including sd_340.php, sn_tcp_ws.php and vd_uart_camera.php. sd_340.php and sn_tcp_ws.php are the official libraries from PHPoC. They are available here. vd_uart_camera.php is user-contributed library (see the code section). sd_340.php contains UART functions to communicate with Camera. sn_tcp_ws.php contains WebSocket functions to communicate with web app. vd_uart_camera.php contains functions to read data from camera.