LAN DS18B20 WEB Temperature Monitor 1 meter Cable

Raspberry Pi: Reading ModBus data from Huawei inverter SUN 2000

PHP file: require_once dirname(FILE) . ‘/Phpmodbus/Phpmodbus/ModbusMaster.php’; // Create Modbus object$modbus = new ModbusMaster(“”, “TCP”); try {// FC 3$recData = $modbus->readMultipleRegisters(1, 32262, 1); // PV1 voltage }catch (Exception $e) {// Print error information if anyecho $modbus;echo $e;exit;} // Print status informationecho “Status: ” . $modbus; // Print read dataecho “Data: “;print_r($recData);echo ““; $data = (256*$recData[0]) + . . .

Read More

USB Relay Module for Windows, Linux, Raspberry Pi

include ‘PhpSerial.php’; // Let’s start the class$serial = new PhpSerial; // First we must specify the device. This works on both Linux and Windows // (if your linux serial device is /dev/ttyS0 for COM1, etc)$serial->deviceSet(“/dev/ttyUSB0“); // We can change the baud rate, parity, length, stop bits, flow control$serial->confBaudRate(9600);$serial->confParity(“none”);$serial->confCharacterLength(8);$serial->confStopBits(1);$serial->confFlowControl(“none”); // Then we need to open it$serial->deviceOpen(); . . .

Read More

Receive UDP packet datagrams in PHP ( UDP server socket)

  PHP file: <?php $socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);if (!$socket) { die(“socket_create failed.n”); }   //Set socket options.socket_set_nonblock($socket);socket_set_option($socket, SOL_SOCKET, SO_BROADCAST, 1);socket_set_option($socket, SOL_SOCKET, SO_REUSEADDR, 1); if (defined(‘SO_REUSEPORT’))socket_set_option($socket, SOL_SOCKET, SO_REUSEPORT, 1); //Bind to any address & port 12345.if(!socket_bind($socket, ‘’, 12345))    die(“socket_bind failed.n”);   //Wait for data.$read = array($socket); $write = NULL; $except = NULL; while(socket_select($read, $write, . . .

Read More

PHP receive script for KMTronic DS1820 LAN POST version module

  Receive POST data using PHP         PHP file: <?php $date = date(‘Ymd’); $time = date(‘H:i:s’); $hourtime = date(‘H:i’); $unixtime = time(); $file = “/var/www/html/data/”.$date.”.log”; $current = file_get_contents($file); $current .= $date; $current .= “-“; $current .= $time; $current .= “\t”; $current .= $unixtime; $current .= “\t”; $temp = $_POST[‘temperature’]; $temp2 = implode(“”,$_POST[‘temperature’]); $current . . .

Read More

Create a Crontab server side PHP script for uploading temperature to a MySQL database

      Temperature Monitor STATUS XML data http://XXX.XXX.XXX.XXX/status.xml XXX.XXX.XXX.XXX is IP ADDRESS Temperature monitor     MySQL table     Cron is a system daemon used to execute desired tasks (in the background) at designated times.  A crontab file is a simple text file containing a list of commands meant to be run at . . .

Read More

KMtronic LAN WEB 8 Channel Relay board