Search Your Query

Custom Search

Monday, 23 May 2011

Digital & Binary clock with thermometer & hygrometer




Here we have a clock. It's not "another clock". It has digital and binary 
output. It also has a thermometer and a hygrometer. It's not "another 
thermo-hygrometer". It display's absolutely humidity (gr/m3) also.

Schematic


Click on image to view large

MCU

I build it around Microchip PIC16F917, with internal Oscillator at 4MHz. 
I also build a serial port programmer, so I can programming it on-line, 
using the DL4YHF WinPic.



Clock

I use a RealTimeClock Maxim DS1305. The RTC backup power is a 
supercapacitor (0,22F). I test  it for 4 weeks, works fine. For this 
reason it don't have the capability to change the time, but you can 
do small-corrections. Once you push the button, the seconds change 
to 30, with no effect to minutes, hours etc. The routine is in lines 
1878-1887 "sec30".
You set the time when you program the PIC. You have to program 
two times. The first time without line 91 (goto  rdtime). The 
routinessetDS and settime is execute.
SetDS is setting RTC's control and trickle charger registers. In the 
settime routine, you set the time. After this, you add line 91 (goto  
rdtime) and you reprogram it. Now the routines do not execute. RTC 
can keep the setting and time at least for 28 days. The routinesDST3 
and DST10 are for DaySavingTime. The check register is flag, 1. The 
checking routine is in lines 434-460. In the last Sunday of March, the 
02:00 o'clock became 03:00 o'clock. In the last Sunday of October, the 
02:00 o'clock became 01:00 o'clock. I set the RTC for 12H mode, leds 
for 12H and display for 24H.




Temperature - Humidity



I use a digital humidity and temperature sensor Sensirion SHT11.
I bought it in a PCB, with the pull-up resistor and decoupled capacitor 
ready in place.
Measurements make every 10 seconds.
At 00, 20 and 40 seconds it measures the temperature and calculate 
the temperature and Absolutely Humidity ("gr/m3" grams at cubic meter of air).
At 10, 30 and 50 second it measures the humidity and calculate the 
Relative Humidity (%).
The check register is flag, 0. The checking routine is in lines 464-475.
The measure temperature routine is in lines 477-514 "measTEMP
and lines 625-714 "measure".
The calculate temperature routine is in lines 1793-1820 "calcTEMP".
The measure Relative humidity routine is in lines 560-590 "measRH
and lines 625-714 "measure".
The measure Absolute humidity routine is in lines 515-555 "measAH".
The calculate Relative humidity routine is in lines 717-1470 "calcRH".
The calculate Absolute humidity routine is in lines 1473-1728 "calcAH".







LCD display

I use a Chinese display 2line, 24row, with backlight. I drive it with a 
sift register T.I. 74164.

LED display
I use bright leds. 7 green with 8,2K resistors for seconds, 7 white with 
5,6K resistors for minutes and 5 blue with 560R resistors for hours.The 
maximum current for leds is about 17mA, so I don't have to drive them 
with transistors.

PCB


The PCB build in DipTrace software.  Download DipTrace files here
BEFORE PRINT:
1.      In print preview click on "Objects" tab. UNCKECK Assy and Silk
2.      CHECK Mirror
3.      CHECK Print in black only
4.      BE SURE print scale 100%.






Super Flux RGB LED Controller




ntroduction

 
In this project it was used the “Piranha Super-flux RGB” Led of common 
anode, and the PIC18F25K20, in order to generate combinations of colors. 
It has two function modes, automatic that generate the color sequence 
that is stored in the μC memory, and the manual mode in which you can 
select one of the seven possible colors.

Schematic




Firmware
 
The control of the RGB led is made with PWM(Pulse With Modulation), 
because PIC18F25K20 only have 2 PWM outputs (Hardware), I did the 
PWM by software to have 3 PWM outputs for that I use TIMER0 and for 
the Manual mode I use IOC(interrupt on change).
 
De-bounce

In this project I use push buttons to change between modes and to 
change the colors. But if we use the button as in the circuit (1) we 
have a problem. The problem with this configuration, due to the 
mechanical nature of any switch that may contains spring return 
action of some kind, there won’t be a clean transition from a state 
to another, but instead there will be a series of high and low states 
spikes. To solve that problem we have to implement a de-bouncing 
system, it can be done by hardware or software. We can use a RC 
delay circuit or it can be done with a schmitt trigger, but both ways 
will increase the price. So I done by software the de-bounce.
Example of code to do de-bounce:


It can be done in a different away but this way works for me.

PSU
I use a 7812 voltage regulator to keep the voltage stable in the RGB led and for 
μC I use an LM317 voltage Regulator. To calculate the output of LM317 I use this equation:


Led RGB
I use different resistor values on the RGB Led because which color have a different 
VF (Forward Voltage) in order to have the same LUX for each color. To calculate 
the resister I use these equations:





Download

A Very Simple Power Failure Light




Introduction



This is a very basic power failure lighting circuit based around a relay.
This simple circuit has many uses, from lighting up rooms and walkways in the case of 
a power failure, to monitoring and security uses.
There are many different power failure circuits out there based on 555 
timers or transistors but they all have different problems including limited 
input voltage, price and complexity, and poor backup power. This unit has 
been designed to work with mains power all the way down to 5 volts, and 
power 3 LEDs to provide light for a hallway or a child's room in the event 
of power failure. The PCB includes many simple add-ons and modifications 
too. 
Specs 
Input Voltage Max: 240 Volts AC
Input Voltage Min: 5 Volts DC
Approximant Power Consumption: 450 mW


Schematic




