Usb serial connection with arduino to add devices to cayenne

dear developers
i successfully add arduino uno to cayenne…1st task is over
now, when i am uploading any sketch to arduino ide (the sketches getting after we add any actuator or sensor to cayenne), i am getting error i.e
avrdude: ser_open(): can’t open device “\.\COM3”: Access is denied.

i find many help in cayenne community.all types of necessary changes were made by my side like
1)i remove serial.begin from sketch…nothing happened
2) i go to the script folder and find cayenne-ser file.and then open with ms word and changed COMM_PORT_OSX=/dev/tty.usbmodem to COMM_PORT_OSX=/dev/tty.usbmodem1234…nothing happened
3 some says …need to stop cayenne server…but after executed, devices get offline…and the sketch is uploading without any error…but one problem i get persists i.e… devices gets into offline mode. so i again tried to start cayenne server by executing command “cayenne-ser.bat -c COM3”.but devices not get connected…only waiting for connection.

what to do i don’t know…help me this to sort out…

I have basically 0 MacOS experience, but sounds like your user account either doesn’t have access to do what you’re trying to do, or COM3 is not the correct port. Maybe someone else that know more about MacOS will have some better suggestions.

Am using windows.not mac.

Hmm ok, you caught me with this, my fault for not reading closely

Did you see this thread? Arduino USB help

but sir
i am using windows 10.

ok Iam a user who using serial connnection

first of all when you are uploading sketch to arduino make use the cmd is closed
restore your settings dont do anything with the script folder
then check the port in which u as plug in from the arduino idle and change cayenne-ser.bat -c COM** and replace the xx with the port you have plug in and hit go it will do let me know if it works

Thanx…it works…now i am able to connect servo motor and control using slider…

Do you have any idea about how to connect DHT11??
IF have then let me ping.

Hello, I have the same issue. But I cannot resolve it with your description. My Arduino Uno is connected to Cayenne Dashboard after running the script. (My system is Windows 8). After I close the cmd (arduino goes offline) I can upload the luminosity sketch but after that my arduino is remained offline and I cannot make it online. I tried to reopen cmd and run the same bat file: cayenne-ser.bat -c COM3 (port is correct) but without success:
And this message is continously repeating after every 5 sec…
What does “restore your settings” mean exactly?
Any idea please? How should I connect my Arduino again without starting the full story again from the beginning?
Thanks in advance

can you provide me the sketch you have uploaded

make sure the code have been uploaded to arduino


qw.txt (3.0 KB)
insert the authentication code in the sketch and upload

after that
open cmd

cd C:\Users[YourUserName]\Documents\Arduino\libraries\Cayenne\extras\scripts
press enter
then insert the code
cayenne-ser.bat -c COMxx where xx is your port number
and hit enter
make sure there is no serial activities going in pc
and your internet connection is strong enough and you have the cayenne library
check whether you have given the right serial port the port which is been used can be obtained from the arduino idle

LET ME KNOW IF IT WORKS:slight_smile:

First, I would like to thank you for your kind reply. I checked your code and found that this line was not in yours: #define CAYENNE_PRINT Serial
I removed that line from my sketch (as you also draw my attention with this: "make sure there is no serial activities going in pc ") and after upload it seems I managed to run the script correctly and Arduino went online. Could it be the issue? What do you think?
Anyway, here you can find my sketch:

Cayenne Luminosity Example

This sketch sample file shows how to change the brightness on a LED
using Cayenne Dashboard.

The Cayenne Library is required to run this sketch. If you have not already done so you can install it from the Arduino IDE Library Manager.


  1. In the Cayenne Dashboard add a new Custom Widget, and select Slider.
  2. Select a virtual pin number.
  3. Set min value to 0 and max value of 1.
  4. Set LED_VIRTUAL_PIN to the pin number you selected.
  5. Connect the LED’s legs to GND, and to a PWM pin (3, 5, 6, 9, 10, and 11 on most Arduino boards).
    Use a 1k resistor if possible.
    [Ground] – [LED] – [1k-resistor] – [PWM Pin]
  6. Set LED_DIGITAL_PIN to the PWM pin number you selected.
  7. Set the token variable to match the Arduino token from the Dashboard.
  8. Compile and upload this sketch.
  9. Once the Arduino connects to the Dashboard you can use the slider to change LED brightness.

//#define CAYENNE_PRINT Serial // Comment this out to disable prints and save space

// If you’re not using the Ethernet W5100 shield, change this to match your connection type. See Communications examples.
#include < CayenneSerial.h>


// Cayenne authentication token. This should be obtained from the Cayenne Dashboard.
char token = “0b7nyxjdhm”;

void setup()

// get value sent from dashboard
int currentValue = getValue.asInt(); // 0 to 1023
analogWrite(LED_DIGITAL_PIN, currentValue / 4); // must be from 0 to 255

void loop()