Author Topic: Using RFID to detect proximity and run TTS using voxcommando  (Read 31484 times)

0 Members and 3 Guests are viewing this topic.

manfaiho

  • Jr. Member
  • **
  • Posts: 47
  • Karma: 0
    • View Profile
Using RFID to detect proximity and run TTS using voxcommando
« on: October 28, 2013, 02:48:27 AM »
I am currently using TCP Plugin as TTS server for Vera Home automation. I wrote Luup code to send the sentence from Vera using socket library to Voxcommando to hook TCP event to trigger the action of speaking this sentence. It works perfectly. Awerson!!

Now I am currenlty purchasing 2.4GHz RFID reader and Active RFID tags which can send a Hexcode like a pattern of "FB 10 00 00 TagID RFGain ReadID 01" over USB or TCP/IP for the purpose of reporting tag presence . I want to make use of Voxcommando TCP Plugin to get this Hexcode then trigger event action to speak something as welcome message then execute some actions for their preference when thery are coming back home. I only found {lastresult} for TCP command which is used for string but I don't know how to decode this pattern of Hexcode to identify its TagID within TCP Plug-in to trigger Vera "Virtual Switch" (On: for some people Present   Off: not here) then run various scenes. Can anyone help me how to extract Hexcode information within TCP Plug? Do you have a better solution? Really apprecaite for your advice :-)

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
Re: Using RFID to detect proximity and run TTS using voxcommando
« Reply #1 on: October 28, 2013, 04:03:34 AM »
Hi manifaiho, did you have tried also the VC Vera-plugin?
James wrote a short piece of Luup code that generate a event for each vera device in VC over UDP - so it is easy to use a RFID or a motion sensor to generate a event in VC.
I can't post this code here because it is not my code, but I'm sure James will do it.  ;)

The attached picture show you how the event looks.
***********  get excited and make things  **********

manfaiho

  • Jr. Member
  • **
  • Posts: 47
  • Karma: 0
    • View Profile
Re: Using RFID to detect proximity and run TTS using voxcommando
« Reply #2 on: October 28, 2013, 04:28:32 AM »
Thanks, Kalle. I also used what you mentioned for other purpose to hook Vera event in VC.

Actually my RFID is not Z-wave awared. It can only send its Hexcode (including TagID) to PC via USB/RS232 or over TCP/IP. I plan to receive this Hexcode from TCP in VC not Vera. I think TCP Plug is the best option compared with Vera to receive TCP data. Any good idea? But what I want is when I got this string in VC using its TCP Server from plugin, how to extract TagID from these Hexcodes so that I can use it identify the one then say welcome message etc then even call Vera scene. If you have idea on Vera to recevie TCP then extract TagID, yes I like it too. I can use it to send back my welcome message to VC to speak it also.

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
Re: Using RFID to detect proximity and run TTS using voxcommando
« Reply #3 on: October 28, 2013, 04:42:08 AM »
Ah ok this device is not a z-wave. If I understand you correct, each RFID chip has a different ID code (Hex code) and you search a way to send this code to VC.
How is the RFID reader connected?
***********  get excited and make things  **********

manfaiho

  • Jr. Member
  • **
  • Posts: 47
  • Karma: 0
    • View Profile
Re: Using RFID to detect proximity and run TTS using voxcommando
« Reply #4 on: October 28, 2013, 05:02:53 AM »
Yes, RFID reader used RS232/USB to send Hexcodes, it also provides one more option for TCP. I plan to use TCP server to receive its Hexcode in VC. I can successfully start TCP Server to receive it but I can't extract its TagID from these Hexcodes within VC. Any clue?

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
Re: Using RFID to detect proximity and run TTS using voxcommando
« Reply #5 on: October 28, 2013, 05:36:45 AM »
There are some possibilities, can you post a screenshot from the received Data? If the {LastResult} contains Data like "FB 10 00 00 TagID RFGain ReadID 01" it is easy to extract any Data from there with "Results.RegEx" or "Results.RegExReplace" etc. action in VC.
« Last Edit: October 28, 2013, 06:06:57 AM by Kalle »
***********  get excited and make things  **********

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Using RFID to detect proximity and run TTS using voxcommando
« Reply #6 on: October 28, 2013, 08:28:34 AM »
Yes, RFID reader used RS232/USB to send Hexcodes, it also provides one more option for TCP. I plan to use TCP server to receive its Hexcode in VC. I can successfully start TCP Server to receive it but I can't extract its TagID from these Hexcodes within VC. Any clue?

Hi manfaiho.  I'm very excited to hear what you are doing.  I have been wanting to try this myself, but I was not sure which hardware to use. (Please send details about the RFID hardware you are using when you have a chance.)

Can you please show us what options you have when setting up TCP on the tag reader.

