Controlling project

Hello
I am new in cayenne and I have this project to control LED, 5V FAN, Solenoid Door Lock, temp DHT11, and motion sensor.
I plug my Arduino and start with the LED and it works, But when I tried to connect the other components it didn’t, I don’t know what is the problem is the connection or I didn’t choose the right widget
DHT11: I choose the generic - digital input
for the Fan I choose it as a button

can your Arduino supply enough power to the FAN?
share the code you are using.

  1. How Can I know
  2. This is the code I used

#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 = “cc6ef700-44e3-11e9-b85b-afa01d2216d6”;
char password = “296453d644113e38404e70397f79c713570a13ea”;
char clientID = “91bf88a0-71ec-11e9-94e9-493d67fd755e”;

#define VIRTUAL_CHANNEL_LED 4
#define ACTUATOR_PIN_LED 4 // Do not use digital pins 0 or 1 since those conflict with the use of Serial.
#define VIRTUAL_CHANNEL_FAN 7
#define ACTUATOR_PIN_FAN 7
#define SENSOR_PIN_DHT 5 // Do not use digital pins 0 or 1 since those conflict with the use of Serial.
#define VIRTUAL_CHANNEL_DHT 5

void setup()
{
Serial.begin(9600);
pinMode(ACTUATOR_PIN_LED, OUTPUT);
pinMode(ACTUATOR_PIN_FAN, OUTPUT);
Cayenne.begin(username, password, clientID);
}

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

// This function is called when data is sent from Cayenne.
CAYENNE_IN(VIRTUAL_CHANNEL_LED)

{
int value = getValue.asInt();
CAYENNE_LOG(“Channel %d, pin %d, value %d”, VIRTUAL_CHANNEL_LED, ACTUATOR_PIN_LED, value);
// Write the value received to the digital pin.
digitalWrite(ACTUATOR_PIN_LED, value);
}

CAYENNE_IN(VIRTUAL_CHANNEL_FAN){
int value = getValue.asInt();
CAYENNE_LOG(“Channel %d, pin %d, value %d”, VIRTUAL_CHANNEL_FAN, ACTUATOR_PIN_FAN, value);
// Write the value received to the digital pin.
digitalWrite(ACTUATOR_PIN_FAN, value);

}
CAYENNE_OUT(VIRTUAL_CHANNEL_DHT)
{
Cayenne.virtualWrite(VIRTUAL_CHANNEL_DHT, digitalRead(SENSOR_PIN_DHT), “digital_sensor”, “d”);
}

And I have a 12V solenoid and I want to use 5V regulator, How can I drag it into the cayenne, Can I choose the simple Button to open/close?

  1. https://electronics.stackexchange.com/questions/67092/how-much-current-can-i-draw-from-the-arduinos-pins
  2. Your code looks fine. Add #define CAYENNE_DEBUG and see if you are receiving the data when the button is clicked on the dashboard.
  3. Your code for DHT is wrong. https://github.com/myDevicesIoT/Cayenne-MQTT-Arduino/blob/master/examples/CommunitySubmitted/DHT/DHT.ino
  4. You cannot power the 12v solenoid directly from the arduino. you need to use either a transistor or better use 5v relay.
  5. What do you mean I want to use 5V regulator,?