Saturday, April 5, 2008

Robot will count your touches



Main Title: Hardware Interface
Project: Robot will count your touches
Developer: Md. Redwanur Rahman
Location: Dhaka, Bangladesh.
Date: 1 October, 2007

I am here to share knowledge with other.

Aim of this project
When someone touches my robot’s hand it will count how many people shake hand with it.

Needed components

C1=10uF 16V Electrolytic Capacitor
R1, R2=100K 1/4 Watt Resistor
R3=10 Meg 1/4 Watt Resistor
U1=4011 CMOS NAND Gate IC
Relay= 9V
D25 connector that is printer port connector.

Circuit details

Touch pad is just normal wires, when some one touch the touch pad then +9v relay will switch and it through signal (Supply +5v) at printer port 10. Computer get signal and program will count a touch. If someone touches my robot, every time it counts. Circuit ground (GND) must be connected to printer port pin 18~25.

Program Details
Private Port, X, Y 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)
Public Sub Command1_Click()
Timer1.Enabled = True
End Sub
Private Sub Command3_Click()
Timer1.Enabled = False
End Sub
Private Sub Command4_Click()
End
End Sub
Private Sub Form_Load()
Port = &H379 ' LPT1 Status Port Address
Text1.Text = 0
Y = 0
X = 0
End Sub
Private Sub Timer1_Timer()
Y = Inp(Port)
If (Y And 1) = True Then
X = X + 1
End If
Text1.Text = X
End Sub

Conclusion:
I developed this circuit and program code that published in Computer Jagat, February, 2007 in Bangladesh. For others people help I am publishing this

Robot will repeat whatever you say



Aim of this project:
Robot will repeat whatever you say. It is voice reorganization project.

Main Title: Voice Recognition
Project: Robot will repeat whatever you say.
Developer: Md. Redwanur Rahman
Location: Dhaka, Bangladesh.
Date: 20 February, 2008



Helps:
You need to install SAPI, Genie.exe, go to http://www.microsoft.com/speech/download/sdk51/ and download sapi5.1 & also download Voice agent genie.exe

Setup:
To use this get and install the sapi 5.1, free from microsoft
Then go to control panel, speech. Configure the microphone
(You may have to go to the volume control at the bottom of your screen and unmute the Line in)
Run the training session (you may have to add a new profile)
Make sure it is very quiet around you
Be sure to turn off the microphone, Line in after using this or it will
Click on genie.exe to install.

Program Details:
Option Explicit
Dim WithEvents RecoContext As SpSharedRecoContext
Dim Grammar As ISpeechRecoGrammar
Dim m_bRecoRunning As Boolean
Dim m_cChars As Integer
Dim vol As Double ' this helps open the volume control
Dim bye As Integer 'this closes the volume control
Dim char As IAgentCtlCharacterEx

Private Sub btnend_Click()
char.Stop
End
End Sub

Private Sub Command1_Click()
char.Speak ("Say note, i will open notpad for you.")
char.Speak ("Say Green, Look behind me, colour will change.")
End Sub

Private Sub Form_Load()
Dim anim As String
SetState False
m_cChars = 0
anim = "genie"
Agent1.Characters.Load anim, anim & ".acs"
Set char = Agent1.Characters(anim)
char.MoveTo 520, 300
char.Show
char.AutoPopupMenu = False
char.Speak ("Talk, I can repeat whatever you say, please 1st say Start")
End Sub

Private Sub btnStart_Click()
Debug.Assert Not m_bRecoRunning
char.Speak ("Say any word.")
' Initialize recognition context object and grammar object, then
' start dictation
If (RecoContext Is Nothing) Then
Debug.Print "Initializing SAPI reco context object."
Set RecoContext = New SpSharedRecoContext
Set Grammar = RecoContext.CreateGrammar(1)
Grammar.DictationLoad
End If
Grammar.DictationSetState SGDSActive
SetState True
End Sub

Private Sub btnStop_Click()
Debug.Assert m_bRecoRunning
Grammar.DictationSetState SGDSInactive
SetState False
End Sub

Private Sub Form_Unload(Cancel As Integer)
Char.stop
End Sub

' This function handles Recognition event from the reco context object.
' Recognition event is fired when the speech recognition engines recognizes
' a sequences of words.
Private Sub RecoContext_Recognition(ByVal StreamNumber As Long, _
ByVal StreamPosition As Variant, _
ByVal RecognitionType As SpeechRecognitionType, _
ByVal Result As ISpeechRecoResult _
)
Dim strText As String
'this is to open the notepad
Dim RetVal As Double
strText = Result.PhraseInfo.GetText
'do what you want for various words here
If strText = "green" Then Label1.BackColor = vbGreen
If strText = "red" Then Label1.BackColor = vbRed
If strText = "yellow" Then Label1.BackColor = vbYellow
If strText = "black" Then Label1.BackColor = vbBlack
'this is to end the program by saying by
If strText = "by" Then
MsgBox ("Bye bye.")
End
End If
'1 is normal, 3 is maximized 6 is minimized
If strText = "not" Then RetVal = Shell("c:\windows\notepad.exe", 3)
StreamNumber & ", " & StreamPosition
' Append the new text to the text box, and add a space at the end of the
' text so that it looks better
txtSpeech.SelStart = m_cChars
txtSpeech.SelText = strText & " "
m_cChars = m_cChars + 1 + Len(strText)
char.Speak (strText)
End Sub

' This function handles the state of Start and Stop buttons according to
' whether dictation is running.
Private Sub SetState(ByVal bNewState As Boolean)
m_bRecoRunning = bNewState
btnStart.Enabled = Not m_bRecoRunning
btnStop.Enabled = m_bRecoRunning
End Sub

Others help email: redu0007@yahoo.com
Others effective web: www.geocities.com/redu0007

Using your voice, you can control a key board.



Aim of this project
Using your voice, you can control a key board.

Main Title: Voice Recognition
Project: Voice controlled key board
Developer: Md. Redwanur Rahman
Location: Dhaka, Bangladesh.
Date: 15 November, 2007

I am here to share idea with other.

Operation of this Project
You have to say first “Start” then Start menu will open. Then say left or right. You may say up or down to control cursor position also and then say “Open” or “Ok”. After open a MS word file say “A” to write A. Like this, you can control your key board. This project has some limitations for some accent problem like I or E.

Program Details