Explanation
This circuit is connected to ac power through J1 then rectified to dc through 
D1-D4. D5 is a 12 volt zener diode being used along with the resistor R1 
and the coil resistance of relay RL1 to regulate the input voltage to 12 volts 
and C1 is used to help smooth this power.

Alternatively a dc voltage of 5 volts or more can be connected directly to J2 
and J3, positive to J2 and negative to J3; in this setup the circuit would not 
need J1D1-D5, and R1.
The relay RL1 is a SPDT 5vDc relay and when power is applied to it, it opens 
the circuit with the LEDs so they are off as long as power is on if the power 
goes off, the relay closes the circuit and the battery BAT1 powers the LEDs 
D6D7, and D8. In this circuit BAT1 is a 9 volt battery that powers the 
3 LEDs through R3; however BAT1 can be many different batteries depending 
on your needs. J4 is also available in parallel with the LEDs to connect a
buzzer or etc.

You can also put a switch on one of the wires for BAT1 so you can turn it 
off so that you 
don't drain it when the circuit is not being used.
Parts List



1
R1
1.2k Ohm
1
R3
120 Ohm
1
C1
470uF
4
D1-D4
1N4004
1
D5
1N4742A
3
D6-D8
White LED
1
RL1*
5 Volt SPDT Relay T7CV5D-05
1
BAT1
9V
1
-
9V Battery Connector

*There are many different relays that can be used, some that even use 
next to no power.
PCB












Download

Motorized Curtain with Remote control




Introduction


The project is "Motorized Curtain" with Remote control. It is made 
up of MCU ATMEGA328 with Arduino BootLoader, motor driver L293D 
( i used L293B with external diodes, because i couldn't find L293D ), 
IR Receiver TSOP 1738, DC Motor from an old printer and other 
small parts. To control it, i use IR remote control from a PixelView 
TV Tuner. The software allows moving the curtain from left to right 
and back, or on steps. On the last peg (of the curtain rail) is 
attached a small magnet, which interacts with the two reed 
contacts, placed on the two ends of the rail. The last peg is 
moved by a cord, which connects it to the motor on one side 
and a reel to the other.
Source Code is written on Arduino. I use NECIRRcv Libraries for decode 
code from IR Remote Control.

Schematic




Photos








Download

Digital Impulse Relay




Introduction



In the first place, a relay is like a switch to a coil assembly. 
This switch is activated when electricity is applied to the coil. 
With a common relay, the electricity must be continuously 
applied to the coil to maintain the contacts, but the impulse 
relay "remembers" and only requires a momentary application 
of electricity. Stated differently, apply pulse of electricity to 
the coil to turn on the relay contacts, apply another pulse of
 electricity to turn off the relay contacts.      
So, impulse relay use it for to turn on a lamp with pushbuttons 
and not toggle switches. What is really neat is connecting 
several momentary pushbuttons in parallel and placing them 
in different locations. I can turn on the lamp in one room, and 
turn it off from a different room, because it was the relay that 
was providing electricity to the lamp, not the switch.




Description
A digital impulse relay is a electronic circuit that mimics perfect 
the all functions of a impulse relay with ratchet mechanism: the 
first press to the button turns the relay on and the second press 
turns it off, and relay in the circuit operating room illuminates. 
Particularity of this circuit is that it can be used in a centralized 
system for home automation. Another advantage is lower price 
compared with that of the impulse relay with ratchet mechanism
Digital impulse relay is immune to electrical noise, connection 
between buttons and circuit can be achieved with unshielded cable 
and any length.

Schematic 
This circuit is operating the room illuminates. The basic component 
of the circuit is a IC1 (CD4017). Push buttons room are connected by 
normally wired to the circuit. All circuit is separately by optocoupler, 
which means that the circuit is immune to electrical noise that can 
come on cable that connects with push buttons.
First any button push put to GND the optocoupler IN. The output 
signal from optocoupler is amplified by transistor Q1 (BC557) 
together by C1, R3, R4 circuit.  The amplified signal is attack to 
clock pin 14 of decade counter IC1 (CD4017), the counter advances 
by 1, pin 2 goes high and relay is ON. Transistor Q2 (2N2222) 
connected to pin 2 of IC1 drives 12V relay. Diode 1N4004 (D1) 
acts as a freewheeling diode. LED1 indicate the ON/OFF status.
Second any button press, the IC1 advances by 1, pin 2 goes low, 
relay is OFF, and pin 4 goes high. If we connect by diode D2, pin 
4 to Reset pin of CD4017, the counter is going back to the initial
 condition, and is ready to get another button press, to turn the 
relay ON.
The C2 - R6 component keep the Reset pin to +12V, when the 
circuit is powering, until the C2 loaded at 12V.
From transistor Q2 colector is IN/OUT for use in to microcontroller 
system (GSM remote control, WEB control, etc.). When use as IN, 
microcontroller system can put to GND Q2 colector, and relay is ON. 
Or the colector is use as OUT, signal obtained say the microcontroller 
system, if the relay is ON or OFF.
The power supply for the circuit is DC 12V. In standby, when relay is 
OFF, digital impulse relay consume 0V. Otherwise, when relay is ON, 
consume depend of 12V relay current.

Installation 

 

Parts List

 
IC1 - CD4017
Q1 - BC557
Q2 - 2N2222
OK1 - PC817 (optocoupler)
D1 - 1N4004
D2 - 1N4148
R1 - 3 K
R2 - 100 K
R3 - 1 K
R4 - 10 K
R5 - 1 K
R6 - 100 K
R7 - 1 K
C1 - 100 nF
C2 - 100 nF
С3 - 1 uF/25V
С4 - 1 uF/25V
С5 - 1 uF/25V
С6 - 1 uF/25V
LED1 - led diode
K1 - 12V relay


PCB










Photos






Related Posts Plugin for WordPress, Blogger...