I think you are probably correct that using the TCP plugin for VC is the best option.  I think it will be possible to do this with the plugin already, but if not, I will be happy to make whatever modifications are necessary to get it to work.

manfaiho

  • Jr. Member
  • **
  • Posts: 47
  • Karma: 0
    • View Profile
Re: Using RFID to detect proximity and run TTS using voxcommando
« Reply #7 on: October 28, 2013, 08:59:11 AM »
Data stream is not ASC character format like FB 10 00... It is hex data stream: 0xFB, 0x10, 0x00 not readable in {1} buffer from TCP plugin. So I don't know how to use Results object to manipulate the hex pattern in VC. I think Hex code in Serial port communication is common. But when using TCP server to receive it, especially for VC, we really don't know that. Any suggestion?

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Using RFID to detect proximity and run TTS using voxcommando
« Reply #8 on: October 28, 2013, 09:06:02 AM »
TCP server will need to generate an event.  The command triggered by the event can use the payload to determine which tag has triggered the device.

I need to adjust the plugin to convert hex codes to a readable form.  Please stand by, it won't take too long.  ;D

manfaiho

  • Jr. Member
  • **
  • Posts: 47
  • Karma: 0
    • View Profile
Re: Using RFID to detect proximity and run TTS using voxcommando
« Reply #9 on: October 28, 2013, 09:09:40 AM »
Hi James, I have tested UHF RFID with Passive Tag but its result is not what I expect. Hence I change it to use Active RFID in 2.4GHz which can have a longer distance range (UHF: less than 8M, 2.4G: <100M). I purchased from taobao.com (you may need to read it in chinese) http://item.taobao.com/item.htm?id=13280048779 It will send hex data command via TCP/IP so I plan to use TCP Plugin to get TagID. However, I can't find Results object to manuipulate Hex data to trigger subsequent action. Any idea?

manfaiho

  • Jr. Member
  • **
  • Posts: 47
  • Karma: 0
    • View Profile
Re: Using RFID to detect proximity and run TTS using voxcommando
« Reply #10 on: October 28, 2013, 09:13:10 AM »
Thank you so much, James. You are so awersome. Look forward to seeing your great work. Taobao.com has so many cheap toys for fun. This set of 100M distance 2.4G RFID reader plus 8 active RFID 2.4G tags, only cost me less than USD200. Interesting  ;D

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Using RFID to detect proximity and run TTS using voxcommando
« Reply #11 on: October 28, 2013, 09:21:29 AM »
If I understand correctly, this is all you will need.

Close VC
Replace the tcp plugin dll file with the attached file
Restart VC and now your hex codes will appear in the correct format (I hope).

manfaiho

  • Jr. Member
  • **
  • Posts: 47
  • Karma: 0
    • View Profile
Re: Using RFID to detect proximity and run TTS using voxcommando
« Reply #12 on: October 28, 2013, 09:28:03 AM »
Its' great, James :-) But how to extract the pattern of "FB 10 00 00 TagID RFGain ReadID 01" in Hex format from your updated TCP Plugin or direct extract TagID from this pattern? Sorry I am not quite familar with it on VC. Once I get this reader these days, I will test it then get back you the result immediately. Thank you very much.

manfaiho

  • Jr. Member
  • **
  • Posts: 47
  • Karma: 0
    • View Profile
Re: Using RFID to detect proximity and run TTS using voxcommando
« Reply #13 on: October 28, 2013, 09:35:57 AM »
Btw, I've also tested to detect the proximity using bluetooth with its Type I bluetooth adapter (longer distance, <50M). I've also downloaded a freeware software with its source code which can detect whether your registered bluetooth device is in the range. Once in-range, it will execute a batch command to trigger my Vera scene. Once out of range, it will also trigger another Vera scene. I've used it for my security system in Vera for the state of ARM and BYPASS then say welcome or bye bye message even turn on my LED in differnt color. Very intersting! But I used RFID becasue I have 4 kids who will not bring any bluetooth devices or mobile phone so I want to put this active tag into thier backpack in order to detect them when they come back home or leave from home..... ;D ;D ;D ;D ;D

manfaiho

  • Jr. Member
  • **
  • Posts: 47
  • Karma: 0
    • View Profile
Re: Using RFID to detect proximity and run TTS using voxcommando
« Reply #14 on: October 28, 2013, 09:45:58 AM »
Hi James, one more question, I used previous TCP Plugin for TTS server. I can send TCP command with speaking sentence from Vera to VC then VC will read this sentence and use TTS.Speak to sepak it out. This sentence I use is a general ASC characters. I can successfully use TTS.Speak {1} to speak it out when I got TCP event. But now, after change it the updated TCP Plugin, all {1}, {2} etc should be hex converted. Can we install two separate TCP Plugin: One for ASC and another for Hex. Or I can use object one to handle ASC and another one for Hex decoded etc...Sorry for my too many questions  :bonk