How to hook Cayenne to Xbee (via Arduino)

Hi, i’m novoce in using Cayenne but i like it;) so I ask you your kind suport.

I’m running a local mesh netw with Arduino & Xbee S2 from Digi.

Xbee Coordinator is running on Arduino shield and communicates with it via its serial pins exchanging readings and commands to remote xbee nodes.

Now i would like to use Cayenne dashboard ( via Arduino board) to monitor/pilot the remote xbee ntw.

Is the “virtual pin” feature the solution to implenent into sketch the gateway b/w Cayenne and xbee protocol?

Thanks in advancec for your help.

Hello,
Right now I also try to use Xbee wifi to connect to Cayenne. I will let you know when I have results.

1 Like

Hi , this is just to notify that the mission was accomplished.

Now I can control/monitor via cayenne remote Xbee Network sensors/actuators

Here shortly the high level architecture:
1- Remote mesh Xbee Serie2 ntw (working in API mode) connects to Xbee coordinator which is placed on the Arduino YUN Wi-fi shield.
2- The Xbee coordinator connects to Arduino YUN board via Xbee.h library and Virtual port on pin8/9.
3) Cayenne connect to internet via Arduino YUN wifi and communicates via Virtual channel from/to Arduino Yun

I’ll be presenting this project @ Arduino Day Event here in Milan (IT)(http://www.archimedea.it/event/arduino-day-2017/)

KR
Sergio

1 Like

Wooow! I did not have much time to do it :frowning: Can you help me and other people here in the community as you post the code for connection :slight_smile: Thank you in advance :slight_smile:

Hi,here we go with the code!
I hope this helps!

Kr

1 Like

Wow thank you very much!

The point I still need to work on is the sensor acquisition from Arduino Virtual channel V0 to be put into a Dashboard graph The value I would like to graph is the Valve’s status (On or OFF) which in the code are the following instructions:

AirValve_Status= HIGH;
CAYENNE_OUT(V0);
.
.
AirValve_Status= LOW;
CAYENNE_OUT(V0);

… but the sensor in the dashboard connected to V0 doesn’t show any data .
Do you have any hint to make it working ?

Any help is appreciated as tomorrow I would like to show it.

KR
Sergio

How do you trigger the valve? Through Cayenne or not?

Can you try this:

CAYENNE_OUT(V0)
{
Cayenne.virtualWrite(V1, newValue);
}

Both, via Cayenne or via Zigbee. Two channels to activate it : soft & hard.
Does it make any difference? At the point of the code where Cayenne_out is
invoked is not relevant where the trigger came from.

Thanks for the suggestion, tomorrow morning GMT i’ll try it . :slight_smile:

However, i’ m not clear why i should invoke Cayenne (V0) while the write
is done against V1.

Again, The “newvalue” is replaced by AirValve_Status which contains the
booean valute to ne shown in the graph. Plas confirm that in my case i have
to replace newvalue with Airvalve_status.

Is there any more specific doc to be read on how to useApis. Info
available online on the portal are not enough detailed.

KR
Sergio

Hello @sergio.paganelli V0 is the example, but you have to invoke whatever virtual pin you want, because this will be used then for your widget in the Cayenne (you will choose when setup the widget that you want to connect to virtual pin number XX).

Yes, the newvalue have to be replaced with your value. You can also make
if(AirValve_Status=LOW) {
newValue = 0; //it is quite the same
}

Thanks. Undrestood. Tomorrow i’ll try and let you know. Thanks for now.

KR
Sergio

1 Like