Start Here…………………………………
Dim Temp As Variant
Private Const KEYEVENTF_EXTENDEDKEY = &H1
Private Const KEYEVENTF_KEYUP = &H2
Private Const VK_Backspace = &H8
Private Const VK_Tab = &H9
Private Const VK_Shift = &H10
Private Const VK_Control = &H11
Private Const VK_Alter = &H12
Private Const VK_Pause = &H13
Private Const VK_CapsLock = &H14
Private Const VK_Return = &HD
Private Const VK_Lshift = &HA0
Private Const VK_Rshift = &HA1
Private Const VK_Rcontrol = &HA
Private Const VK_Escape = &H1B
Private Const VK_Space = &H20
Private Const VK_End = &H23
Private Const VK_Home = &H24
Private Const VK_Left = &H25
Private Const VK_Up = &H26
Private Const VK_Right = &H27
Private Const VK_Down = &H28
Private Const VK_Insert = &H2D
Private Const VK_Delete = &H2E
Private Const VK_1 = &H61
Private Const VK_2 = &H62
Private Const VK_3 = &H63
Private Const VK_4 = &H64
Private Const VK_5 = &H65
Private Const VK_6 = &H66
Private Const VK_7 = &H67
Private Const VK_8 = &H68
Private Const VK_9 = &H69
Private Const VK_help = &H70 '''any help file open
Private Const VK_0 = &H60
Private Const VK_a = &H41
Private Const VK_b = &H42
Private Const VK_c = &H43
Private Const VK_d = &H44
Private Const VK_e = &H45
Private Const VK_f = &H46
Private Const VK_g = &H47
Private Const VK_h = &H48
Private Const VK_i = &H49
Private Const VK_j = &H4A
Private Const VK_k = &H4B
Private Const VK_l = &H4C
Private Const VK_m = &H4D
Private Const VK_n = &H4E
Private Const VK_o = &H4F
Private Const VK_p = &H50
Private Const VK_q = &H51
Private Const VK_r = &H52
Private Const VK_s = &H53
Private Const VK_t = &H54
Private Const VK_u = &H55
Private Const VK_v = &H56
Private Const VK_w = &H57
Private Const VK_x = &H58
Private Const VK_y = &H59
Private Const VK_z = &H5A
Private Const VK_star = &H6A '*
Private Const VK_plus = &H6B '+
Private Const VK_sub = &H6D '-
Private Const VK_dot = &H6E '.
Private Const VK_b_sls = &H6F '/

Private Declare Sub keybd_event Lib "user32.dll" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)

Private Type NOTIFYICONDATA
cbSize As Long
hwnd As Long
uId As Long
uFlags As Long
uCallBackMessage As Long
hIcon As Long
szTip As String * 64
End Type
Private Const WM_MOUSEMOVE = &H200
Private Const WM_LBUTTONDOWN = &H201 'Button down
Private Const WM_LBUTTONUP = &H202 'Button up
Private Const WM_LBUTTONDBLCLK = &H203 'Double-click
Private Const WM_RBUTTONDOWN = &H204 'Button down
Private Const WM_RBUTTONUP = &H205 'Button up
Private Const WM_RBUTTONDBLCLK = &H206 'Double-click
Private Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean

Private nid As NOTIFYICONDATA

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)
Select Case (UCase(Msg))
Case ("CLOSE")
Call Close_window
Case ("START")
Call Start
Case ("UP")
keybd_event VK_Up, 0, 0, 0 'Key Press
keybd_event VK_Up, 0, KEYEVENTF_KEYUP, 0 'Key Unpress
Case ("DOWN")
keybd_event VK_Down, 0, 0, 0
keybd_event VK_Down, 0, KEYEVENTF_KEYUP, 0
Case ("LEFT")
keybd_event VK_Left, 0, 0, 0
keybd_event VK_Left, 0, KEYEVENTF_KEYUP, 0
Case ("RIGHT")
keybd_event VK_Right, 0, 0, 0
keybd_event VK_Right, 0, KEYEVENTF_KEYUP, 0
Case ("OPEN")
keybd_event VK_Return, 0, 0, 0
keybd_event VK_Return, 0, KEYEVENTF_KEYUP, 0
Case ("OK")
keybd_event VK_Return, 0, 0, 0
keybd_event VK_Return, 0, KEYEVENTF_KEYUP, 0
Case ("ONE")
keybd_event VK_1, 0, 0, 0
keybd_event VK_1, 0, KEYEVENTF_KEYUP, 0
Case ("TWO")
keybd_event VK_2, 0, 0, 0
keybd_event VK_2, 0, KEYEVENTF_KEYUP, 0
Case ("THREE")
keybd_event VK_3, 0, 0, 0
keybd_event VK_3, 0, KEYEVENTF_KEYUP, 0
Case ("FOUR")
keybd_event VK_4, 0, 0, 0
keybd_event VK_4, 0, KEYEVENTF_KEYUP, 0
Case ("FIVE")
keybd_event VK_5, 0, 0, 0
keybd_event VK_5, 0, KEYEVENTF_KEYUP, 0
Case ("SIX")
keybd_event VK_6, 0, 0, 0
keybd_event VK_6, 0, KEYEVENTF_KEYUP, 0
Case ("SEVEN")
keybd_event VK_7, 0, 0, 0
keybd_event VK_7, 0, KEYEVENTF_KEYUP, 0
Case ("EIGHT")
keybd_event VK_8, 0, 0, 0
keybd_event VK_8, 0, KEYEVENTF_KEYUP, 0
Case ("NINE")
keybd_event VK_9, 0, 0, 0
keybd_event VK_9, 0, KEYEVENTF_KEYUP, 0
Case ("ZERO")
keybd_event VK_0, 0, 0, 0
keybd_event VK_0, 0, KEYEVENTF_KEYUP, 0
Case ("A")
keybd_event VK_a, 0, 0, 0
keybd_event VK_a, 0, KEYEVENTF_KEYUP, 0
Case ("B")
keybd_event VK_b, 0, 0, 0
keybd_event VK_b, 0, KEYEVENTF_KEYUP, 0
Case ("C")
keybd_event VK_c, 0, 0, 0
keybd_event VK_c, 0, KEYEVENTF_KEYUP, 0
Case ("D")
keybd_event VK_d, 0, 0, 0
keybd_event VK_d, 0, KEYEVENTF_KEYUP, 0
Case ("E")
keybd_event VK_e, 0, 0, 0
keybd_event VK_e, 0, KEYEVENTF_KEYUP, 0
Case ("F")
keybd_event VK_f, 0, 0, 0
keybd_event VK_f, 0, KEYEVENTF_KEYUP, 0
Case ("G")
keybd_event VK_g, 0, 0, 0
keybd_event VK_g, 0, KEYEVENTF_KEYUP, 0
Case ("H")
keybd_event VK_h, 0, 0, 0
keybd_event VK_h, 0, KEYEVENTF_KEYUP, 0
Case ("I")
keybd_event VK_i, 0, 0, 0
keybd_event VK_i, 0, KEYEVENTF_KEYUP, 0
Case ("J")
keybd_event VK_j, 0, 0, 0
keybd_event VK_j, 0, KEYEVENTF_KEYUP, 0
Case ("k")
keybd_event VK_k, 0, 0, 0
keybd_event VK_k, 0, KEYEVENTF_KEYUP, 0
Case ("L")
keybd_event VK_l, 0, 0, 0
keybd_event VK_l, 0, KEYEVENTF_KEYUP, 0
Case ("M")
keybd_event VK_m, 0, 0, 0
keybd_event VK_m, 0, KEYEVENTF_KEYUP, 0
Case ("N")
keybd_event VK_n, 0, 0, 0
keybd_event VK_n, 0, KEYEVENTF_KEYUP, 0
Case ("O")
keybd_event VK_o, 0, 0, 0
keybd_event VK_o, 0, KEYEVENTF_KEYUP, 0
Case ("P")
keybd_event VK_p, 0, 0, 0
keybd_event VK_p, 0, KEYEVENTF_KEYUP, 0
Case ("Q")
keybd_event VK_q, 0, 0, 0
keybd_event VK_q, 0, KEYEVENTF_KEYUP, 0
Case ("R")
keybd_event VK_r, 0, 0, 0
keybd_event VK_r, 0, KEYEVENTF_KEYUP, 0
Case ("S")
keybd_event VK_s, 0, 0, 0
keybd_event VK_s, 0, KEYEVENTF_KEYUP, 0
Case ("T")
keybd_event VK_t, 0, 0, 0
keybd_event VK_t, 0, KEYEVENTF_KEYUP, 0
Case ("U")
keybd_event VK_u, 0, 0, 0
keybd_event VK_u, 0, KEYEVENTF_KEYUP, 0
Case ("V")
keybd_event VK_v, 0, 0, 0
keybd_event VK_v, 0, KEYEVENTF_KEYUP, 0
Case ("W")
keybd_event VK_w, 0, 0, 0
keybd_event VK_w, 0, KEYEVENTF_KEYUP, 0
Case ("X")
keybd_event VK_x, 0, 0, 0
keybd_event VK_x, 0, KEYEVENTF_KEYUP, 0
Case ("Y")
keybd_event VK_y, 0, 0, 0
keybd_event VK_y, 0, KEYEVENTF_KEYUP, 0
Case ("Z")
keybd_event VK_z, 0, 0, 0
keybd_event VK_z, 0, KEYEVENTF_KEYUP, 0
Case ("CAPS")
keybd_event VK_CapsLock, 0, 0, 0
keybd_event VK_CapsLock, 0, KEYEVENTF_KEYUP, 0
Case ("BACK")
keybd_event VK_Backspace, 0, 0, 0
keybd_event VK_Backspace, 0, KEYEVENTF_KEYUP, 0
Case ("GAP")
keybd_event VK_Space, 0, 0, 0
keybd_event VK_Space, 0, KEYEVENTF_KEYUP, 0
Case ("EXIT")
End
End Select
End Function

Public Sub Start()
keybd_event VK_Control, 0, 0, 0
keybd_event VK_Escape, 0, 0, 0
keybd_event VK_Down, 0, 0, 0
keybd_event VK_Control, 0, KEYEVENTF_KEYUP, 0
keybd_event VK_Escape, 0, KEYEVENTF_KEYUP, 0
keybd_event VK_Down, 0, KEYEVENTF_KEYUP, 0
End Sub
Public Sub Close_window()
keybd_event VK_Alter, 0, 0, 0
keybd_event VK_F4, 0, 0, 0
keybd_event VK_Alter, 0, KEYEVENTF_KEYUP, 0
keybd_event VK_F4, 0, KEYEVENTF_KEYUP, 0
End Sub

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 = "{{Start}}=" Then
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

End Here…………………………………

Need Filled :Command.txt

[Grammer]
Type=Cfg

[{{Start}}]

{{Start}}=Start
{{Start}}=Open
{{Start}}=Ok
{{Start}}=Close
{{Start}}=Exit
{{Start}}=Up
{{Start}}=Down
{{Start}}=Left
{{Start}}=Right
{{Start}}=One
{{Start}}=Two
{{Start}}=Three
{{Start}}=Four
{{Start}}=Five
{{Start}}=Six
{{Start}}=Seven
{{Start}}=Eight
{{Start}}=Nine
{{Start}}=Zero
{{Start}}=A
{{Start}}=B
{{Start}}=C
{{Start}}=D
{{Start}}=E
{{Start}}=F
{{Start}}=G
{{Start}}=H
{{Start}}=I
{{Start}}=J
{{Start}}=K
{{Start}}=L
{{Start}}=M
{{Start}}=N
{{Start}}=O
{{Start}}=P
{{Start}}=Q
{{Start}}=R
{{Start}}=S
{{Start}}=T
{{Start}}=U
{{Start}}=V
{{Start}}=W
{{Start}}=X
{{Start}}=Y
{{Start}}=Z
{{Start}}=Caps
{{Start}}=Gap
{{Start}}=Back

For help email me: redu0007@yahoo.com

Conclusion: Some people in our world have some sorrow. With out a hand how can control a Computer? Because of that I tried to do some.

Talk, Computer will write for you



Aim of this project: Talk, Computer will write for you
Main Title: Voice Recognition
Project: Talk, Computer will write for you
Developer: Md. Redwanur Rahman
Location: Dhaka, Bangladesh.
Date: 11 February, 2008

Read Me:
This sample demonstrates how to do simple dictation in VB with SAPI 5.1. It uses shared recognized context object, uses the default audio input, loads in dictation grammar, sets up event handlers, and shows the recognized text in the dialog text box.
Note:
Since the text box is using system locale, it may not correctly show characters in other languages. For example, if you use Chinese Speech Recognition engine as the default engine on your English OS, the text box may show garbage even though the engine recognizes Chinese.
Helps:
You need to install SAPI, go to http://www.microsoft.com/speech/download/sdk51/ and download sapi5.1
Setup:
To use this get and install the sapi 5.1, free from microsoft
Then go to control panel, speech. Configure the microphone
(You may have to go to the volume control at the bottom of your screen and unmute the Line in)
Run the training session (you may have to add a new profile)
Make sure it is very quiet around you
Be sure to turn off the microphone, Line in after using this or it will
Go asunder (ie get all screwed up)
Have fun it's a blast

P.S it takes a while for the computer to register the voice the first time around so give it a few seconds and see if it comes up.

Program details:
Option Explicit
Dim WithEvents RecoContext As SpSharedRecoContext
Dim Grammar As ISpeechRecoGrammar
Dim m_bRecoRunning As Boolean
Dim m_cChars As Integer
Dim vol As Double ' this helps open the volume control
Dim bye As Integer 'this closes the volume control

Private Sub btnend_Click()
'to end you must turn off the volume control
'If bye = 1 Then End
'vol = Shell("sndvol32", 1)
' you need to do this so the volume control doesn't just
'stop and minimize
'bye = bye + 1
'disable the buttons
'btnStop.Enabled = False
'btnStart.Enabled = False
'change the end buton caption to exit
'btnend.Caption = "&Exit"
End
End Sub

Private Sub Form_Load()
SetState False
m_cChars = 0
'open the volume control to turn it on (not mute)**NOTE this is not microphone but LINE in
Dim vol As Double
vol = Shell("sndvol32", 1)
End Sub

Private Sub btnStart_Click()
Debug.Assert Not m_bRecoRunning
' Initialize recognition context object and grammar object, then
' start dictation
If (RecoContext Is Nothing) Then
Debug.Print "Initializing SAPI reco context object..."
Set RecoContext = New SpSharedRecoContext
Set Grammar = RecoContext.CreateGrammar(1)
Grammar.DictationLoad
End If
Grammar.DictationSetState SGDSActive
SetState True
End Sub

Private Sub btnStop_Click()
Debug.Assert m_bRecoRunning
Grammar.DictationSetState SGDSInactive
SetState False
End Sub

Private Sub Form_Unload(Cancel As Integer)
'open the volume control mute the line in box
vol = Shell("sndvol32", 1)
End Sub
' This function handles Recognition event from the recognized context object.
' Recognition event is fired when the speech recognition engines recognizes
' a sequences of words.
Private Sub RecoContext_Recognition(ByVal StreamNumber As Long, _
ByVal StreamPosition As Variant, _
ByVal RecognitionType As SpeechRecognitionType, _
ByVal Result As ISpeechRecoResult _
)
Dim strText As String
'this is to open the notepad
Dim RetVal As Double
strText = Result.PhraseInfo.GetText
'do what you want for various words here
If strText = "green" Then Label1.BackColor = vbGreen
If strText = "red" Then Label1.BackColor = vbRed
If strText = "yellow" Then Label1.BackColor = vbYellow
If strText = "black" Then Label1.BackColor = vbBlack
'this is to end the program by saying by
If strText = "by" Then
MsgBox ("remember to turn off the volume line in")
End
End If
'1 is normal, 3 is maximized 6 is minimized
If strText = "not" Then RetVal = Shell("c:\windows\notepad.exe", 3)
'I'm not sure why microsoft put this in, I took it out and all is still okay
'Debug.Print "Recognition: " & strText & ", " & _
StreamNumber & ", " & StreamPosition
' Append the new text to the text box, and add a space at the end of the
' text so that it looks better
txtSpeech.SelStart = m_cChars
txtSpeech.SelText = strText & " "
m_cChars = m_cChars + 1 + Len(strText)
End Sub

' This function handles the state of Start and Stop buttons according to
' whether dictation is running.
Private Sub SetState(ByVal bNewState As Boolean)
m_bRecoRunning = bNewState
btnStart.Enabled = Not m_bRecoRunning
btnStop.Enabled = m_bRecoRunning
End Sub

For help email:  redu0007@yahoo.com
Web: www.geocities.com/redu0007
Conclusion:
This program recognized your voice and write in a text field. You can use this program to write in MS-word, MS-Excel

Color recognition from a unique color picture.



Aim of this project:
Speaking color reorganized project. Its recognize color from any unique color picture.

Main Title: Color Recognition
Project: Color recognition from a unique color picture.
Developer: Md. Redwanur Rahman
Location: Dhaka, Bangladesh.
Date: 5 November, 2007

I am here to share idea with other.

This snippet of code will change the background color of a picture box to reflect the value of the Red, Green and Blue scroll bars and indicated what the color it is: A shade of blue, purple, orange etc...

This code is fairly accurate but right now isn’t able to distinguish brown/tan colors. This code is still in its infancy.

Program Details
Start Here…………………………………

Private Sub cmdexit_Click()
Unload Me
End Sub

Private Sub cmdGo_Click()
'now find out what type of color it is. IE yellow, orange, blue, grey etc...
Dim MyRVal As String
Dim MyGVal As String
Dim MyBVal As String
MyRVal = Brightness(Me.ScrollRed.Value) & "R"
MyGVal = Brightness(Me.ScrollGreen.Value) & "G"
MyBVal = Brightness(Me.ScrollBlue.Value) & "B"
Dim MyWholeColor As String
MyWholeColor = MyRVal & MyGVal & MyBVal
Dim colorname As String
Select Case MyWholeColor
'example: a Dark Red and a Dk Green and a Dark Blue values are similar in color to a dk grey or blk.
Case Is = "DRDGDB"
colorname = "Dk Grey or black"
Case Is = "DRDGMB"
colorname = "Blue"
Case Is = "DRDGLB"
colorname = "Blue"
Case Is = "DRMGDB"
colorname = "Green"
Case Is = "DRMGMB"
colorname = "BlueGreen"
Case Is = "DRMGLB"
colorname = "Blue"
Case Is = "DRLGDB"
colorname = "Green"
Case Is = "DRLGMB"
colorname = "BlueGreen"
Case Is = "DRLGLB"
colorname = "Blue"
Case Is = "MRDGDB"
colorname = "Red"
Case Is = "MRDGMB"
colorname = "Purple"
Case Is = "MRDGLB"
colorname = "Purple"
Case Is = "MRMGDB"
colorname = "Yellow"
Case Is = "MRMGMB"
colorname = "Grey"
Case Is = "MRMGLB"
colorname = "BluePurple"
Case Is = "MRLGDB"
colorname = "Green"
Case Is = "MRLGMB"
colorname = "Green"
Case Is = "MRLGLB"
colorname = "BlueGreen"
Case Is = "LRDGDB"
colorname = "Red"
Case Is = "LRDGMB"
colorname = "RedPurple"
Case Is = "LRDGLB"
colorname = "Purple"
Case Is = "LRMGDB"
colorname = "Orange"
Case Is = "LRMGMB"
colorname = "Pink/Red"
Case Is = "LRMGLB"
colorname = "Purple"
Case Is = "LRLGDB"
colorname = "Yellow"
Case Is = "LRLGMB"
colorname = "Yellow"
Case Is = "LRLGLB"
colorname = "White/Grey"
End Select
TextToSpeech1.Speak ("The color in the picture is " & colorname)
MsgBox ("The color in the picture is " & colorname)
End Sub


Private Sub ScrollBlue_Change()
'change the caption and the back color of the picture
Me.lblblue.Caption = Me.ScrollBlue.Value
Call ChangeBackColor(Me.ScrollRed, Me.ScrollGreen, Me.ScrollBlue)
End Sub

Private Sub ScrollGreen_Change()
'change the caption and the back color of the picture
Me.lblGreen.Caption = Me.ScrollGreen.Value
Call ChangeBackColor(Me.ScrollRed, Me.ScrollGreen, Me.ScrollBlue)
End Sub

Private Sub ScrollRed_Change()
'change the caption and the back color of the picture
Me.lblRed.Caption = Me.ScrollRed.Value
Call ChangeBackColor(Me.ScrollRed, Me.ScrollGreen, Me.ScrollBlue)
End Sub
Private Sub ChangeBackColor(RVal As Integer, GVal As Integer, BVal As Integer)
'change the back color of the picture to reflect the croll bar values
RVal = Me.ScrollRed.Value
GVal = Me.ScrollGreen.Value
BVal = Me.ScrollBlue.Value
Me.Picture1.BackColor = RGB(RVal, GVal, BVal)
End Sub

Public Function Brightness(mycolor As Integer) As String
'see what the brightness of the color is: dark, medium or light
'"D" for Dark, "L" for light and "M" for med
'If R value and G value and B Value are all less than 85 then it is a dk color
'so will probably be either black or a dk grey (Example (50,50,50) would be a dk grey)
'Same goes for R,G and B value greater than 170. The closer the 3 values get to 255, the closer the
'color will be to white.
If mycolor < 86 Then
Brightness = "D"
ElseIf mycolor < 171 Then
Brightness = "M"
Else
Brightness = "L"
End If
End Function

End here………………..

For help email me: redu0007@yahoo.com

Conclusion: From a unique color picture this program can recognized Color Name.

Convert English text to voice



Main Title: Voice Interface
Project: Convert English text to voice
Developer: Md. Redwanur Rahman
Location: Dhaka, Bangladesh.
Date: 25 September, 2007

I am here to share knowledge with other. I am writing about voice interface project.

Aim of this project
Sometimes to read may bore. Wish someone may read it and I may enjoy to listen. Important news or weather report from web will convert to voice using these codes. These codes also convert your text in .wav format that will play by Media player

Needed component
Sapi.dll file (if not in computer download form Microsoft)

Program Details
Option Explicit
Dim Voice As SpVoice
Private Sub Form_Load()
Set Voice = New SpVoice
End Sub
Private Sub ExitBtn_Click()
Unload Form1
End Sub
Private Sub SpeakItBtn_Click()
On Error GoTo Speak_Error
If SaveToWavCheckBox Then
SaveToWav
Else
If Not TextField.Text = "" Then
Voice.Speak TextField.Text, SVSFlagsAsync
End If
End If
TextField.SetFocus
Exit Sub
Speak_Error:
MsgBox "Speak Error!", vbOKOnly
End Sub

Private Sub SaveToWav()
Dim cpFileStream As New SpFileStream
cpFileStream.Format.Type = SAFT22kHz16BitMono
ComDlg.CancelError = True
On Error GoTo Cancel
ComDlg.Flags = cdlOFNOverwritePrompt + cdlOFNPathMustExist + cdlOFNNoReadOnlyReturn
ComDlg.DialogTitle = "Save to a Wave File"
ComDlg.Filter = "All Files (*.*)|*.*|Wave Files " & "(*.wav)|*.wav"
ComDlg.FilterIndex = 2
ComDlg.ShowSave
cpFileStream.Open ComDlg.FileName, SSFMCreateForWrite, False
Set Voice.AudioOutputStream = cpFileStream
Voice.Speak TextField.Text, SVSFDefault
cpFileStream.Close
Set cpFileStream = Nothing
Set Voice.AudioOutputStream = Nothing
Cancel:
Exit Sub
End Sub

Conclusion
I developed these codes to listen my thesis that helped to revise again and again. Really I enjoy it during my thesis time. For others people help I am publishing this

Tuesday, April 1, 2008

International Award Winner Robot Bangla Manob



In February 2004, I developed a digital display board named “E vision” and Arif (other one of robot Bangla manob developer) developed some voice programs and both took participate in Stamford university IT fair. This was our 1st participation in IT competition. In fair we followed that our developed project was poor. We decided to develop a joint project called “online voice controller”. Hardware was developed by me and Arif developed voice software. That’s took a day from us and it was the first day of that fair. 2nd day was judgment day and after judgment we achieve 3rd prize in that fair. But one of our teachers visited fair and gave us information about NSU 5th soft fair that will be held on 25 March, 2004. The Stamford fair is over and we are waiting for the next. We didn’t decide before 20 days ago of NSU fair what we will be developed. Our UAP teacher Mr. Muniruzzaman’s advised us to develop a robot though he didn’t like human type robot. But it was a big question for us it will happen or not? We try harder to achieve our goals. At last a day before we have done it. I remember the day still and our teacher Mr. Muniruzzaman’s voice “Redwan I want to see your robot is walking. Try faster to walk your robot. Arif show me your software, is robot speaks or not?” thank you sir for your inspiration. In 25 March 2004 we ware in NSU fair but unfortunately our robot burned. Our friend left us and the day was very pathetic for us. Before that we ware working on sensor project for two years but our teachers changed our dimension on robotic project.

The day 27th march 2004, in Hotel Sheraton where we awarded for developing Robot Bangla Manob. The NSU 5th Soft fair, 2004 was for 3 days. The 1st day in Fair our Robot was burned due to electricity problem. So before the 2nd day I worked for new robot whole night. In morning it was completed. The 2nd day in fair our computer local area network was not working and this day was our judgment day. So we try harder to solve this problem. We solved it timely and our judges’ ware pleased for our work. But at that time we didn’t know that we are going to achieve an award. The 2nd day was passed. In 3rd day many people ware gathering in front of our stall, just they want to talk with our robot “Bangla Manob”. I always remember that day. After that Bangla Manob went to Pakistan and got 2nd international Prize.

About Bangla Manob



It’s an intelligent robot that’s talk to men intelligently. It recognized voice, face, geometric shapes, colour etc. It can control by eye movement & voice. Its hardware and software developed by Md. Redwanur Rahman & Arif Reza Anwary. The University of Asia Pacific where we completed our Bachelor Degree in CSE helps us to develop such kind of robot. Our teacher Mr. Muniruzzaman, Mr. Tasadduq Imam and Mr. Sazzad Hossain help us and their inspiration give us an international award on robot Bangla Manob. In Bangladesh this robot got 1st National award in 2004 in NSU 5th Soft Fair and in Pakistan got 2nd international award in 2005.

Voice controlled Stepper Motor



Main Title: Hardware Interface

Project: Robot Arm Controller Stepper Motor.

Developer: Md. Redwanur Rahman

Location: Dhaka, Bangladesh.

Date: 24 September, 2007


I am here to share knowledge with other
Aim of this project:

Using Computer you can control a stepper motor. This concept can be used for robot walking or arms movement, door opening, Machineries control etc.

Needed components

Uni-polar Stepper Motor, Transistor (TIP110), Diode (1N4001), D25 connector with wire (printer port connector), +12 v Power supply

Circuit details:

Connect D25 connector pin 2 to the circuit Pin 2 and D25 connector pin 3 to the circuit Pin 3 so on. Circuit Ground must connect to D25 connector pin 18 ~25. Transistor is used to switch Stepper motor coil. Use uni- Polar stepper motor that has 5 wires. One wire is common source and other connected to ground. Transistor is using to select which coil should be grounded. Diodes are use for to guide transistor or nothing else. Need to fiddle with coil’s wire to get the exact order. Incorrect order will cause the motor to either step irregularly, or not at all. Depend on Motor and transistor supply voltage may change.


Program Details:

Public Port, X, Y 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)
Public Sub Command1_Click()
Timer1.Enabled = True
Timer2.Enabled = False
End Sub
Private Sub Command2_Click()
Timer1.Enabled = False
Timer2.Enabled = True
End Sub
Private Sub Command3_Click()
Timer1.Enabled = False
Timer2.Enabled = False
End Sub
Private Sub Command4_Click()
Out Port, 0
End
End Sub
Private Sub Form_Load()
Port = &H378 ' LPT1 Port Address
Out Port, 0
X = 0
Y = 0
Text1.Text = Y
End Sub
Private Sub Timer1_Timer()
If Y = 360 Then
Y = 0
End If
Out Port, X + 1 'Send signal to Pin 2 (D25 Connector)
Out Port, X + 2 'Send signal to Pin 3 (D25 Connector)
Out Port, X + 4 'Send signal to Pin 4 (D25 Connector)
Out Port, X + 8 'Send signal to Pin 5 (D25 Connector)
Y = Y + 1
Text1.Text = Y
End Sub
Private Sub Timer2_Timer()
If Y = 0 Then
Y = Y
Y = 360
End If
Out Port, X + 8 'Send signal to Pin 5 (D25 Connector)
Out Port, X + 4 'Send signal to Pin 4 (D25 Connector)
Out Port, X + 2 'Send signal to Pin 3 (D25 Connector)
Out Port, X + 1 'Send signal to Pin 2 (D25 Connector)
Y = Y - 1
Text1.Text = Y
End Sub

Operation:
In controller windows has a button “Left Move”, “Right Move”, “Stop” and “End”. Press buttons to control the uni-polar stepper motor.

Conclusion:
I developed this circuit and program code that published by Computer Jagat in Bangladesh, 2006.