Matlab and arduino connected to cayenne


#1

Hello there…
I had successfully transfer the commands from matlab to arduino via serial cable(need compulsory serial cable attached to arduino via pc because of change in commands according to ptogramme).

Now i want to connect arduino with cayenne. i want to use usb serial communication to communicate via cayenne.

It is possible to use same serial cable for connecting to cayenne?? Or need any other method of connecting viz. Esp8266 or other

Please suggest…


#2

Hi @vin3yasukhadeve, you can indeed use a USB serial connection method to connect your Arduino to Cayenne. When adding a new Arduino to Cayenne, choose your appropriate Arduino board, then there will be a list of example sketches – you’re looking for the one titled ‘Serial USB Connection’:

There are detailed instructions in the comments inside the sketch file provided there – let me know if you have any trouble with them.

It can be a little tricky using USB serial at first because it requires a script running on the connected computer to facilitate communication, but in my experience once set up correctly this connection method is very reliable and easy to use.


#3

Hello…
I already done a big project on the cayenne by using usb serial communication and also using esp8266 by using arduino…
The help you are suggeated is very basic level which i know already.

Please help me with the main point of my interest…


#4

I don’t see another question in your original post besides the part about connecting your Arduino via serial USB to Cayenne, apologies. :confused:

Let me know what more I can do to assist.


#5

Ok…i will tell you what i actually try to do…

I am doing face recognition project on matlab. so, if face detection is right then, buzzer should be activated and sent message to the admin about this detection.
So, face detection part is over by using matlab…now buzzer is connected to the arduino, which should be activated while correct face detection. To interface arduino with matlab, i install matlab support to the arduino which will sent data to the arduino and buzzer will on and off…

Now i want to connect arduino to the cayenne for email notifications as well as text notification…

So my question is, if i use serial communication, them already my first serial communication is already connected to the matlab interface…so it is possible to use same cable to connect with cayenne. Or there is a COM port problem…


#6

I see. I’m fairly sure that the USB serial communication with Matlab will occupy the port so Cayenne can’t use it (and vice versa). I know that the Arduino IDE complains when trying to upload code with the Cayenne USB Serial connection active, so I imagine it blocks out any other software as well.

I’d look into getting one of the supported wired or wireless Arduino shields from this list to facilitate internet connectivity for Cayenne, while reserving the USB communication for the Matlab part of your project.


#7

Hey @rsiegel
Thank you very much for your suggestion.

Now , i will use esp8266 for connecting with cayenne…
Again, i am in doubt about something
I am doing my programming to activate buzzer connected to arduino in matlab command…

If i want to send the email notification using cayenne, then i need to programme in matlab itself or in arduino??
Because all the buzzer activation after correct face detection is done in matlab itself.Only i want email notification and text mesaage…
How to achieve this? Please suggeat something about this programming…

I am asking because no any thread found related to matlab in cayenne…i think i am only one here to work on matlab cayenne interface…

So please help me…


#8

Since the buzzer is on your Arduino, what I would do is create a 2-state widget to represent the state of the pin that drives the buzzer. Then, when the buzzer is activated, Cayenne will change this 2-state widget to a ‘1’ and you can base your email and text message triggers on that in the Cayenne UI.

Here is some example code that does this – it assumes that the buzzer is on digital pin 6 on the Arduino, and the 2-State widget is set to Virtual Pin 10 in Cayenne. It simply writes a 1 to virtual pin 10 when the buzzer is ON and a 0 when the buzzer is OFF.

// Cayenne authentication token. This should be obtained from the Cayenne Dashboard.
char token[] = "0xpkkcpcjw";

int buzzerpin = 6;

  
void setup()
{
	Serial.begin(9600);
	Cayenne.begin(token);
}

void loop()
{
	Cayenne.run();
}

CAYENNE_OUT(V10)
{
if(digitalRead(buzzerpin) == HIGH) 
  {
    Cayenne.virtualWrite(V10, 1);
  }
else
  {
    Cayenne.virtualWrite(V10, 0);
  }  
}

#9

Thank you for the code for my reference…

I will get back to you…says whether it is worked for me or not…


#10

Hello @rsiegel
I am successfully connected Arduino with Matlab by using Matlab support package of Arduino.
as I said, I want to transfer the data to the cayenne, and for that, i am using esp8266 to do the same.
now, after connecting Arduino to Matlab, commands from the Matlab is smoothly run and drive Arduino.
but after connecting the esp board, Matlab says “The host and client connection is lost. Make sure the board is plugged in and recreate Arduino and related objects”, after this, nothing is executed from the Matlab command.

if i remove tx and rx connection of esp8266 to arduino, then again all commands gets executed .
what to do?


#11

If it is a connectivity/communication issue between Matlab and your Arduino, you may want to contact their support, I’ve not worked with Matlab myself or have any experience connecting Arduino boards to it.

If the ESP8266 is the only thing blocking it from working properly, you may want to try an Arduino Ethernet or Wifi shield for internet connectivity on the Arduino to simplify the build. The advantage here is that Cayenne officially supports these shields where our ESP8266 support is limited to using it as a stand-alone device for your project (replacing the Arduino entirely rather than being a component to provide internet connectivity for it).

As you may have found on this forum, we do have a contingent of users unofficially using ESP8266 to provide Arduino internet connectivity – they may be able to help troubleshoot in that thread as well.