Send a password from cayenne to arduino when a button is pushed

I would like to control my home made alarm system. I want turn on and turn off the system using a cayenne´s buttom but i would like to introduce a security code (like a password) (maybe it´s possible open a new window for introduce the numbers/characters).

Is it possible that cayenne ask for a password when the user push the alarm button?.

This password could be sent to arduino and this device will execute the order only in case of right password.

Thank you in advance and apologize for my horrible english.

maybe you can try and create a custom app which opens only when the correct password is pressed.

Thank you for you answer. I´m a new cayenne user and i am not using a app. I am using the cayenne´s webside from my mobile phone in orden to control my arduino´s digital pins.

I would like to introduce a password in order to avoid no authorized users but, i think it could confirm too the action from authorized users (avoiding the action in case of accidental pressed to alarm button).

is it possible to introduce characters using the keyboard in cayenne and send them to arduino?.

i guess it is similar project done by @gygonzales here Virtual numeric keypad - #21 by gerardgonzales1977

Thank you for your answer.

The bygonzales´ project looks like he is trying to make a code using different combinations of several digital buttons. I´m trying to send and character string from cayenne to arduino like a password. For examble “1234” or “8675” o whatever. i´m think type this code in a window and send to arduino pressing a button but i´don´t if it´s possible.


You can give the code for keyboard a try. Where the counter increments on each correct input and after x try is the counter is equal to the value then the particular action is taken.

HI Rafael. Have you figured how to produce characters string?

No, i haven´t achieved produce a charactyer string running like a password.

The Schrmik´s suggestion is similar but, unfortunately, it isn´t what i´m looking for.

any idea from your side?

Nope. MAybe we should ask Shramik again. : )

Hi Shramik. What do you mean when you said “you can give the code for keyboard”.
What modifications do I need to do with the code to accomplish that? Thanks in advance.

can you explain what is the use of this? i will try an find a best suitable way to do it.

Before the code I made was just based on whether the widget is a "1 or “0”. Now I want a widget that produces a character as opposed to an integer… And then after that use those character string generated by pressing widgets and compare it to a predetemined password. Something like that. Basically, they keypad now acts like the keypad that will generate the necessary password.

*Basically, they widget now acts like the keypad that will generate the necessary password.

not with character but i tried with integers a similar approach:

//#define CAYENNE_DEBUG       // Uncomment to show debug messages
#define CAYENNE_PRINT Serial  // Comment this out to disable prints and save space
#include <CayenneMQTTEthernet.h>

// Cayenne authentication info. This should be obtained from the Cayenne Dashboard.
char username[] = "-c72c-11e8-9fa8-";
char password[] = "";
char clientID[] = "77edd";

int code[3];
int lenght = 0;
void setup() {
  Cayenne.begin(username, password, clientID);


void loop() {

  if (lenght == 3)
    lenght = 0;
    if ( ( code[0] == 5 ) && ( code[1] == 7 ) && ( code[2] == 8 ) )

  code[lenght] = 5;

  code[lenght] = 7;

  code[lenght] = 8;

  // Write data to Cayenne here. This example just sends the current uptime in milliseconds on virtual channel 0.
  Cayenne.virtualWrite(0, millis());
  // Some examples of other functions you can use to send data.
  //Cayenne.celsiusWrite(1, 22.0);
  //Cayenne.luxWrite(2, 700);
  //Cayenne.virtualWrite(3, 50, TYPE_PROXIMITY, UNIT_CENTIMETER);

Thanks again Shramik. I will try this.

Excuse Shramik, i am not inderstaand how can i send the code from cayenne to arduino. In your example, you are sendind three characters (numbers) from virtual channels 5, 7 and 8. If those characters are the right ones, arduino will produce the message “correct”. But my doubt is in cayenne project (not in arduino receipt). What is the device/widget that i have to use in orden to send to arduino those characters from cayenne.

Thank you in advance.

Just simple button widgets on cayenne dashboard.

I tried it Raphael. Shramik’s code works!

Just check the serial momitor

1 Like

Great to hear it works the way you want.