tag:blogger.com,1999:blog-41918877533313043132024-03-13T22:49:32.721+02:00DIYfanНаправи си сам... / Do It Yourself...Христоhttp://www.blogger.com/profile/14002909704834630953noreply@blogger.comBlogger43125tag:blogger.com,1999:blog-4191887753331304313.post-60749699070374052112023-08-01T22:54:00.001+03:002023-08-01T22:54:31.424+03:00Very Simple Timer with PIC16F18313<p>Recently I was asked for gerber files for one of my old projects - "<a href="https://diyfan.blogspot.com/2014/04/simple-timer-with-pic16f628a.html">Simple Timer with PIC16F628A</a>", but unfortunately the files of that project were lost. I decided to make a new project with more modern and smaller microcontroller - <a href="https://www.microchip.com/en-us/product/PIC16F18313">PIC16F18313</a>, which have 8 pin only. To make that possible the display has to be with 2 wire serial communication. I already had such a display - a 4 digit 7 segment module with TM1637, and I already learned how to use it.</p><p>Here is the schematic:</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgta65VNneN8YQtTxz1haENXNLldxw_tVCuwd_QLxn9F0P9NAd0agpltx9v5vnZqynUefxLSa9OBrd7rMMo08-oD2Dx9yOjn5jboAk36EskPnO7_VnUllekW_xX0AFGCyGFE4nRxbA4zpvooEjlOh6EAodbb-_cRJU7IbjDpr8c9UnfILSiour3fQgDluMk/s1788/Timer_Schematic.JPG" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="881" data-original-width="1788" height="316" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgta65VNneN8YQtTxz1haENXNLldxw_tVCuwd_QLxn9F0P9NAd0agpltx9v5vnZqynUefxLSa9OBrd7rMMo08-oD2Dx9yOjn5jboAk36EskPnO7_VnUllekW_xX0AFGCyGFE4nRxbA4zpvooEjlOh6EAodbb-_cRJU7IbjDpr8c9UnfILSiour3fQgDluMk/w640-h316/Timer_Schematic.JPG" width="640" /></a></div><div><br /></div>The circuit is extremely simple, but it can be simplified even further. If the active buzzer is a piezo type with less than 15 mA consumption, the transistor Q1 can be removed and the buzzer and the LED can be connected directly between the microcontroller pin 3 (RA4) and the ground. Also if the timer is used only for the alarm, the second transistor and the relay can also be scrapped. <div><br /></div><div>There is a jumper (JP1 that can switch the voltage to the relay circuit between 5V and the input voltage. This is useful if one don't have 5V relay, there can be used 12V or 24V relays instead.</div><div>The supply voltage can be between 7 and 30V. When using higher supply voltage the regulator 7805 can get hot so some sort of heatsink may be needed.<br /><div><br /></div><div>Here is the 3D view of the PCB:</div><div><br /></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhlUsX1JZIrctpFJ1r4_xOEx_9H6oAjrI3mmsgKDcSLhnFFJqBqdUnu1VExGm4VEiafxflzXJKvqcyUtCctDFOkMciXdCuNuub6N4iL7GXnzMIeDto5MeGbfkliGZ34_C2b_TLRbKOgfj40_pmjJlWSOmV3EJwKBM_i3erHFvsthTYv3gfCS4qgOJXi9TFx/s1168/Timer_3D_1.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="779" data-original-width="1168" height="213" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhlUsX1JZIrctpFJ1r4_xOEx_9H6oAjrI3mmsgKDcSLhnFFJqBqdUnu1VExGm4VEiafxflzXJKvqcyUtCctDFOkMciXdCuNuub6N4iL7GXnzMIeDto5MeGbfkliGZ34_C2b_TLRbKOgfj40_pmjJlWSOmV3EJwKBM_i3erHFvsthTYv3gfCS4qgOJXi9TFx/s320/Timer_3D_1.JPG" width="320" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8wpnSDAGshE36pT6MAxza_iSKtIHj0r85UJuejKpyHTcPVWJnR1Kaqho5bN7opHjjDfZM5HpLum_7T9wdzOsFcOIWIb8Xb4ViojQMY-RFCd7NssYkemP3fNL1O6u4U1_TfBnufotRFBYyfAL-IQHatMAdG2jJQeAIjHJ3EhQ6xKZBTujYuczFOZeLhAip/s1311/Timer_3D_2.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="874" data-original-width="1311" height="213" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8wpnSDAGshE36pT6MAxza_iSKtIHj0r85UJuejKpyHTcPVWJnR1Kaqho5bN7opHjjDfZM5HpLum_7T9wdzOsFcOIWIb8Xb4ViojQMY-RFCd7NssYkemP3fNL1O6u4U1_TfBnufotRFBYyfAL-IQHatMAdG2jJQeAIjHJ3EhQ6xKZBTujYuczFOZeLhAip/s320/Timer_3D_2.JPG" width="320" /></a></div><br /><div>I designed the PCB single sided and with only through hole elements so to be easy made at home.<br /><div><br /><div>The schematic uses the internal 32 MHz oscillator of the microcontroller - there is no way to connect external crystal - no enough pins for this luxury :) The internal oscillator is good enough in most cases, but there is a way to tune the frequency with the register OSCTUNE to make it more precise. </div><div><br /></div><div>As the schematic uses pin4 as input for the Button2, this pin cannot be used as reset pin so when programming the microcontroller the programmer have to use high voltage to initiate the programming.<br /><div><div><br /></div><div>The operation of the timer is simple: Button1 cycles between four modes: "Idle/Stop", "Edit minutes", "Edit seconds", Timer On. When in "Edit minutes" and "Edit seconds", clicking the Button2 will increase the minutes or the seconds. Long press will trigger repeat function of Button2. Pressing both buttons in "Idle/Stop" will clear the set time, in "Edit minutes" will clear only the minutes and in "Edit seconds" will clear only the seconds. The timer can be set from 1 second up to 99 minutes and 59 seconds. If the set time is 00:00 the timer will count 100 minutes.</div><div><br /></div><div>The relay contact are connected to the terminal block J1 and can be used to control any external appliance. The relay used in the schematic is something like this: <a href="https://www.lcsc.com/product-detail/Power-Relays_Ningbo-Songle-Relay-SRD-DC12V-SL-C_C688866.html">LCSC</a> </div><div>It can switch up to 10A and voltages up to 30VDC or 250VAC. </div><div>Please be careful if using the timer with high voltages and/or high currents!</div><div><br /></div><div>Here is short video demonstrating how to operate the timer:<br /><div><div><iframe allowfullscreen="" height="315" id="odysee-iframe" src="https://odysee.com/$/embed/@DIYfan:d/Timer:c?r=424EpYmR7rqikUUegDcVRJJ8h8nCcEbg" width="560"></iframe></div><div><p>Here the archive with all project files: <a href="https://bit.ly/3OEFPHC">Timer_PIC16F18313</a></p><p>I only test the schematic on a breadboard, so there is always a possibility for errors in the PCB. Check everything for yourself and use the files on your own responsibility.</p><p><br /></p></div></div></div></div></div></div></div></div>Христоhttp://www.blogger.com/profile/14002909704834630953noreply@blogger.com0tag:blogger.com,1999:blog-4191887753331304313.post-2877687281647913832023-07-12T23:17:00.000+03:002023-07-12T23:17:52.794+03:00Triangle and Trapezoid Wave Generator<p> I was searching the web for schematic which can generate a trapezoidal waveform. None of the results was suitable for my needs, so i started to experiment in LTspice (still learning it), and I designed an interesting circuit, that has great flexibility and it's not very complex.</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsohm5ejmZ9L6eE0zmv0M8ifQ-j-QJPq-_6yuurW6q4xNa0g3U7it1p-0J5J2kIenlZyasPQAr6haFnauk4wASKeM2vWSHdLgaylQ7kEA88EwWFHmnXyJ_lsg1eP6x0vWml_xcM9KyyE1FSfk01Dn9SsTBhZ68OBbSgb4d-3d-BxPg9__pmew7atVT3jeC/s1619/LTspice_trapezoid.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1040" data-original-width="1619" height="412" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsohm5ejmZ9L6eE0zmv0M8ifQ-j-QJPq-_6yuurW6q4xNa0g3U7it1p-0J5J2kIenlZyasPQAr6haFnauk4wASKeM2vWSHdLgaylQ7kEA88EwWFHmnXyJ_lsg1eP6x0vWml_xcM9KyyE1FSfk01Dn9SsTBhZ68OBbSgb4d-3d-BxPg9__pmew7atVT3jeC/w640-h412/LTspice_trapezoid.png" width="640" /></a></div><p>The left side of the circuit is standard square wave oscillator made with U1 opamp. It can be replaced with 555 oscillator.</p><p>The next stage consist of two identical constant current sources (CCS), one with PNP transistor and the other with NPN transistor which alternatively charge and discharge a capacitor. The upper CCS starts to charge the capacitor C1 when the square wave goes down and the lower CCS starts to discharge the capacitor when the square wave goes up. The up slope angle is determined by the R2 and C1 and the down slope angle - by R4 and C1. The two slopes can have different angles (here the duty cycle is also adjusted):</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUNcu7w3GiQWSWzmSiiG-0CRhcNIXf8qV5I2eL9zyC70auUsj8o__OzxvXZHOBKjXm2qoqRMGb3Le_PPfe208DmyYjE-gZqar3iMerP9TIuOqcTjkKaNTxzqJUHtSaC5nj8vm7EjSCjf_hUrqZ5rQlrhZQS8txQltnReBnh_O2Hk_YzvAOIRAzXHnbc01m/s1550/LTspice_trapezoid3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1040" data-original-width="1550" height="430" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUNcu7w3GiQWSWzmSiiG-0CRhcNIXf8qV5I2eL9zyC70auUsj8o__OzxvXZHOBKjXm2qoqRMGb3Le_PPfe208DmyYjE-gZqar3iMerP9TIuOqcTjkKaNTxzqJUHtSaC5nj8vm7EjSCjf_hUrqZ5rQlrhZQS8txQltnReBnh_O2Hk_YzvAOIRAzXHnbc01m/w640-h430/LTspice_trapezoid3.png" width="640" /></a></div><p> If we increase the two slopes enough or increase the frequency, the output signal will become triangle wave:</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjIJnu1azAPIcoiF8rmegis6tVDP6i9QtMehCObK07oPjZtNWYNs1U0-ublKAKfsSuPJN7zVQdeBYsdv5LHzfRYcURLakiJyvz25BDiP8JQEgdpRbkaAnJ52YptVbo_JNs3pio8Hwh7rPONUJNfmTp7VDTe9D19R0GRY_AHMwFuHNWVHm4g1KOVJJ2HrGps/s1550/LTspice_trapezoid2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1040" data-original-width="1550" height="430" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjIJnu1azAPIcoiF8rmegis6tVDP6i9QtMehCObK07oPjZtNWYNs1U0-ublKAKfsSuPJN7zVQdeBYsdv5LHzfRYcURLakiJyvz25BDiP8JQEgdpRbkaAnJ52YptVbo_JNs3pio8Hwh7rPONUJNfmTp7VDTe9D19R0GRY_AHMwFuHNWVHm4g1KOVJJ2HrGps/w640-h430/LTspice_trapezoid2.png" width="640" /></a></div><p>The third stage is just a buffer.</p><p><br /></p>Христоhttp://www.blogger.com/profile/14002909704834630953noreply@blogger.com0tag:blogger.com,1999:blog-4191887753331304313.post-20211727505535724902023-06-02T16:43:00.001+03:002023-08-04T00:24:16.441+03:00Mini sine wave oscillator<p>This project is a variant of the 'Miniature Audio Oscillator' by the great Rod Elliott.</p><p>I have made very few changes to the core schematic. I removed the potentiometer used for adjusting the frequency and replaced it with a DIP switch, allowing for easy switching between three different frequencies: 20 Hz, 1 kHz, and 20 kHz. These options should be sufficient for quickly testing various audio equipment.</p><p>Additionally, I added a third dual opamp. One half of the opamp is used as an output buffer, while the other half serves as a voltage rail splitter and virtual ground. The schematic is designed for a single rail voltage: a 9V battery should be sufficient, but it can also work with higher voltages up to 30V (depending on the opamps used). If Li-ion batteries need to be used, then it is recommended to connect 3 or 4 batteries in series.</p><p>The output signal, as stated in the original article, has very low Total Harmonic Distortion (THD) at approximately 0.12%. While I do not have the necessary measurement equipment to gauge the distortion of my variant, I estimate it to be below 0.5%.</p><p>I created this project using the EasyEDA software, with the aim of making it relatively easy to replicate at home. The design employs a single-sided PCB and through-hole components.</p><p>This is the schematic:</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgm2Chs_GpkhYnpvBPMZDwSWrFkuMhJt3X4b6jyfGTIxhdfAmKhlaW-Y5qgCAQIsSPFtnPlWK9uomBJ7sMFrZPFTElJW-Pk0FVxtGtrMyFVeHe5tcuElxW-PubZ8DNrYEl_d-2ffzMdsWtKKwnCwc0cNyjZiauDfqQ_1atnHlA5deMWyUJTVFkrH9bw2g/s1987/Schematic.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1196" data-original-width="1987" height="386" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgm2Chs_GpkhYnpvBPMZDwSWrFkuMhJt3X4b6jyfGTIxhdfAmKhlaW-Y5qgCAQIsSPFtnPlWK9uomBJ7sMFrZPFTElJW-Pk0FVxtGtrMyFVeHe5tcuElxW-PubZ8DNrYEl_d-2ffzMdsWtKKwnCwc0cNyjZiauDfqQ_1atnHlA5deMWyUJTVFkrH9bw2g/w640-h386/Schematic.png" width="640" /></a></div><p>And this is 3D view of the PCB:</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4Qwt52mtLs2-w9fs6EMQMmll55bY-YH4VoIBOSciCOXmVXW_rwkj86mYLLmoQ5Dp6Ar9ZXsPZPWyY6It3wFxCYZeYGE7XNXFfZK63Qj4Eafhf8s_Ngv4q2pWfUVrjCb_SJIRtWMbXAtq_GKvBpy38u2Om8DQIRlK-BIbazabZYHKCP8d5Kmqwyx47Qw/s1609/3D_view.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="893" data-original-width="1609" height="356" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4Qwt52mtLs2-w9fs6EMQMmll55bY-YH4VoIBOSciCOXmVXW_rwkj86mYLLmoQ5Dp6Ar9ZXsPZPWyY6It3wFxCYZeYGE7XNXFfZK63Qj4Eafhf8s_Ngv4q2pWfUVrjCb_SJIRtWMbXAtq_GKvBpy38u2Om8DQIRlK-BIbazabZYHKCP8d5Kmqwyx47Qw/w640-h356/3D_view.png" width="640" /></a></div><p>For this project, I used a photosensitive dry film for the first time. It wasn't easy, but after a number of trials and errors, I finally managed to produce a fairly good PCB. Here's how it turned out:</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMeSAyMs0lijnLGjki2YP06Io3UdZaMJ_c8sAqims4HjTEZo-774l9MykBvsDDi3aTYvmzmDLTRFNcXyfs7ZGmBuMFpI-j-nCwW9iiasQGHYXwZ-rmse9rk32m3TIce55vECdEVDTqmYZq32YpKzzuutpHMPIjWW9zZSYLLaTeh3v2Q3wZvCpmFXCnyA/s1500/PCB_Top.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1000" data-original-width="1500" height="426" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMeSAyMs0lijnLGjki2YP06Io3UdZaMJ_c8sAqims4HjTEZo-774l9MykBvsDDi3aTYvmzmDLTRFNcXyfs7ZGmBuMFpI-j-nCwW9iiasQGHYXwZ-rmse9rk32m3TIce55vECdEVDTqmYZq32YpKzzuutpHMPIjWW9zZSYLLaTeh3v2Q3wZvCpmFXCnyA/w640-h426/PCB_Top.jpg" width="640" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIsvpGwu4Gcf7VuBp_tDX9_h99qHTxbuLLB_V9kkMRH9ReATB9ccsLDTPIjZ7r-vzzsSRcGROqLvivZs7_wFeCPbymsycJgFW2i_DFemwVoSzrQdaTuF6qkgg1FxLlNqErMVL3lDP4YTFmDOlEVmk8p3YPblkZ-FLhtsi0W7WqQlCVWTZKULlKGBL29g/s1500/PCB_Bottom.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1000" data-original-width="1500" height="426" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIsvpGwu4Gcf7VuBp_tDX9_h99qHTxbuLLB_V9kkMRH9ReATB9ccsLDTPIjZ7r-vzzsSRcGROqLvivZs7_wFeCPbymsycJgFW2i_DFemwVoSzrQdaTuF6qkgg1FxLlNqErMVL3lDP4YTFmDOlEVmk8p3YPblkZ-FLhtsi0W7WqQlCVWTZKULlKGBL29g/w640-h426/PCB_Bottom.jpg" width="640" /></a></div><p>The oscillator utilizes a 4-channel DIP switch to control the activation of different value capacitors, thereby altering the output frequency.</p><p>The formula for calculating the frequency is F = 1 / (2π × R × C),</p><p>where R = R6 = R7 = 10k and</p><p>C = C1_A = C2_A = 680 pF when all switches are OFF. These two capacitors can also be 820 pF. To achieve a frequency close to 20 kHz, I handpicked two 680 pF capacitors with higher actual values.</p><p>When the left two switches are ON, C = C1_A + C1_B = C2_A + C2_B = 680 pF + 15 nF ≈ 15.7 pF.</p><p>When all switches are ON, C = C1_A + C1_B + C1_C + C1_D = C2_A + C2_B + C2_C + C2_D = 680 pF + 15 nF + 680 nF + 100 nF ≈ 795 nF. Note that C1_D and C2_D are included for fine-tuning the lowest frequency of 20 Hz. While not strictly necessary, omitting these capacitors will result in a slightly higher lowest frequency, around 23-24 Hz.</p><p>The output voltage measures approximately 3.5 Vpp or 1.24 Vrms and can be adjusted with the potentiometer.</p><p>The schematic is compatible with various types of opamps. I tested it with TL072 and NE5532. The current consumption with the TL072 is approximately 10-11 mA, whereas with the NE5532, it is around 34 mA. For extended battery life, the TL062 is the optimal choice; however, I do not have any available at the moment. With the TL072, the output signal begins to visibly distort when the supply voltage drops below 8V.</p><p>Here some screenshots from the oscilloscope:</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgIIPAstcRbzwAaOlR7V3cwjbCYV0uv9uvg1oBeu6D0qj9R4ejzqLa34Vd9GpDLqxyO94oIgXQqDijCo2vUI4YY-nX6wpEWyv7wPz3JuAbRezezl7rhdrxiMLKVLcTOp7Q7yh10yuuqjZMAjJuaot5KKRzdsEq2se6v-NPwOVEOo7XXvMsFV3LhTQ0HA/s1200/Scope_20_Hz.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="585" data-original-width="1200" height="156" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgIIPAstcRbzwAaOlR7V3cwjbCYV0uv9uvg1oBeu6D0qj9R4ejzqLa34Vd9GpDLqxyO94oIgXQqDijCo2vUI4YY-nX6wpEWyv7wPz3JuAbRezezl7rhdrxiMLKVLcTOp7Q7yh10yuuqjZMAjJuaot5KKRzdsEq2se6v-NPwOVEOo7XXvMsFV3LhTQ0HA/s320/Scope_20_Hz.jpg" width="320" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFLyMuchYcqrNztPvo7IDcBYn_q_ZH5Xbt-ChAYLEN1M-cB54MoSi01WCbsmmax7Y8gJiZUHfnxp3Rt2tzc0JAtI9qngdCnBZd_9DaxVdD7neKSTCVtS5dv4n2tEMy_AuiyNQVVvLkzCM2kXe7qhcTrfQbvU4RQD4ZENv-3xMluQCMszOR8faIVbJHMQ/s1200/Scope_1_KHz.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="585" data-original-width="1200" height="156" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFLyMuchYcqrNztPvo7IDcBYn_q_ZH5Xbt-ChAYLEN1M-cB54MoSi01WCbsmmax7Y8gJiZUHfnxp3Rt2tzc0JAtI9qngdCnBZd_9DaxVdD7neKSTCVtS5dv4n2tEMy_AuiyNQVVvLkzCM2kXe7qhcTrfQbvU4RQD4ZENv-3xMluQCMszOR8faIVbJHMQ/s320/Scope_1_KHz.jpg" width="320" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhv_d4Rpt5MN9p8X_EgudDmxquHUOEc9TRSbpU_MUH0Gn8Pe0PwPQXYXVJk33FshEHYpSRC-ll8IK1wKTkzRn9NNLNo4RfLknMgP4sNljzbpYyK9gIW7sMH1D8AlsNUNRiefs4aNPeLnJJoBOyMCP7Hds5nutQQkUi3lhmyfkC-mIcnCJTwDp_J0Hrd7A/s1200/Scope_20_KHz.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="585" data-original-width="1200" height="156" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhv_d4Rpt5MN9p8X_EgudDmxquHUOEc9TRSbpU_MUH0Gn8Pe0PwPQXYXVJk33FshEHYpSRC-ll8IK1wKTkzRn9NNLNo4RfLknMgP4sNljzbpYyK9gIW7sMH1D8AlsNUNRiefs4aNPeLnJJoBOyMCP7Hds5nutQQkUi3lhmyfkC-mIcnCJTwDp_J0Hrd7A/s320/Scope_20_KHz.jpg" width="320" /></a></div><p>And here is a video of the oscillator at work:</p><p><iframe allowfullscreen="" height="315" id="odysee-iframe" src="https://odysee.com/$/embed/@DIYfan:d/miniOsc:8?r=424EpYmR7rqikUUegDcVRJJ8h8nCcEbg" width="560"></iframe></p><p>Project files can be downloaded from here: <a href="https://www.dropbox.com/s/fz5x6adoispgfz6/SineWaveGenerator.rar?dl=1">MiniOsc</a>. Use them on your own responsibility!</p><p><br /></p>Христоhttp://www.blogger.com/profile/14002909704834630953noreply@blogger.com0tag:blogger.com,1999:blog-4191887753331304313.post-11742632730303361382022-12-19T04:41:00.003+02:002022-12-19T04:41:45.104+02:00Shaker for PCB etching<div><p>This is an old project, that was sitting in the cabinet for a very long time and I just finished it a week ago. It uses an old computer DVD drive (no one ever uses them anymore). It is completely stripped from all electronics and mechanics except for the parts that move the tray in and out. The motor inside is a simple DC motor.<br /></p><p>The shaker uses an 8-pin microcontroller <a href="https://www.microchip.com/en-us/product/PIC16F15313">PIC16F15313</a> and a <a href="https://www.aliexpress.com/w/wholesale-Motor-Driver-Module-DRV8833.html">motor driver module based on DVR8833</a> chip.</p><p>There are two NO reed switches that are mounted on the case and two magnets glued on the moving tray. When one of the switches is closed by the magnet the microcontroller reverse the direction of the tray. There is also an potentiometer connected to an analog pin which control the movement speed of the tray.</p><p>The shaker is supplied with 12Vdc from an power adapter. It will work with voltages from 6V to 12V. For the microcontroller there is a 78L05 voltage regulator.</p><p>At first there was an power resistor mounted on the bottom of the aluminium sheet and connected directly to the 12V rail. The idea was to heat up the container with the etch solution, but because the container is plastic there was not much heat transfer going on and I removed it. Now I heat up the solution in the microwave oven first, and then I put the PCB in and use the shaker.</p><p>The circuit is assembled on piece of perfboard. <br /></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_BFEHzBp4RwBySag1GmEoTg5FJjY6Cq9YSukJhE1O7z6WEMxGdKXeZwEVCG6RozbTPFY3AiMGgJ8_9QOL2zg4asBUdNcLEP7jVDR9t0nGvH0Yq2JaQSe1b5Ntb5qaGmooLwGcSEqoqXYYD0cBGRypgYMNDd5ec6htmmSno7QZzTtgumyCTpIu4gAV8g/s2255/Shaker_Schematic.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1524" data-original-width="2255" height="432" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_BFEHzBp4RwBySag1GmEoTg5FJjY6Cq9YSukJhE1O7z6WEMxGdKXeZwEVCG6RozbTPFY3AiMGgJ8_9QOL2zg4asBUdNcLEP7jVDR9t0nGvH0Yq2JaQSe1b5Ntb5qaGmooLwGcSEqoqXYYD0cBGRypgYMNDd5ec6htmmSno7QZzTtgumyCTpIu4gAV8g/w640-h432/Shaker_Schematic.png" width="640" /></a></div><p></p><p> <a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2WkIhaYrq9htHeBVVgAw7g7PZ9F5ruVhbYpDyx6dO7rE-EI3LSGvIFPtl58tWp8aYIbtzO6r6Y047X6nxMeAeMU49tKMvp-mAFer8ALiXI9ZylKBvo4p6aMzlJQ8mcrws0YhRtWwOw-rKd1U-RRfeppRBMgI3-tuYrrwpHG6-dFUBiYn1rhtSWlmm1A/s2000/Shaker1.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1500" data-original-width="2000" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2WkIhaYrq9htHeBVVgAw7g7PZ9F5ruVhbYpDyx6dO7rE-EI3LSGvIFPtl58tWp8aYIbtzO6r6Y047X6nxMeAeMU49tKMvp-mAFer8ALiXI9ZylKBvo4p6aMzlJQ8mcrws0YhRtWwOw-rKd1U-RRfeppRBMgI3-tuYrrwpHG6-dFUBiYn1rhtSWlmm1A/w640-h480/Shaker1.jpg" width="640" /></a></p><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYIbGwJBB1Tpv47KssT-j-7RiRTO4fw6CeSA6nZq6Csig0viQmzUHLg_zwGEo5NEBU0QKa7IPMjCvKvXhUaBW3QFTANRKI7OjHaIjDqBatkxfDexnsCaa0r6HhQfjd9r3vLIZ1_sJRIFS-ImT6NrkRid41LtXYhAgZdiwXAN4w7YKeC5RVIY-ofk9u6g/s2000/Shaker2.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1500" data-original-width="2000" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYIbGwJBB1Tpv47KssT-j-7RiRTO4fw6CeSA6nZq6Csig0viQmzUHLg_zwGEo5NEBU0QKa7IPMjCvKvXhUaBW3QFTANRKI7OjHaIjDqBatkxfDexnsCaa0r6HhQfjd9r3vLIZ1_sJRIFS-ImT6NrkRid41LtXYhAgZdiwXAN4w7YKeC5RVIY-ofk9u6g/w640-h480/Shaker2.jpg" width="640" /></a></div><br /></div><p style="text-align: left;"><br /></p><p style="text-align: left;"></p><p style="text-align: left;"><iframe allowfullscreen="" height="315" id="odysee-iframe" src="https://odysee.com/$/embed/@DIYfan:d/Shaker:e?r=424EpYmR7rqikUUegDcVRJJ8h8nCcEbg" width="560"></iframe><br /></p><p style="text-align: left;">When using this shaker make sure the speed is not too high, because there is a risk of spilling potentially dangerous liquid around.</p><p style="text-align: left;">The code for the microcontroller is created in MPLAB X v6.08 and can be downloaded from here: <a href="https://www.dropbox.com/s/zzjqzbu62onhkfs/Shaker_PIC16F15313.zip?dl=1">Shaker_Source_Code</a>.</p><p style="text-align: left;"><br /></p>Христоhttp://www.blogger.com/profile/14002909704834630953noreply@blogger.com0tag:blogger.com,1999:blog-4191887753331304313.post-28276239960382581242022-11-27T04:50:00.005+02:002022-11-28T15:35:33.360+02:00IR remote code reader (NEC protocol)<p>This is a quick project on breadboard for decoding and displaying the signals from a IR remote.</p><p>The technical details of the NEC IR transmission protocol can be read <a href="https://techdocs.altium.com/display/FPGA/NEC+Infrared+Transmission+Protocol">here</a>.</p><p>The project uses PIC16F628A microcontroller and 4 digit 7-segment common cathode LED display for showing the codes. The first two digits represent the address for the receiving device, and the next two digits represent the command code. The format of the codes on the display is hexadecimal.</p><p>The schematic is extremely simple:</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipY3pbRwOQvR9bTwN4A3EtVDooKsT1lqVivKR4vOOeV7sJBkz0ihyw73ODRMtFleiAjeZoIPeaCpiOU20ZqBJDRzc2cjTa-vvzmQpPM_Dxr1jYzxJHV961Y2J-1J9QqJZS-7lOUts9XJpBqVKxIC1saQ55MIGcX70Z4scMj3pSS-AFZzGLcco4GxNRSQ/s2124/IR_code_reader1..png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1517" data-original-width="2124" height="458" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipY3pbRwOQvR9bTwN4A3EtVDooKsT1lqVivKR4vOOeV7sJBkz0ihyw73ODRMtFleiAjeZoIPeaCpiOU20ZqBJDRzc2cjTa-vvzmQpPM_Dxr1jYzxJHV961Y2J-1J9QqJZS-7lOUts9XJpBqVKxIC1saQ55MIGcX70Z4scMj3pSS-AFZzGLcco4GxNRSQ/w640-h458/IR_code_reader1..png" width="640" /></a></div><p></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjT820leBtIitPXi7sVQRt5YMoECcVYk2CaPGUE66FtrMx5KZiw1iRiOyYWz4DiByAp4yv7MLh6_Wm8j_yxvQYkMd475MYqzl1-mTHTz3vALCMguva6SwSuoknUuznMp-O1Hcl9U9dPgnrXeO9g7sBxmbIblc1vnM-gojzlY4EXhhLgZ1O_RZCecMwRQ/s2000/IR_code_reader2.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="866" data-original-width="2000" height="278" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjT820leBtIitPXi7sVQRt5YMoECcVYk2CaPGUE66FtrMx5KZiw1iRiOyYWz4DiByAp4yv7MLh6_Wm8j_yxvQYkMd475MYqzl1-mTHTz3vALCMguva6SwSuoknUuznMp-O1Hcl9U9dPgnrXeO9g7sBxmbIblc1vnM-gojzlY4EXhhLgZ1O_RZCecMwRQ/w640-h278/IR_code_reader2.jpg" width="640" /></a></div><p></p><p><br /></p><iframe allowfullscreen="" height="315" id="odysee-iframe" src="https://odysee.com/$/embed/@DIYfan:d/VID_20221127_035129:1?r=424EpYmR7rqikUUegDcVRJJ8h8nCcEbg" width="560"></iframe>
<p></p>
<p>The program is written in C using MPLAB X IDE 6.0 and compiled with the xc8 compiler.</p><p>The source code can be downloaded from <a href="https://www.dropbox.com/s/674e3rk9nyomwwb/PIC16F628A_IR_Remote.rar?dl=1">here</a>.</p><p></p><p><br /></p><p><br /></p><p><br /></p>
Христоhttp://www.blogger.com/profile/14002909704834630953noreply@blogger.com0tag:blogger.com,1999:blog-4191887753331304313.post-49206420471078922182022-04-06T16:10:00.001+03:002022-04-06T16:10:17.512+03:00Driving NeoPixel type ARGB LEDs with PIC<p> I have ordered 10 pcs of addressable LED from <a href="https://www.aliexpress.com/item/1005001863273661.html">Aliexpress </a>some time ago and tested them with my Arduino boards and the library from Adafruit and they work as expected. But of course I am more a PIC guy, so I start to thinker with some PIC microcontrollers trying to drive these LEDs. And it is not easy! So the major difference between 8-bit PIC micro and a ATMEGA 328P is that the ATMEGA command rate of ATMEGA is the same as clock rate, so it has 16 MHz clock frequency and 16 MHz command rate but the PICs have command rate 4 times slower than clock frequency. So a PIC clocked at 16 MHz will have 4 MHz command rate and 32 MHz PIC will have 8 MHz command rate. In order to achieve similar performance as ATMEGA, the PIC must be clocked at 64 MHz. </p><p>The difficulty comes from the very high frequency and the format of the output signal. The frequency of NeoPixel signal is ≈800 kHz and the "1" have 800 ns high followed by 400 ns low. The "0" is 400 ns high followed by 800 ns low. And 1 instruction of 32 MHz PIC microcontroller take 125 ns to execute. It is impossible to write a C code that can create such signal in 9-10 instructions. This is achievable only with carefully written Assembler. I had success with PIC16F1847 clocked at 32 MHz.</p><p>It was pain in the a**, because there are very little info and tutorials about writing mixed code (C and assembler) for xc8. For example I couldn't find a way to declare a variable in BANK0 in assembly code because the variables in C code evidently take precedence and occupy all the free space in BANK0 first. And it is important the variables to in the same memory bank as PORTB, because changing banks takes one additional instruction. So I has to declare the variables in the C code specifying the exact address... </p><p><textarea cols="60" rows="20">
PROCESSOR 16F1847
#include <xc.inc>
#define SER_OUT PORTB, 4
EXTRN _colorByte
EXTRN _index
GLOBAL _sendByteASM, _sendByteASM2
psect ASMcode, class=CODE, local, delta=2
_sendByteASM:
MOVWF _colorByte ; copy parameter to the local variable _colorByte
MOVLW 8
MOVWF _index
START:
BSF SER_OUT
BTFSC _colorByte, 7
GOTO ONE
BCF SER_OUT
LSLF _colorByte, 1
NOP
NOP
DECFSZ _index, 1
GOTO START
GOTO ENDLABEL
ONE:
LSLF _colorByte, 1
NOP
NOP
BCF SER_OUT
DECFSZ _index, 1
GOTO START
ENDLABEL:
return
_sendByteASM2:
MOVWF _colorByte ; copy parameter to the local variable _colorByte
BIT0:
BSF SER_OUT
BTFSC _colorByte, 7
GOTO ONE0
BCF SER_OUT
NOP
NOP
GOTO BIT1
ONE0:
NOP
NOP
NOP
BCF SER_OUT
BIT1:
NOP
NOP
BSF SER_OUT
BTFSC _colorByte, 6
GOTO ONE1
BCF SER_OUT
NOP
NOP
GOTO BIT2
ONE1:
NOP
NOP
NOP
BCF SER_OUT
BIT2:
NOP
NOP
BSF SER_OUT
BTFSC _colorByte, 5
GOTO ONE2
BCF SER_OUT
NOP
NOP
GOTO BIT3
ONE2:
NOP
NOP
NOP
BCF SER_OUT
BIT3:
NOP
NOP
BSF SER_OUT
BTFSC _colorByte, 4
GOTO ONE3
BCF SER_OUT
NOP
NOP
GOTO BIT4
ONE3:
NOP
NOP
NOP
BCF SER_OUT
BIT4:
NOP
NOP
BSF SER_OUT
BTFSC _colorByte, 3
GOTO ONE4
BCF SER_OUT
NOP
NOP
GOTO BIT5
ONE4:
NOP
NOP
NOP
BCF SER_OUT
BIT5:
NOP
NOP
BSF SER_OUT
BTFSC _colorByte, 2
GOTO ONE5
BCF SER_OUT
NOP
NOP
GOTO BIT6
ONE5:
NOP
NOP
NOP
BCF SER_OUT
BIT6:
NOP
NOP
BSF SER_OUT
BTFSC _colorByte, 1
GOTO ONE6
BCF SER_OUT
NOP
NOP
GOTO BIT7
ONE6:
NOP
NOP
NOP
BCF SER_OUT
BIT7:
NOP
NOP
BSF SER_OUT
BTFSC _colorByte, 0
GOTO ONE7
BCF SER_OUT
NOP
NOP
GOTO ENDLABEL2
ONE7:
NOP
NOP
NOP
BCF SER_OUT
ENDLABEL2:
return
</textarea> </p><p>The above code has two subroutines _sendByteASM and _sendByteASM2. The first one use a cycle to check and send the bits to the serial output pin (in this case RB4). The best timing I was able to achieve this way was "0" - 375ns/875ns, "1" - 875ns/500ns. And it worked.</p><p>The second subroutine check and send every bit separately and there I was able to achieve timing much closer to the required. "0" - 375ns/875ns, "1" - 875ns/375ns. </p><p>Then I got a more modern PIC - PIC16F15344, which have 4 very interesting modules: Configurable Logic Cell (CLC) each of which can be set as 4-input AND, AND-OR, D-type flip flop, J-K flip flop and couple of other types. Also I saw a video from the great <a href="https://www.youtube.com/watch?v=aCK0SpZ2ueg">Ben Heck</a> where he is using the SPI output from ESP32 with some external logical chips to form the output signal compatible with NeoPixel. </p><p>My thought was to feed the color bytes to the SPI module (configured to work at 800 kHz) and the output (clock and data) to use somehow to form impulses with different length and then combine them with CLC. The following screenshots are the settings of different modules used in this project.</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEieXyeGiK3jM4_FEEty26PVrgaX7Xl3Z0W7_9IrtKo6I5jY8t4OypQat2x0i6mSZNhAyix-KH3Ir8T8yFLuM5lF3T21A4bFdpMDWvAd7w7fFE9_w7wNXqL2vuLlsmfqfvkOuOjWQZmyqSBYFvACv9ZErPkTl2hsj3vwO24TbMJ6kJ1qGQ0CBuYqMSuzZQ/s1706/MSSP1.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1040" data-original-width="1706" height="390" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEieXyeGiK3jM4_FEEty26PVrgaX7Xl3Z0W7_9IrtKo6I5jY8t4OypQat2x0i6mSZNhAyix-KH3Ir8T8yFLuM5lF3T21A4bFdpMDWvAd7w7fFE9_w7wNXqL2vuLlsmfqfvkOuOjWQZmyqSBYFvACv9ZErPkTl2hsj3vwO24TbMJ6kJ1qGQ0CBuYqMSuzZQ/w640-h390/MSSP1.png" width="640" /></a></div><p>The CLC1 is configured as AND-OR and the signal from the SPI is directly routed to the output. This will be needed later. </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjenQzfcOAdrIFQRReIam6sy98dWSxPNf5_GlOxgzDiJ_KkJm9FgsdS0drepKtSxcYi2iLs8I_oV25WyNpODK3EM5tewGbH-pDdoQgUKxHaa7bbMLQ-eQIKB54ThJ_VJKF4UFot-UvreYxamQZui8V79440OnCZIBdvyUfDeMD-OfW5jQq2qy0YDPIMmg/s1706/CLC1.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1040" data-original-width="1706" height="390" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjenQzfcOAdrIFQRReIam6sy98dWSxPNf5_GlOxgzDiJ_KkJm9FgsdS0drepKtSxcYi2iLs8I_oV25WyNpODK3EM5tewGbH-pDdoQgUKxHaa7bbMLQ-eQIKB54ThJ_VJKF4UFot-UvreYxamQZui8V79440OnCZIBdvyUfDeMD-OfW5jQq2qy0YDPIMmg/w640-h390/CLC1.png" width="640" /></a></div><p>For creating the waveforms of "0" and "1" I used the Complementary Waveform Generator (CWG). This module is used to create a signal for driving half-bridge or full bridge circuits and among other setting there can be set a dead time. So I fed the signal from CLC1 (which is a copy of SCK signal and have 50% duty cycle or 600 ns high) to the CWG module and set the dead time of the rising edge to be about 400 ns and when inverted this will be the "0". The dead time of the falling edge is set to be around 200 ns increasing low time to 800 ns and when inverted form the "1" waveform.</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5AiY8GNyo7hhhPuX_uobdO-VU-awSj9Ph0eAocXL2LJd0aZT-6NnOoyQBaWZIQkA_gHIXjjDFb67szQII7_vHC-vLImq1hP-1OaKDWmRUxjcB8z_A016HSoE1yj3t62fJM0qSMvvbWKJnMCfp9btdVMKkyrNznZY90Uk-fc0veMZSi9OSOGl8cl9qyQ/s1706/CWG.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1040" data-original-width="1706" height="390" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5AiY8GNyo7hhhPuX_uobdO-VU-awSj9Ph0eAocXL2LJd0aZT-6NnOoyQBaWZIQkA_gHIXjjDFb67szQII7_vHC-vLImq1hP-1OaKDWmRUxjcB8z_A016HSoE1yj3t62fJM0qSMvvbWKJnMCfp9btdVMKkyrNznZY90Uk-fc0veMZSi9OSOGl8cl9qyQ/w640-h390/CWG.png" width="640" /></a></div><p>CLC2 is configured as 4-input AND. There I combine the inverted output from CWG1A, CLC1 and SDO from SPI to create the "0" signal:</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiD_0zPmaXV3CzKKEOtD21OTJFyHGiz1EVv3OT5nHvP3ybIvlTPE48hOs8I74AVeg_yVMjlK2RgYTaCAaCjjVfpr4_9Y6av_2lt5xiAw4LhhibduIqluDxWjhY9OfauUcTfrb3zAixFifw41kbQSTmkghAVtSKQ80EPrXV6-EvJLgVYwbxc8JiHU9KrSA/s1706/CLC2.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1040" data-original-width="1706" height="390" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiD_0zPmaXV3CzKKEOtD21OTJFyHGiz1EVv3OT5nHvP3ybIvlTPE48hOs8I74AVeg_yVMjlK2RgYTaCAaCjjVfpr4_9Y6av_2lt5xiAw4LhhibduIqluDxWjhY9OfauUcTfrb3zAixFifw41kbQSTmkghAVtSKQ80EPrXV6-EvJLgVYwbxc8JiHU9KrSA/w640-h390/CLC2.png" width="640" /></a></div><p>Finally, all is combined at CLC3 which is set as AND-OR cell:</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRG2m6Em1ndHBCCeKatIVq0XxBSyc_Y1ASGCDVWzoXseGW3mFIInFCxjTm9I9uuSDPljnshutR19dWc_K1r8EfoewLwIHGQNAP_IYrpJKqpOhcgDXH-ehYVMM9NQCiqFwag05yArXMlh-UkiWNz_MKL09uuL2YF25ymjNO1-WzkEh7S4zVBSAIr2QxCQ/s1706/CLC3.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1040" data-original-width="1706" height="390" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRG2m6Em1ndHBCCeKatIVq0XxBSyc_Y1ASGCDVWzoXseGW3mFIInFCxjTm9I9uuSDPljnshutR19dWc_K1r8EfoewLwIHGQNAP_IYrpJKqpOhcgDXH-ehYVMM9NQCiqFwag05yArXMlh-UkiWNz_MKL09uuL2YF25ymjNO1-WzkEh7S4zVBSAIr2QxCQ/w640-h390/CLC3.png" width="640" /></a></div><p>Here the inverted signal from CWG1B is "AND"-ed with the SDO signal to produce the "1" signal. Then both "0" (from CLC2) and "1" are "OR"-ed to form the final output signal which is routed to one of the pins - in my case RC4/pin6. </p><p>Here some scope screenshots:</p>
<table>
<tbody>
<tr>
<td><div class="separator" style="clear: both; text-align: left;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj34aD6Djlg0izPsYgBRo-w3TkHTHO5HpkOmFklxns83-6t6779Y2IJ5Gl9-eNFwyov_X6_78Tz1VMNowfpl2ZP2iCKvdZggpcrk9WKJ8zMg-yMZ11-cFOOQ6rtP8wAf3kvBinCpgeEjMPMxJty7zbzBTszsChiVVZApmqzIB53HHcFbYVDZE0J-zeimQ/s480/Scope1.png" style="margin-left: 0em; margin-right: 1em;"><img border="0" data-original-height="234" data-original-width="480" height="156" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj34aD6Djlg0izPsYgBRo-w3TkHTHO5HpkOmFklxns83-6t6779Y2IJ5Gl9-eNFwyov_X6_78Tz1VMNowfpl2ZP2iCKvdZggpcrk9WKJ8zMg-yMZ11-cFOOQ6rtP8wAf3kvBinCpgeEjMPMxJty7zbzBTszsChiVVZApmqzIB53HHcFbYVDZE0J-zeimQ/s320/Scope1.png" width="320" /></a></div></td>
<td><div class="separator" style="clear: both; text-align: left;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyQluVLftkbcldIvOJZ3xovQ3pC-OFQzRYCq-9fClexzILL2R-FPMUl60PsavZr2en1nQQUmroDvI7IDTYlPCEVv7o0pveQYKNQ3lnvnM96W3t-mIVvZLMOQkyf5oPMHMfPQHFQNRsckIHmdo1t3ShQr5xmarDgYKxp39MdniEdS0a9-P1JO9ra9VVHQ/s480/Scope2.png" style="margin-left: 0em; margin-right: 1em;"><img border="0" data-original-height="234" data-original-width="480" height="156" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyQluVLftkbcldIvOJZ3xovQ3pC-OFQzRYCq-9fClexzILL2R-FPMUl60PsavZr2en1nQQUmroDvI7IDTYlPCEVv7o0pveQYKNQ3lnvnM96W3t-mIVvZLMOQkyf5oPMHMfPQHFQNRsckIHmdo1t3ShQr5xmarDgYKxp39MdniEdS0a9-P1JO9ra9VVHQ/s320/Scope2.png" width="320" /></a></div></td>
</tr>
<tr>
<td><div class="separator" style="clear: both; text-align: left;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEik-JgIpGSAtG5OgXbwVmmg4bjNKkfD5aP8ERHBiWV9rtEfbGVuSy-exn32kFNr8x2SMDpiJRokARivKqW7BKULEdkjmd88c76bteZ7w53fpvYGQ46jCUl0JhiMjJZ8vGerBv3Awt5zf2rz8c5tug9xGPvZQSGtyp6alcgcYm8m_HKEGRx2LmqRZ-AQDw/s480/Scope3.png" style="margin-left: 0em; margin-right: 1em;"><img border="0" data-original-height="234" data-original-width="480" height="156" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEik-JgIpGSAtG5OgXbwVmmg4bjNKkfD5aP8ERHBiWV9rtEfbGVuSy-exn32kFNr8x2SMDpiJRokARivKqW7BKULEdkjmd88c76bteZ7w53fpvYGQ46jCUl0JhiMjJZ8vGerBv3Awt5zf2rz8c5tug9xGPvZQSGtyp6alcgcYm8m_HKEGRx2LmqRZ-AQDw/s320/Scope3.png" width="320" /></a></div></td>
<td><div class="separator" style="clear: both; text-align: left;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzqKKWnaRGMvu7F4WLQKBPXuP-BHTQYmVc-rE1nAhrMcnmfCvXImpIV1w6Jsl0g5HUof_jxKCQh3vpSrVwXmvkt9ccJKdyRhNjM6ZiIZXllRojfweznfUGr6ekKPWs84XWM_9AQmgQplQDTcNaozDU312O7PbhYEUkcjDIIcDecCkU3rp0uIBywq9aeg/s480/Scope4.png" style="margin-left: 0em; margin-right: 1em;"><img border="0" data-original-height="234" data-original-width="480" height="156" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzqKKWnaRGMvu7F4WLQKBPXuP-BHTQYmVc-rE1nAhrMcnmfCvXImpIV1w6Jsl0g5HUof_jxKCQh3vpSrVwXmvkt9ccJKdyRhNjM6ZiIZXllRojfweznfUGr6ekKPWs84XWM_9AQmgQplQDTcNaozDU312O7PbhYEUkcjDIIcDecCkU3rp0uIBywq9aeg/s320/Scope4.png" width="320" /></a></div></td>
</tr>
</tbody></table>
<p>The timing here is much better and the beauty of this solution is that there is no interrupts, no assembler code. All of the above is just setup of registers. I am using MPLAB Code Configurator to generate all the code and the actual work is done by the hardware modules and for sending a single byte to the NeoPixels are needed only 2 lines of code. Here is the function to send the 3 bytes for red, green and blue:</p>
<textarea cols="60" rows="20" style="height: 132px; width: 284px;">void sendPixel(NeoPixel p) {
SSP1BUF = p.red;
while (!SSP1STATbits.BF);
SSP1BUF = p.green;
while (!SSP1STATbits.BF);
SSP1BUF = p.blue;
while (!SSP1STATbits.BF);
}
</textarea>
<p>Bellow is a video demonstration how it work with the assembler code. I adapted some of Adafruit library functions for this demo: rainbow, their table for gama8 function and the function for HSV color. </p>
<iframe allowfullscreen="" height="315" id="odysee-iframe" src="https://odysee.com/$/embed/NeoPixel_Demo/e0097bd7a4fa274ebb482c64c5fc695271940972?r=424EpYmR7rqikUUegDcVRJJ8h8nCcEbg" width="560"></iframe>Христоhttp://www.blogger.com/profile/14002909704834630953noreply@blogger.com0tag:blogger.com,1999:blog-4191887753331304313.post-89987859671383016042022-02-15T18:33:00.000+02:002022-02-16T15:12:38.025+02:00HV rescue shield for Microchip ATmega series 8-bit microcontrollers<p>These days I decided to play a little with ATmega328P microcontroller and it was a total disaster. I used a PICkit 4 programmer and MPLAB X + XC8 for the code writing and compiling. Then I came to the brilliant idea to use MCC (MPLAB Code Configurator) which supposedly is easy way to configure and use the different modules inside the chip. And after setting the wrong fuses for the clock source the chip was effectively bricked. It worked, but only if I put a watch crystal at 32.768 kHz as a clock source. And the programmer cannot communicate at that low frequency.</p><p>Why these chips are designed this way? The ICSP interface in PIC microcontrollers have a dedicated clock line, so the programming of the chip is independent of the his internal configuration. I start digging for solutions in the web and tried all sorts of things. Most recommended solution was to attach external clock source to XTAL1 pin. I have signal generator and tried this with different frequencies but without success.</p><p>Finally I found this excellent page <a href="https://mightyohm.com/blog/2008/09/arduino-based-avr-high-voltage-programmer/" target="_blank">ARDUINO-BASED AVR HIGH VOLTAGE PROGRAMMER</a> and following the latest schematic I put the ATmega328Pchip on a breadboard and connected a million jumper wires to the Arduino. It worked and the chip was rescued. Of course I connected it again to the PICkit 4 and successfully bricked it again!</p><p>So in order to avoid dealing with jumper wires on the breadboard I get the original schematic, removed all other interfaces except the ATmega and replaced a dual PNP+NPN transistor array with discrete transistors. Also I removed the DC-DC voltage convertor because I can connect external voltage source for the 12V line. Here is the modified schematic:</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEiPO9yyotBcXLFyYmDvx6zQHkzQUjNxdrYtwNBt3l9fRC0HWIlQfvfAgKOBRHAC5lnOU8811udLFPPD5-I27Qf9YGv7iYI-nGpd2GxIFJfL4edCxmb7LboDeEIQHzw2nN37j_tnzk7yYhNtHLfNPKj8gZU-T0KHteYcbVYXlP7-JRW3c9y8HzhwKI_3og=s2125" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1525" data-original-width="2125" height="460" src="https://blogger.googleusercontent.com/img/a/AVvXsEiPO9yyotBcXLFyYmDvx6zQHkzQUjNxdrYtwNBt3l9fRC0HWIlQfvfAgKOBRHAC5lnOU8811udLFPPD5-I27Qf9YGv7iYI-nGpd2GxIFJfL4edCxmb7LboDeEIQHzw2nN37j_tnzk7yYhNtHLfNPKj8gZU-T0KHteYcbVYXlP7-JRW3c9y8HzhwKI_3og=w640-h460" width="640" /></a></div><div class="separator" style="clear: both; text-align: center;"><br /></div>And here is the finished shield for Arduino:<div><br /></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEhX72QGETqJYul7Ra0PztS1zjuK0M1E6oK0wB2SvLkEsjohN57knCtuKNuFgg2LwuQkUH6cKFz3jXwkqiCuqHM3fRIlcLzJLtNTFZ3vn-foCkC0ztf_aL9GysVwtqNHJrAbtOrBz-8n3Qph19iMTROhrhVGZTLxZunu9C1117sdCSVU2PxetmWdwDkzyg=s2000" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="2000" data-original-width="1745" height="320" src="https://blogger.googleusercontent.com/img/a/AVvXsEhX72QGETqJYul7Ra0PztS1zjuK0M1E6oK0wB2SvLkEsjohN57knCtuKNuFgg2LwuQkUH6cKFz3jXwkqiCuqHM3fRIlcLzJLtNTFZ3vn-foCkC0ztf_aL9GysVwtqNHJrAbtOrBz-8n3Qph19iMTROhrhVGZTLxZunu9C1117sdCSVU2PxetmWdwDkzyg=s320" width="279" /></a><a href="https://blogger.googleusercontent.com/img/a/AVvXsEiL9hC6Y4Cyic0nY34P-pLz7wIW3kkWPS7LGgsa3R1PFWXAyYC5n0KgPgUp2yYRJ8IA6Smai7oZ26AVjKFnrv9XLcHvuBBhXHbvlH6lUF_xW-NCQTNb7XFFxq5SfrmMH1o_YFvvtXBNQQ2NSbI1BL0ZIJVqxTwGq7UliOi8IClvc_t2D74lnQrtN4ne_g=s2000" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="2000" data-original-width="1816" height="320" src="https://blogger.googleusercontent.com/img/a/AVvXsEiL9hC6Y4Cyic0nY34P-pLz7wIW3kkWPS7LGgsa3R1PFWXAyYC5n0KgPgUp2yYRJ8IA6Smai7oZ26AVjKFnrv9XLcHvuBBhXHbvlH6lUF_xW-NCQTNb7XFFxq5SfrmMH1o_YFvvtXBNQQ2NSbI1BL0ZIJVqxTwGq7UliOi8IClvc_t2D74lnQrtN4ne_g=s320" width="291" /></a></div><br /><div><p>It worked perfectly, the chip was saved and I am ready for another bricking :)</p><p>The board was edited with EasyEDA. You can download the project files from <a href="https://tinyurl.com/w44jh2fb">HERE</a>. Inside are included Gerber files. Use these on your own responsibility. The Arduino sketch for this project you can download from the original project page <a href="https://mightyohm.com/blog/products/hv-rescue-shield-2-x/" target="_blank">HERE</a>.</p></div>Христоhttp://www.blogger.com/profile/14002909704834630953noreply@blogger.com0tag:blogger.com,1999:blog-4191887753331304313.post-61738524860445126402022-01-25T16:25:00.024+02:002022-02-15T16:28:12.260+02:00Driving 4 digit 7-segments TM1637 display module with PIC microcontroller<p><a href="https://www.mcielectronics.cl/website_MCI/static/documents/Datasheet_TM1637.pdf" target="_blank">TM1637 </a>display modules are cheap chinese modules that are offered in different colors, with digital dots or with colon. Usually these are 4 digit, but there are 6 digit modules also. I bought mine for 1.84 USD delivered. </p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEjDopB5lZbD8XFHGZFZkp4yJFwb3dDPwVyqJFPT6AmbUaW0kxdfTWqaZ0oaK0gaMjpKNLUeS1pSswKZnZRhg4cH3OP0ZXNxxQ2SFPpg46xvrLA7nGwC6dALGTlN6DBmB73SOcnoHbsjBdnzxaQeK7OjvFaaOAk1y03G6skV1PWWBYBh-76gfwMI15dePA=s2000" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1330" data-original-width="2000" height="426" src="https://blogger.googleusercontent.com/img/a/AVvXsEjDopB5lZbD8XFHGZFZkp4yJFwb3dDPwVyqJFPT6AmbUaW0kxdfTWqaZ0oaK0gaMjpKNLUeS1pSswKZnZRhg4cH3OP0ZXNxxQ2SFPpg46xvrLA7nGwC6dALGTlN6DBmB73SOcnoHbsjBdnzxaQeK7OjvFaaOAk1y03G6skV1PWWBYBh-76gfwMI15dePA=w640-h426" width="640" /></a></div><br /><span><a name='more'></a></span><p>The problem is there are tons of libraries, tutorials and videos for Arduino, and very little for PIC microcontrollers. So here is my take for driving these with PIC. </p><p>I have couple of microcontroller in DIP packages for testing purposes and I chose <a href="https://ww1.microchip.com/downloads/en/DeviceDoc/39598F.pdf" target="_blank">PIC16F818</a>. The library I wrote should work on most of 8-bit PICs.</p><p>The datasheet for the TM1637 is written in terrible english and is not very easy do decipher. An there was another problem with my module. The DIO and CLK buses are connected with 10k resistors to the Vdd and it is supposed only to drive the lines down. The datasheet recommend to connect two 100pF capacitors between each bus and the ground for filtering the noise. The manufacturer however decided to put 10nF there, which is 100 times higher. Of course this make driving the lines fast impossible. I replaced these capacitors with 82pF, but because mine were bigger (0805 instead of 0603) I had to solder them on the narrow side:</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEjop6zikwIAaXT9eD5rTatmNPEE8uveD54_Nio-UFF17Dzes2ElaG-pS23qVugikI0mu8pxbF_0VdStOEpMBcOSPE-47HzuF2Xptcr-FSF4pJ5rtXLCjwIaNMLgluKWvUOp-JnzGd4nWk0R96-9idcIhwpaudD4bUia9KzAfDN3gbBEhTnvPrzOhAG81Q=s1600" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1200" data-original-width="1600" height="480" src="https://blogger.googleusercontent.com/img/a/AVvXsEjop6zikwIAaXT9eD5rTatmNPEE8uveD54_Nio-UFF17Dzes2ElaG-pS23qVugikI0mu8pxbF_0VdStOEpMBcOSPE-47HzuF2Xptcr-FSF4pJ5rtXLCjwIaNMLgluKWvUOp-JnzGd4nWk0R96-9idcIhwpaudD4bUia9KzAfDN3gbBEhTnvPrzOhAG81Q=w640-h480" width="640" /></a></div><p>The microcontroller runs with 30 MHz crystal, so it has no problem with fast driving when there are correct capacitors on the module. In the library there are commented lines with delay subroutines, if uncomment these lines the library will work slower and will drive the module with its original capacitors.</p><p>I did not include a schematic, because the connection is very simple - DIO connects to one of the digital IO pins of the microcontroller and the CLK connects to another digital IO pin. In my demo CLK is connected to RA0 and DIO is connected to RA1. 5V and GND obviously connects to VDD and GND.</p><p>Here a short video demonstrating how it works:</p><p style="text-align: center;"><iframe allowfullscreen="" height="315" id="odysee-iframe" src="https://odysee.com/$/embed/TM1637_demo/d11e3c437ce08052b266123cf28cb15f29a1f8f1?r=424EpYmR7rqikUUegDcVRJJ8h8nCcEbg" width="560"></iframe></p><div>I will add the code of the library shortly (should add comments and such :( )</div><div><br /></div><div><b>UPDATE (30.01.2022)</b></div><div>I tested the library with PIC16F818, PIC16F628A and PIC16F1847 and everything is working.</div><div>I included the short demo code for PIC16F628A in the archive file. The library is written with C language on MPLAB X IDE v.6.00.</div><div><b>Download</b>: <a href="https://tinyurl.com/TM1637d" target="_blank">TM1637</a></div>Христоhttp://www.blogger.com/profile/14002909704834630953noreply@blogger.com2tag:blogger.com,1999:blog-4191887753331304313.post-11587960468676935122020-09-08T23:30:00.001+03:002020-09-25T12:57:25.286+03:00Power supply replacement for FY6900 function generator<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-V3UD4TLJJ4qSkOLsN71_5F2aSJssJfg4Am_etDVnTdqVOyqQn3fAnRv9SHpbNQwbMmEMv71BTenyS7-sXpMmhZqQpfjP4-QCwSDnHlU05SkTMy9U4xvnT17vitW29OYvuA51cfezr-xu/s2000/FY6900%25281%2529.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1322" data-original-width="2000" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-V3UD4TLJJ4qSkOLsN71_5F2aSJssJfg4Am_etDVnTdqVOyqQn3fAnRv9SHpbNQwbMmEMv71BTenyS7-sXpMmhZqQpfjP4-QCwSDnHlU05SkTMy9U4xvnT17vitW29OYvuA51cfezr-xu/s320/FY6900%25281%2529.JPG" width="320" /></a></div><p>Recently I bought an function generator from Banggood. I chose the FeelElec FY6900-60M. In the internet I found many projects for replacing the original switching power supply. The benefits are questionable, but I thought it will be fun little project to make. <span></span></p><a name='more'></a><p></p><p>I decided to go for full linear voltage regulation with standard isolation transformers. The voltages of the original PSU was +13.6V/-13.6V/+5V. I measured the current consumption for different rails and for +5V it was near 0.5A and for +13.6V and - 13.6V it was bellow 0.2A. These was measured with both channels at 24Vpp and loaded with 47 Ohm resistors. </p><p>It would be convenient to have a single 20-25VA transformer with three secondary windings: 2 x 14-15Vac and 7-9Vac but I couldn't find such transformer, so I had to use 2 separate transformers - one 2 x 15Vac/0.66A (20VA) and one 2 x 7V/0.42A (6VA). The secondary windings of the second transformer are connected in parallel for doubling the current rating.</p><p>The obvious choice for voltage regulators was LM317T and LM337T for ±13.6V rails but these required minimum 3V difference between input and output to regulate properly. This mean the minimum input voltage must be at least 16.6V and I was not sure what would be the minimum rectified voltage of my transformer when taking into account the ripple. So I decided to use 7812 and 7912 voltage regulators with 3 diodes in series to the ground pin to lift the output voltage to 13.6-14V. These regulators have less dropout voltage (2V for 7812 and 1.1V for 7912). I also used Schottky diodes for the bridge rectifiers to further reduce voltage drop before the regulators. The schematic I designed is bellow:</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBaRkiLcBW5YGUt_-EZ25csN7Q2Bit3LsmrhC5bHS_Nzuz76B-bhcIjH6OGEH2WvszCdD-y0f9CoWrbnl2N8XdGHbHUldJtag3OuKFTkqcbOeFABbsObCb1acVnU4jRVjb9-wAl52Btb4J/s2260/PSU_schematic.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1960" data-original-width="2260" height="544" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBaRkiLcBW5YGUt_-EZ25csN7Q2Bit3LsmrhC5bHS_Nzuz76B-bhcIjH6OGEH2WvszCdD-y0f9CoWrbnl2N8XdGHbHUldJtag3OuKFTkqcbOeFABbsObCb1acVnU4jRVjb9-wAl52Btb4J/w625-h544/PSU_schematic.png" width="625" /></a></div><br /><p>The circuits for +13.6V and -13.6V are almost identical with the only difference is the resistor R1 which equalize the current through diodes because the 7812 have higher quiescent current than 7912. Probably can be omitted.</p><p>The output voltage can be tuned by replacing some of 1N4148 with Schottky diodes (BAT42). With 3 x 1N4148 the output voltage will be 12V + 3*0.7V = 14.1V. If we replace one 1N4148 with Schottky the output voltage will be 12V + 2*0.7V + 0.3V = 13.7V</p><p>The +5V rail use 7805 voltage regulator connected in typical manner. </p><p>The final result is satisfactory. The measured voltages are +13.7/-13.5/+4.96. The power supply generate too much heat to be left with passive cooling so in the PCB I included connector for a fan before 5V regulator. The voltage there is around 9-10V and I purchased very quiet 40mm/12V fan which is almost inaudible. </p><p>Here some pictures of the power supply:</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVld8CF3nzUBc6CwU59Por8pOXOWan_T0_KdwzpXbLLn0GgilTy3uN3qINgE-L82__Q0-RtBHlI2XetY9UvHHTAZZChHevADjpCA45BGpNkU-CjKfAYWKxMSzJzA0xtfqh1wKR34zjESSX/s2000/FY6900%25282%2529.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1446" data-original-width="2000" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVld8CF3nzUBc6CwU59Por8pOXOWan_T0_KdwzpXbLLn0GgilTy3uN3qINgE-L82__Q0-RtBHlI2XetY9UvHHTAZZChHevADjpCA45BGpNkU-CjKfAYWKxMSzJzA0xtfqh1wKR34zjESSX/s320/FY6900%25282%2529.JPG" width="320" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgzJ8iRdnjvE12VnJMmdRz3DMDmoQDxpKlCNdb3oDxHUmLhdNxsYVmoc1J4DsCWzK5L2kONNLhkGLVTUTF_G6lwF6kAQBe_XZ0LWcXBQi7LMyne899ssSG3ajH9BPjrf0B8k71mLYVi7_d7/s2000/FY6900%25284%2529.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1410" data-original-width="2000" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgzJ8iRdnjvE12VnJMmdRz3DMDmoQDxpKlCNdb3oDxHUmLhdNxsYVmoc1J4DsCWzK5L2kONNLhkGLVTUTF_G6lwF6kAQBe_XZ0LWcXBQi7LMyne899ssSG3ajH9BPjrf0B8k71mLYVi7_d7/s320/FY6900%25284%2529.JPG" width="320" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3n8JMIQNCAbf86Qx-P_NR1aWKBWjQrYDcbJK5CR9US9cA7pBuFR6SBzhWtw-GrLE1jhwB8UnNQ_9bHHPCrySoaPyuGdVWc1S-InqmQqPRdAFfpm2ovAebB9uB8AjeOA5csIUWXDrtm-LW/s2000/FY6900%25283%2529.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="2000" data-original-width="1748" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3n8JMIQNCAbf86Qx-P_NR1aWKBWjQrYDcbJK5CR9US9cA7pBuFR6SBzhWtw-GrLE1jhwB8UnNQ_9bHHPCrySoaPyuGdVWc1S-InqmQqPRdAFfpm2ovAebB9uB8AjeOA5csIUWXDrtm-LW/s320/FY6900%25283%2529.JPG" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://1.bp.blogspot.com/-SWLgta45r5k/X1fg_FPs7hI/AAAAAAAAC0g/X73Hn0GzXdsKxZJ6q6e05yXf0DGsK3TEACPcBGAsYHg/s2000/FY6900%25285%2529.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1435" data-original-width="2000" src="https://1.bp.blogspot.com/-SWLgta45r5k/X1fg_FPs7hI/AAAAAAAAC0g/X73Hn0GzXdsKxZJ6q6e05yXf0DGsK3TEACPcBGAsYHg/s320/FY6900%25285%2529.JPG" width="320" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUHKCPAFlzt0fDjwhN9caw0rDq0-O0mA78DRGELeXuCEutiWs0d-NdjvULIXWAbwwv4i_kL5zOTDDVJ5Z90DVVIrkEcWpYkiQLEyLjNwsShkMfi8QuuHk7Q-73oIyFvdpg_R8Ie9gmlnH6/s2000/FY6900%25286%2529.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1413" data-original-width="2000" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUHKCPAFlzt0fDjwhN9caw0rDq0-O0mA78DRGELeXuCEutiWs0d-NdjvULIXWAbwwv4i_kL5zOTDDVJ5Z90DVVIrkEcWpYkiQLEyLjNwsShkMfi8QuuHk7Q-73oIyFvdpg_R8Ie9gmlnH6/s320/FY6900%25286%2529.JPG" width="320" /></a></div><p>Now this generator have some weight and doesn't feels like a toy :)</p><p>BTW, the black transformer happens to block the holes for the handle/stand and I had to cut it a little in order to fit back.</p><p>Also keep in mind that the tab of the 7812 is connected to the ground pin, but on the 7912 it is connected to the input pin, so if both regulators have to be mounted on one heat sink there must be insulation on one or both regulators. I used mica insulators and plastic washers on both regulators. </p><p>If there is interest I can put the files for the project for downloading. </p>Христоhttp://www.blogger.com/profile/14002909704834630953noreply@blogger.com7tag:blogger.com,1999:blog-4191887753331304313.post-51033201600973521472020-07-06T01:17:00.005+03:002022-02-11T19:57:31.069+02:00100 MHz third overtone crystal oscillatorCouple of years ago I purchased from a local store 100 MHz crystal resonator and tried several times to make a working schematic on breadboard using standard circuits I found on the internet. It never worked good enough, usually oscillating at 33.3 MHz instead of 100 MHz. Finally, I found that the crystal is third overtone type. Here some documents, that were useful for this project:<br />
<div>
1. <a href="https://www.analog.com/media/en/technical-documentation/application-notes/EE-168.pdf">https://www.analog.com/media/en/technical-documentation/application-notes/EE-168.pdf</a></div>
<div>
2. <a href="https://www.crystek.com/documents/appnotes/pierce-gateintroduction.pdf">https://www.crystek.com/documents/appnotes/pierce-gateintroduction.pdf</a></div>
<div>
3. <a href="http://www.conwin.com/pdfs/EP-3rd-Overtone_April-2013.pdf">http://www.conwin.com/pdfs/EP-3rd-Overtone_April-2013.pdf</a></div>
<div>
<br /></div>
<div>
I used as a base the schematic from first document and here what I design:</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-Vnlf4ZqLZvg/XwJQ0wBg2dI/AAAAAAAACvA/MsPNBKswGhI7U84CnWIRvImSx7OVgrIEgCK4BGAsYHg/s847/100MHz_sch1.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="498" data-original-width="847" height="368" src="https://1.bp.blogspot.com/-Vnlf4ZqLZvg/XwJQ0wBg2dI/AAAAAAAACvA/MsPNBKswGhI7U84CnWIRvImSx7OVgrIEgCK4BGAsYHg/w625-h368/100MHz_sch1.png" width="625" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<a name='more'></a><br />
<div>
The schematic is traditional Pierce crystal oscillator with the addition of an inductor in parallel with C2 which should block the fundamental frequency of the crystal and allow it to oscillate at 3-th overtone frequency (3 x fundamental frequency).</div>
<div>
<br /></div>
<div>
The actual schematic which I used is this:</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihbgb4S2U_8OVHxFnVBaTErDdAd0G6DV3gMB3s4FBeoSzAh3_wqkWhQtRLZWS6YD3Gj3eCydRpMJydxhk0HGNjVLxfR1UtVB9hTf11PDYbQXHkP_1ICdoprG-ipLdqRY7PgkH4d04KcGl9/s903/100MHz_schematic.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="843" data-original-width="903" height="585" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihbgb4S2U_8OVHxFnVBaTErDdAd0G6DV3gMB3s4FBeoSzAh3_wqkWhQtRLZWS6YD3Gj3eCydRpMJydxhk0HGNjVLxfR1UtVB9hTf11PDYbQXHkP_1ICdoprG-ipLdqRY7PgkH4d04KcGl9/w625-h585/100MHz_schematic.png" width="625" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div>
<br /></div>
<div>
It is very simple circuit and the idea was to solder a female pin headers and then to put capacitors, inductor and feedback resistor on them and try different values until the circuit work stable, and then remove the pin headers and solder the element permanently on the board. The schematic have 5V voltage regulator allowing it to work with supply voltages from 7V to 12V. In case we want to use 5V there can be put jumper between pin 4 and 5 of JP3 which effectively bypass the voltage regulator. The schematic use very fast variant of 7404 hex inverter - 74AHC04 which have propagation delay below 10ns. The oscillator is build with one of the inverters and the rest of them are connected as a buffer with 50 ohm output impedance.</div>
<div>
<br /></div>
<div>
In the first document there is a bunch of formulas to calculate the values of the elements, but in the end the circuit didn't work with calculated values. The values with which it worked are:</div>
<div>
C1 = 20pF, C2 = 20pF, C3 = 1nF, L = 0.32uH, Rfb = 100k. </div>
<div>
C3 is for DC blocking and its value is not critical - can be anything between 1 nF and 100 nF.</div>
<div>
<br /></div>
<div>
The output frequency (according to my oscilloscope) is 100.017 MHz, which is OK.</div>
<div>
Is it worth the hassle? No. On ebay or aliexpress you can buy 100 MHz active crystal oscillator for a dollar. In fact I ordered 5 pcs to compare them to my schematic. But I made it as a proof of concept and I am happy it finally worked.</div>
<div>
<br /></div>
<div>
Here some additional pictures:</div>
<div>
<br /></div>
<div>
<table border="1" bordercolor="#888" cellspacing="0" style="border-collapse: collapse; border-color: rgb(136, 136, 136); border-width: 1px;"><tbody>
<tr><td style="min-width: 60px;"><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxJ76hs-vBwNqiHnLn8VVH5S2eBfGgI8MQD-tw1yv-uBUcAlw1FUEiIaWuU377E2StLiJAqDZLP8n8Y2kH-3Hu1ctizmGI3iiT7QReVJvsTX8BLXp8PZHMCwUOgc6xNTrr7wjQYVWmtBe_/s2000/100MHz_module1.JPG" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" data-original-height="1494" data-original-width="2000" height="239" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxJ76hs-vBwNqiHnLn8VVH5S2eBfGgI8MQD-tw1yv-uBUcAlw1FUEiIaWuU377E2StLiJAqDZLP8n8Y2kH-3Hu1ctizmGI3iiT7QReVJvsTX8BLXp8PZHMCwUOgc6xNTrr7wjQYVWmtBe_/w320-h239/100MHz_module1.JPG" width="320" /></a></div>
</td><td style="min-width: 60px;"><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-cIJfsU8cb5s/XwJBVScTzzI/AAAAAAAACtk/eHtCmKyw5EQduqOR3jKafi2DTuW5cfBGACK4BGAsYHg/s2000/100MHz_module2.JPG" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" data-original-height="1463" data-original-width="2000" height="234" src="https://1.bp.blogspot.com/-cIJfsU8cb5s/XwJBVScTzzI/AAAAAAAACtk/eHtCmKyw5EQduqOR3jKafi2DTuW5cfBGACK4BGAsYHg/w320-h234/100MHz_module2.JPG" width="320" /></a></div>
</td></tr>
<tr><td style="min-width: 60px;"><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvlbXbDU5ljoPq5VNbibTbHhW5jYSOc8PAhHlSVW2TBJ0lGGgn_n1ArnDCgTlUnvZlnhFNdfdH_mRabS_2Wv-FNuuL8NViRc-4IV9xNp7PtNZ4JCtKZFBKXSavL2CtuEaE2uWUdjKjzqSY/s2000/100MHz_module3.JPG" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" data-original-height="1420" data-original-width="2000" height="227" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvlbXbDU5ljoPq5VNbibTbHhW5jYSOc8PAhHlSVW2TBJ0lGGgn_n1ArnDCgTlUnvZlnhFNdfdH_mRabS_2Wv-FNuuL8NViRc-4IV9xNp7PtNZ4JCtKZFBKXSavL2CtuEaE2uWUdjKjzqSY/w320-h227/100MHz_module3.JPG" width="320" /></a></div>
</td><td style="min-width: 60px;"><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTL0DfdSjl85HxmKHNjPO4Y-NFD10XdSpbx6-yjnAVKS1sE11C_CFzf44pQxAHq_OHYFTSohdXIDqPCNBjPZD2xiVSgyZZRb1JLBLAuQrLbC2qv6osQuMGxF8P5tkaEq3KWTM5g3Nbt826/s2000/100MHz_oscilloscope.JPG" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" data-original-height="1330" data-original-width="2000" height="213" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTL0DfdSjl85HxmKHNjPO4Y-NFD10XdSpbx6-yjnAVKS1sE11C_CFzf44pQxAHq_OHYFTSohdXIDqPCNBjPZD2xiVSgyZZRb1JLBLAuQrLbC2qv6osQuMGxF8P5tkaEq3KWTM5g3Nbt826/w320-h213/100MHz_oscilloscope.JPG" width="320" /></a></div>
</td></tr>
</tbody></table>
</div>
<div>
<br /></div>
<div>
The signal waveform is supposed to be square, but my oscilloscope is only 70 MHz, and anything above 50-60 MHz shows as sine wave.</div>
<div>
<br /></div>
<div>
The Gerber files for this project can be downloaded from here: <a href="https://bit.do/fTs3E">Link</a></div>
Христоhttp://www.blogger.com/profile/14002909704834630953noreply@blogger.com5tag:blogger.com,1999:blog-4191887753331304313.post-71658508298392670042019-03-20T12:26:00.009+02:002022-02-22T02:44:50.649+02:00Simple Digital Clock with PIC16F628A and DS1307 and 7-Segment LED displayIn this new project I am again using <a href="http://ww1.microchip.com/downloads/en/DeviceDoc/40044G.pdf">PIC16F628A </a>microcontroller. The goal is simple digital clock with 7-segment LED display and the clock will have no additional functionality - no alarm, no seconds digits, no date. The latter can be added in the software though. For the RTC chip I chose <a href="https://datasheets.maximintegrated.com/en/ds/DS1307.pdf">DS1307</a>. For the LED display I used <a href="https://www.kingbrightusa.com/images/catalog/SPEC/CC56-21SRWA.pdf">Kingbright CC56-21SRWA. </a><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjL15wu_0NtjXLwilxs7nUpVHlB0_sk-pEbF151S0RyDG0z8JAwKHnE8GF3AMFD_DGN5mlzZM4p5n3NdS24DgqTQ0r417vpphVSDQEWaM3KtdgZZYiR34vNQai-BLS4jT6Ohx-5JlCU0pwZ/s1600/Schematic.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="856" data-original-width="1600" height="342" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjL15wu_0NtjXLwilxs7nUpVHlB0_sk-pEbF151S0RyDG0z8JAwKHnE8GF3AMFD_DGN5mlzZM4p5n3NdS24DgqTQ0r417vpphVSDQEWaM3KtdgZZYiR34vNQai-BLS4jT6Ohx-5JlCU0pwZ/s640/Schematic.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<a name='more'></a><br />
This is the schematic I concocted. The microcontroller works with it's internal oscillator at 4 MHz to save 2 extra pins. Reset pin (MCLR) is also used as input for one of the buttons. All segments are connected to PORTB and COMs are connected to PORTA. RTC chip is also connected to PORTA.<br />
The schematic is extremely simple and I assembled it on a breadbord for a quick test:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-FB_WXLMlq2oZpfiVDQaRWci6x8NC0TYV2CvoK88RKwDoF_KXKRe2pH-uGZMUuaYx-aNzUmGIHqKnjw_qWdPkM13UgKE8p0CWy6ffzv0yLCfz9NKMQKpJAZX7kJH2VF-iHlBvWyv2CCVq/s1600/DigiClock1.JPG" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1064" data-original-width="1600" height="424" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-FB_WXLMlq2oZpfiVDQaRWci6x8NC0TYV2CvoK88RKwDoF_KXKRe2pH-uGZMUuaYx-aNzUmGIHqKnjw_qWdPkM13UgKE8p0CWy6ffzv0yLCfz9NKMQKpJAZX7kJH2VF-iHlBvWyv2CCVq/s640/DigiClock1.JPG" width="640" /></a></div>
<br />
It worked as expected. The refresh rate of the digits is about 53Hz and there is no visible flickering. Because of the multiplexing the digits are dimmer and to compensate this the current through segments must be higher. I tested it with different values for current limiting resistors R1-R7 and below 220 Ohm the microcontroller starts to misbehave - some of the digits start to flicker. 220 Ohm and above seems OK. The two dots in the middle are connected to the SQW pin of the DS1307. This pin is configured as 1 Hz square wave output. It is an open drain output, so in order to work it has to have pull-up resistor. I searched and didn't find anywhere information about current capability of this pin. I tested with 330 and 470 Ohm and it didn't burn :) To be on the safe side I left the 470 Ohm one - it's a little dimmer than the rest of the segments, but still well visible.<br />
There are two buttons for adjusting the time - one for the hours and one for the minutes.<br />
There is one unused pin left - RB7, which can be used for additional functionality. For example a buzzer can be connected and an alarm function can be added to the software.<br />
<br />
The software is written and compiled with MikroC Pro and uses its build in software I2C library for communicating with RTC chip. If someone wishes to use MPLAB software for compiling the code he should write his own I2C functionality from scratch. <br />
Here is a short video demonstrating how it works:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/Vgwu8VHBLL8/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/Vgwu8VHBLL8?feature=player_embedded" width="320"></iframe></div>
<br />
<br />
Software code and HEX file: <a href="https://tinyurl.com/DigClock">DigitalClock</a><br />
If you use PICkit 3 standalone software to upload HEX code to the microcontroller, then in the "Tools" menu check the option "Use VPP First Program Entry".<br />
<br />
<br />
<b>Update: June 30, 2020</b><br />
This clock (with improved schematic) is available for purchase at <a href="https://www.tindie.com/products/fandorin/digital-led-clock/">tindie.com</a><br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/xb0sy7Y_l_k/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/xb0sy7Y_l_k?feature=player_embedded" width="320"></iframe></div>
<div><br /></div>Христоhttp://www.blogger.com/profile/14002909704834630953noreply@blogger.com14tag:blogger.com,1999:blog-4191887753331304313.post-33672566944382592142019-03-08T01:44:00.000+02:002019-03-08T01:44:33.883+02:003-wire fan adapter with fake 'tach' signalThis is a quick small project that I design this evening. My wife complained about loud fan in her computer, so I purchased the quieter fan I can find in Sofia - <a href="https://www.digikey.com/product-detail/en/sunon-fans/HA80251V4-000U-999/259-1619-ND/3694186">SUNON <span class="name" itemprop="name">HA80251V4-000U-999.</span></a><br />
<span class="name" itemprop="name">It's only 22 dB noise but unfortunately it is two-wire fan without yellow tach signal wire. The computer will work fine but at every startup it will beep some fan error and will require </span><span class="name" itemprop="name"><span class="tlid-translation translation"><span class="" title="">confirmation to continue.</span></span></span><br />
<span class="name" itemprop="name">I spend some time researching the subject and found that the tach signal is square wave signal and usually have two pulses for every rotation. So the frequency of the signal will be: F = (RPM / 60) x 2. </span><br />
<span class="name" itemprop="name">For example a 2000 RPM fan will have 67 Hz tach signal. </span><br />
<span class="name" itemprop="name">One unusual thing about 3-wire fans is that the tach wire is connected as open collector.</span><br />
<span class="name" itemprop="name"><br /></span>
<span class="name" itemprop="name">The solution is very simple - small adapter board with square wave oscillator followed by a NPN transistor with open collector. The frequency of the oscillator is not that important - from 33 Hz imitating 1000 RPM fan to 200 Hz for 6000 RPM fan. I chose the classic two transistor astable multivibrator:</span><br />
<br />
<span class="name" itemprop="name"></span><br />
<div class="separator" style="clear: both; text-align: center;">
<span class="name" itemprop="name"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjwoK8M9-36DDC7ZJUCd08t5fa3XOIheKeDZql92KtIw7M3QPoIUdbpZrfKdi0tc1hC2rHvi-g18IAu36P7SKyMGBjSp9BCzFiA2XyuxVkiQ8h-Xun8t4ngBy2YJxUopJM5FyLQiHBz-GDl/s1600/Schematic.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="604" data-original-width="1084" height="356" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjwoK8M9-36DDC7ZJUCd08t5fa3XOIheKeDZql92KtIw7M3QPoIUdbpZrfKdi0tc1hC2rHvi-g18IAu36P7SKyMGBjSp9BCzFiA2XyuxVkiQ8h-Xun8t4ngBy2YJxUopJM5FyLQiHBz-GDl/s640/Schematic.png" width="640" /></a></span></div>
<span class="name" itemprop="name"><span id="goog_952218409"></span><span id="goog_952218410"></span></span><br />
<span class="name" itemprop="name"><br /></span>
<span class="name" itemprop="name">I soldered the components on a small piece of perfboard. The fan doesn't come with a connector but only with two strip wires, which I soldered directly to the board. On the other side I soldered standard 3-wire cable with molex connector. The adapter worked as expected - the computer recognized the fan and started without problems. I checked with <a href="https://www.hwinfo.com/download/">HWiNFO</a>, and the program reported around 2600 RPM for this fan. </span><br />
<span class="name" itemprop="name"><br /></span>
<span class="name" itemprop="name">This adapter can also be used entirely without a fan - the computer will still think there is a fan connected. Of course if your CPU burn out it will be only your fault :)</span>Христоhttp://www.blogger.com/profile/14002909704834630953noreply@blogger.com1tag:blogger.com,1999:blog-4191887753331304313.post-78914947959239292752019-02-08T03:25:00.000+02:002019-03-08T01:47:26.890+02:00Push button ON/OFF + Soft start v.3This is a revamping of an old project: <a href="https://diyfan.blogspot.com/search/label/soft%20start" target="_blank">"Two versions of soft sart"</a>. There were reports in the comments that the circuit doesn't always work. I have tried myself on a breadboard and indeed - the schematic works with chips from Nexperia and doesn't work with chips from other manufacturers. The problem is in the input stage of the schematic - the push button. There is a capacitor in parallel to smooth the bouncing of the contacts but the pulse gets too long and is registered by 4027 clock input as more than 1 impulse. Without the capacitor schematic will work if the push button is high quality, otherwise, again the 4027 will detect more than 1 input signals. To combat this problem I tried different methods an here I present two of them.<br />
<br />
<a name='more'></a><br />
I added a debouncing stage to deal with the contact bouncing followed by an inverter with Schmitt trigger to produce a nice sharp impulse:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-jHYBr8WkoEs/XFzTcbwfbQI/AAAAAAAACQ8/uTx3XPPAqqggC1XsqjSLcvpFkASUWEoYgCKgBGAs/s1600/SoftStart%2B%2528v3.0%252C%2BSchematic%2529.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="832" data-original-width="1600" height="332" src="https://1.bp.blogspot.com/-jHYBr8WkoEs/XFzTcbwfbQI/AAAAAAAACQ8/uTx3XPPAqqggC1XsqjSLcvpFkASUWEoYgCKgBGAs/s640/SoftStart%2B%2528v3.0%252C%2BSchematic%2529.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
This schematic have another variant in which the second relay is operated with another one of the inverters instead of the second J-K flip-flop of 4027:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMsAuX1qd6Hw7Uo-Id3iN6RoiZVdLw0CP6M1C1oGet_Hn3SnragWUzhnUHljLPJvQyRDz4LviPFkbJGo1q4BEZA9XzK8SJm1cWwZ1gvU24ClM9BWlD4Jtc7GIpCe6XSwJ3QIt3ai7_QAms/s1600/SoftStart+%2528v3.0a%252C+Schematic%2529.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="906" data-original-width="1600" height="362" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMsAuX1qd6Hw7Uo-Id3iN6RoiZVdLw0CP6M1C1oGet_Hn3SnragWUzhnUHljLPJvQyRDz4LviPFkbJGo1q4BEZA9XzK8SJm1cWwZ1gvU24ClM9BWlD4Jtc7GIpCe6XSwJ3QIt3ai7_QAms/s640/SoftStart+%2528v3.0a%252C+Schematic%2529.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
Because it is inverter, the input is connected to the inverted output of the first J-K flip-flop and the diode D2 is reversed.<br />
Using only one or two of the six inverters is a bit of a waste. There is an interesting chip <a href="http://rohmfs.rohm.com/en/products/databook/datasheet/ic/logic_switch/standard_logic/bu4s584g2-e.pdf" target="_blank">BU4S584G2</a> - a single inverter with Schmitt trigger, that can be used instead of the hex inverter 40106.<br />
<br />
The third variant is using two transistors as input stage instead of inverter with Schmitt trigger:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiVynyTbvRoEl7GxDOhflTqkaivKME1J8JumVHobRiGn-J5JbxcaJsx8DG97C8Nd0xVbOZ1bRy82nYoLPNDPCMPd04Aue7u6J2n06-ewE4x2wcqqe-ffRGel_k2lmJoLP7fhZ8tL2cW0-iL/s1600/SoftStart+%2528v3.2b%252C+Schematic%2529.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="897" data-original-width="1600" height="358" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiVynyTbvRoEl7GxDOhflTqkaivKME1J8JumVHobRiGn-J5JbxcaJsx8DG97C8Nd0xVbOZ1bRy82nYoLPNDPCMPd04Aue7u6J2n06-ewE4x2wcqqe-ffRGel_k2lmJoLP7fhZ8tL2cW0-iL/s640/SoftStart+%2528v3.2b%252C+Schematic%2529.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
These three schematics was tested on breadboard with 4027 from different manufacturers and work without problems.<br />
So, how they work? When the circuit is connected to the power, the Reset pin will be shorted through the capacitor to the positive rail and the first J-K flip-flop will stay low until capacitor is charged and all transition processes finish. When the push button is pressed an impulse will be send to the clock input of the J-K flip-flop. It doesn't matter if the impulse is low-high-low or high-low-high. In the first case the J-K flip-flop will toggle at the beginning of the impulse (when push button is pressed) and in the second - will toggle at the end of the impulse (when the push button is released).<br />
When the first J-K flip-flop is switched high the first relay is turned on and the load is connected through the power resistors to the mains thus limiting the inrush current. <br />
The capacitor C7 connected to the Set pin of the second J-K flip-flop start to charge through a resistor until the voltage is high enough to toggle the output to high and turn on the second relay. The second relay shorts the power resistors and the load is connected directly to the mains.<br />
The second push to the button will switch off the first J-K flip-flop and the first relay. The capacitor connected to Reset pin of the second J-K flip-flop will discharge instantaneously through the diode D2 and the second J-K flip-flop will switch off, releasing the second relay.<br />
The delay of the second relay is determined by capacitor C7 and the resistor connected to it. with 10 MOhm and 100nF the delay time is about 0.8 seconds. The same time will be achieved with 1 MOhm resistor and 1uF capacitor. Delay more than 1 second usually is not needed.<br />
Schematics work with power supply from 5 to 15 V. The transformer should be select according to the desired DC voltage. For 5VDC transformer with 7-9VAC will do the job and for 12VDC transformer with 12-15VAC will be perfect. The voltage regulator also must be select accordingly. Of course the relays also must match the DC supply voltage.<br />
<br />
Here are the files for the project including Gerber files. The third variant is entirely with through hole elements and one sided board. Other two are two sided boards with mixed TH and SMD elements, but there are only couple of tracks on the top side, which can be replaced with wire bridges and thus the boards can be made one sided.<br />
<b>Download link:</b> <a href="http://bit.ly/2WOLlud" target="_blank">SoftStart v.3</a> <br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/rd8EuU5J5K8/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/rd8EuU5J5K8?feature=player_embedded" width="320"></iframe></div>
<div style="text-align: center;">
This is demonstration of the third variant on a breadboard.</div>
Христоhttp://www.blogger.com/profile/14002909704834630953noreply@blogger.com2tag:blogger.com,1999:blog-4191887753331304313.post-22637897061329089982017-04-08T15:08:00.000+03:002019-01-29T23:10:46.292+02:00Download links problemHi there,<br />
<br />
From some time now the links for downloading project files in my blog are not working. This is because most of them are from dropbox and they for some reason changed their sharing policy and now all public links has been disabled and I must edit all the links one by one. Things get further complicated because I use URL shortening service (bit.ly), and long story short - it will take some time to fix all the links.<br />
<br />
<b>UPDATE: September 08, 2017</b><br />
Most of the links are now fixed.<br />
<br />
<b>UPDATE: 29.01.2019</b><br />
Fixed some more dead links and for some of the projects I also added Gerber files.<br />
If there are still dead links, let me know.<br />
<br />
Hristo. Христоhttp://www.blogger.com/profile/14002909704834630953noreply@blogger.com2tag:blogger.com,1999:blog-4191887753331304313.post-21909222941625610362015-09-23T03:18:00.000+03:002017-04-08T14:33:49.117+03:00100MHz frequency counter with LCD display<br />
<b>Update November 26, 2015: </b><br />
I made a full project with preamp/signal conditioning and power supply with soft on/of switch. It is published <a href="http://www.electronics-lab.com/project/100mhz-frequency-counter-with-pic16f628a-2/" target="_blank">here</a>. <br />
<br />
<br />
---------------- <br />
This is the same as the previous frequency counter but the output is on the 16x2 LCD display.<br />
For more details about how it work look here: http://diyfan.blogspot.bg/2015/08/100mhz-frequency-counter.html<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-P1LJL3bCgZc/VgGfYOZIQeI/AAAAAAAABO0/jMddvILGZB4/s1600/FreqCounter%2528LCD%252CSchematic%2529.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="390" src="https://4.bp.blogspot.com/-P1LJL3bCgZc/VgGfYOZIQeI/AAAAAAAABO0/jMddvILGZB4/s640/FreqCounter%2528LCD%252CSchematic%2529.png" width="640" /></a></div>
<br />
<br />
<a name='more'></a><br />
Bellow are pictures and short video, showing the frequency counter in action. As my oscilloscope is with only 70Mhz bandwidth, the 110+ MHz signal looks like sinusoidal, but it is probably not.<br />
I generate the test signal with SN74HC00N connected in this way:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-Yo6xukKM6gU/VgHqJLs4w7I/AAAAAAAABPo/wh6yIQIloaQ/s1600/signalgenerator.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="228" src="https://1.bp.blogspot.com/-Yo6xukKM6gU/VgHqJLs4w7I/AAAAAAAABPo/wh6yIQIloaQ/s320/signalgenerator.jpg" width="320" /></a></div>
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgWT11Q2hMh1DetJJXIKl5IfO-F29qKt8ilBqjjqlSgjW8OHGpnL6nUgiZjJDIJI7qy4oSBBzuEbwtUuptsaWC9oCwzQBk4QkXbDKnQLyhYkuY2dGlRc8hgQqTOlsg6U9a4_rs64z6DIhKI/s1600/114MHz.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgWT11Q2hMh1DetJJXIKl5IfO-F29qKt8ilBqjjqlSgjW8OHGpnL6nUgiZjJDIJI7qy4oSBBzuEbwtUuptsaWC9oCwzQBk4QkXbDKnQLyhYkuY2dGlRc8hgQqTOlsg6U9a4_rs64z6DIhKI/s640/114MHz.jpg" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvbw3DuoK7Win5a1qr7f7fT4dVPv7Iy67C-A2fyVWku6OV2WYwis7cNwx18ETrHK2HYosZcSYyiTqxulJO2LWRr_qvk9f1cGC4kqyjpQ-InMMxepfS0u3FemFW5k5Zu-oepLg2efh1X43C/s1600/117MHz.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvbw3DuoK7Win5a1qr7f7fT4dVPv7Iy67C-A2fyVWku6OV2WYwis7cNwx18ETrHK2HYosZcSYyiTqxulJO2LWRr_qvk9f1cGC4kqyjpQ-InMMxepfS0u3FemFW5k5Zu-oepLg2efh1X43C/s640/117MHz.jpg" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: left;">
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/tOO-NKiTwco/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/tOO-NKiTwco?feature=player_embedded" width="320"></iframe></div>
<br />
Source code and HEX file can be downloaded here: <a href="http://bit.ly/FreqC-LCD" target="_blank">http://bit.ly/FreqC-LCD</a><br />
<br />
<br />
<br />
<br />Христоhttp://www.blogger.com/profile/14002909704834630953noreply@blogger.com10tag:blogger.com,1999:blog-4191887753331304313.post-41213543122658421612015-08-05T01:58:00.000+03:002020-05-07T14:22:11.881+03:00100MHz frequency counterCouple of weeks ago I purchased from eBay one of these amazingly cheap an useful modules with <a href="http://www.ebay.com/sch/i.html?_from=R40&_trksid=p2047675.m570.l1313.TR0.TRC0.H0.XMAX7219+8-Digit.TRS0&_nkw=MAX7219+8-Digit&_sacat=0" target="_blank">MAX7219</a> LED driver and 8 digit LED display. It is ideal for frequency counter project. The problem was the absence of library for PIC microcontrolers. Luckily, I found a <a href="http://ee.cleversoul.com/max7219.html" target="_blank">great library</a> for Arduino and I reworked it to be compatible with PIC. The schematic of the frequency counter is actually almost the same as the <a href="http://diyfan.blogspot.com/2014/08/frequency-counter-with-pic16f628a.html" target="_blank">previous </a>. It uses PIC16F628A microcontroller with external 32.768kHz watch crystal attached to Timer1 to generate 1 second time base. Measured signal is fed to pin3 (RA4) which is counted by Timer0.<br />
<br />
<a name='more'></a><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCzup2sMtkTqLXMb-cJdH2KsFkMSuCgutxt1R5vp_N892YQAM2-foBJgIfMXyvImv0YkyAQNFUXMo25I0DLNP5BE5gr5eUKxPAlk4o3Nn8NC5gy552SVNaJvg4uO7C9OZLRDnXQCsuKfE2/s1600/FreqCounter%2528Schematic%2529.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="422" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCzup2sMtkTqLXMb-cJdH2KsFkMSuCgutxt1R5vp_N892YQAM2-foBJgIfMXyvImv0YkyAQNFUXMo25I0DLNP5BE5gr5eUKxPAlk4o3Nn8NC5gy552SVNaJvg4uO7C9OZLRDnXQCsuKfE2/s640/FreqCounter%2528Schematic%2529.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
The program make short (0.125s) test of the input signal to determine the prescaler value. Next is the actual counting with the proper prescaler value and then the result is send to the display.<br />
<br />
This is fast breadboard proof-of-concept project, and I don't intend to make a finished product, for now at least. Of course there must be some sort of preamplifier/protection in front of the frequency counter in order to be usable.<br />
<br />
In the pictures below is shown the breadboard and five different quartz crystals generating different frequencies. The differences between the value on the display and the value on the oscilloscope are negligible. I tested the schematic also with frequencies above 90 MHz and even above 100Mhz and the results was accurate, but of course most significant digit was lost in case of 100+ MHz.<br />
<br />
Link for downloading the code and .hex files: <a href="http://bit.ly/MAX7219_" target="_blank">LINK</a><br />
<i>The code is compiled with MikroC Pro. RA5/MCLR must be configured as I/O or if not there must be 10k resistor connected between RA5 and +5V. When programming the microcontroler with PICkit 3 the option "Tools/Use VPP First Program Entry" should be selected and the schematic should be disconnected from the power supply.</i><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjqPPQPvsrcPX1H5_5XaiW9JR-N7a5T4cjv5cHYG2g_v2-w8rijTXUdhWEbab2z3WeRcIMwNDiJEqLZFX-hzv16tosXLJViiwTYDuJpnyyMbocQFlDfRXkZJeRiD5vWJsiChd4oNu-Tsqnc/s1600/Freq%2528Breadboard%2529.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjqPPQPvsrcPX1H5_5XaiW9JR-N7a5T4cjv5cHYG2g_v2-w8rijTXUdhWEbab2z3WeRcIMwNDiJEqLZFX-hzv16tosXLJViiwTYDuJpnyyMbocQFlDfRXkZJeRiD5vWJsiChd4oNu-Tsqnc/s640/Freq%2528Breadboard%2529.jpg" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEid0tci1U_b3rwNpKu-4TvkhsIgbKIZeQM2UG7Y2S_4PanqNLjt-2m3tGUqFxA2TRiVjEBSHOsGZFwjbeUKgYXfgiXjay8ChYPuMI1utHMnm_QJBeHO447c7ikFUi_scli3sIsE-whP6LZ6/s1600/20MHz.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEid0tci1U_b3rwNpKu-4TvkhsIgbKIZeQM2UG7Y2S_4PanqNLjt-2m3tGUqFxA2TRiVjEBSHOsGZFwjbeUKgYXfgiXjay8ChYPuMI1utHMnm_QJBeHO447c7ikFUi_scli3sIsE-whP6LZ6/s640/20MHz.jpg" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMWd_KQTPmUJI1_WmeJ-6IYdt1KF4HRYMxCfpwMG5GrBkmqQuWE9e4jGduMkT3ThSWuD8nLF-MOEOdQEWoge6QXHc-0xWem27MzSblfgbQYgUa2XQTp-cQmqjaq7bKiOA4ys4QxJXicMa0/s1600/27MHz.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMWd_KQTPmUJI1_WmeJ-6IYdt1KF4HRYMxCfpwMG5GrBkmqQuWE9e4jGduMkT3ThSWuD8nLF-MOEOdQEWoge6QXHc-0xWem27MzSblfgbQYgUa2XQTp-cQmqjaq7bKiOA4ys4QxJXicMa0/s640/27MHz.jpg" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTlHCuesp4CUjacmAQK4Sh4SmSMB0FbDFSTuIAkP-BCGOexGRxoGtGNMUmqT6EIoAmup1pfjF6QN2gpYZwZcWiS6FcMt5NqdQJj_2smC9oxfiX3uqi491eAT3LggK2HWEsQk5fxkzWcxcY/s1600/30MHz.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTlHCuesp4CUjacmAQK4Sh4SmSMB0FbDFSTuIAkP-BCGOexGRxoGtGNMUmqT6EIoAmup1pfjF6QN2gpYZwZcWiS6FcMt5NqdQJj_2smC9oxfiX3uqi491eAT3LggK2HWEsQk5fxkzWcxcY/s640/30MHz.jpg" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPjLzt0CzbvtFmlk79YeX3Tf_zcdpwcnSzhqvmoR3F6RqAlE8sw_njs9wV_nUJGF0c4uhlmHWFmQPKQKEBFcV0VWVs1V8vVZG0TNnrMWw6LOVnPegk5qH0B_-CaODALoJ9Z1170BGwa85B/s1600/4.194MHz.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPjLzt0CzbvtFmlk79YeX3Tf_zcdpwcnSzhqvmoR3F6RqAlE8sw_njs9wV_nUJGF0c4uhlmHWFmQPKQKEBFcV0VWVs1V8vVZG0TNnrMWw6LOVnPegk5qH0B_-CaODALoJ9Z1170BGwa85B/s640/4.194MHz.jpg" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjom-iPq_gMEMryMG8PcYmm4u91Dny4Lcc_HC95PNoat5o1SjoPQP7MFtr8nCMUwbw92NMxCrr-R4484KSBWa6I6SkAxAupYEAch66pDvEKAlubddRsfUWBVReukd-DwCwlyVMknD9fHoM2/s1600/4MHz.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjom-iPq_gMEMryMG8PcYmm4u91Dny4Lcc_HC95PNoat5o1SjoPQP7MFtr8nCMUwbw92NMxCrr-R4484KSBWa6I6SkAxAupYEAch66pDvEKAlubddRsfUWBVReukd-DwCwlyVMknD9fHoM2/s640/4MHz.jpg" width="640" /></a></div>
<br />Христоhttp://www.blogger.com/profile/14002909704834630953noreply@blogger.com28tag:blogger.com,1999:blog-4191887753331304313.post-39998282507528034042015-08-02T14:17:00.000+03:002017-09-08T01:10:33.278+03:00Simple and small temperature fan controllI published this schematic long ago in this article: <a href="http://diyfan.blogspot.com/2012/02/adjustable-lab-power-supply.html" target="_blank">Adjustable power supply</a> and since then I made some improvements in PCB to make the board as small as possible. The idea is to be easy to attach the whole board to the heat sink which we want to monitor. The board is only 27mm x 27mm.<br />
<br />
<a name='more'></a><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgkKcpSGz1_s98lT2-Ec0dgfSyx9z5yJiU4TYxSiy0QtqFiKyPve03o908u_Es18zLg6SAzOWIlPE2z8bdhGr026wT4nqDWgNkMx5AM0ebqC-6QTVHa1gh6jwUDFezREz43x8RnCgdXx-gQ/s1600/FanControl7.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="358" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgkKcpSGz1_s98lT2-Ec0dgfSyx9z5yJiU4TYxSiy0QtqFiKyPve03o908u_Es18zLg6SAzOWIlPE2z8bdhGr026wT4nqDWgNkMx5AM0ebqC-6QTVHa1gh6jwUDFezREz43x8RnCgdXx-gQ/s640/FanControl7.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<b>Some notes: </b><br />
<br />
1. The C3 can be omitted, its purpose was to filter noises picked up by connecting cable between board and sensing transistor, but as the transistor is mounted on the board it become unnecessary.<br />
2. R8 is optional and is for reducing the fan speed. Its value must be calculated according the fan current rating and the shorting track bellow it must be cut with sharp knife.<br />
3. When mounting, make sure the board is not touching the heat sink. There are two mounting holes - the one above the sensing transistor and one in opposite corner. I suggest to use a 4mm nut or other similar spacer between the transistor and the board.<br />
4. If there must be electrical insulation between transistor and heat sink, I suggest using transistor with insulated package like MJE350. If not, then BD140 will do the work.<br />
5. Instead of fan you can connect a 12V relay which can do some other job, for example disconnecting appliance from power or connecting bigger fan(s).<br />
6. Trimmer R2 adjust the temperature at which the board switch on. There is hysteresis of 5-10 degrees between switch on and switch off temperatures.<br />
7. Zener diode D1 can be BZX79C7V5 or BZX55C7V5 or 1N4737. <br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-epRJfv0vuwA/Vb3MX5_Pm3I/AAAAAAAABKc/_Sn9MTTQtLg/s1600/FanControl4.JPG" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="492" src="https://2.bp.blogspot.com/-epRJfv0vuwA/Vb3MX5_Pm3I/AAAAAAAABKc/_Sn9MTTQtLg/s640/FanControl4.JPG" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijhs1I8ygmdotgTVrrLJ0Htga9sjeTcA-PZJsNszO4E2Flp5NXsQSSqrY6ueh5K-raDeEglvLtehLj2axal3B8utCZcawjmq7TqcR3nq6x9bP3b7X-z3UywBHtxyRh7LmSFg_cFrqX2VxN/s1600/FanControl5.JPG" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="476" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijhs1I8ygmdotgTVrrLJ0Htga9sjeTcA-PZJsNszO4E2Flp5NXsQSSqrY6ueh5K-raDeEglvLtehLj2axal3B8utCZcawjmq7TqcR3nq6x9bP3b7X-z3UywBHtxyRh7LmSFg_cFrqX2VxN/s640/FanControl5.JPG" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyO92A7xHT1wHoKo1bF7Gta__JaB_BmAeZgAYmLLjXpj88Ockyk18s8dhkQbYbL-vVwPnN0qLQOjthWlcK_yI5Q4Ih1tiNgqPl1WV6h3vZ8m2_3GIeMHf0HsRZTzbDGiZFO3427zs-Shzy/s1600/FanControl6.JPG" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="442" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyO92A7xHT1wHoKo1bF7Gta__JaB_BmAeZgAYmLLjXpj88Ockyk18s8dhkQbYbL-vVwPnN0qLQOjthWlcK_yI5Q4Ih1tiNgqPl1WV6h3vZ8m2_3GIeMHf0HsRZTzbDGiZFO3427zs-Shzy/s640/FanControl6.JPG" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
Here are the pictures of the mounted fan control board on the heat sink of my <a href="http://diyfan.blogspot.com/2014/03/50w-power-amplifier-with-lm3886.html#more" target="_blank">recently finished</a> power amplifier with LM3886:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2fkkIbOJ60d2eggFHd20s5ScWZNwh29NO_UryYvFRQQs4AN6Ci9nJPnk85wvEYiIPVRi1tUoc1ErXYj_ATQr2GRiL9OHf29IjSz9wTrs19Jl1mQINVyUUDG_tSR2yCri7NmJ5d8nohW3x/s1600/IMG_20150802_134351.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2fkkIbOJ60d2eggFHd20s5ScWZNwh29NO_UryYvFRQQs4AN6Ci9nJPnk85wvEYiIPVRi1tUoc1ErXYj_ATQr2GRiL9OHf29IjSz9wTrs19Jl1mQINVyUUDG_tSR2yCri7NmJ5d8nohW3x/s640/IMG_20150802_134351.jpg" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-Qh-TCYjCQs8/Vb31WLwONQI/AAAAAAAABLU/E4kSAXdd6bI/s1600/IMG_20150802_134316.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="640" src="https://4.bp.blogspot.com/-Qh-TCYjCQs8/Vb31WLwONQI/AAAAAAAABLU/E4kSAXdd6bI/s640/IMG_20150802_134316.jpg" width="480" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
Files for the project: <a href="http://bit.ly/Fan_Control2" target="_blank">LINK</a><br />
<br />
Use them on your own responsibility.Христоhttp://www.blogger.com/profile/14002909704834630953noreply@blogger.com2tag:blogger.com,1999:blog-4191887753331304313.post-91164225506306134642015-05-14T20:37:00.000+03:002015-05-14T20:38:08.425+03:00Thermal controlled fans<div class="separator" style="clear: both; text-align: center;">
</div>
Since many years I am fan of quiet computing, but I also like power computers and videocards because I like do play games from time to time. That's why I have tried number of different solutions to control the fans in my computer.<br />
<br />
<a name='more'></a><br />
Couple of years ago I stumbled across a two schematics of temperature controlled fan in one <a href="http://www.ixbt.com/cpu/fan-thermal-control.shtml" target="_blank">russian site</a>. I tried both and they worked fine, but of course they are not very efficient and can control only one or two fans.<br />
Another solution that I designed was a schematic that connect the fans to the 5V rail and switched them to the 12V rail when temperature crosses certain limit.<br />
Lately there is a gain in popularity of PWM controlled fans. I have tried that too, but I am not satisfied because usually PWM controlled fans produce more noise. <br />
So here is my solution: DC-DC converter with temperature controlled output voltage. As a base, I used the first schematic from the aforementioned russian site. In my boxes I found one LM2575 in TO-220 package and one LM2595 in TO-263 package, and I made two pieces with both. Here is the first variant I made:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhrd3-EWKcZG19DKboXaEyuZbiV9kzQnH0C70_xylNR_fN-gAZwo2yndj4pgP2efDaQ2kqmahz8jU0ZFchCvIc0GdVyoPy268fgN-F815k4ktD5TfN7wQcyPLcKjUvtorjOBO-cZQkMna5M/s1600/FanControl1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="308" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhrd3-EWKcZG19DKboXaEyuZbiV9kzQnH0C70_xylNR_fN-gAZwo2yndj4pgP2efDaQ2kqmahz8jU0ZFchCvIc0GdVyoPy268fgN-F815k4ktD5TfN7wQcyPLcKjUvtorjOBO-cZQkMna5M/s640/FanControl1.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<span id="goog_1878534253"></span><span id="goog_1878534254"></span><br />
<span id="goog_1878534253">The first comparator is connected as non-inverted amplifier and amplify the voltage </span>difference so the output voltage changes between almost 0V to about 12V as temperature changes form 25°C to 80-90°C. Zener diode D3 prevents the voltage at the negative input of the second comparator to drop below 4.5V. If the connected fans cannot start at 4.5V, then D3 can be replaced with lower voltage zener diode. The minimum voltage is calculated with the formula: Umin = 12V - Uzener. For example with 6.8V zener diode the minimum voltage will be 5.2V<br />
The second comparator control the feedback input of the DC-DC convertor so that the output voltage is equal to that in its negative input.The resulting output voltage varied between 4.5V and 11V. It cannot reach 12V because the saturation voltage of the DC-DC converter is about 1V. <br />
<br />
There can be connected as much as 5 fans and the current can be up to 1A.<br />
The transistor used for thermal sensing can be PNP or NPN and is connected as VBE multiplier. The case of the transistor must be electrically isolated because usually heatsinks are connected to ground. <br />
I tested the schematics with KSE350 and KSE340. The two resistors are soldered directly to the transistor pins and are isolated with a heat shrink tubes.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-WOiOD_beHys/VVSmeZLM89I/AAAAAAAABFE/hI2BGa8DuSE/s1600/FanControl1.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="426" src="http://3.bp.blogspot.com/-WOiOD_beHys/VVSmeZLM89I/AAAAAAAABFE/hI2BGa8DuSE/s640/FanControl1.JPG" width="640" /></a></div>
<table align="center"><tbody>
<tr><td><div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgQPdSsMb6hjfEFcma0Vo_3O27UT8F01oGh72L1DYSLG3szyb0MCRXsR30n6ji2jgOUCkgY22JfGBURHP6nmVmhAhGzvXlpohRRMc-ma-fPik3hPNbgw9eq06119f3ajrjLyJ_hrHatJCqj/s1600/FanControl2.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgQPdSsMb6hjfEFcma0Vo_3O27UT8F01oGh72L1DYSLG3szyb0MCRXsR30n6ji2jgOUCkgY22JfGBURHP6nmVmhAhGzvXlpohRRMc-ma-fPik3hPNbgw9eq06119f3ajrjLyJ_hrHatJCqj/s320/FanControl2.JPG" width="320" /></a></div>
<br /></td><td><div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixbt-cBSOYFFLRvfW6BvwUcSvqOewxhFIZvehdpxce5MPoybrpoLvKVdamfNF35MTxUYjjvUZ_OA78YQQFgj_dat4X4DPgiwr_VkOjKaf5BByUW8vmPAGNFo81u5tJQ0uXPAk6XjWVejdc/s1600/FanControl3.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixbt-cBSOYFFLRvfW6BvwUcSvqOewxhFIZvehdpxce5MPoybrpoLvKVdamfNF35MTxUYjjvUZ_OA78YQQFgj_dat4X4DPgiwr_VkOjKaf5BByUW8vmPAGNFo81u5tJQ0uXPAk6XjWVejdc/s320/FanControl3.JPG" width="320" /></a></div>
<br /></td></tr>
</tbody></table>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
Here is a little video demonstrating how it works. In the video I heat up the little heatsink with my solder iron: <br />
<br />
<div style="text-align: center;">
<iframe align="middle" allowfullscreen="" frameborder="0" height="480" src="https://www.youtube.com/embed/RyVi3_ujkYA?rel=0" width="640"></iframe><br />
<br />
<div style="text-align: left;">
After I finished the two boards I realized that the more convenient solution will be if the thermosensor is connected to the ground and the first comparator is connected as inverted amplifier:</div>
<div style="text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJWJr0eBR0ZQXUEk9W6LkRyotB7MjAxoUAsi4WBTeAR7qPEpdcIafE9ZHZRVUcjF7FyCGhFpmw8iVjuyXp7bGatYCUXECMoae0OWS323sIInZJMXMqOQWkupSb-48pssTdPUpu5nTpYivm/s1600/FanControl5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJWJr0eBR0ZQXUEk9W6LkRyotB7MjAxoUAsi4WBTeAR7qPEpdcIafE9ZHZRVUcjF7FyCGhFpmw8iVjuyXp7bGatYCUXECMoae0OWS323sIInZJMXMqOQWkupSb-48pssTdPUpu5nTpYivm/s640/FanControl5.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div style="text-align: left;">
<br />
With the collector of the thermal sensing transistor connected to the ground, there is no requirement for electrical insulation, so it can be BD140 or MJE350. </div>
<div style="text-align: left;">
I am not tested this variant yet, but it work in simulation.<br />
Also, you can notice that in the schematic I used LM2596. If the rest of the power elements (D2, L1) are selected properly this can control up to 3A load.<br />
<br />
I will post the files for the project in couple of days.<br />
<br />
P. P. The two finished boards are for sale - if anyone is interested, the contact info is in the "about" page.</div>
</div>
Христоhttp://www.blogger.com/profile/14002909704834630953noreply@blogger.com1tag:blogger.com,1999:blog-4191887753331304313.post-5714434976078169122015-04-16T21:57:00.000+03:002017-09-08T01:16:13.932+03:00Audio oscillator with frequency counter 2My last project is not completely new. In fact, the oscillator is made from the same schematic as in one of my <a href="http://diyfan.blogspot.com/2012/05/audio-oscillator-with-frequency-counter.html">previous projects</a> and only the<a href="http://diyfan.blogspot.com/2014/08/frequency-counter-with-pic16f628a.html"> frequency counter</a> is made with different schematic.<br />
<br />
<br />
<a name='more'></a>After I finished the oscillator, I made some minor changes in the square signal part of the schematic. I connected five of the inverters in parallel with low value load resistors, thus reducing the influence of the parasitic capacitance of the PCB. The goal is to lower rise and fall times of square signal. Max output voltage in square signal mode is around 5V.<br />
<br />
Here the schematic:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDopmy_MtubZU0Dp3foUMjZiblsKdpTLpcp1Pb4laEcAIZOPNW2hdvQFukpN41fqpi1ZjAERNns8NtYEG4KIq-5iYEXvNS5Uplvk8cQK9wIAbZP7HBp8o3iLJkCST3qNUnBdZ7iF0MxSka/s1600/Osc9.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="392" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDopmy_MtubZU0Dp3foUMjZiblsKdpTLpcp1Pb4laEcAIZOPNW2hdvQFukpN41fqpi1ZjAERNns8NtYEG4KIq-5iYEXvNS5Uplvk8cQK9wIAbZP7HBp8o3iLJkCST3qNUnBdZ7iF0MxSka/s1600/Osc9.png" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
The oscillator have 4 ranges which are switched with external 3-pole/4-position <a href="http://www.ebay.com/sch/i.html?_from=R40|R40|R40|R40&_sacat=0&_nkw=rotary+switch+3+pole+4+position&_sop=15" target="_blank">rotary switch</a>, connected this way:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhWQrgd-iQZtenhs9Xh2wyz7_TQ2CFJB2UOAuR-5TYmKuO7km_8XqXiXIK7EYg_PH24lBNAsZK3MSyrnOYAIYzoZauxIrJ6WTQmXqsSV9rmh-iWEmUtvaDAMb0nG4VE9ikYQpgzeOhe2jM/s1600/Osc10.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhWQrgd-iQZtenhs9Xh2wyz7_TQ2CFJB2UOAuR-5TYmKuO7km_8XqXiXIK7EYg_PH24lBNAsZK3MSyrnOYAIYzoZauxIrJ6WTQmXqsSV9rmh-iWEmUtvaDAMb0nG4VE9ikYQpgzeOhe2jM/s1600/Osc10.png" width="252" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
This module is connected via short cables to the respective connectors on the oscillator board.<br />
Notice, that capacitors are soldered from the bottom side of this little board. The leads of the capacitors must be cut clean from the other side of the board for they do not touch the rotary switch<br />
<br />
The photoresistor R9 and LED D5 form a negative feedback and must be put together in some isolated enclosure. I used an aluminum casing from a big electrolytic capacitor for this purpose. LED is standard 5mm red and for the photoresistor I used a TESLA brand piece (not sure what is the exact model). Other types of photoresistors should also work.<br />
In the schematic the photoresistor is connected with one resistor (R8) in series and one (R10) in parallel. I found that in my case the oscillator work better without these 2 resistors. <br />
<br />
Here are some more pictures:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhtCNl2nEkNNYRijyvY35l8PdKY2RZaPbfbUWLfidjobbMK5rXW4mnYQqebmV_GaFE9WKxkRLnkGE8zKAMPTNIZBZK4k8Eqm4aGO2qOWcht56UDd4-IguCzEd867jrLp2CBZE4i3im8K1Ra/s1600/Osc1.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="468" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhtCNl2nEkNNYRijyvY35l8PdKY2RZaPbfbUWLfidjobbMK5rXW4mnYQqebmV_GaFE9WKxkRLnkGE8zKAMPTNIZBZK4k8Eqm4aGO2qOWcht56UDd4-IguCzEd867jrLp2CBZE4i3im8K1Ra/s1600/Osc1.JPG" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPHK8-_n8wFWeQLlS6XEPUNta6lqYZpkALKFBbXXtHhGU8oUucZrRD2WLir7ObdmtV_e68DSNEJR2-ZUuu9GiG5STQp4sa0QLztH6agqUb663psFDGfuxY1JKzK7A6CzC2HfEcibKLcAtS/s1600/Osc2.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="436" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPHK8-_n8wFWeQLlS6XEPUNta6lqYZpkALKFBbXXtHhGU8oUucZrRD2WLir7ObdmtV_e68DSNEJR2-ZUuu9GiG5STQp4sa0QLztH6agqUb663psFDGfuxY1JKzK7A6CzC2HfEcibKLcAtS/s1600/Osc2.JPG" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7boR7SX9lt3iXljpGcVgnc0sJwq3a-FGFxPIXxh40InqbLdzAFoaX8PonkDg2cCd8xbsGKg-wuCohp3t68DVkTNwPTUJk3JAB-GWBsjrmVluMI56u1oB9bDd7julfjjA73i3aiVcmyA7x/s1600/Osc3.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="420" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7boR7SX9lt3iXljpGcVgnc0sJwq3a-FGFxPIXxh40InqbLdzAFoaX8PonkDg2cCd8xbsGKg-wuCohp3t68DVkTNwPTUJk3JAB-GWBsjrmVluMI56u1oB9bDd7julfjjA73i3aiVcmyA7x/s1600/Osc3.JPG" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6DZztXli7-Mcp6dNVgngr95cMcJYZzshTJt6EXBrAwNss4TyRbco29hQVfWoIZU64AE0zZ1UKqM4LHYg9-Grl381OI8B3zWrLLZrA45s3sXtCOC_YU-rJNdluEbDP1CxgHPJTKw7DuLBn/s1600/Osc4.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="468" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6DZztXli7-Mcp6dNVgngr95cMcJYZzshTJt6EXBrAwNss4TyRbco29hQVfWoIZU64AE0zZ1UKqM4LHYg9-Grl381OI8B3zWrLLZrA45s3sXtCOC_YU-rJNdluEbDP1CxgHPJTKw7DuLBn/s1600/Osc4.JPG" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjR2j6W-B5Wm12_bk62Ati_ekJljWhhQJ2LMIo71UANUzEbMpLLe8tlEmazBkt88nQ5lv8hyphenhyphenwoFysC8fP3jo7nwF6Lhrha48citVK2AbLi2FinXsHfgtpKHbaKihLlsxhtEfCTdqGow_xFr/s1600/Osc5.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjR2j6W-B5Wm12_bk62Ati_ekJljWhhQJ2LMIo71UANUzEbMpLLe8tlEmazBkt88nQ5lv8hyphenhyphenwoFysC8fP3jo7nwF6Lhrha48citVK2AbLi2FinXsHfgtpKHbaKihLlsxhtEfCTdqGow_xFr/s1600/Osc5.JPG" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh29DIvs75l-mb5h91e2opelwfDdIkbITya4SiAacJxSZuaeYtUwayJuzEa1_tkgf3x6ZhArMpU5adqZguF2E7fQZWr1HNZj07W-RiApt8w902Br2XHajGpBWBhwlnztWhyphenhyphenT2tclNWp-v9T/s1600/Osc6.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="360" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh29DIvs75l-mb5h91e2opelwfDdIkbITya4SiAacJxSZuaeYtUwayJuzEa1_tkgf3x6ZhArMpU5adqZguF2E7fQZWr1HNZj07W-RiApt8w902Br2XHajGpBWBhwlnztWhyphenhyphenT2tclNWp-v9T/s1600/Osc6.JPG" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-eN34FqC-pp4/VC_TwcyDkaI/AAAAAAAAA9Y/GN40PgEDXV8/s1600/Osc7.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="360" src="https://3.bp.blogspot.com/-eN34FqC-pp4/VC_TwcyDkaI/AAAAAAAAA9Y/GN40PgEDXV8/s1600/Osc7.JPG" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-qE96aZo0_eo/VC_TwaGHZoI/AAAAAAAAA9M/2gmNdFdE0G4/s1600/Osc8.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="360" src="https://3.bp.blogspot.com/-qE96aZo0_eo/VC_TwaGHZoI/AAAAAAAAA9M/2gmNdFdE0G4/s1600/Osc8.JPG" width="640" /></a></div>
<br />
As you can see, the position of the BNC connector and two knobs is not very convenient. In the last revision of the PCB I switched the positions of the BNC connector and the LEVEL potentiometer. <br />
All in all I am satisfied with the result.<br />
<br />
If someone want to try this project, here the link to the archive with schematic and PCB files:<br />
<a href="http://bit.ly/OscV23">AudioOscillator v.2.3</a><br />
Use them on your own responsibility! <br />
<br />Христоhttp://www.blogger.com/profile/14002909704834630953noreply@blogger.com1tag:blogger.com,1999:blog-4191887753331304313.post-23030204040862894552014-08-20T23:45:00.000+03:002019-01-26T23:41:00.384+02:00Frequency counter with PIC16F628ASome time ago I made an <a href="http://diyfan.blogspot.com/2012/05/audio-oscillator-with-frequency-counter.html">audio oscillator with frequency counter</a> which worked very well, but I sold it, and now I am making a new one. The oscillator itself will be mostly the same and when I finish the whole project there will be a separate article. Here I will show the frequency counter module I made for the project.<br />
<br />
<a name='more'></a>The previous frequency counter was made with CMOS logic ICs, but as I already own a PIC programmer, this one is designed with PIC microcontroller. As usual I searched the web for inspiration. The original idea came from this project: <a href="http://www.moty22.co.uk/lcd_counter.php">LCD frequency counter</a>. As you can see - very simple and yet elegant schematic. But I wanted to use 7-segment LED display, not LCD, so I found a second useful project: <a href="http://ued.udjat.nl/counter/">Simple 100MHz frequency counter</a> which uses 6 digit LED display.<br />
<br />
Combining two projects into one wasn't very easy. First of all I wanted a PIC microcontroller to do the whole job without any additional ICs. Also I wanted to use the the familiar 16F628A, but because one of the portA pins (RA5) can be used only as input I was short of outputs to do the job. Driving 6 digit 7-segment multiplexed display requires 7 + 6 = 13 outputs. The 16F628A has 16 IO pins, two of which are used for the crystal oscillator, one is for the signal input and other one can be used only for input, that leaves us with only 12 useful IO pins. The solution was to drive one of the common cathodes with a transistor, which opens when all other digits are switched off.<br />
<br />
<br />
Here is the final schematic:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLqQwYmvsd4KWo9bsxNo_hJRVMwy9tqZBtJUtiMRifFpQ5WhZ_RUQ401xCnW3sI7OSN1PRv6z5ZtLDuiqcb1zhtkVJEXLfjNg9rp4V-nc3bhAf3pUg0i0CeIV-oc2ryFmyaWRs_GuAp1k9/s1600/FreqC+(16F628A).png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="426" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLqQwYmvsd4KWo9bsxNo_hJRVMwy9tqZBtJUtiMRifFpQ5WhZ_RUQ401xCnW3sI7OSN1PRv6z5ZtLDuiqcb1zhtkVJEXLfjNg9rp4V-nc3bhAf3pUg0i0CeIV-oc2ryFmyaWRs_GuAp1k9/s1600/FreqC+(16F628A).png" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
7-segment displays used here are 3 digit multiplexed common cathode type (<a href="http://www.us.kingbright.com/images/catalog/spec/BC56-12SRWA.pdf">BC56-12SRWA</a>). Digits 2..5 are switched on when respective pins are set low. When all these pins are high, the transistor Q1 opens and switches on the first digit. The current for each segment is about 6-7mA. <br />
<br />
I must mention that pins connected to common
cathodes theoretically may sink up to 50mA if all segments are light up (7x7mA). This is way above max specifications of the microcontroller. But as every digit is switched on for very brief moment
I think it is safe. The whole schematic consumes around 30-40mA in
average and the microcontroller is not heating at all, so everything seems OK.<br />
<br />
The microcontroller uses its internal 4MHz oscillator for the CPU clock. Timer1 uses external crystal oscillator with frequency 32768Hz for setting the 1 second time interval. Timer0 is used to count the input signal at pin RA4. And finally, Timer2 is used for cycling and refreshing the digits.<br />
As the input signal will be 5Vpp square wave there isn't any preamp or buffer in the front.<br />
The counter can measure up to 920-930kHz which is more than enough for my project. The reason why it can't go higher is because driving all these digits consumes lots of CPU cycles. I suppose, the program code can be optimized or even written in assembler and then the counter can reach 999999 Hz.<br />
<br />
The crystals for 32768Hz are sold in two sizes : 2x6mm and 3x8mm. I recommend 2x6mm because it fits perfectly below the left display. The other size also can be used but it will lift a little the left display.<br />
<br />
<br />
Anyway, this is the finished module:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVHZ-cTNLX0Ul1cHeUmEeSOkW5rsXac3mQ20uyo4GhhT3Jik_ecAy6dqrOFtyps03k0JOZ7y54o9qaEgp6ZNZz15jDz3Jxc-9AELMixi5-r3jX-Lg3GRzoeDx85igMpEqEdY95779Lvg8P/s1600/FreqC+(16F628A)(1).jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="374" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVHZ-cTNLX0Ul1cHeUmEeSOkW5rsXac3mQ20uyo4GhhT3Jik_ecAy6dqrOFtyps03k0JOZ7y54o9qaEgp6ZNZz15jDz3Jxc-9AELMixi5-r3jX-Lg3GRzoeDx85igMpEqEdY95779Lvg8P/s1600/FreqC+(16F628A)(1).jpg" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-pQfzBRoAaRKX8uLHlW2w9i2q2RXcaqj7iiDF7cNxtuvIS7qAh7ORRrKr1jEJDPxhDKCgaa2MKb1to0rhyphenhyphenh4CZP9INPvo9vpq0iBrjxBlHX0m29JUUSaKrvCeDJtrNXKrr7R-0hg4DghD/s1600/FreqC+(16F628A)(2).jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="356" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-pQfzBRoAaRKX8uLHlW2w9i2q2RXcaqj7iiDF7cNxtuvIS7qAh7ORRrKr1jEJDPxhDKCgaa2MKb1to0rhyphenhyphenh4CZP9INPvo9vpq0iBrjxBlHX0m29JUUSaKrvCeDJtrNXKrr7R-0hg4DghD/s1600/FreqC+(16F628A)(2).jpg" width="640" /> </a> </div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnqCwYQV0gQNqxNbVKV7eKI6ReyHubdQAvkoQy1xjihD_wzhiwUW5NL2FRFbXaLet0xy7z52qh3jFuz_A7-np2ZNCjsZ2he90jzvo1_T7T7MNh5i_jxMWMCMZ_j-G0IiU90R9FCv1k0znS/s1600/FreqC+(16F628A)(5).jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnqCwYQV0gQNqxNbVKV7eKI6ReyHubdQAvkoQy1xjihD_wzhiwUW5NL2FRFbXaLet0xy7z52qh3jFuz_A7-np2ZNCjsZ2he90jzvo1_T7T7MNh5i_jxMWMCMZ_j-G0IiU90R9FCv1k0znS/s1600/FreqC+(16F628A)(5).jpg" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXNF_ws4z3aSeh-R1EAXvrkFz0JaybJuSsU9_sDOmK-ihZYCcFusjniPU6cn5X0CyWfC_lLRzNLyl5XaIaMN2bIHuxw4EdM3GLU1PEnBAWh0taquRlY-IXvoeF2kgYOOY3ty7NDsglt12i/s1600/FreqC+(16F628A)(4).jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXNF_ws4z3aSeh-R1EAXvrkFz0JaybJuSsU9_sDOmK-ihZYCcFusjniPU6cn5X0CyWfC_lLRzNLyl5XaIaMN2bIHuxw4EdM3GLU1PEnBAWh0taquRlY-IXvoeF2kgYOOY3ty7NDsglt12i/s1600/FreqC+(16F628A)(4).jpg" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-8uBOijShrkQ/U_Pb1Xjo3dI/AAAAAAAAA3U/Y4HUPGWs-xw/s1600/FreqC%2B(16F628A)(3).jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://2.bp.blogspot.com/-8uBOijShrkQ/U_Pb1Xjo3dI/AAAAAAAAA3U/Y4HUPGWs-xw/s1600/FreqC%2B(16F628A)(3).jpg" width="640" /></a></div>
<br />
So, if anyone has a burning desire to test this project himself, here are the project files: <a href="http://bit.ly/FreqC16F628A">FreqC(16F628A)</a><br />
Use them on your own responsibility!<br />
The PCB in the archive is a little different from the pictures above, because I made some optimizations. <br />
I am open for suggestions about program code and how it can be optimized.<br />
<br />
<b>UPDATE: 26.01.2019</b><br />
Refined PCB, different voltage regulator, slightly smaller board. Archive include Eagle files, HEX and C file and also zipped Gerber files.<br />
<a href="http://bit.ly/2B50aiR">FreqC (PIC16F628A, v2)</a>Христоhttp://www.blogger.com/profile/14002909704834630953noreply@blogger.com11tag:blogger.com,1999:blog-4191887753331304313.post-15889434414703116542014-06-11T23:05:00.000+03:002017-04-08T14:19:13.604+03:00LED VU Meter with LM3916This was finished months ago and just now I had time to finish the article. <a href="http://www.ti.com.cn/cn/lit/ds/symlink/lm3916.pdf">LM3916 </a>is a dedicated IC for VU LED meter. Unlike LM3915 which have 3dB step between voltage levels, the LM3916 have nonlinear steps: -20, -10, -7, -5, -3, -1, 0, +1, +2, +3db, just like old school analog VU meters. I saw in YouTube an interesting commercial LED VU meter, which imitates the needle movement in analog VU meters and I thought I can make a similar one. All I needed I found in the datasheet of LM3916.<br />
<br />
<a name='more'></a>The LM3916 can be feed with AC signal without any rectification, but I wanted to implement a precision full wave rectification. I chose the schematic on page 13, fig.21 of the datasheet: "Precision Full-Wave Peak Detector". This is the full schematic I designed:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZBfpu9eesW_tM7rg6iufVSRBdtSDxZWXDlgQKQm_1Z_o9KJL1g5qnXeIfKuYGEou2q_6Xj8xk96kijh-5MIiukCPbIX3xtY9EVVamN1R_SRPD-lm-GZae4hXzgjxYixDOaQsfAtouuWZ5/s1600/LED+VU+Meter+%2528schematic%2529.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZBfpu9eesW_tM7rg6iufVSRBdtSDxZWXDlgQKQm_1Z_o9KJL1g5qnXeIfKuYGEou2q_6Xj8xk96kijh-5MIiukCPbIX3xtY9EVVamN1R_SRPD-lm-GZae4hXzgjxYixDOaQsfAtouuWZ5/s1600/LED+VU+Meter+%2528schematic%2529.png" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
The LEDs are connected via sockets J3 to J12 (only one row LEDs is shown on the schematic) and I found that it's cheaper to use a 28 pin IC sockets cut in half than regular 40 pin sockets. Of course LEDs can be soldered directly on the PCB.<br />
<br />
The schematic needs bipolar power supply to work correctly, but the negative rail can be as low as -5V or even -3.3V. The positive rail must be bellow +25V and combined voltage of negative and positive rails must not exceed 36V. The minimum positive rail voltage depends on the voltage of the LEDs. For example if the LED have 1.9V forward voltage and we have 7 LEDs on one pin, then the minimum positive voltage will be 7*1.9V + 1.5V (drop voltage at LM3916) = 14.8V. The green LEDs usually have little higher forward voltage - 2.2V - 2.4V, so +18V will be sufficient in most cases.<br />
<br />
<br />
The LEDs current is determined by R1_REF, and with 2.2k resistance it will be 5 - 6 mA.<br />
The formula is Iled = 10 * (1.2V / R1_REF). <br />
<br />
IC2 is connected as precision full wave rectifier and can be any general purpose dual opamp - TL072, TL082, LF353. <br />
<br />
The output mode can be set with 3-pin jumper JP1. Shorting pins 1-2 will set the bar mode and shorting pins 2-3 will set the dot mode.<br />
<br />
The max input voltage of the LM3916 is set to 1.2V, and with R8-R7 we can adjust the input level. <br />
<br />
The color of the LEDs is your choice. I used green LEDs for negative
levels, yellow for 0dB and red for positive levels. For this project I
bought transparent rectangular LEDs, but they have two drawbacks. First -
when one column lights up the <span class="short_text" id="result_box" lang="en"><span class="hps alt-edited">adjacent</span> <span class="hps">columns
also significantly lights up. My solution was to paint the sides of the
LEDs with black marker. There also can be used a black tape around the entire collumn.</span></span><br />
<span class="short_text" id="result_box" lang="en"><span class="hps">Second drawback is that because of the transparency, the LEDs emit light from one point, which is not very pleasant. The solution here was to rasp the top side of the LEDs with </span></span><span class="short_text" id="result_box" lang="en"><span class="hps">rough file, so the light to diffuse more even. </span></span><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-sg5MdcOpXOMXq8FMgBe_5kBMtZQslMiEish4T6r58vbdu9cwVGawVTOYkBSmWuT8wewlGQbxFV1FJ-WgQ3ws5nHK7F8AIVBXoOkRqh_pH20TwBdIx_wkhcICh6ZY-bjttxGqgo5u67GE/s1600/LED+VU+Meter+%25281%2529.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-sg5MdcOpXOMXq8FMgBe_5kBMtZQslMiEish4T6r58vbdu9cwVGawVTOYkBSmWuT8wewlGQbxFV1FJ-WgQ3ws5nHK7F8AIVBXoOkRqh_pH20TwBdIx_wkhcICh6ZY-bjttxGqgo5u67GE/s1600/LED+VU+Meter+%25281%2529.JPG" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0VJ7G3elvT28yL7wqFNnwd-HcGQH3AmFx0gPis0M-4Dz9JchphCA1fv9VsZwcm2eViRpKxUwEsKc5bN6lAi_9WlZkFeMXQmVMNbR-IMVI0seQoAOqRoHDD7b3tJS_uevUezzrlRQtMNju/s1600/LED+VU+Meter+%25282%2529.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0VJ7G3elvT28yL7wqFNnwd-HcGQH3AmFx0gPis0M-4Dz9JchphCA1fv9VsZwcm2eViRpKxUwEsKc5bN6lAi_9WlZkFeMXQmVMNbR-IMVI0seQoAOqRoHDD7b3tJS_uevUezzrlRQtMNju/s1600/LED+VU+Meter+%25282%2529.JPG" width="640" /></a></div>
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsIrrQrQf6lNKhaW7SBKMv1LtSwcQjTzLNQEb5YqIw23Ifgizt30pSYdBUOsVbLgV9_l6E10vZr1f-uK4t0VlX5A4HYkZsAWFiG1FAiB6ZP_44oml23dw1eBJChifpXfv2zHF-MrIvMIgQ/s1600/LED+VU+Meter+%25283%2529.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsIrrQrQf6lNKhaW7SBKMv1LtSwcQjTzLNQEb5YqIw23Ifgizt30pSYdBUOsVbLgV9_l6E10vZr1f-uK4t0VlX5A4HYkZsAWFiG1FAiB6ZP_44oml23dw1eBJChifpXfv2zHF-MrIvMIgQ/s1600/LED+VU+Meter+%25283%2529.JPG" width="640" /></a></div>
<br />
<br />
Short clip of the VU Meter in action :)<br />
<br />
<iframe allowfullscreen="" frameborder="0" height="315" src="https://www.youtube.com/embed/qMAbSlZHMEo" width="560"></iframe>
<br />
<br />
Download the files of the project here: <a href="http://bit.ly/LEDVU">LED VU meter.rar</a><br />
Use them on your own responsibility!<br />
There are some changes - I removed the 0R resistors which are present in the test prototype. Also the mini SMD switch is replaced with jumper.Христоhttp://www.blogger.com/profile/14002909704834630953noreply@blogger.com15tag:blogger.com,1999:blog-4191887753331304313.post-68054692516922990552014-04-12T23:12:00.000+03:002019-01-26T21:12:00.752+02:00Simple timer with PIC16F628AThis is a quick project for a timer. Recently I finished my UV light exposure box and thought that it will be convenient to have a build in timer to switch off the light after preset time. <br />
So I had a PIC16F628A lying around and after searching the web I found a <a href="http://microcontrolandos.blogspot.com/" target="_blank">Brazilian site</a> (I think?) with tons of interesting projects with microcontrolers. This project is based on one of them.<br />
<br />
<a name='more'></a>This is the schematic of the timer:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_sEA_qXCI14ICaoRdokqC5nOAAUk_DHEajbWv2r8JFN65RovcF1T72wU2TCXhNkRKRH0JV74dDJKDGQ8IxdcCuwhdcr3LBw81h-J_p6Irxfd6iYVAdWpxIte56PPNaM1bPSJE376w6dAO/s1600/Timer+%2528schematic%2529.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="354" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_sEA_qXCI14ICaoRdokqC5nOAAUk_DHEajbWv2r8JFN65RovcF1T72wU2TCXhNkRKRH0JV74dDJKDGQ8IxdcCuwhdcr3LBw81h-J_p6Irxfd6iYVAdWpxIte56PPNaM1bPSJE376w6dAO/s1600/Timer+%2528schematic%2529.png" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
The schematic uses the internal oscillator of the microcontroller which is enough accurate for my purposes, but as the pins 15 and 16 are left unoccupied, there can be connected external quartz resonator with better accuracy.<br />
As I said, this project is based on an existing project, but actually my schematic is quite different and the code was almost completely rewritten. My programming abilities are little rusty, but I think the final result is quite good. <br />
<br />
There are three buttons to operate the timer: "START/STOP", "MIN" and "SEC".<br />
"START/STOP" is for starting and pausing the timer.<br />
"MIN" is for adjusting the minutes. Minutes may go up to 99 and then starts again from 0. <br />
"SEC" is for adjusting the seconds. Seconds goes up to 59 and then starts from 0.<br />
"MIN" and "SEC" have repeat functionality.<br />
Pressing MIN and SEC buttons simultaneously will reset the timer. <br />
When the timer reach 00:00, the buzzer sounds 3 short and 1 long beeps and the LED lights up.<br />
The buzzer is electromagnetic type. <br />
<br />
After this any of these three buttons will reset the status and LED will switch off.<br />
When timer is counting down - RB7 (pin 13) is high and when the timer is stopped - RB7 is low.<br />
<br />
With this pin we can operate some external circuitry. In my case there will be connected a transistor which will switch on and off the UV exposure box.<br />
<br />
Jumper J1 is for calibrating of the timer. When shorted, the timer enter in adjusting mode. With MIN and SEC buttons we can increase/decrease the value of an internal parameter thus slowing down or speeding up the timer. This value is stored in the EEPROM. <br />
Pressing START/STOP button when in this mode will reset this parameter to its default value.<br />
<br />
I tested the schematic on the breadboard and everything works as described.<br />
The code is written and compiled with mikroC PRO for PIC. The options for the project are:<br />
<b>Oscillator:</b> INTOSC oscillator: I/O function...<br />
<b>Oscillator frequency:</b> 4.000000 MHz<br />
<b>Watchdog Timer:</b> disabled<br />
<b>Power-up Timer:</b> enabled<br />
<b>RA5/MCLR/VPP pin function:</b> disabled<br />
<b>Brown-out detect:</b> enabled<br />
The .hex file was programmed in the microcontroller with <a href="http://diyfan.blogspot.com/2013/06/original-pickit-2.html" target="_blank">my clone of PICkit2</a> using "<a href="http://www.microchip.com/Developmenttools/ProductDetails.aspx?PartNO=PG164120" target="_blank">PICkit 2 programmer</a>" v.2.61<br />
<br />
Link for downloading the archive with schematic, source .c file and .hex file : <a href="http://bit.ly/2FNvmYd" target="_blank">Timer</a><br />
Use them on your own responsibility!<br />
<br />
Some photos of the finished board:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2p_VulaGik_VGZuxwCpUZcOYYgXIPm5qX5G-0wowdwAo12uRydcvLSjL5I6gQutwUyMLA1PEQU_0jjk1zRAYZiCc_OHK_L_rdxYcoTo32tULb-sEoWAzqpP9mfESpijqVNoVmUlSYV6Pg/s1600/Timer%25281%2529.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="450" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2p_VulaGik_VGZuxwCpUZcOYYgXIPm5qX5G-0wowdwAo12uRydcvLSjL5I6gQutwUyMLA1PEQU_0jjk1zRAYZiCc_OHK_L_rdxYcoTo32tULb-sEoWAzqpP9mfESpijqVNoVmUlSYV6Pg/s1600/Timer%25281%2529.JPG" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1bluNP2WMNmTX_FsuqpWUwMWHG1UbJDDMFV5IGU1iF7OTahxazQTPCtgG4ozQ10H86z6H63x1GnT-6HxQX2djhZbgoKgelioylmnTojM-gKZgzwNfyU1wNp1NINxZXHNEviENyI2RqguT/s1600/Timer%25282%2529.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1bluNP2WMNmTX_FsuqpWUwMWHG1UbJDDMFV5IGU1iF7OTahxazQTPCtgG4ozQ10H86z6H63x1GnT-6HxQX2djhZbgoKgelioylmnTojM-gKZgzwNfyU1wNp1NINxZXHNEviENyI2RqguT/s1600/Timer%25282%2529.JPG" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjsUKrrbCrniuR3YsGCrJolxS8FOeiEkDRI1-1MdW30WxbnPTbZC3qpEj5gBSzA2D7DKkvtpQwcwRvxAFh7HoEuGc8bbYqzRfcv4jpAiB9k9SvVjTh30MONj3Q1ySgdYOkCHmBbcV19F2q/s1600/Timer%25283%2529.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjsUKrrbCrniuR3YsGCrJolxS8FOeiEkDRI1-1MdW30WxbnPTbZC3qpEj5gBSzA2D7DKkvtpQwcwRvxAFh7HoEuGc8bbYqzRfcv4jpAiB9k9SvVjTh30MONj3Q1ySgdYOkCHmBbcV19F2q/s1600/Timer%25283%2529.JPG" width="640" /></a></div>
<br />
And the schematic (same as above with added switching transistor and the buttons are different type): <br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihoWdZtw3olRFmQzfsZ9VkCN4hal5UN2pv32DJy7uRdUgfAmTF5zpUO1b_WdG4hBU9j0FsYSOosgUPlhMV4Uxujie6uMbAwCn9z-b3cWXHk4OBYNSduNPInWOjH3lj8uM2GS-7WjksK8DW/s1600/Timer+%2528schematic2%2529.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="336" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihoWdZtw3olRFmQzfsZ9VkCN4hal5UN2pv32DJy7uRdUgfAmTF5zpUO1b_WdG4hBU9j0FsYSOosgUPlhMV4Uxujie6uMbAwCn9z-b3cWXHk4OBYNSduNPInWOjH3lj8uM2GS-7WjksK8DW/s1600/Timer+%2528schematic2%2529.png" width="640" /></a></div>
<br />
<br />
How it works:<br />
<object height="360" width="640"><param name="movie" value="//www.youtube.com/v/oAwIHM4hULM?version=3&hl=en_US&rel=0" /><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><embed allowfullscreen="true" allowscriptaccess="always" height="360" src="//www.youtube.com/v/oAwIHM4hULM?version=3&hl=en_US&rel=0" type="application/x-shockwave-flash" width="640"></embed></object><br />
<br />
<b>Update: June 12, 2014</b><br />
Because, one of my reader ask me to publish the files of the actual device (second schematic), here the link for downloading them: <a href="http://bit.ly/2FPfe8s" target="">Timer (PIC16F628A)(2).rar</a><br />
Inside are the schematic, PCB, partlist, source file and .hex file.<br />
Use them on your own responsibility!<br />
<b>Notes</b>: the LCD display is connected via male - female pin headers. I prefer to solder the 16-pin female header on the PCB and the male pin header to the display board, but it can be done otherwise.<br />
If there are used standard pin headers, the distance between display board and PCB is around 10mm, so there must be used low profile capacitors for C1 and C2 or they can be bend to fit under the display. <br />
<br />
<b>Update: February 25, 2016</b><br />
There is update of the software - the changes are:<br />
slightly different interface, the LED will light when the timer is counting. To enter in the adjustment mode it is needed only brief shorting of RA0 to the ground. pressing the START/STOP button will end the adjustment mode.<br />
The link: <a href="http://bit.ly/2Wi7TDv" target="_blank">Timer (PIC16F628A)</a><br />
In the archive are only .C and .HEX files. The schematic and the PCB are the same and can be found in the previous update.<br />
<br />
<b>Update: May 1, 2016 </b><br />
One of my readers, Alnoor Ratansi send me a modified code for the timer with added ability to count up to 99 hours 59 min 59 sec. The software uses one additional button attached to pin 16 for adjusting hours. Thank you, Alnoor!<br />
I haven't tried the code, so if anyone try the code, let me know if it work properly. Here you can download it: <a href="http://bit.ly/2DAKhmb" target="_blank">PicTimer</a>Христоhttp://www.blogger.com/profile/14002909704834630953noreply@blogger.com74tag:blogger.com,1999:blog-4191887753331304313.post-19306831380840130782014-03-05T21:55:00.000+02:002017-09-08T01:28:46.277+03:0050W Power Amplifier with LM3886This is my second encounter with <a href="http://www.ti.com/product/lm3886">LM3886</a>. I was pleased of the sound this chip produced the first time, so I decided to make another amplifier with it.<br />
<br />
<a name='more'></a><br />
The schematic is based on the schematic in the datasheet of the chip with minor changes.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-7KiolWnihSM/Uxdn9TSLWNI/AAAAAAAAAqQ/gURowVX7n0c/s1600/LM3886+%2528schematic%2529.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="404" src="https://1.bp.blogspot.com/-7KiolWnihSM/Uxdn9TSLWNI/AAAAAAAAAqQ/gURowVX7n0c/s1600/LM3886+%2528schematic%2529.png" width="640" /></a></div>
<br />
I removed the time delay capacitor connected to MUTE pin, because it's better to use separate DC protection schematic which has similar functionality.<br />
I made the output inductance L1 by winding 15 turns of enameled wire around the resistor R7. The diameter of the wire must be minimum 0.4mm. The whole was wrapped with heat shrink.<br />
I used 47uF/63V non polarized capacitor for C2. It can be regular electrolytic capacitor, but it's better to use non-polarized or bipolar. <br />
<br />
Here's what the finished boards look like:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEizZKM-kKhWrzkhbuZFi3AC-caqurox0AzvXjI7w318aa5s6_YJxEI-9kfMKBtDFfp08gKCZujJpVPYBl3zj917YObUYH6sqNYvNmA6j9BkqvEqtL-rvdlNdxIHbNUhQho35Df6Onz81N-9/s1600/LM3886%25281%2529.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEizZKM-kKhWrzkhbuZFi3AC-caqurox0AzvXjI7w318aa5s6_YJxEI-9kfMKBtDFfp08gKCZujJpVPYBl3zj917YObUYH6sqNYvNmA6j9BkqvEqtL-rvdlNdxIHbNUhQho35Df6Onz81N-9/s1600/LM3886%25281%2529.JPG" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-cRN8AGzpFv5d7ZxSr_wpImHBWzNKfgDZkaGZkek5-cSPkd0fSFEyBctW-7mU0iqQfKfDKcWX9vYQ4T_dmZVX-2SZ_B9q_Ye0RrTvE1e7alZ4lRCkUAGSnMYKwqUwKlRHsSIt9MUH6wTz/s1600/LM3886%25282%2529.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-cRN8AGzpFv5d7ZxSr_wpImHBWzNKfgDZkaGZkek5-cSPkd0fSFEyBctW-7mU0iqQfKfDKcWX9vYQ4T_dmZVX-2SZ_B9q_Ye0RrTvE1e7alZ4lRCkUAGSnMYKwqUwKlRHsSIt9MUH6wTz/s1600/LM3886%25282%2529.JPG" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-yP5U3_XXTIU/Uxdm7bFl1EI/AAAAAAAAAps/ChFCnPVYjlI/s1600/LM3886%25283%2529.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://1.bp.blogspot.com/-yP5U3_XXTIU/Uxdm7bFl1EI/AAAAAAAAAps/ChFCnPVYjlI/s1600/LM3886%25283%2529.JPG" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-Oe4UB_4DmAM/Uxdm8RcB1xI/AAAAAAAAAp4/H70igBEDkgg/s1600/LM3886%25284%2529.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://3.bp.blogspot.com/-Oe4UB_4DmAM/Uxdm8RcB1xI/AAAAAAAAAp4/H70igBEDkgg/s1600/LM3886%25284%2529.JPG" width="640" /></a></div>
<br />
And here's my test setup :)<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEinWJPLg4fxX4DJtqkOgfOTtgnobo6AW5Qp-so_KhhTVHZZ3N-NzviiB2VBI4SrMtE9774Gf7dAq7CrVePdJoOV0PUa0d6FmsvRGX96gjnY9jkm2znQhR426xGHJ9WSZ7FVFCSylzG3LFVE/s1600/LM3886%25285%2529.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEinWJPLg4fxX4DJtqkOgfOTtgnobo6AW5Qp-so_KhhTVHZZ3N-NzviiB2VBI4SrMtE9774Gf7dAq7CrVePdJoOV0PUa0d6FmsvRGX96gjnY9jkm2znQhR426xGHJ9WSZ7FVFCSylzG3LFVE/s1600/LM3886%25285%2529.JPG" width="640" /></a></div>
The transformer is 2x24VAC / 105W. The test was ran with 8Ohm dummy load and the big heat sink gets only warm after hours of playing music from my computer at max volume. The transformer is a little weak for this amplifier, maybe 150W or 200W would be a better choice. <br />
The power supply is very simple - a bridge rectifier and 4 x 10 000uF/50V capacitors.<br />
<br />
If the input is disconnected and open there is a little hum which can be heard only with an ear pressed against the speaker. But once the amplifier is connected via cable to the source and there is no signal, it becomes absolutely silent.<br />
Also if the heat sink is isolated from the metal tabs of the chips with some mica pads then the heat sink is good to be connected to the ground to prevent inducing hum in the open inputs.<br />
It can be mounted without isolation pads for better thermal conductance, but then the heat sink itself must be isolated from the metal enclosure which usually is connected to the ground.<br />
<br />
How does it sound? Excellent :)<br />
<br />
<br />
<b>Update: July 22, 2015</b><br />
<br />
Now, after more than a year, I finished the amplifier :)<br />
It's intended to be connected to my computer and will power two bookshelf speakers on my desk. The enclosure isn't the prettiest, but it is only 5 euro, so...<br />
The heat sink here is much smaller than before and that's why there is a 60mm fan mounted on the back. It is powered by voltage regulator 7809 and it is inaudible. There is small empty space at upper left corner where I can put an EMI filter some time in the future :)<br />
<br />
This is how it looks:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-euvqzkiXqkU/Va9hwAx73rI/AAAAAAAABJU/vCLFWc9xg2E/s1600/LM3886%25286%2529.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="532" src="https://4.bp.blogspot.com/-euvqzkiXqkU/Va9hwAx73rI/AAAAAAAABJU/vCLFWc9xg2E/s640/LM3886%25286%2529.JPG" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-U6G-DRzoiOI/Va9hySWomdI/AAAAAAAABJc/GybIxIPYKdI/s1600/LM3886%25287%2529.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="374" src="https://2.bp.blogspot.com/-U6G-DRzoiOI/Va9hySWomdI/AAAAAAAABJc/GybIxIPYKdI/s640/LM3886%25287%2529.JPG" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAORXAV4sdq0dhqMW_HvZSEU8QU1v_qjp2ECl-9oyWdk57G-AWKqOLRT2JboZ8XJBPqcsuBwJCNMFTz4hbEc5wIzbDiYq1lPE6NmkoMR832cpVMD9PrM7qFMY-Z2U7au742n7fpAGBnsf7/s1600/LM3886%25288%2529.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="390" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAORXAV4sdq0dhqMW_HvZSEU8QU1v_qjp2ECl-9oyWdk57G-AWKqOLRT2JboZ8XJBPqcsuBwJCNMFTz4hbEc5wIzbDiYq1lPE6NmkoMR832cpVMD9PrM7qFMY-Z2U7au742n7fpAGBnsf7/s640/LM3886%25288%2529.JPG" width="640" /></a></div>
<br />
<br />
<br />
Link for downloading files of the project in PDF format: <a href="http://bit.ly/LM3886DIYFan">LINK</a><br />
Use them on your own responsibility.<br />
The PCB in the archive is a little different from that in the pictures - I changed the way R7/L1 combo is mounted. It's horizontal now which is more convenient.<br />
<br />
<u><b>Update December 3, 2015</b></u><br />
One of my readers ask me for the PCB of the power supply. I haven't published it before, because it's very simple design and I think everybody should be able to make it himself . Anyway, here is the link for downloading the files for power supply: <a href="http://bit.ly/PSU_LM3886" target="_blank">LINK</a><br />
This is the schematic:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlY200vbUpm1gclvvLucWkHVfqRyT3J2aLho5thHx1lzB-0QsaRfF2Hm1JXfgOWTWTw5YlF0Am8O1EZMtKOzk-8aWxUzBAO0loPeIlU-JUnYMi8Nb6sXGMN2wI9_LsjReCPHnP7O_onCDu/s1600/PowerSupply%2528schematic%2529.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="260" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlY200vbUpm1gclvvLucWkHVfqRyT3J2aLho5thHx1lzB-0QsaRfF2Hm1JXfgOWTWTw5YlF0Am8O1EZMtKOzk-8aWxUzBAO0loPeIlU-JUnYMi8Nb6sXGMN2wI9_LsjReCPHnP7O_onCDu/s640/PowerSupply%2528schematic%2529.png" width="640" /></a></div>
This is simple bridge rectifier with smoothing capacitors and bleeding resistors and connectors. There are connectors for DC input in case the bridge rectifier is not mounted on the board, but elsewhere.<br />
<br />
<br />Христоhttp://www.blogger.com/profile/14002909704834630953noreply@blogger.com12tag:blogger.com,1999:blog-4191887753331304313.post-32975069572485084922013-10-19T16:16:00.000+03:002013-10-19T16:17:21.528+03:00Troubles with chargerA couple of months ago I bought a Chinese Android tablet <a href="http://www.cube-tablet.com/cube-u35gt-2gb-ram-rk3188-quad-core-tablet-pc-7-85-inch-ips-android-4-1-16gb-white.html" target="_blank">Cube U35GT2</a> , which is quite nice although it has its downsides. One of them is the charger included in the bundle. It is a typical Chinese charger rated 5V/2A and it gets very hot when I use the tablet while charging. Eventually it burned out and I got to repair it - the output filter capacitor was blown up and I replaced it and also replaced the catch diode with a higher rated one.<br />
<a name='more'></a>But this was not the main problem. When using the tablet while charging, the touchscreen behaves erratically - there are phantom touches on the screen which make it hard to use. After googling the problem I found out that the main suspect for such behavior is the charger.<br />
<br />
My first idea was to buy a new charger, but I was not sure that it will not behave the same way. So I decided to make a new one. I had a previously bought DC-DC converter with <a href="http://www.ti.com/lit/ds/symlink/lm2596.pdf" target="_blank">LM2596-ADJ</a> and also an adaptor from a scanner rated 24V/550mA with real transformer inside.<br />
My plan was to use the adapter and to fit inside it the DC-DC module to get the 5V/2A output. <br />
The DC-DC module is with adjustable output voltage and is supposed to provide up to 3A current. It is very small and fits inside the case with ease. It turned out that 2A consumption from my tablet is too much and it gets so hot that the solder on some of the elements melted and the internal protection of the chip switches off the module.<br />
<br />
But I did not give up easily so I made a new DC-DC module with <a href="http://www.ti.com/lit/ds/symlink/lm2596.pdf" target="_blank">LM2596-5.0</a> which has 5V fixed output voltage. I designed the new PCB to be as big as possible to fit inside the adapter and to have enough clear space to mount on it a small heatsink.<br />
<br />
The schematic is the same as in the datasheet with an additional ripple filter. I chose the elements with large reserve - the catch diode is rated 8A, the main inductor is rated 5.5A and the inductor in the ripple filter is rated 4.5A. All of the elements are SMD except the input filter capacitor. As you will see in the photos bellow it is very custom made PCB and the board fits very tight in the case.<br />
<br />
There was a glitch in the first run - in the rush to finish it I had soldered the output cable with reverse polarity and when I plugged the cable in the tablet, it blacked out and did not power up anymore. Thank goodness when I plugged the original charger it started to charge and came to life. After that I corrected the mistake and tried again, this time with success :)<br />
<br />
The new charger also gets hot but not too much and more importantly it does not have that problem with the touchscreen of the tablet, so I can play my favorite games while charging the battery :)<br />
<br />
Here are some photos of the project:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-Qc7wwM-v2qw/UmJ9yUkl6-I/AAAAAAAAAlo/-FyxtFxgxpA/s1600/Charger1.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="478" src="http://3.bp.blogspot.com/-Qc7wwM-v2qw/UmJ9yUkl6-I/AAAAAAAAAlo/-FyxtFxgxpA/s640/Charger1.JPG" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjVpj2oJTJTR0R-PB1GoXWOSsfDR2I9phvEBSYX7IrWDfK4XnUVLAsdliw36iwVl_cfDhCAs55mLCewgbrvUguNOl8Rrb75KZXUJ1Xl3JD-GEtfcqtp7mk6C8CmokRmquqieZemTu-1H_hD/s1600/Charger2.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="478" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjVpj2oJTJTR0R-PB1GoXWOSsfDR2I9phvEBSYX7IrWDfK4XnUVLAsdliw36iwVl_cfDhCAs55mLCewgbrvUguNOl8Rrb75KZXUJ1Xl3JD-GEtfcqtp7mk6C8CmokRmquqieZemTu-1H_hD/s640/Charger2.JPG" width="640" /></a></div>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSTJ3RZH9TfEv5ztMwV_n6wfUweF-dClT8sw0Ghl61v7yiDnlSK-WSeFnIyvyndNMFRKfpetydmyenX6WqSfQRsOWCEm57AISb_NTwZA7oekKFM83hILGWRVCI9QQfpEP0RoETO-uY16KN/s1600/Charger3.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="478" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSTJ3RZH9TfEv5ztMwV_n6wfUweF-dClT8sw0Ghl61v7yiDnlSK-WSeFnIyvyndNMFRKfpetydmyenX6WqSfQRsOWCEm57AISb_NTwZA7oekKFM83hILGWRVCI9QQfpEP0RoETO-uY16KN/s640/Charger3.JPG" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Here is the DC-DC module bought from eBay for comparison with mine.</td></tr>
</tbody></table>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhEXN-MiQ-_dl83h4rk9tGCGCm8qLQur-wx0asqgt6puw4fnZcBnUOufnGt9F0cy5hoEl4SdH2CCJR7x9txYTyOE9wrXhHk7H-TfJow-3GnQSSNpinUYLDGjpKvBoqu_3ijP4MYuS_ksH3/s1600/Charger4.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="478" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhEXN-MiQ-_dl83h4rk9tGCGCm8qLQur-wx0asqgt6puw4fnZcBnUOufnGt9F0cy5hoEl4SdH2CCJR7x9txYTyOE9wrXhHk7H-TfJow-3GnQSSNpinUYLDGjpKvBoqu_3ijP4MYuS_ksH3/s640/Charger4.JPG" width="640" /></a></div>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2hCH8pi3MUxzg3_BFLwgpSphRrCHfw7AjWTMI9WeapducjrdLMJc2iZoAsf-w2mAtKawTY5ldscAUxWmqMngDv8hZpZ1G9G1tVXElycZQXOg6-mPqetpOOCoejc-f8Fjn0bUYnM6yP8qX/s1600/Charger5.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="478" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2hCH8pi3MUxzg3_BFLwgpSphRrCHfw7AjWTMI9WeapducjrdLMJc2iZoAsf-w2mAtKawTY5ldscAUxWmqMngDv8hZpZ1G9G1tVXElycZQXOg6-mPqetpOOCoejc-f8Fjn0bUYnM6yP8qX/s640/Charger5.JPG" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">I drilled some holes on the bottom side for better ventilation.</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpM0AANVHn2jokk2praSQvBZITdg9wTJGrJWmWcpERROoEL7wqfH6_vf_fPxcPfUlmmHBvCb6hsx6lq_thFhr7i93KL6_TGVDqDwNoWbqnXVU6ppzzQoLbhIRx11R7TEVNqWVVBSipOfL_/s1600/Charger6.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="478" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpM0AANVHn2jokk2praSQvBZITdg9wTJGrJWmWcpERROoEL7wqfH6_vf_fPxcPfUlmmHBvCb6hsx6lq_thFhr7i93KL6_TGVDqDwNoWbqnXVU6ppzzQoLbhIRx11R7TEVNqWVVBSipOfL_/s640/Charger6.JPG" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">The complete charger (two parts of the case fixed with some tape :) )</td></tr>
</tbody></table>
<br />Христоhttp://www.blogger.com/profile/14002909704834630953noreply@blogger.com0tag:blogger.com,1999:blog-4191887753331304313.post-31996907275627246402013-06-23T00:28:00.000+03:002017-09-08T01:32:47.981+03:00Original PICKIT-2These days I was thinking about a better PIC programmer that can work with Microchip <a href="http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en019469">MPLAB IDE </a>software so that I can write my own programs or edit someone else's programs.<br />
I found that there are numerous versions of the famous Microchip <a href="http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en023805">PICkit 2 </a>on the web. Some of them are using the original schematic published by Microchip and some are lite versions - with different parts or simplified schematics. None of them satisfied my requirements. So I got the original schematic, removed the memory chips and the input ICSP connector (which I didn't plan to use anyway) and made a new single sided PCB. I used mostly SMD parts.<br />
<br />
<a name='more'></a>I found out that I can get all parts for the original schematic from local stores, and only two - <a href="http://ww1.microchip.com/downloads/en/devicedoc/21733f.pdf">MCP6001U</a> and <a href="http://cncjuniormaster.ucoz.com/different/PICkit/FDC6420C.pdf">FDC6420C </a>- I had to order from Farnel. I also decided to replace two Schottky diodes <a href="http://www.fairchildsemi.com/ds/BA/BAT54.pdf">BAT54 </a>and <a href="http://www.diodes.com/datasheets/ZHCS1000.pdf">ZHCS1000 </a>with <a href="http://www.vishay.com/docs/88746/ss12.pdf">SS14 </a>because of more convenient package. <br />
I programmed the <a href="http://ww1.microchip.com/downloads/en/devicedoc/39632c.pdf">PIC18F2550 </a>microcontroller with my Chinese programmer.<br />
Here is the schematic which I used:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxZEEjNrB3S4EDcGMqsnOWKJNYcJkZt_N3HrOno8huxRFymG0Ecf98cyFzsnS2_-zmHSVa4-ECwC3ssg85XxLCUCqKML6tOHWX-jnJaoAT9Y9-EzaLDuWVaGSgwA1MbpONXphZiDoQxuwD/s1600/PICKIT-2+%2528schematic+p1%2529.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="412" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxZEEjNrB3S4EDcGMqsnOWKJNYcJkZt_N3HrOno8huxRFymG0Ecf98cyFzsnS2_-zmHSVa4-ECwC3ssg85XxLCUCqKML6tOHWX-jnJaoAT9Y9-EzaLDuWVaGSgwA1MbpONXphZiDoQxuwD/s640/PICKIT-2+%2528schematic+p1%2529.png" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjx_rCCZsUWixjOyyd4ThGCWP9HSxSMIBAJvxCwwZh7m6J5M5JhrQXjvNaUYNivhf5DAEfoY-EkJvSx6TmoMA0M0TCFVuwJaqgMzVhUJwuQ8yI20DGcKMl1_GD0XRH3hyphenhyphenTLtyxPboUqbdls/s1600/PICKIT-2+%2528schematic+p2%2529.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="530" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjx_rCCZsUWixjOyyd4ThGCWP9HSxSMIBAJvxCwwZh7m6J5M5JhrQXjvNaUYNivhf5DAEfoY-EkJvSx6TmoMA0M0TCFVuwJaqgMzVhUJwuQ8yI20DGcKMl1_GD0XRH3hyphenhyphenTLtyxPboUqbdls/s640/PICKIT-2+%2528schematic+p2%2529.png" width="640" /></a></div>
<br />
In the end the schematic is not exactly like the original one but it is close enough :)<br />
I used the same notifications of the parts like in the original schematic. <br />
<br />
PCB which I made is very satisfying:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-K9DiBEQkBbY/UcWcXLpaAHI/AAAAAAAAAgo/yf5EBBfxSes/s1600/PICKIT-2+%25281%2529.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="379" src="https://3.bp.blogspot.com/-K9DiBEQkBbY/UcWcXLpaAHI/AAAAAAAAAgo/yf5EBBfxSes/s640/PICKIT-2+%25281%2529.JPG" width="640" /></a></div>
<br />
It is one sided and has only five jumpers. The size is comparatively small - 83mm x 52mm.<br />
<br />
And the final product:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-alFYXk3oS0E/UcWcdGfTscI/AAAAAAAAAgw/RbaP8_CV0c8/s1600/PICKIT-2+%25282%2529.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://4.bp.blogspot.com/-alFYXk3oS0E/UcWcdGfTscI/AAAAAAAAAgw/RbaP8_CV0c8/s640/PICKIT-2+%25282%2529.JPG" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXpU1MlSRvwoBi0VDxfUjj24FCheLN3Ww341JP20NQntJgRIQoLabJY0E60dgq7i21T0TIOWR7PkhVD8uhFt8X_efTq5iVwY5cufZHJJsxpNrdNK9OT4TYudFLXxVjJ5QRfcncFcLH4s9L/s1600/PICKIT-2+%25283%2529.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="364" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXpU1MlSRvwoBi0VDxfUjj24FCheLN3Ww341JP20NQntJgRIQoLabJY0E60dgq7i21T0TIOWR7PkhVD8uhFt8X_efTq5iVwY5cufZHJJsxpNrdNK9OT4TYudFLXxVjJ5QRfcncFcLH4s9L/s640/PICKIT-2+%25283%2529.JPG" width="640" /></a></div>
<br />
<br />
I don't want to brag, but I think I made the best one sided PCB for PICkit 2 programmer :) .<br />
It also works without any hiccups. I tested it with an PIC16F628A which I have at hand. It was recognized in both PICkit 2 software and MPLAB IDE.<br />
<br />
Here is the picture of the programmer connected to the breadboard with the PIC16F628A on it.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4XSYi4peCKjIJtT7Lvwza4RbvtJZNoGO-7uWJ9l_LY5QA9yYBRVlKz-1k2hWhxQViwSkeMVJdmtceDLIjrmTPlFppk4Vg8EpAfvbuQN6ZH5Q41cKlKzHxFEEuq10DyPF26BCSdsHfQQH6/s1600/PICKIT-2+%25284%2529.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="538" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4XSYi4peCKjIJtT7Lvwza4RbvtJZNoGO-7uWJ9l_LY5QA9yYBRVlKz-1k2hWhxQViwSkeMVJdmtceDLIjrmTPlFppk4Vg8EpAfvbuQN6ZH5Q41cKlKzHxFEEuq10DyPF26BCSdsHfQQH6/s640/PICKIT-2+%25284%2529.JPG" width="640" /></a></div>
<br />
Connecting cable is made from short piece of LAN cable.<br />
Later I will make a separate board with 40 pin ZIF socket for easier programming of various models of the PIC microcontrollers. <br />
<br />
If anyone wants to make their own PICkit 2 here are the files of the project: <b><a href="http://bit.ly/PICkit2DIY">PICkit 2</a></b><br />
Inside are the PCB and the schematic in PDF format, parts list and also the latest version of the firmware for the PIC18F2550 and the user guide from the Microchip site.<br />
Use them on your own responsibility.<br />
<br />
<br />
<b>Update: 25 June 2013</b><br />
<br />
Here how I made the ZIF socket adaptor:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-S2ziy4U6esk/Uck8S17cf1I/AAAAAAAAAhk/8xaXNv2JLLg/s1600/PICKIT-2+%25285%2529.JPG" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="380" src="https://3.bp.blogspot.com/-S2ziy4U6esk/Uck8S17cf1I/AAAAAAAAAhk/8xaXNv2JLLg/s640/PICKIT-2+%25285%2529.JPG" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3qztWOnTTPzXZmWcdOgDIDKTsw5vLhUmYiPfRTJY59ihXEiAPuews7T1N0UbCsCJVz4WMXZikZclN5e-hLIDYJT74Y_2n8kOlae8NIEaTgtSTCnvO6pyh8vXMVW4B8ccXRB-YUpEVWxwZ/s1600/PICKIT-2+%25286%2529.JPG" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="378" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3qztWOnTTPzXZmWcdOgDIDKTsw5vLhUmYiPfRTJY59ihXEiAPuews7T1N0UbCsCJVz4WMXZikZclN5e-hLIDYJT74Y_2n8kOlae8NIEaTgtSTCnvO6pyh8vXMVW4B8ccXRB-YUpEVWxwZ/s640/PICKIT-2+%25286%2529.JPG" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjq1Gf7AA_bniB1ok5YVrpHSnGB1YC9tKdorz7gbHhIJ1sbO3e3R5STHCp4bar3HmPeYcbIdESSNKM46C7NDO2ft-vGpYgyHjm4KcqYgIpM9PHDXK4Xrc_wftEjrDh4X6zCfEfFwM110JPE/s1600/PICKIT-2+%25287%2529.JPG" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="478" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjq1Gf7AA_bniB1ok5YVrpHSnGB1YC9tKdorz7gbHhIJ1sbO3e3R5STHCp4bar3HmPeYcbIdESSNKM46C7NDO2ft-vGpYgyHjm4KcqYgIpM9PHDXK4Xrc_wftEjrDh4X6zCfEfFwM110JPE/s640/PICKIT-2+%25287%2529.JPG" width="640" /></a></div>
<br />
It is very simple approach - necessary connections are made with wires so care must be taken which pin goes where. <br />
<br />Христоhttp://www.blogger.com/profile/14002909704834630953noreply@blogger.com16