SEROUT Hex Numbers?

erco

Senior Member
I need an M2 chip to serial output hex format numbers to control a speech recognition module. Possible?

SEROUT command says "Optional #'s are for outputting ASCII decimal numbers, rather than raw characters" but it doesn't say what format "raw characters" is.
 

inglewoodpete

Senior Member
I presume it needs ASCII characters 0-9, A-F to be sent in pairs.

Edit: While the code I posted here will send ASCII-HEX data as text, post #9 by @Aries indicates that simple byte values (Decimal 0-255 / $00-FF) are required by the module.

You may be able to adapt the following code for your purpose:
Rich (BB code):
'
' ----- ShowHex: Send Hexadecimal value to PE Terminal -----------------------------------------
'
'        Send a  byte  as hex to terminal on the programming lead
'        Send a nibble as hex to terminal on the programming lead
'        Alternate "D" entries cause a leading $ sign to be sent
'
'        Entry:   bByteToShow (byte) data to be transmitted
'        Exit:    bByteToShow (byte) unchanged
'        Used:    bTemp       (byte)
'
ShowHexD:SerTxd("$")                      'Alternate entry
ShowHex: bTemp = bByteToShow >> 4         'Get high nibble
         GoSub SHexNib2                   'Show it
         Goto SHexNibl
ShowNibD:SerTxd("$")                      'Alternate entry
SHexNibl:bTemp = bByteToShow And mskLoNibble
SHexNib2:bTemp = bTemp + "0"              'Convert to ASCII
         If bTemp > "9" Then              'Separate out and
            bTemp = bTemp + 7             ' correct over-decimal part.
         EndIf
         SerTxd(bTemp)                    'Display it
         Return
 
Last edited:

westaust55

Moderator
More information or data sheet on your module could be helpful.

it may want the hex values in a format such as
0X41 0XAF 0X0D
 

westaust55

Moderator
Raw values (not ascii encoded)
Can be sent as binary %10101010
Or as hexadecimal $AA or 0xAA
Or by decimal value 170

binary is the native form for most/all microcontrollers and computers
Hex and decimal are just ways to express the same value which can be easier for us humans to understand/interpret.
 

steliosm

Senior Member
It's pretty weird that you need to send a hex representation of the command value instead of the actual value. Any change the datasheet has been translated from Chinese and this part may contain errors?
 

erco

Senior Member
Thanks all. Here is the module. I bought it probably 8 years ago, but it's still available on ebay.

https://www.geeetech.com/wiki/images/6/69/Voice_Recognize_manual.pdf manual

https://www.banggood.com/Voice-Recognition-Module-With-Microphone-Control-Voice-Board-p-10 56127.html

The module works quite well with a PC using Hterm serial terminal, just as this video shows:


It's a bit convoluted because he is using an Arduino as his USB/serial adapter, and he is sending hex characters but receiving ASCII. I will be playing with this today with a 14M2, will advise. Thanks again.
 

Aries

New Member
Just looking at the manual (the "introduction" on banggood), you have commands like:
serial.write(0x37)
That isn't sending hex characters - it is sending the value (in Picaxe terms) $37 (or 55 decimal)
 

erco

Senior Member
Success! Jeez, that took a lot of brute force experimenting. The Geeetech module is finnicky since it has its own micro & ecosystem, and the documentation is scarce, so it took a while to configure and get the comms right sending numbers in hex. I wasted half a day trying to get 4800 baud working but no go, so I had to stick with 9600 baud, running my 08M2 at 8 Mhz. Recognition is surprisingly good, but the limiter is the number of phrases. User trains up to 15 phrases of 1.3 sec max, but the phrases are in 3 groups of 5. That is, only 5 phrases are active at a time. So to make full use, you would have to break up your phrases in the right groups, then based on the phrase, the Picaxe can select (import) a different group of 5 phrases. The attached code looks ridiculously simple and obvious, but when you start from nothing, there's nothing simple and obvious about it!


