• Aucun résultat trouvé

Building the speech-recognition circuit

Dans le document 12 Incredible Projects You Can Build (Page 167-174)

The demonstration circuit operates in the HM2007’s manual mode.

This mode uses a simple keypad and microphone to program the HM2007 chip.

Keyboard

The keyboard is a telephone keypad made up of 12 normally open switches. static RAM. If the RAM checks out, the board displays “00” on the seven-segment display chips, lights the red light-emitting diode (LED) (Ready), and waits for a command.

To train

Press “1” (display will show “01”) and the LED will turn off. Then press “T” (Training), and the LED will turn back on.

Hold the microphone close to your mouth and say the training word.

For instance, let’s use the word “computer” as the training word. Say

147

the word computer into the microphone. If the circuit accepts the word spoken, the LED will blink. The word computer is now pro-grammed as the “01” word. Whenever the circuit hears the word computer, it will display “01” on its digital output.

If the LED did not blink when you said the word computer, either repeat the word again louder or start over completely by pressing

“01” then “T.”

Continue training new words in the circuit. Press “02” then “T” to train the second word. The circuit will accept up to 40 words. You do not need to train all 40 words to use the circuit. Train the circuit with just the words you need and start using the circuit.

Testing recognition

Repeat a trained word into the microphone. The number of the word should be displayed on the segmented display. For instance, if the word “directory” was trained as word number 25, saying the word “directory” into the microphone will cause the number 25 to be displayed.

Error codes

The chip provides the following error codes:

䊐 55word too long 䊐 66word too short 䊐 77no word match found Clearing memory

You can erase individual words in memory by entering the word number you want to erase and hitting the CLR button. To erase all the words in memory, press “99” and then CLR.

More about the HM2007 chip

The HM2007 is a single-chip complementary metal-oxide semi-conductor (CMOS) voice-recognition large-scale integration (LSI) circuit. The chip contains an analog front end, voice analysis, recognition, and system control functions. The chip may be used in a stand-alone or connected CPU.

Features

䊐 Single-chip voice-recognition CMOS LSI 䊐 Speaker-dependent

䊐 External RAM support

䊐 Maximum of 40-word recognition 䊐 Maximum word length of 1.92 s

148

䊐 Microphone support

䊐 Manual and CPU modes available

䊐 Response time less than 300 milliseconds (ms) 䊐 5 volt (5V) power supply

Circuit construction

The speech-recognition circuit is available in kit form from Images Company (see the parts list at the end of the chapter). The schematic is shown in Fig. 7.1. The components can be mounted and wired on a standard printed circuit board (PCB).

Solder the keypad to the board according to Fig. 7.2. You will have just seven wires from the keypad to the HM2007 on the PCB. The number next to each wire coming out of the keypad refers to the pin number it’s connected to on the HM2007 IC.

Figure 7.3 shows the top view of the parts placement on the PCB.

Figure 7.4 is the complete speech-recognition circuit.

Independent recognition system

This demonstration circuit allows you to experiment with depen-dent as well as independepen-dent systems. The system is typically trained as speaker dependent, meaning the voice that trained the circuit also uses it.

We will take the other track and train the system for speaker inde-pendent recognition. To accomplish this we will use four word spaces for each target word.

To simplify the digital logic, the allocation of word spaces is as fol-lows. Our circuit will only look at the first [least significant digit (LSD) on the display] digit space for recognition. This means that the word spaces 01, 11, 21, and 31 will all be recognized as the same word. Since we are only decoding the first digit, they all look like word space 1. Likewise word spaces 04, 14, 24, and 34 all look like word space 4.

This system works most of the time, but a problem is encountered when an error code pops up.

䊐 55word too long 䊐 66word too short 䊐 77no word match found

Obviously the base circuit would identify these error codes as word 5, 6, and 7, respectively. There are two ways to work around this problem. The first way is to use a dedicated logic circuit

149

7.1Schematic of speech-recognition circuit

150

(see Fig. 7.5) that brings a line high when the digits 5, 6, or 7 appear in the most significant byte (MSB). This line becomes an enable-disable line. This circuit brings the line high when the digits 5, 6, or 7 are displayed, so an interface should interpret this line going high as a disable.

7.2 Keypad wiring to speech-recognition circuit

7.3 Top view of parts placement on PCB

151

The second way to work around the problem is to simply use a PIC microcontroller to read the entire 8-bit output from the SRC. Any word number above 40 is an error and should be ignored. While we are not interfacing this circuit to a microcontroller here, it should be evident to anyone who has worked with the PICBASIC compiler and PIC chips (see Chap. 6) in other applications that this inter-face would not present a problem. In Chap. 15 we use a PIC inside the speech-controlled circuit for controlling a robotic arm.

The 8-bit output is taken from the output of the 74LS373 data octal latch. The output is not a standard 8-bit byte, but it is broken into two 4-bit binary coded decimal (BCD) nibbles. BCD code is related to standard binary numbers as Table 7.1 illustrates.

7.4 Finished speech-recognition circuit

Disable High Enable Low AND

19 OR 16

2 From 74LS373

Error Code Detection from MSB of 74LS373

7.5 Error detection circuit taken from upper BCD number

152

As you can see, the binary and BCD numbers remain the same until reaching decimal 10. At decimal 10, BCD jumps to the upper nibble and the lower nibble resets to zero. The binary numbers continue to decimal 15, and then jump to the upper nibble at 16 where the lower nibble resets. If a computer is expecting to read an 8-bit binary number and BCD is provided, this will be the cause of errors.

Project 2: Interface circuit

The interface circuit revolves around the 4028 BCD integrated circuit. The 4028 takes the lower BCD output from the 74LS373 on the speech-recognition board and outputs a high signal; see the truth table on 4028, Table 7.2.

The schematic for the interface circuit is shown in Fig. 7.6. The inputs A, B, C, and D to the 4028 are the lower BCD numbers from the 74LS373. When I stripped the car of its radio-control (R/C) equipment, I was left with a group of wires that, when powered, performed the basic driving functions. The robot car has just four functions: forward straight, forward right, forward left, and reverse.

Table 7.1

16 0001 0000 0001 0110

17 0001 0001 0001 0111

18 0001 0010 0001 1000

19 0001 0011 0001 1001

20 0001 0100 0010 0000

153

Each function is controlled by an electric motor or motor/solenoid combination that can be powered by an NPN transistor. So each function requires one NPN transistor. Four transistors connected to the outputs of the 4028, labeled Q1 to Q4, control this electric car.

For purposes of a clear illustration, Fig. 7.6 shows only one NPN transistor connected to output Q1 powering an electric motor. The exact model R/C car I used when writing this chapter is no longer available. Even so, most inexpensive R/C cars will function in a similar manner. Remove the R/C equipment from the car. You will be left with wires leading to the drive motor that will either have to be grounded or connected to Vcc to power the motor. Turning left and right is usually accomplished with an inexpensive solenoid.

Again check the wires from the steering solenoids to see if they need to be connected to ground or connected to Vcc.

Dans le document 12 Incredible Projects You Can Build (Page 167-174)

Documents relatifs