27 Sept 2013

digital compass

Digital compass



Things we need to build a compass

1. ic 7805 used as 5v regulator
2.leds
3.9v battery
4.dinsmore 1490 works on priciple of hall effect it is a sensor


It detects the earth magnetic field using dimnsore 1490 electronic compass.

sensor has 12 pins which are arranged in to four sets of three. pins marked 1 are connected to the positive (+5V). pins marked 2 are tied together and connected to the ground. The pins marked 3 are the output pins. Each output pin is equivalent to the open collected of an NPN transistor and can sink up to 20mA. An LED is connected between the positive (+5V) and each of the output pin. The 1K resistor will limit the LED current to 5mA.The direction can be identified by interpreting the combination of LEDs glowing. A typical 5V regulator using IC 7805 is used to produce 5V DC from the 9V battery for powering the circuit.

digital compass sequence





NE567 proximity sensor.

NE567 proximity sensor.


NE567 is a tone decoder IC from Philips. The IC has a built in PLL circuit with AM lock detection and an output driver circuit. The main function of NE567 is to drive a load (usually LED) when a frequency with in its detection band is available at the IC’s input. Center frequency of the input frequency band, output delay etc can be programmed using external components. The features of NE567 IC includes 0.01Hz to 500KHz frequency range, highly stable centre frequency, programmable bandwidth, high noise rejection, can sink 100mA at the output, highly immune to false triggering, externally adjustable VCO frequency etc. The common applications of NE567 are touch tone decoding, remote controls, ultrasonic controls, frequency monitoring etc.

 Pin 8 is the output terminal of the internal output driver circuit inside the IC. This pin goes low when the input frequency to the IC (at pin3) is with in the detection band. Resistor R7  and capacitor C4 sets the frequency of oscillations. These oscillations are available  pin 5 and  coupled to the terminal A of the pick up assembly using capacitor C3. Terminal B picks up the oscillations and couples it to the base of the transistor Q1 through capacitor C1. Q1 and Q2 forms a two stage collector to base biased 2 stage amplifier. R1 and R4 are the collector to base biasing resistors for Q1 and Q2. C2 couples the output of first stage to the second stage. The picked up signal is thus amplified and applied to the input pin (pin3) of the IC through capacitor C7. C6 forms the output filter capacitor and capacitor C5 determines the band width of the receiving signal. C9 is a power supply by pass capacitor. C2 and R2 provides a phase shift to the VCO signal from the IC and this phase shifted signal is detected by the IC. When some object comes near the pick up assembly, the capacitance between its terminals change. This change in capacitance changes the frequency ,IC detects this change and shows the  indication.  Resistor R8 limits the output LED current.

Notes.


Use 9V DC for powering the circuit.
we can use AC adapter
The pick up assembly can be made using two metal strips.
POT R6 can be used for adjusting the sensitivity.

water sensor

Water sensor


This one is a water sensor circuit.

This is a  alarm circuit which produces a  tone when water or some conducting liquid comes in contact with the two sensor wires. The circuit is based on four transistors and one melody generator IC (M 3482).

When water comes in contact with the sensors wires A & B, the base of Q1 gets connected with the negative and it conducts. This makes Q2 and Q3 ON. When Q3 is ON the power is available for the music generator circuit and it starts producing 12 different melodies one after another. The music continues as long as there is water between the sensor wires. The POT R12 can be used as a volume controller.
Circuit diagram with Parts list.
water-activated-musical-bell-circuit

water-activated-musical-bell-circuit


Two insulated aluminum wires can be used as the sensor.

The speaker be a 8 Ohm, ½ W tweeter.

Temperature detection using led

Temperature detection using led




The circuit has two LEDs (D1 and D2), they are controlled by the temperature of the surrounding. The  IC LM35 is used as temperature sensor here. Output of LM35 increases by 10mV per degree rise in temperature. Output of LM35 is connected to  non inverting input of the opamp CA3130.The inverting input of the same opamp can be given with  reference voltage using POT R2. If the reference voltage is 0.8V, then the voltage at the non inverting input (output of LM35) becomes 0.8V when the temperature is 80 degree Celsius. At this point the output of IC3 goes to positive saturation. This makes the transistor Q1 On and LED D1 glows. Since the base of Q2 is connected to the collector of Q1, Q2 will be switched OFF and LED D2 remains OFF. When the temperature is below 80 degree Celsius the reverse happens.IC1 produces a stable 5V DC working voltage from the available 9 V DC supply. If you already have a 5 V DC supply then you can use it directly
.

                                                                     q1, q2 be NPN transistor



Biomedical heart rate detector

HEART RATE DETECTOR,MONITER USING MICROCONTROLLER


we need 
1. 8051 microcontroller model is AT89s51
2.IR diode LTH1550-01 photo transistor pair
3.sevensegmen disply with 3 digit

