Main Title: Voice Interface
Project: Voice Controlled Electrical Device Details
Developer: Md. Redwanur Rahman
Location: Dhaka, Bangladesh.
Date: 15 September, 2007
I am here to share knowledge with other. I am writing about voice interface project. The people who are computer engineer will get help from this project.
Aim of this project:
Using your voice you can switch on/off a room’s light
Needed components:
6V relay, Diode two pieces (1N914), Transistor (BC547A), Adaptor 6 & 12 V, 12V light, Printer port cable (D25 Connector).
Circuit details:
Carefully see the circuit of this project. 6V relay is used to controlled 12v light and this relay is controlled by Transistor (BC547A) that’s base (B) is connected to printer port pin 2 and emitter (E) is grounded that also connect to printer port pin 18~25. Diode 2 is used for proper working of relay. When computer gives signal to pin 2 then relay switch and it switch the 12v light. Run the below program in visual basic and say “ Device On” then light will be on or say “ Device off” light will be off. Project is very sample and builds circuit carefully
Program Details:
It has two parts 1. Program Codes 2. Command.txt file
1. Codes
‘Past this code in main form
Public Port As Integer
Private Declare Function Inp Lib "inpout32.dll" Alias "Inp32" (ByVal PortAddress As Integer) As Integer
Private Declare Sub Out Lib "inpout32.dll" Alias "Out32" (ByVal PortAddress As Integer, ByVal Value As Integer)
Private Sub Form_Load()
Dim FileN As String
FileN = App.Path & "\commands.txt"
SR.Deactivate
SR.GrammarFromFile FileN
SR.Activate
SR.AutoGain = 99
CMD_List
End Sub
Private Sub SR_PhraseFinish(ByVal flags As Long, ByVal beginhi As Long, ByVal beginlo As Long, ByVal endhi As Long, ByVal endlo As Long, ByVal Phrase As String, ByVal parsed As String, ByVal results As Long)
Debug.Print Phrase
If Trim(Phrase) = "" Then
Exit Sub
Else
Text2.Text = Trim(Phrase)
SelMSG (Phrase)
Process_Message (Trim(Phrase))
End If
End Sub
Function Process_Message(Msg As String)
Port = &H378
Select Case (UCase(Msg))
Case ("EXIT")
Out Port, 0
End
Case ("DEVICE ON")
Out Port, 1
Case ("DEVICE OFF")
Out Port, 0
End Select
End Function
Function CMD_List()
Dim TxT As String, Temp As String
Open App.Path & "\commands.txt" For Input As #1
Do Until EOF(1)
Line Input #1, TxT
Temp = Left(TxT, 8)
If Temp = "
TxT = Mid(TxT, 9, Len(TxT))
List1.AddItem TxT
End If
Loop
Close #1
End Function
Function SelMSG(Msg As String)
Dim Temp As String
Dim i As Integer
For i = 0 To List1.ListCount
Temp = List1.List(i)
If Trim(UCase(Temp)) = Trim(UCase(Msg)) Then
List1.ListIndex = i
Exit Function
End If
Next
End Function
2. Command.txt file
Put inside the below code in command.txt file and this file must be in this program directory.
[Grammer]
Type=Cfg
[start]
start=Device On
start=Device Off
start=Exit
Download this Project: www.geocities.com/redu0007/cnews
Conclusion:
I developed this circuit and software that published in Cnews in Bangladesh. I am regular writer of Cnews, Computer Gajat and Computer tomorrow that’s monthly computer journal of Bangladesh.
No comments:
Post a Comment