Is this possible?

10 replies [Last post]
garrydwilms
Offline
United Kingdom
Joined: 31 Mar 2011

Due to hardware limitations I have attempted to combine the HAHcentral node for jeenode data collection and the URFrX sketch.

this has worked fine and I know get xap-serial messages from jeenodes and 433mhz rf devices.

jeenodes are still functioning fine so i'm no worse off than I was.

however, I know need to squirt the data from xap-serial into the xap-urfRx. Looking through the code it doesn't appear that I can direct a xap message towards it so i was wondering if there is any other way.

Brett, I noticed you have sucked in data from a file using a command like: $ ./xap-urfrx -i eth0 -s urf.in. 

Is it possible to do something similar, save the xap-serial data to a file then call the above command, although I suppose this means starting and stopping the daemon regularly. It all sounds messy.

any other thoughts?

 

thanks

Garry

brett
Offline
Providence, United States
Joined: 9 Jan 2010
It would be possible and I

It would be possible and I had considered this architecture this when I was building it but I decide to keep it separated, whilst still in development mode.

You would need to modifyt xap-urfrx to have a hook to pick up the xap-serial packet instead of directly communicating with the serial port itself.

Let me add some code to allow this combination - its trivial (well for me).

Brett

brett
Offline
Providence, United States
Joined: 9 Jan 2010
This was a little more complex then I thought

Gary,

I've done it but it turned out to be non-trivial and I changed a number of things along the way.

Needless to say when I send this (below) the xap-urfrx processor will now pick this up correctly match it against my definitions.

xap-header
{
v=12
hop=1
uid=FF00D500
class=Serial.Comms
source=dbzoo.livebox.Serial
}
Serial.Received
{
port=/dev/ttyUSB0
data=RFRX -10000,378,-1079,1120,-352,378,-1079,378,-1079,378,-1079,378,-1079,378,-1079,378,-1079,378,-1079,378,-1079,378,-1079,1120,-352,378,-1079,378,-1079,378,-1079,378,-1079,378,-1079,378,-1079,378,-1079,1120,-352,378,-1079,1120,-352,378,-1079,378,-1079,-10000
}

You will need to make sure you prefix the data string like this in your HAHCentral changes.

data=RFRX<space><data......>

The reason for this is to make it easier to pick up the DATA for the right processor.  The HAHNodes pickup data from the HAH Central when it begins with 'OK'.  So this will differentiate it and make it easy to spot.

I've not tried this for real in a URFRX/HAHCentral combo but I figure you are already there so I'll let you be the first.  :)   I'll work on some architecture changes to the URFRX stuff to make it a class so you can just include to make it more modular.   I've also make a web GUI change to handle this stuff to - go look.

I've pushed Beta 309.3

@Karl this beta contains your graph changes too.

Brett

garrydwilms
Offline
United Kingdom
Joined: 31 Mar 2011
Thanks for your time on this

Thanks for your time on this Brett. Will give it a go.

if good I will post the combined sketch in case others want it

Garry

garrydwilms
Offline
United Kingdom
Joined: 31 Mar 2011
Almost

Brett,

All is good with your code, however, just noticed xap-serial cmd buffer at 128. Therefore I'm not getting all the data through.

Can this just be increased?

Garry

brett
Offline
Providence, United States
Joined: 9 Jan 2010
xap-serial buffer has been

xap-serial buffer has been increased.  Next beta drop is ready.   I will see if I can test this scenario out myself here might one more wart that I can think of.

Brett

garrydwilms
Offline
United Kingdom
Joined: 31 Mar 2011
Sorted, sketch attached

Beta downloaded and all is good, many thanks.

I have attached the combined HAHCentral and RFRx sketch in case anybody else wants it. This is the no config version to stop accidental jeenode changes.

I am sure it can be optimised further as it is pretty much just a copy and paste of the two original sketches.

cheers

Garry

AttachmentSize
HAHCentralnocfgRFRx.txt 11.66 KB
brett
Offline
Providence, United States
Joined: 9 Jan 2010
URFRX state machine reset bug

Gary,

I fixed a bug in the state machine processor for which I had a hack in the serial backend to workaround.  With the introduction of virtual serial I either had to put in yet another workround or fix the root problem.   I also noticed that I was not sending out a serial.setup message which I should also be doing.  You got away with it as the lua hahnode process had already done this, but techinical it should be sent again it won't hurt.

Anyway's I pushed 309.5 with a few tweaks.   I looked at your "mash up" we need to make the RFRX code into a class so it can be included as easily as this and all the goodness is encapsulating into he RFRX class.

#define RECV_PIN 4
RFrecv rfrecv(RECV_PIN);
RFResults results;

setup() {
   rfrecv.enableRFIn();
}
loop() {
  if(rfrecv.match(&results)) {
     dumpRaw(&results);
     rfrecv.resume();
   }
}

Then bolting into the HAHCentral is very minimally invasive.  On my list - getting there.

Brett

brett
Offline
Providence, United States
Joined: 9 Jan 2010
UniversalRFRx sketch and the HAHCentral sketch now use RFRX lib.

I've overhauled the UniversalRFRx sketch and the HAHCentral sketch.

The RFRX reciever code has been turned into a library and it now used by each of the above sketchs.  This improves the separation of these two pieces.  It does however make your work redundant Gary (sorry) but you'll probably agree this is much prettier when you grab it.
I've also incorporated the changes necessary to make the HAH Central not use the EEPROM so its NODE ID will never change once set, currently hardcoded to NODEID 1.

Many other minor updates to the Arduino code base so if you are using Tortoise (svn update) please.
Brett

brett
Offline
Providence, United States
Joined: 9 Jan 2010
HAHCentral + RF Rx is a GO.

I just flashed the latest HAHCentral and enabled the RFRX module, attached a 433Mhz RF receiver "bugger me" if it all just didn't work first time.  I press my handy Byron RS1 remote and the signal gets all the way over to xap-urfrx and it toggles the BSC endpoint.
Hey Gary this is neat and I see why you where keen to get it working this way.

Pin 4 is labeled PORT 1 on the HAHNode in case anybody was wondering why I chose PIN 4.

How my setup looks (see pic) a little ugly but it works.

Base node with 433Mhz RF Rx

With a RF RX with the 3 pins instead of using the PCB it should just plug straight into the PORT without the need for kludgy wiring like I have in this picture and look must better.

Brett

garrydwilms
Offline
United Kingdom
Joined: 31 Mar 2011
Cheap functionality

Yeah, for those already using jeenodes this is excellent additional functionality for the price of an rf receiver (I paid less than a fiver delivered).

 

Your modifications to the script is great, cheers. Will flash it on mine later.

Garry

Hardware Info