we detect the heart rate from finger tip using ir reflection and displays on display

When the heart expands (diastole) the volume of blood inside the finger tip increases and when the heart contrcats (systole) the volume of blood inside the finger tip decreases. The resultant pulsing of blood volume inside the finger tip is directly proportional to the heart rate and if you could some how count the number of pulses in one minute, that’s the heart rate in beats per minute (bpm)
IR transmitter /receiver pair is placed in close contact to the finger tip. When the heart beats, the volume of blood cells under the sensor increases and this reflects more IR waves to sensor and .When there is no beat the intensity of the reflected beam decreases. The pulsating reflection is converted to a suitable current or voltage pulse by the sensor





program

ORG 000H                   // origin
MOV DPTR,#LUT              // moves starting address of LUT to DPTR
MOV P1,#00000000B          // sets P1 as output port
MOV P0,#00000000B          // sets P0 as output port
MAIN: MOV R6,#230D         // loads register R6 with 230D
      SETB P3.5            // sets P3.5 as input port
      MOV TMOD,#01100001B  // Sets Timer1 as Mode2 counter & Timer0 as Mode1 timer
      MOV TL1,#00000000B   // loads TL1 with initial value
      MOV TH1,#00000000B   // loads TH1 with initial value
      SETB TR1             // starts timer(counter) 1
BACK: MOV TH0,#00000000B   // loads initial value to TH0
      MOV TL0,#00000000B   // loads initial value to TL0
      SETB TR0             // starts timer 0
HERE: JNB TF0,HERE         // checks for Timer 0 roll over
      CLR TR0              // stops Timer0
      CLR TF0              // clears Timer Flag 0
      DJNZ R6,BACK
      CLR TR1              // stops Timer(counter)1
      CLR TF0              // clears Timer Flag 0
      CLR TF1              // clears Timer Flag 1
      ACALL DLOOP          // Calls subroutine DLOOP for displaying the count
      SJMP MAIN            // jumps back to the main loop
DLOOP: MOV R5,#252D
BACK1: MOV A,TL1           // loads the current count to the accumulator
       MOV B,#4D           // loads register B with 4D
       MUL AB              // Multiplies the TL1 count with 4
       MOV B,#100D         // loads register B with 100D
       DIV AB              // isolates first digit of the count
       SETB P1.0           // display driver transistor Q1 ON
       ACALL DISPLAY       // converts 1st digit to 7seg pattern
       MOV P0,A            // puts the pattern to port 0
       ACALL DELAY
       ACALL DELAY
       MOV A,B
       MOV B,#10D
       DIV AB              // isolates the second digit of the count
       CLR P1.0            // display driver transistor Q1 OFF
       SETB P1.1           // display driver transistor Q2 ON
       ACALL DISPLAY       // converts the 2nd digit to 7seg pattern
       MOV P0,A
       ACALL DELAY
       ACALL DELAY
       MOV A,B             // moves the last digit of the count to accumulator
       CLR P1.1            // display driver transistor Q2 OFF
       SETB P1.2           // display driver transistor Q3 ON
       ACALL DISPLAY       // converts 3rd digit to 7seg pattern
       MOV P0,A            // puts the pattern to port 0
       ACALL DELAY         // calls 1ms delay
       ACALL DELAY
       CLR P1.2
       DJNZ R5,BACK1       // repeats the subroutine DLOOP 100 times
       MOV P0,#11111111B
       RET

DELAY: MOV R7,#250D        // 1ms delay
 DEL1: DJNZ R7,DEL1
       RET

DISPLAY: MOVC A,@A+DPTR    // gets 7seg digit drive pattern for current value in A
         CPL A
         RET
LUT: DB 3FH                // LUT starts here
     DB 06H
     DB 5BH
     DB 4FH
     DB 66H
     DB 6DH
     DB 7DH
     DB 07H
     DB 7FH
     DB 6FH
END



How to use

When power is switched ON, the indicator LED D4 will glow an continues in that state. Now place your finger tip over the sensor and adjust preset R14 so that the LED D4 starts blinking. After you got the LED blinking, reset the power and wait for 15 seconds. The display will show your heart rate in beats per minute

Analyser circuir BREATHANALYSER

BREATHALYSER CIRCUIT IMPLEMENTED USING MICROCONTROLLERSSOR 8051


This is abreath analyser using 8051 micro controller which gives output through blood alcohol content as input.This is a BaC displayes a 3digit 7 segment display.

we need a AT89S51 microcontroller of 8051
2.alcohol sensor  MQ135

MQ135 is agas sensor it detects the presence of alcohol in blood and output is displayed.Generally MQ135 sensor detect ammonia,co2,AL2o3,alcohol9(ch3cooh),smoke,nitrogen dioxide.

