Author Topic: multiple moteino units sending to central receiver  (Read 1857 times)

dotson

  • NewMember
  • *
  • Posts: 1
multiple moteino units sending to central receiver
« on: June 18, 2014, 03:29:59 PM »
I'm embarking on an evolving project that will draw data from multiple sensors of differing types from multiple moteinos/radios for water management and property monitoring. I've just recently started with arduinos/moteinos, but thanks to the supplied code and samples from this forum I've demonstrated to myself I can transmit data from one deployed moteino. While I know in principle that the central radio can receive data from multiple sending units, I've not seen an example of coding to do that. How would I generalize the supplied send and receive codes for receiving and parsing data from more than one sending unit? Can someone point me to an example?

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: multiple moteino units sending to central receiver
« Reply #1 on: June 18, 2014, 05:17:53 PM »
You can use the Node and Gateway examples as a starting point:
https://github.com/LowPowerLab/RFM69/tree/master/Examples

For the node you just change the NodeID to differentiate between your deployed nodes. Then you interpret that data however you need/want at the gateway.
Does that help?

luisr320

  • Sr. Member
  • ****
  • Posts: 255
  • Country: pt
Re: multiple moteino units sending to central receiver
« Reply #2 on: June 29, 2014, 10:04:48 PM »
By having this code on the gateway,

Code: [Select]
if (radio.receiveDone())//If some packet was received by the radio, wait for all its contents to come trough
{
if (radio.TARGETID == 1)//Check if the packet destination is this radio (NODE 1)
{
//Display a message on the serial monitor showing the packet origin radio NODE number
Serial.print('[');Serial.print(radio.SENDERID, DEC);Serial.print("] ");
you can see here that the radio.SENDERID is used to identify the sender ID node.

So all you have to do is check its content and according to the sender ID the program would act accordingly. Something like this

If (radio.SENDERID = 1)
{
    Do this;
}
else if (radio.SENDERID =2)
    Do that;
}

Or you could send the node name/function along with the data packet in a struct and simply parse its content on the gateway.

This way I can send from the same node several data types like temperature, humidity, fuel level, whatever.



 
« Last Edit: July 01, 2014, 10:21:45 PM by luisr320 »