We did a physical Facebook like page counter. From the old electric meter. At the heart of the programmable board Iskra Neo from Amperki (analogue of Arduino) and a servomotor of constant rotation.

To monitor the growth of likes, we set up an online camera aimed at the counter, and rendered the button to the likes of the blog. I also like to deal with electronics and manage things via the Internet.
This is the first experience.
')
How is it done
Electronics for obtaining likes has already been assembled and tested in the Amperka project, it is enough just to assemble it. It turned out that it was not so easy when I wanted to do everything on Arduino Uno instead of the Spark. It did not work because of the different principles of working with the UART (the WiFi module receives signals through it). In order not to write a software UART, I had to score on Arduino and use the original Iskra Neo.
The module cannot request the number of likes directly from the fb page, as it does not work with HTTPS. To bypass the restriction on the server hangs a PHP script that finds out the number of likes and is issued as a variable. And the module is already accessing the address of this PHP script using
AT commands (remember, before the modem could be told ATDP XXX, where XXX is the phone number and he started calling him? That's what they are)
The electronics were ready; I divided the remaining tasks into two parts:
- Drive for counter
- Control program
Drive for counter
It would be great to make an elegant solution to connect the meter with the supply of current to the original coil. Then it was possible to leave the rotating disk, and at the minimum to interfere with the design. But it is difficult to implement, therefore, postponed until the next version. Now in the counter, a constant-rotation servomotor is directly attached to the gears rotating the counter.



Control program
At first, I calculated how many milliseconds to turn on the motor so that it turns the disk one turn. It turned out about 1650 ms. Immediately it became clear that this figure changes from the voltage in the network (and for some reason it sometimes jumps), and from the reading of the meter's wheels. They were developed about 50 years ago and then plus or minus half of the numbers did not play a role then.

The program needs to know exactly what the counter shows, and we at least have the opportunity to manually adjust it. To find out the exact number of degrees by which the motor turned the wheels, you will need a sensor like a throttle position sensor on a car, this is difficult.
Therefore, in the first version, there is an electronic display next to the counter to control the correctness of the readings, and two buttons with which you can manually adjust the counter if it did not run off somewhere. Semi-manual mode, and what to do.
The program provides a variable that stores the number of likes on a physical counter. When you turn off the power, it is stored in the EPROM and when turned on, it is taken back from there.
This is necessary so that when disconnected from the network, they know how much the meter needs to be corrected.
What is the result?
It turned out cool art object. Before setting up the camera and hanging it on the wall in our room, we put it on display in the common area of co-working.
He is still far from perfect. There is a lack of accuracy, the servomotor sometimes starts spinning by itself when the power is turned on and there is no original rotating disc.
We will improve in the next version.