this ssensor has steel net and heating element present inside.
When alcohol is present in breath is oxidised to acetic acid when touches the heating element when this acetic acid fall on sensing layer resistance  of the material decreases and bridge circuit converts to appropriate voltage.


mq135 alcohol sensor
we can use the load upto 50k




program

ORG 00H
MOV P1,#11111111B
MOV P0,#00000000B
MOV P3,#00000000B
MOV DPTR,#LUT
MAIN: MOV R4,#250D
      CLR P3.7
      SETB P3.6
      CLR P3.5
      SETB P3.5
WAIT: JB P3.4,WAIT
      CLR P3.7
      CLR P3.6
      MOV A,P1
      MOV R5,A
      SUBB A,#86
      JC NEXT
      SETB P3.3
      CLR PSW.7
NEXT: MOV A,R5
      SUBB A,#115D
      JNC LABEL
      MOV A,#00000000B
      CLR PSW.7
LABEL: MOV B,#5D
       MUL AB
       MOV B,#8D
       DIV AB
       MOV B,#10D
       DIV AB
       MOV R6,A
       MOV R7,B
DLOOP:SETB P3.0
      MOV P0,#01000000B
      ACALL DELAY
      CLR P3.0
      SETB P3.1
      MOV A,R6
      ACALL DISPLAY
      MOV P0,A
      ACALL DELAY
      CLR P3.1
      SETB P3.2
      MOV A,R7
      ACALL DISPLAY
      MOV P0,A
      ACALL DELAY
      CLR P3.2
      DJNZ R4,DLOOP
      SJMP MAIN
DELAY: MOV R3,#255D
LABEL1: DJNZ R3,LABEL1
        RET
DISPLAY: MOVC A,@A+DPTR
         CPL A
         RET
LUT: DB 3FH
     DB 06H
     DB 5BH
     DB 4FH
     DB 66H
     DB 6DH
     DB 7DH
     DB 07H
     DB 7FH
     DB 6FH
     End

MQ135 sensor require 5min  to heat 
when alcohol test done if result is true we should take some time to do another test
intefacing 7segment display with 8051 to be done carefully


Linux shell tips 2

Linux shell tips 2


Mount a directory (for cases when symlinking will not work):
mount --bind /source /destination
Send dynamic update to DNS server:
nsupdate < <EOF
update add $HOST 86400 A $IP
send
EOF
Recursively grep all directories:
grep -r "some_text" /path/to/dir
List ten largest open files:
lsof / | awk '{ if($7 > 1048576) print $7/1048576 "MB "$9 }' | sort -n -u | tail
Show free RAM in MB:
free -m | grep cache | awk '/[0-9]/{ print $4" MB" }'
Open Vim and jump to end of file:
vim + some_file_name
Git clone specific branch (master):
git clone git@github.com:name/app.git -b master
Git switch to another branch (develop):
git checkout develop
Git delete branch (myfeature):
git branch -d myfeature
Git delete remote branch:
git push origin :branchName
Git push new branch to remote:
git push -u origin mynewfeature
Print out the last cat command from history:
!cat:p
Run your last cat command from history:
!cat
Find all empty subdirectories in /home/user:
find /home/user -maxdepth 1 -type d -empty
Get all from line 50 to 60 in test.txt:
< test.txt sed -n '50,60p'
Run last command (if it was: mkdir /root/test, below will run: sudo mkdir /root/test):
sudo !!
Create temporary RAM filesystem - ramdisk (first create /tmpram directory):
mount -t tmpfs tmpfs /tmpram -o size=512m
Grep whole words:
grep -w "name" test.txt
Append text to a file that requires raised privileges:
echo "some text" | sudo tee -a /path/file
List all supported kill signals:
kill -l
Generate random password (16 characters long in this case):
openssl rand -base64 16
Do not log last session in bash history:
kill -9 $$
Scan network to find open port:
nmap -p 8081 172.20.0.0/16
Set git email:
git config --global user.email "me@example.com"
To sync with master if you have unpublished commits:
git pull --rebase origin master
Move all files with "txt" in name to /home/user:
find -iname "*txt*" -exec mv -v {} /home/user \;
Put the file lines side by side:
paste test.txt test1.txt
Progress bar in shell:
pv data.log
Send the data to Graphite server with netcat:
echo "hosts.sampleHost 10 `date +%s`" | nc 192.168.200.2 3000
Convert tabs to spaces:
expand test.txt > test1.txt
Skip bash history:
< space >cmd
Go to the previous working directory:
cd -
Split large tar.gz archive (100MB each) and put it back:
split b 100m /path/to/large/archive /path/to/output/files
cat files* > archive
Get HTTP status code with curl:
curl -sL -w "%{http_code}\\n" www.example.com -o /dev/null
Set root password and secure MySQL installation:
/usr/bin/mysql_secure_installation
When Ctrl + c not works:
Ctrl + \
Get file owner:
stat -c %U file.txt