Geek contest: how we did it (part 2) and the results

    As promised in the first part , we talk in more detail about our project, about successful and unsuccessful solutions, problems and unexpected surprises. Let's start with the printer.

    a printer

    For obvious reasons, the printer is a critical node in our project, so we have chosen it carefully. After going through about 15 different models, we settled on the HP Officejet Pro X451dw inkjet printer with the ability to duplex printing (that is, on both sides of the sheet). Its competitive advantage was also a high printing speed, a large tray of 500 sheets (with the ability to buy another one for the same amount) and a sufficiently large height at which the output window for printed sheets is located.

    We removed the plastic stand for the printed sheets (it is mounted on latches), and we got a pretty good height difference. This allowed us to use the force of gravity (“Use the force, Luke!”), Under the influence of which the tickets glided down the tray, which was set at an angle. At the same time, I did not have to produce extra travolators to push the sheet inside the tray.

    When the printer was brought to us, we gladly opened the box (I don’t know about you, but I like the smell of new technology!) And started to set it up. The first test took place on "Hurray", the printer regularly printed our test tickets. However, when more rigorous testing began, it turned out that duplex printing only works on A4 paper. And our ticket format was A5 (after all, we care about the environment and do not want to harass excess paper). That is, A5 format tickets were printed “face down”. We had already begun to think about how to place the camera from below, but after a couple of days we found a wonderful driver for UNIX (we will talk about the server a bit below) and still taught how to print it with duplex.

    In general, the printer performed very well. About 30,000 tickets were printed, and during all this time a paper jam occurred only three times (!).

    Arduino, servos and sensors

    For the project, two sets of Arduino Uno, Troyka Shield, servos, displays, sensors and other trifles were purchased. In the original version, the Arduino connection diagram looked like this:

    The first Arduino was responsible for opening and closing the tray. The second - for receiving information from the gradient sensor (later another sensor appeared - an ultrasonic range finder), and displaying this information on the screen. Quick assembly showed that there should be no problems, the engine was spinning properly, test information was displayed on the screen.

    The analog line sensor perfectly gave us data on the level of illumination on the test gradient:

    We placed the gradient on the side wall of the urn, and above it we fixed the line sensor:

    Another sensor connected to the Arduino is infraredobstacle sensor . It is located on the top cover of the tray, under it, a special hole is cut in the bottom wall of the tray. Its task is to notify the server that the ticket has printed and fell into the tray:

    As soon as the ticket falls into the tray, the sensor sends an Arduino signal, which in turn passes it to the server, and it starts recording the camera. After a few seconds, the camera turns off and power is supplied to the servo, which opens the "curtain". We made the curtain from Makeblock elements .

    The third sensor connected to the Arduino is an ultrasonic rangefinder. It measures the distance between the bottom of the ballot box and the floor, is an additional source of information for calculating weight. After the final assembly, we did not hide the arduinki in the nightstand, but placed them behind a transparent tray so that multi-colored wires and blinking LEDs pleased the fans of geek porn (and there are many of them in our company).


    Another critical area of ​​our design is the tray. A printed competitive ticket falls into it, and it was necessary to make the tray so that the ticket did not turn over, it fell exactly under the camera and did not get stuck. The first prototype, glued with a glue gun from Plexiglas scraps, looked like this:

    After we more or less selected the dimensions, the location of the camera, sensors and servo with a shutter, we made a drawing and cut out all the details with a laser cutter (thanks to the guys from lab3dprint. ru ). The parts were glued together with dichloroethane (we should in no case be allowed cracks and irregularities when gluing), and as a result we got a more decent design with smooth seams:

    However, even despite the hole under the obstacle sensor, the paper sheet often got stuck (stuck to plexiglass), and the gravity was not so high as to overcome the friction force.

    To reduce the area of ​​contact between the sheet and the surface of the tray, we pulled badminton strings:

    However, this did not help much, the ticket stubbornly stuck in the last segment and did not even reach the blind. Then we went even further, and attached a servo from below with a six-petal plastic gear, which starts to rotate immediately after the shutter opens:

    Such a “push” of a ticket from below solved the problem, and now the tickets were slipping “with a whistle”. We breathed a sigh of relief and switched to the urn.


    As you probably already guessed, the ballot box here is also not the easiest structural element. After all, we are not looking for easy ways, and decided to measure the weight with non-ordinary scales (although in the very first version of the design we thought lazily about Wi-Fi scales), and do this with the help of two sensors, which was already described above. And in order for these sensors to measure the dynamics of changes in weight, we had to hang the ballot box on the springs. For the test design, we found a metal frame from the old bedside table, made a wooden box from plywood and hung it on springs from the clutch pedal VAZ 2101:

    Do not worry, not a single Zhiguli was hurt, all the springs beat were bought at an auto parts store. :) Measurements of the estimated weight of competition tickets, spring tensile ratios, basket volume and other parameters showed that the design should be much larger and the springs more powerful:

    The second version of the ballot box and frame looks like this:

    The ballot box was assembled from exhibition aluminum profiles and plexiglass, and the frame from designs known on the market as Joker Uno. More powerful springs were purchased on the construction market, we connected them to the holders with flexible metal cables:

    To prevent the frame and the bin from being accidentally moved relative to the printer, we decided to add a special nightstand for the printer to the design, as a result, it all looked like this:

    Server side

    In parallel with the pieces of iron, we worked on the “brains”. And the brain of our entire system is a special script written under UNIX. His task includes:
    1. Receive data from Habr.
    2. Formation of a member's ticket based on this data.
    3. Print.
    4. Communication with Arduino.
    5. Video recording.
    6. Sending video to Habr.
    7. Trouble Alert.

    For convenience, we organized the script management through SSH-access, this is how the project control panel looks like:

    Data is transferred in portions of 10 entries each. After the information is received, the script starts the assembly of the PDF file for the first ticket, where it inserts the avatar, nickname, last name and first name of the participant, as well as his karma and rating. The generated PDF is sent to the printer, and waiting for a signal from the infrared obstacle sensor starts. As soon as the ticket is printed and enters the field of view of the sensor:

    (we tested, of course, on the Habr's most beloved users)

    ... recording starts from the camera located above the tray. After the recording is made, one of the 30 video messages from Anatoly Wasserman is attached to it, and the file is placed in the outbox. At the next call, the Habr server will pick up these recorded videos. Next, we open the curtain and wait for the ticket to fall into the ballot box. As soon as the infrared sensor stops seeing the ticket, we recalculate the weight and start printing the next ticket.

    If all the tickets received from Habr are already printed, then we change the status to "0", which means that we are ready to accept a new batch of data. Along the way, the script checks the camera, printer, and Arduino for errors, and if suddenly something is wrong with one of the devices, we receive an SMS notification (you can’t make the contest participants wait!).

    Project support

    Probably, many of you are familiar with this feeling when the project is launched and there is no desire to deal with it - all the tastiest things have already been completed, everything works, and I want to switch to new tasks. And then some users are calling and want to fix it, or is it ...

    Honestly, we were no exception. The project lasted 45 days and during this time our adrenaline enthusiasm after the launch gradually changed to a slight apathy. Nevertheless, we regularly monitored the project, and if the server sent us SMS, we honestly connected via SSH and watched what happened there. Sometimes it was just necessary to restart the script, sometimes call the guard to feed the printer with paper (after hours this security mission carried out this honorable mission, for which many thanks to them!), Sometimes go down and get the jammed ticket or replace the cartridge. Sometimes an alarming SMS overtook us in the most unexpected places, for example, in a fitness center:

    Or behind the wheel:

    But now that the project is completed, one cannot but admit that it was one of the most interesting in our lives, and our hands are scratching again to come up with something even more fun! Thanks to all of you who did not remain indifferent to the project and took part in our competition. ;)

    And now, with the rumble of drums, the list of winners of our geek contest!

    A laptop@Noizefan
    A laptop@yongchunlaohu
    A laptop@akkNightmare
    Samsung Galaxy S5@alexeyfdv
    Samsung Galaxy S5@Malevolent
    Samsung Galaxy S5@BVYU
    Google nexus 7@iusfof
    Google nexus 7@ zolt85
    Google nexus 7@rmq
    Google nexus 7@mrise
    Google nexus 7@TomashUA
    Jawbone@ sveta0203
    Leap motion@ MrMeowington5
    Leap motion@jackee
    Leap motion@Feanrez
    Leap motion@verbaux
    Leap motion@WizardOfRain
    Leap motion@usupport
    Backpack@ Kag0r
    T-shirt@ graycat660
    There were a lot of tickets, and we decided to pour them into the inflatable pool. For every ticket I had to literally dive.

    Also popular now: