» Electronics »Daily timer on the Attiny13 microcontroller

Daily timer on the Attiny13 microcontroller


In the modern world, automation has penetrated literally into all areas of human life. We all sometimes want soulless automation to do some boring routine for us — water the flowers, ventilate the room, feed the cat, give the dog a drink ... It's not easy to say that laziness is the engine of progress, because a lazy person is ready to work hard and create such electronic a device that will do for him everything that is required. And if a lazy person is friends with a soldering iron, then the matter remains small, only create this very automation.

In this article, we will consider the process of creating an electronic timer that will turn the load on and off at the specified time. Such a timer can be found in many applications - for example, once a day with it to water flowers, or beds in the garden. Automatically turn on the light at night and turn it off during the day when it is light, or pour water into the drinker once a day. In general, the device is absolutely universal, the scope is not limited to anything.

Scheme:




The diagram has two control buttons, numbered with the numbers "1" and "2". Button "1" sets the time to turn on the load, and button "2", respectively, the time to turn off. To better understand the principle of operation, consider this example: there is a Christmas tree garland that must be turned on at 13:00 every day and turned off at 15:00. So, to set the time intervals for the timer, you need to press the “1” button at 13:00, while the relay turns on for about a minute, then wait 15:00 and press the “2” button, the relay again turns on for about a minute, signaling about successful time setting. In the future, the relay will automatically turn on the garland at 13:00 and turn off at 15:00 every day. A flashing LED indicates that the device is working.

The circuit contains two microcircuits - the Attiny13 microcontroller and the DS1307 clock microcircuit. The supply voltage of the entire circuit is 12 volts. Thanks to the 78l05 linear stabilizer, on the circuit board the microcircuit receives the power they need 5 volts, and the relay winding is powered by 12 volts.In parallel with the relay coil, a low-power diode should be installed, for example, 1N4148. The SS8050 transistor, the control relay, can be replaced with any other low-power NPN transistor. The buttons in the harness of the microcontroller should be taken without fixing.

The peculiarity of the DS1307 clock microcircuit is that it can work from a backup power supply, if the main thing disappears. To do this, to its conclusions 3 and 4, you need to connect a 3 volt power source, for example, a CR2032 battery. In this case, in the event of a power failure, the countdown will continue, as soon as the main power appears again, the device will continue to work in the previous mode, turning the relay on and off at the set hours. Do not forget to put electrolytic and ceramic capacitors in parallel with the power supply of both the main and the backup capacitors, in order to suppress interference of any kind. The LED resistor coming from the 7th leg of the clock microcircuit can be reduced to 0.5 - 1 kOhm, then its brightness will noticeably increase.

Before installing the microcontroller on the board, it must be flashed, the firmware files are attached to the article. This is most conveniently done using a USBASP programmer. When using a new, previously unused microcontroller, the fuses should not be changed. From the factory, Attiny13 microcontrollers are clocked from an internal generator with a frequency of 9.6 MHz, an 8 divider is on.

Daily timer on the Attiny13 microcontroller


The printed circuit board can be made using laser-ironing technology, the so-called "LUT". Photo of my board:


After tinning, the board takes the following form:


List of required parts:


0.125 W Resistors:
• 6.8 kOhm (682) - 1 pc.
• 10 kOhm (103) - 1 pc.
• 4.7 kOhm (472) - 2 pcs.
• 3 kOhm (302) - 1 pc.

Capacitors:
• 100 microfarads (electrolytic) - 2 pcs.
• 100 nF (ceramic) - 2 pcs.

Rest:
• Attiny13 microcontroller (+ socket) - 1 pc.
• Chip DS3107 (+ socket) - 1 pc.
• Transistor SS8050 - 1 pc.
• Diode 1N4148 - 1 pc.
• Button without fixing - 2 pcs.
• The stabilizer 78l05 - 1 pc.
• 3 volt LED - 1 pc.
• Quartz 32768 Hz - 1 pc.
• Relay for 12 volts - 1 pc.

Photo of the device I collected:









The circuit, circuit board and files for the firmware are in the archive: pechatnaya-plata-i-fayly-proshivki.zip [36.13 Kb] (downloads: 479)
0
0
0

Add a comment

    • smilesmilesxaxaokdontknowyahoonea
      bossscratchfoolyesyes-yesaggressivesecret
      sorrydancedance2dance3pardonhelpdrinks
      stopfriendsgoodgoodgoodwhistleswoontongue
      smokeclappingcraydeclarederisivedon-t_mentiondownload
      heatirefullaugh1mdameetingmoskingnegative
      not_ipopcornpunishreadscarescaressearch
      tauntthank_youthisto_clueumnikacuteagree
      badbeeeblack_eyeblum3blushboastboredom
      censoredpleasantrysecret2threatenvictoryyusun_bespectacled
      shokrespektlolprevedwelcomekrutoyya_za
      ya_dobryihelperne_huliganne_othodifludbanclose
8 comments
Guest Aleks
Good day, do you have the source code for this timer program?
I really liked the scheme and idea of ​​this device.
For the aquarium, add on and off the compressor with a period of about 1 hour.
With a HEX file, this is very difficult, especially since I just started with microcontrollers.
Guest Aleks
How, and is it possible to use the ready-made DS1307 Real-Time Clock Module, instead of the clock chip of your option.
Guest Alex
And how to reset the settings?
Author
I agree that such a management system is not very suitable for a weekly or monthly timer. Here, one day to wait for someone who needs this is not a problem at all, especially since it’s enough to install it once and more without touching it. But there was an advantage - the lack of a screen and indeed any indication, which, in fact, is not so needed in such schemes
If, according to this scheme, not a daily, but a weekly, monthly or annual timer is collected, then you can grow old around it, waiting for the moment when you need to press button 1 or do not live up to pressing button 2.
According to the popular opinion, Estonians are very leisurely people. So is this timer: they pressed the number 1 button at the moment when it should turn on, and for this it is necessary to wait for this moment and press it in time. Then they waited for the desired interval and pressed the button number 2, if suddenly forgot, distracted - start all over again. And only a day after pressing the first button, the timer starts to work.
Author
Quote: Ivan_Pokhmelev
"Estonian" timer.

In what sense, "Estonian"?
"Estonian" timer.

We advise you to read:

Hand it for the smartphone ...