Timer With Disconnection and Output to TRIAC for 220v
by inopya in Circuits > Arduino
606 Views, 2 Favorites, 0 Comments
Timer With Disconnection and Output to TRIAC for 220v
Project born from the need to correct the huge error of a cheap electromechanical timer for socket.
(Delay of about 25 minutes per programmed hour) :-P
The timing was performed by a small clock powered at 30v by a voltage divider (and of a very poor quality in terms of its inaccuracy), and the output was controlled by a switch that was mechanically operated during the rotation of the clock.
I already had a version of timer controlled with Arduino and relay output, without RTC, mounted reusing the box of an old router. In spite of not having RTC it had an acceptable precision, approximately 1.5 seconds per hour. This timing was based on the arduino timer2 and needed a support counter. Timer1 (16 bits) was discarded, which would have been more convenient, because it was a multipurpose assembly and had some servo outputs, so it was decided to "respect" Timer1, which is the one on which the servo library is based.
Code and more information on the project website
Supplies
1x Arduino NANO
1x Power supply AC 220v - DC 5v (an old mobile phone charger)
1x optocoupler MOC3041
1x TRIAC BT137, (BT13X)
1x 470 Ohm resistor
1x 510 Ohm resistor
1x resistor 1 K
1x resistor 1 M (or higher)
1x red led (reused the original one from the cannibalized timer)
1x OLED display 128x64
Wires, soldering iron, solder, 3D printer...
For the NTC probe
1x NTC 10 K
1x 10 K resistor
Options Available
It presents a menu at startup in which we can choose between two modes:
1) TIMER with time to shutdown which shows a countdown to task completion and also displays a progress bar which also decreases in length as the time runs out.
1a) A temperature probe is available and the output can be controlled based on its measurement.
1b) If the use of the probe is activated, a preheating temperature can be set which must be reached before starting the timer.
The timer detects whether the probe is connected or not, so that its use can be activated only if the probe is present.
A simple "trick" is used to detect the probe. The analog input A0 used for the probe connection has a pulldown resistance of 1M (it can be a higher value)
so that if the NTC probe is not connected or is incorrectly positioned, the input will register 0 (thus "knowing" that there is no probe).
With the probe connected (a 10k NTC), the parallel it forms with the 1M will certainly give us a small error in the temperature measurement, but we can consider it negligible for practical purposes (it will be less than 1%).
2) CLOCK, mode in which the output is kept active and shows the time it has been running.
possibility to pause or stop the activity (only in clock mode).
Original Timer Test and Timer1 Settings
In this case, and due to the fact that it is going to be used exclusively as a timer, Timer1 is used which, being of 16 bits, allows more than enough to make the necessary count at once and avoids having to have a secondary counter as in the case of Timer2 (it also makes the timing adjustments much easier). This new version of the software timer based on Timer1 achieves an error of approx. 0.14 seconds advance per timed hour.
So having this electromechanical timer, useless by all means, was a golden opportunity to cannibalize it and create a timer that is minimally accurate and with a compact and unobtrusive physical appearance. (Better? of course).
Due to the limited space available, the arduino UNO of the original version is replaced by a NANO. The relay output is replaced with TRIAC and optocoupler. The 16x2 LCD is replaced by a small OLED display of 128x64 pixels, which, truth be told, allows us a greater amount of information. Of course, it is also I2C communication and we must take into account that its writing and refreshing needs a little more than 40 ms (a real eternity). We must also place inside the power supply for Arduino NANO, in this case reusing an old mobile charger.
more information on the project website
https://github.com/inopya/Temporizador_salida_220v
Inside View
Testing Menus, Visual Appearance and First Tests
3D Designed Parts
In order to make the best use of the available space, some parts were designed to