Thursday, October 15, 2009
Marquee Display
Thursday, July 02, 2009
Father & Son: Conversation
“Thatha (father) what’s that smoke?”
“It’s coming out from that double-cab”
“What double-cab?”
“The one in front of us”
“Why is it smoking?”
“Because it is old”
“Why?”
“Since that uncle bought it a long time back”
“What uncle?”
“That uncle who is driving the double cab”
“What double cab?”
“The one which smoked a while ago”
“Why was it smoked?”
“Because it is old”
“Why?”
……..
Friday, May 15, 2009
Hygrometer: Back on track
Here it is in action;
It shows temperature, relative humidity, atmospheric pressure and height from sea level.
If you could refer my previous photo of the hygrometer, the reading was around 62% and that was in January. After 5 months, the reading is 76% for the same temperature. This explains the hot humid condition we are experiencing currently.
I have to format the output in a suitable way which I'm working on currently. At the same time, I must think a way to use the other three sensors too...
Tuesday, April 21, 2009
Altimeter - Contd...
Thursday, March 19, 2009
Altimeter
Pressure is given by
P = (Vout/Vs+.095)/0.009 kPa
Where Vs, supply voltage = 3v
Vout, Output voltage measured from ADC
Altitude is given by
H = -ln(P/Po)*R*T/g
Three variables have to be measured:
T - average temperature in degrees Kelvin
Po - atmospheric pressure at ‘zero’ level
P - atmospheric pressure at current level
Remaining values are fixed constants:
R – universal gas constant = 286
g – gravitational acceleration = 9.81
Assuming Po=101.325 kPa and T=303.15K (30C)
The device reported H = 52.5m
Accuracy of this value is largely depending on the resolution of the ADC.
10-bit resolution of the ADC is not even near to get a reasonable accuracy of the altitude. One unit change in the ADC measurement will change 10m of height. To obtain 1m sensitivity, I need at least 12-bit ADC. So I ordered 12-bit ADCs from Maxim-IC and waiting until they arrive for the final product.
Tuesday, March 03, 2009
PIC Relay – 230v
This simple PIC circuit can be used to pre-program the on/off time of 230v electrical appliances. The PIC is programmed as a clock and at specified times, it can turn on/off a relay to control the appliance. I found a broken power guard (which protects electrical equipments from over and under voltage) in my old parts ‘yard’ at home. It was good source for the relay, diods, step down transformer, voltage regulator, the plastic container and even the LEDs. This relay is having good characteristics since these power guards were produced mainly to protect refrigerators. Only drawback in this design is that it doesn’t have a user interface. If you want to change the on/off time, you have to do it using the program. (I was too lazy to add a display unit for the device) It is being tested with our refridegerator and is working fine. I put the fridge to turn off at midnight for about four hours.
/*
* Project name:
PIC Relay
* Copyright:
Chandana Inc.
* Description:
PIC Relay - 230v
* Test configuration:
MCU: PIC16F88
Oscillator: XT, 04.0000 MHz
SW: mikroC v8.0
* NOTES:
Time might not be accurate.
*/
unsigned int countdown ; // interrupt counter
unsigned char update ; // update output
unsigned char secs, mins, hrs ; // tally variables
unsigned char ticks, correction,mode;
char oldstate_min, oldstate_hr, PowerOK, Powerchange, OutputStatus;
void interrupt()
{
if (--countdown == 0)
{
countdown = 8000; // 8000 x 125us = 1 second
update = 1; // flag to update clock output
}
PIR1.TMR2IF = 0; // clear interrupt flag
}
void Clock24()
{
if (++secs == 60) // check each tally for rollover
{ secs = 0;
if (++mins == 60)
{ mins = 0;
if (++hrs == 24)
hrs = 0 ;
}
}
update = 0;
}
void Initialize()
{
CMCON=7;
secs = 255;
mins = 23;
hrs = 15;
update = 1;
countdown = 8000;
INTCON.GIE = 1; // enable GIE
INTCON.PEIE = 1; // enable PEIE
T2CON = 0; // prescaler=0; postscaler=0; Timer2=off
TMR2 = 0; // clear timer2
PR2 = 124; // TMR2 resets when matching PR2
PIE1.TMR2IE = 1 ; // interrupt enabled
PIR1.TMR2IF = 0 ; // interrupt flag cleared
T2CON.TMR2ON = 1 ; // start Timer0
}
void main() {
Initialize();
PORTA = 0;
TRISA =0b00010;
PORTB = 0;
TRISB = 0;
oldstate_min=0;
oldstate_hr=0;
mode=0;
PowerOK=0;
Powerchange=0;
OutputStatus=1;
do
{
if (update == 1) // advance seconds?
Clock24(); // yes...then output
if (Button(&PORTA,1,1,1))
{
PowerOK=1;
//mode=0;
}
if (PowerOK && Button(&PORTA,1,1,0))
{
PowerOK=0;
PowerChange=1;
mode=1;
}
if (Powerchange && PowerOK) //power restore
{
Powerchange=0;
mode=0; //back to normal
}
if (mode==0)
{
if (OutputStatus==0) //turn off
{PORTA.F0=1;
PORTA.F2=1;
PORTA.F3=0;}
else
{PORTA.F0=0; //Turn ON
PORTA.F2=0;
PORTA.F3=1;}
}
else
{
PORTA.F0=0;
PORTA.F2=0;
PORTA.F3=0;
}
} while(1); // endless loop
}//~
Thursday, January 29, 2009
Oops...
But hey... I got a new project... this time, I have to be extra cautious because it involves 230v. A small mistake can be deadly. Will post the details later...