-or physical website visits display-


If you have a blog or any other kind of website then this is for you. It’s a little box that connects to the internet and displays how many visits you have on your website. It’s designed to work independently of your computer, connecting directly to the internet via your router. Mine even steals power from one of the routers USB ports.

Meet the ego box.

By now the name should explain itself: it’s called ‘ego’ because it’s suppose to tickle your ego when you see just how many people visit your site. And ‘box’ because it’s … ammm… all packed in a nice box.

Don’t be fooled by the picture, the box is really small (about 6 x 9 cm / 2.4 x 3.3” footprint to stay technical). No, I didn’t want a large display placed on the wall. I wanted a small box that can find a place anywhere. After all, it’s the displayed number that it is important.

I’ve used the toner transfer to ABS method to make the front panel. Things came out very well except that the whole thing is a little tilted, but in an optimistic way. The top of the box gets its own writing with the things name.

The display consists of 8 digits capable of displaying up to 99.999.999. Sorry, this project is not for those of you with more than 100 million page visits (still, it’s easy to extend it to as many digits as you want).


Update 16th July 2011

Last night I stayed up late to watch this happen:


The technical bit

How does all this work? The whole system consists of two parts. The first part is a small php script that is ran every time someone visits my website. It reads the number stored in a text file, increases it and writes it back. I’ve placed it in the header.php file of my wordpress theme so that it is run every time some page is loaded. See info on script here.

The second part is the box. It’s got an Ethernet interface that connects it to the internet through a router and accesses the text file that contains the number of visits. Then the number is extracted and displayed on the 7 segment display.

Let’s get to the technical details of making all this work.

The counter

First of all, a file to hold the number of visits is required. If you are using cpanel the online file manager works easily. I chose to create a separate folder to hold that file. Just create a new folder named, let’s say, counter in the www folder. On your computer create a text file containing just #$$%0 and save it. I’ve named it hits.html. You may also check your website statistics and put the actual visits number so that you may start with the correct value, e.g. #$$%101256. (Update: Initially the file contained just the number, but I chose to include a header #$$% in front of the number to make things better at the microcontroller side). Upload this file to the counter folder. Because the script needs to be able to change the file you need to change its access permissions so that it can be written by the user and readable by the rest of the world(644). Check out below:

Now the script needs to be added. You may use the same file manager. Say you will place it in the header, navigate to /wp_content/themes/your_theme/header.php. Choose to edit it and add the following script in the header file:

$hitfile = $_SERVER[‘DOCUMENT_ROOT’].”/counter/hits.html”;
$hits = @file_get_contents($hitfile);
$hits = substr($hits, 4)+1;
file_put_contents($hitfile,”#$$%”. $hits,LOCK_EX);

Just make sure that you have the correct file and location for your counter file(highlighted above). Example below:

This concludes the online part of the counter. Test it and see that the number is correctly increasing. Just navigate to the counter file see that it increases correctly as you access your website. For my website this is located at . This will be the address that the box will read.

The box

As I have mentioned, the box connects to the internet with an Ethernet interface. I’ve used the very popular Microchip ENC28J60 MAC and PHY because it is easy to use.  There is plenty of good working software for controlling it already available and this has positively contributed to a quick development. My choice is the stack available at written by Guido Socher which provides most of the functions required to access a web page.

The microcontroller of choice is the ATMEGA168. It has just enough pins (the display needs 15) and enough memory for the whole applications. To complete the circuit for this project I’ve added a display and the driving circuitry. I’ve chosen an old fashion 7 segment display because of its visibility and the technological look it gives to the project. Be aware that there was no way for me to capture the real pure red of the display with my camera.  The 8 digits display is composed of two KW4-361ASB, 4 digits each.

For the power supply I planned on using 5V from one of the free USB ports of my router. As the whole circuit needs 3.3V, a LM1117-3.3 LDO regulator was used. There is a serial port that I have used for debugging during the development and for loading the software via a bootloader. I ended up not using an external oscillator for the microcontroller, but there is space for one on the PCB.  Other than that, the schematic is self explanatory and it can be seen below:

The PCB was designed to fit a certain project box that I had. I managed to make it very compact and single sided. It’s built using my UV exposure box.

The software

The software contains the TCP/IP stack for use with the ENC28J60, a display controller, interrupts, functions for accessing the counter page, processing it etc. The firmware is well documented and it is included in the project archive at the end.

Some things need to be changed and it has to be compiled for usage in your project. For the Ethernet part it needs to be given a MAC address, a local IP address and a gateway address. You will also need to set the URL of your counter file.

There is an option to choose how fast the update is made. I’ve chosen 1 minute which is a reasonable time, but gives you over 40.000 accesses to the counter file per month. I think that this is a rather low load, but you may increase the time.

The build:

I’ve put together a small gallery below during the build of the box. First off is the PCB:

Most of the parts mounted:

The PCB mounted inside half of the case:

Soldering the wires on the display:

Mounting everything inside the case:

Transferring the image on the top

half of the case:

Making the first tests(shutter speed ate one digit):

And the final box, fully functional. I didn’t mount the back panel to allow for the inside components to be seen:


Finally the software and eagle files can be downloaded from here. The software is licensed under GPL V2 and the eagle files are free for personal use.

Bookmark the permalink.


  1. ???????,??????????! .

  2. Pingback: LED logger V2 « Electro Bob

  3. Pingback: ESP8266 tests « Electro Bob

  4. Pingback: Web interfaces « Electro Bob

  5. thank you for sharing.
    can you please tell me how do you transfer Ego Box LOGO on top of your case?
    please send reply to my email adress
    thank you in advance

  6. Easily Conceal Your IP Address – Just click “Hide IP” and your IP is instantly hidden! Other people see a fake IP, which is not associated with your real IP

  7. Pingback: etherfeed – Tickling your ego or statistics? | etherfeed | connected your way

  8. Pingback: etherfeed – physical website analytics tool | etherfeed | connected your way

  9. Bogdan,

    I have completed the AVR Statistics device that I have previously discussed with you. It is called etherfeed, It displays Google Analytics Visits,Hitcount, It displays also PayPal IPN sales (SUM of sales), Google weather data etc. The device uses ATMEGA644. see

  10. Feedair just got announced at CES in Las Vegas. its a small hardware that perhaps does what this does, but you can buy it for like 50 bucks.

  11. ı advise avr net tcp ıp stack ıt works much better than tux

  12. Thanks for all of the great information. love it thanks again.

  13. Awesome project, I may try this myself. I’ve never tried anything with Ethernet, but this chip looks pretty sweet.

  14. The project will do the same as the Ego Box but it contains

    Atmega32 microcontroller, the UIP TCPIP stack, and a 1×8 LCD Display with COOL blue or RED backlight.

  15. Pingback: Trochę inny licznik odwiedzin strony WWW

  16. Pingback: Ego Box derivitive – the statsboard « richms's rants

  17. Hey everyone!
    Sorry for this delay, I’ve been busy with exams…
    I’ve considered your requests to going commercial with it. Unfortunately I’ve got too little free time to actually built some extra boxes and ship them worldwide.
    The project also has some limitations, you have to know the link of the file, IP address etc, then compile the code and program the micro.

    Luckily, the project is open source so that anyone can build one.
    At this moment I could make PCBs available for everyone if I could find some service, such as BatchPCB that was available to worldwide customers.

    I’m also considering a version 2 of this, switching to a microcontroller with integrated Ethernet and easily customizable address and IP.

    In the mean time, thank you very much for the appreciation and I’ll do my best to come up with great projects.

  18. Just like lots of others here I would like one of those but find myself too busy to put all the pieces together. If this would be available as a solder yourself and “pre programmed” I would order one in a heartbeat. Bob, when you are ready to pursuit monetizing on your project contact me. If anyone else wants to make a buck and with Bob’s permission contact me to build me one. In any event keep up with your passion. You rock.

  19. Good post, but this doesn’t really to make use of my router ip address, any advice?

  20. Clever device.
    Where did you get the enclosure?

  21. Possibly the bost thing to do here is set up a webcam viewing the box and placing the stream at the bottom of the page, that way all visitors can see the number of visitors you have….oh, hang on… 🙂

  22. Pingback: DIY: EgoBox To Monitor Web Hits |

  23. This is great! Would love to make one, but have no idea how. Any option for purchasing one (either a kit in parts, or ready made?).

    Thanks! 🙂

  24. This is a nice device .
    What display use you .
    You say :”The software contains the TCP/IP stack for use with the ENC28J60″
    Can you give us more detail…

    • Like I have mentioned in the text: “The 8 digits display is composed of two KW4-361ASB, 4 digits each.” You can find the datasheet of the display online.

      Regarding the TCP/IP stack, there are a few versions out there, for various types of micros or ethernet adapters, such as Microchip’s, uIP, the one from tuxgraphics that I have used etc.
      If you want to know more about how communication in the internet is done, check out a bit about the ‘OSI model’.

  25. I want one. How much to make one for me?

  26. This is super cool. I really like the chip you used for ethernet, and i will use it as well. I will feature it today in my site. Keep up the good work.

  27. Pingback: Blog » Blog Archive » EGO BOX: a physical website visits display

Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.