Code:
'voice recognition chip 9600 baud
'c.1 output
'c.2 input

#picaxe 08m2
#no_data

pause 500
setfreq m8 ' 8mHz sets 9600 baud
pause 500


serout 1,T9600_8,($00,$AA,$00) ' wait mode
pause 400

sertxd ("Voice Recognition Module",13,10)

serout 1,T9600_8,($00,$AA,$22) ' import word group 2 
pause 400

serout 1,T9600_8,($00,$AA,$37) ' compact mode
pause 400

sertxd ("READY",13,10)


do
serin 2,T9600_8,b0:sertxd (#b0,13,10)
loop
 

Attachments

Last edited:

julianE

Senior Member
My board came in today, what kind of microphone can i attach to it, I have a couple of the old radio shack ones but if i remember right they have a built in fet amplifier that needs to be powered. Any help is appreciated.
 

erco

Senior Member
Excellent. I ordered ten bare boards like yours, but they haven't arrived yet.

My first unit came (and works well) with the cheap 2-wire electret type. Some 3-wire types have a B+ lead, not sure if those will work.

These bargain types should work fine, I just ordered ten: https://www.ebay.com/itm/363385929010 free ship

Buy quickly, Ebay China prices are skyrocketing. Dollar items used to have free ship but now many sellers are charging $3 minimum shipping charge.
 

erco

Senior Member
Mfr website at https://www.hlktech.com/en/Goods-98.html. All info is in Chinese only, I keep asking for English but nothing yet. The Chinese datasheet has the pinouts in English at least (attached).

Hopefully the output pins on the small module are the same ones driving 3 LEDs on the bigger one, so you can control at least a few items. I have yet to find a list of programmed commands, I just use the demo videos for reference. The only Easter Egg I have discovered accidentally is "turn rice cooker on and off". :)
 

Attachments

Last edited:

julianE

Senior Member
Thank you kind sir. I ordered the microphones, yup prices have jumped up. I have to do a better job cataloguing everything I have, often times I'll order an item I already had in one of my many part bins. I'm fairly sure I have one of those microphones someplace. Thanks for the pinout.
all the best.
 

papaof2

Senior Member
After finding myself ordering something I already had, I started a parts inventory in a spreadsheet. Description, date, quantity, etc. And it can find "fuse" vesus "fuseholder". The list isn't up-to-date but I work on it from time to time. Maybe in another year, if I don't buy any more parts?
 

julianE

Senior Member
BTW never fall for this module, it's Chinese language only: https://www.aliexpress.com/item/1005002316607927.html
Well, mine looks just like the one you sent a pinout for in your last message. I went and hooked everything up and no joy.
I'm using terminal software through an FTDI cable and sending commands, I never get a reply. I did test my cable and all is good.
the other odd thing, when I power the module up a chinese language voice comes out of the speaker, i do not speak Chinese so not sure what is being said. I'll put some more time in figuring it out
 

lbenson

Senior Member
After finding myself ordering something I already had, I started a parts inventory in a spreadsheet.
I did that years ago, but found I wouldn't keep it up. Now I log everything I buy to a text file when I buy it starting with the date (preceded by "+ " if I've received it). I may also make notes on how it worked out.
Code:
+ 210226 ELLO computer ordered from knivd GB soldered up and working--no SD module
+ 210225 Car MP3 Decoder Board bluetooth Car MP3 amplifier 5V 12V USB FM TF Radio Audio aliex
+ 210222 F4_LCD_pc.brd for OTM8009A IPS 800*480 sent to JLCPCB; shipped 2/26-3/15
+ 210221 2pcs OTM8009A 4 inch TFT LCD SCREEN touch module IPS full view Ultra HD 800X480 F4 aliex
210221 Mini Smart Bluetooth Speaker Portable Bluetooth+FM MP3 aliex (by May 30)
Then I can search for anything with a batch file:
Code:
egrep -i %1 \stuff\orders.txt
Another little batch file gives outstanding orders (I have to update the batch file each month):
Code:
egrep "2102|2103|2104|2105" \stuff\orders.txt | egrep " 210" -v | sort
 

