27 Sept 2013

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