A cyber invitation to a wedding or how to effectively destroy patterns

    Already wrote a lot on Habré about improvised electronic devices of various calibers. What I want to talk about should not be put on a par with the “smart home” or the production of wooden mice. Surely, those who are just starting to have fun with DIY and are thinking where to start, will find something useful for themselves. I hope this post will once again convince newcomers that any, even the strangest, at first glance, idea suits our business.

    So the idea

    It all started with the fact that one day I decided to get married! Statement, preparation for the holiday, all things. But here's the challenge: to make original wedding invitations. I did not want to sign pieces of cardboard. The soul asked for a hardcore handmade, far from traditional wedding patterns. And on my “and in general, you can do electronic devices” the bride said: “Cool! Come on! ”

    By that time, my experience was reduced to soldering Friduina from a set of parts and ritual flashing of the LED. I was horrified to estimate that with my hands I had to collect not one or two, but 33 copies, I said goodbye to the coming summers in advance - and away we go ...

    February. The wedding in August, but it seemed to me that I did not have time. Because, hell knows where and what will go wrong. However, a plan gradually began to emerge: to mold into one piece an LCD screen, a battery, a button and some kind of controller, so that at the touch of a button the device would display a message on the screen in rows.

    Selection of components

    The genre “Invitation” immediately dictated its additional requirements. It was important that the battery was not wasted in one or two impressions and that the messages on all copies were different. In addition (and the bride implored me hourly about this) I wanted the result of my experiments to look like a product, even if it was a makeshift one. That is, it did not fall apart in the hands and did not spread the wire loops in all directions.


    I picked up the nearest radio components store in the catalog, first took one for testing. According to the specifications, the following came out: LCD, text, Russian letters, 1 line of 16 characters, without backlight. It is called WH1601A-NGG-CT ( datasheet ), it costs a hundred-plus rubles. A successful screen turned out to be a wave, later bought a whole box of them:


    The controller was selected from the Atmel catalog (on the Atmel website, press the MCU Selector). Atmel, because I already had a little experience with arduino, and easyelectronics has an excellent course on AVR controllers . I was looking for one
    • to have enough legs, but as few as possible
    • so that the DIP case (I have not yet soldered SMD and did not want to take risks),
    • so that energy consumption can be small
    • and that the nearest store was available.

    It came Attiny 2313A-PU ( Datasheet ).


    The screen needed 5V power, so after some research I decided to use a pair of CR2016 batteries, stacked in a stack in the holder for CR2032.

    Every other

    Oddly enough, it turned out that small things (resistors, capacitors, etc.) are better not to buy in St. Petersburg, but to order from near Yoshkar-Ola (ekits.ru store). Everything was found at normal prices.


    He mastered the screen: soldered wires to it, experimented from Arduina, made sure that he wrote letters in turn with given pauses. I did not use libraries, I wanted everything myself. Here is the code .

    Everything was ready to work on a prototype.

    March, April. A long period of writing firmware in assembler (intentionally not in C, in order to better feel the architecture), drawing and wiring the circuit. He showed the bride. “Come on,” she tells me, “it will also flash with bulbs.” I had to build in the process “also the bulbs”: I added two pairs of LEDs and work with interruptions, the wiring was a little complicated. (I ordered the LEDs the same way, from Yoshkar-Ola). The scheme as a result came out like this:

    For beginners, like me, explanations for the scheme:
    Explanations for the scheme
    In the middle of the controller, on the right screen. The seven wires from the controller to the screen are three control and a four-bit data bus. All on datasheet. The screen is powered not directly, but from the PD2 pin (V-LCD pin), this is because the device does not work most of the time, the controller goes to sleep, and the battery does not spend on the screen power either. There is also a VO-LCD, which is fed to the VO pin of the screen. According to the datasheet, it is necessary to apply some voltage there greater than zero, but less than VCC, this contrast controls the screen contrast. Datashit offers to push the rheostat there and adjust on the go. But not in each payment rheostat to push! So I picked up the voltage experimentally and built a voltage divider to get it. This is the design of the two resistors below. Still drawn below, that power is initially taken from the battery and that a capacitor is inserted in the power supply to protect it, for example, from bounce when fresh batteries are inserted. Well, that's all. There is also a reset button and four LEDs that are turned on in pairs.

    But such a firmware .

    The wiring for the first time was not easy, so it is likely that I violated some canons. I had to get along with a bunch of conditions:
    • The board should have been slightly larger than the screen, so that it was convenient to press the start button.
    • Connector and mounting holes - match the connector and holes on the screen board. (I then connected the holes with screws).
    • LEDs (according to the design idea) - be sure to look in different directions.

    As a result, I managed with two jumpers, on the circuit they are blue:

    I assembled everything on a breadboard, debugged for a long time, got it to work ... Yes, I flashed Arduina according to the circuit chewed here. The circuit requires connecting the reset to power via a resistor: I hung the resistor directly into the wire.

    And yes, it was important that each device had a personalized text (an invitation!). The text was stored in the firmware as a dump (“.db 0xa2, 0xa3 ...”). Moreover, the encoding table for the screen has its own features. It, for example, saves and contains only those Cyrillic letters for which there is no analogue in the Latin alphabet. For convenient conversion, I made a utility in java .

    How long, short by May I already had a working device, but on a breadboard. The power worked both from USB (via Arduino and the firmware wiring), and from the batteries. It all looked like this:

    In the video, I start the process by clicking on the board - this is because I mistakenly soldered the button on the other side. 8)

    I didn’t do a programming connector on the final board. I simply inserted the next microcircuit into the crib on the breadboard, flashed it and soldered it into the board. It is inflexible, but saves holes and components. And time, of course.


    It was May. I started making the first copy. I will not paint LUT and etching, DiHALT’s manuals were read by everyone. I will tell only about certain features and differences from the manual.
    • Etched in a mixture of blue vitriol and sodium chloride. It’s less caustic and the ingredients are in the nearest building supermarket.
    • I drilled a 1 mm drill for metal (there wasn’t less in that supermarket) and a real, full-sized drill. The hand was firm enough not to break the drill bit and not to grease the hole. And the screwdriver turned out to be, though lighter, but too slow. By the way, the recommendation that dust should be protected is absolutely true! It is very small, white and almost invisible, if not poured with a bunch. But if it is in the air, the throat is scary.
    • First he tinkered, and then drilled, although everyone everywhere recommends the opposite. But just as easy! The rim of the hole becomes thicker and additionally adjusts the sight at the beginning of drilling.
    • Did in batches - it’s faster. That is, a dozen boards go through the first stage, then the second, etc. It turns out less context switches, less tool shifting and, accordingly, faster work. The stages are as follows:
      1. Cut off a piece of the board and sand it
      2. Smooth a piece of paper with a picture and wash it
      3. Etch board
      4. Stitch track
      5. Drill holes
      6. Solder everything except the controller
      7. Insert the controller into the breadboard and flash
      8. Solder controller
      9. Connect to the screen with screws

    It turned out like this. In the video, however, so far without screws.

    That's all. Devices were ready.

    Finishing touches

    It remained to supplement the device with something that would make it even more like an invitation. The bride perfectly coped with this task, having invented to hang the device on a small home-made fishing rod (once it blinks with lights, why not on the fishing rod).

    Of course, as expected, they wrote an instruction manual for the device and packed it in homemade painted boxes. When you get everything, it looks like this:

    And the instruction that is visible in the photograph, like this

    In general, the effect is achieved! The guests are delighted, the wedding was a success, we have a plus-a lot of experience and a desire to continue the experiments ...

    Also popular now: