« Previous | Next»

Pollin Net-IO PHP Library

Posted by coldtobi | 9 Feb, 2011, 19:37

Currently I work on a small private home-automation project. The purpose to "control" the heating system at home (heat-pump system) via the Internet. 

Okay, "control" is a too big word for the heat-pump as it has only 3 controlable modes, at least without reverse-engineering effort: "normal", "off" and "night reduction" by an external analog input. The goal is to shift energy consumption to the lower priced off-peak times.

For this project, I'm using a Ethernet Board with an Atmel AVR microcontroller, my Thecus N2100 as control server and PHP.


So it makes sense to build a small PHP library, and maybe someone else has also use of this library.

The library is compatible with the original firmware and supportsthe following main functions:

  • Connecting to the network
  • Setting the digital outputs and reading back the status (with the possiblity to cache the results)
  • Reading the digital inputs (with the possiblity to cache the results)
  • Reading the analog (ADC) inputs .


Download the code

Here's the library:  http://frost.de/files/net_io.txt (make sure to change the extension to .php)

And here are some testcases, also illustrating the usage:  http://frost.de/files/net_io_testcases.txt (make sure to change the extension to .php)

Usage snippets

Instanciating (NB: is the IP I use on my network. You might need to change this. Factory-Default is

$p = new pollin_netio("");

Setting an Output (example: Port 0 to high, 5V) - note Port 0 is Port 1 as on the hardware schematic.

if ( false == $p->setport(0,1)) {
        echo "ERROR on setting port 1\r\n";
    } else  {
        echo " OK setting port 0\r\n";

 Reading the input IO (eg. input 1)

$port = $p->query(8, false);

Reading analog values

for ( $i=0; $i<4; $i++) {
    $result = $p->queryad($i,0);
    if ( false == $result) {
        echo "ERROR reading port $i\r\n";
    } else  {
        echo "OK reading port $i (value $result)\r\n";


Electronics and Atmel AVR, Thecus N2100 | Comments (2) | Trackbacks (0)

Related Articles:

2 Comments | "Pollin Net-IO PHP Library" »

  1. Mark : AVR NET IO

    16/02/2011, at 11:43 [ Reply ]

    Perfect! i changed the IP and it works! Thanks

  2. Dany : NET IO

    21/02/2012, at 18:46 [ Reply ]

    Thank you.
    Very interesting topic will bookmark your site to check if you write more about in the future.