erco

Senior Member
Well, mine looks just like the one you sent a pinout for in your last message. I went and hooked everything up and no joy.
I'm using terminal software through an FTDI cable and sending commands, I never get a reply. I did test my cable and all is good.
the other odd thing, when I power the module up a chinese language voice comes out of the speaker, i do not speak Chinese so not sure what is being said. I'll put some more time in figuring it out
Uh oh. Where did you buy it from? If it's all Chinese then Lord help us.

TTYTT I never hooked mine up to terminal software, just powered up via the micro USB connector.
 

erco

Senior Member
Try playing that Youtube clip I shared back in #18 so your chip can hear and possibly respond, in hopes that it may understand English commands too.
 

julianE

Senior Member
Try playing that Youtube clip I shared back in #18 so your chip can hear and possibly respond, in hopes that it may understand English commands too.
This is the seller I got it from US based, HLK-V20.
From what I read it should do both english and chinese but confidence is very low. I'll hook it up again and give it a try. I do get FF over serial from the module when I power it up but nothing else. Tried the AA codes but I don't think that's what this module uses. Looks like it was a dud purchase.
 

erco

Senior Member
Dang, I ordered from the same seller! I haven't gotten any useful info from the mfr Hi-Link yet but I don't give up easily.
 

mushroom

New Member
Hi guys,
I ordered 4 of the above modules on the 5th. They arrived this morning, the 10th. (2x basic module and 2x modules on base with mic and speaker).
Haven't tried them yet. The supplier customized the basic modules, ie wake up words; 'Wake up' or 'Beam me up Scotty' ..... Reply; 'your wish is my command'. Many other words too. The point is he knows how to customize them. He'll be back in Aust in 10 days. I should have more info then.
In the Chinese info I didn't understand what was said about USB. My wife read it and suggests it's for power, not USB programming, Terminal use, BUT
that might depend on the presence or lack of the chip in front of USB port. Mine have the chip.
My wife is not technical, but she does speak fluent Cantinese and Manderine. (reads simplified and complex Chinese). This might help us muddle through.
 

mushroom

New Member
Just powered one up. Mine spoke English. Said 'Welcome to Hi Link'...... I said 'hello lamp', It said 'Hi. How can I help you?' Saying 'Lights On' turned on a LED. 'Lights Off' Turned the LED off. I think I like this module.
 

julianE

Senior Member
Just powered one up. Mine spoke English. Said 'Welcome to Hi Link'...... I said 'hello lamp', It said 'Hi. How can I help you?' Saying 'Lights On' turned on a LED. 'Lights Off' Turned the LED off. I think I like this module.
Sounds like you have a good one.
 

erco

Senior Member
Great news, mushroom! Yes it's a cool chip.

My requests to Hi-Link for info in English have been unanswered or misunderstood. Please keep us informed if you find out any info.

Also try these commands:

Turn on (off) the light. (yellow LED)
Turn on (off) the switch. (green LED)
Turn on (off) the air conditioner. (blue LED)
Turn on (off) the rice cooker.
Increase temperature.
Decrease temperature.
Heating mode.
Cooling mode.
Minimum volume
Maximum volume.
 

mushroom

New Member
Erco,
All 'turn on' work as expected. Temperature and heating/cooling say 'already set'?? Min/Max volume work by adjusting modules volume.
Module speaks like a Chinese lady doing a USA accent. Need an Aussie accent to be perfect.
Plugged USB into my computer which said windows couldn't find drivers. That implies USB does data, not just power. That's good.
I have some software to risk, downloaded from site. I'll report it's function, or not.
 

julianE

Senior Member
The ebay seller reached out asking if i received the item and if it was satisfactory. I mentioned that it's in Chinese, hopefully they might have some answers.
 
Top