Hello guys, I need help in my project, i am new to this.
Last month I was stolen in my house and I have the idea to make a home security system with
cloud based platform (cayenne). Therefore I want to create a security system in my house.
I want to make a project where there are Arduino Uno, RFID scanner (RC-522), Esp8266 module (as a shield), Yx5300 (as mp3), and servo motor.
Here are some of the schemes that I have tried to create :
What I want to ask is whether it is possible to combine all of them in 1 Arduino? coz I already bought all that
And even now I can only control LED Arduino using Esp8266 as a shield, im stuck
I don’t really understand how to program it. Can anyone help me in making this project, I will really appreciate it
Im sorry, I forgot to explain beforehand how the project went,
So I want to make, if the rfid scanner scans the correct rfid tags, it will trigger a servo motor (assuming as the door lock), and if the rfid scanner scans for the wrong rfid tags, it will trigger an alarm in the mp3 module (in my case yx5300)
is it possible to make it like that?
I found this article , hopefully it’s an example of the right project
I’ve read this project , but it’s using a different rfid scanner and mp3 module. What should i do now ?
lets try a different approach.
First, set the baud rate of your esp to 9600 using this code:
// Basic serial communication with ESP8266
// Uses serial monitor for communication with ESP8266
//
// Pins
// Arduino pin 2 (RX) to ESP8266 TX
// Arduino pin 3 to voltage divider then to ESP8266 RX
// Connect GND from the Arduiono to GND on the ESP8266
// Pull ESP8266 CH_PD HIGH
//
// When a command is entered in to the serial monitor on the computer
// the Arduino will relay it to the ESP8266
//
//AT+CIOBAUD=9600
#include <SoftwareSerial.h>
SoftwareSerial ESPserial(2, 3);
void setup()
{
Serial.begin(9600); // communication with the host computer
//while (!Serial) { ; }
// Start the software serial for communication with the ESP8266
ESPserial.begin(115200);
Serial.println("");
Serial.println("Remember to to set Both NL & CR in the serial monitor.");
Serial.println("Ready");
Serial.println("");
}
void loop()
{
// listen for communication from the ESP8266 and then write it to the serial monitor
if ( ESPserial.available() ) { Serial.write( ESPserial.read() ); }
// listen for user input and send it to the ESP8266
if ( Serial.available() ) { ESPserial.write( Serial.read() ); }
}
Once uploaded, open the serial monitor. Type AT you should receive a response OK if all the connection is okay. Now type AT+CIOBAUD=9600 to change the baud rate to 9600.
Now that you have set the baud rate to 9600, use this code to connect to cayenne.
#define CAYENNE_DEBUG // Uncomment to show debug messages
#define CAYENNE_PRINT Serial // Comment this out to disable prints and save space
#include <CayenneMQTTESP8266Shield.h>
#include <SoftwareSerial.h>
#define VIRTUAL_CHANNEL 1
// WiFi network info.
char ssid[] = "";
char wifiPassword[] = "";
// Cayenne authentication info. This should be obtained from the Cayenne Dashboard.
char username[] = "";
char password[] = "";
char clientID[] = "";
// Set ESP8266 Serial object. In this example we use the Serial1 hardware serial which is available on boards like the Arduino Mega.
//#define EspSerial Serial
SoftwareSerial EspSerial(2,3);
ESP8266 wifi(&EspSerial);
void setup()
{
Serial.begin(9600);
delay(10);
// Set ESP8266 baud rate
EspSerial.begin(9600);
delay(10);
Cayenne.begin(username, password, clientID, wifi, ssid, wifiPassword);
}
void loop()
{
Cayenne.loop();
}
// Default function for sending sensor data at intervals to Cayenne.
// You can also use functions for specific channels, e.g CAYENNE_OUT(1) for sending channel 1 data.
CAYENNE_OUT_DEFAULT()
{
// 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);
}
// Default function for processing actuator commands from the Cayenne Dashboard.
// You can also use functions for specific channels, e.g CAYENNE_IN(1) for channel 1 commands.
CAYENNE_IN_DEFAULT()
{
CAYENNE_LOG("Channel %u, value %s", request.channel, getValue.asString());
//Process message here. If there is an error set an error message using getValue.setError(), e.g getValue.setError("Error message");
}
I tried change baudrate using this command AT+UART=9600,8,1,0,0 from this link and receive OK on serial monitor, but AT does not working anymore, did I make a mistake ?
Upload below code and see if you get a response for AT
// Basic serial communication with ESP8266
// Uses serial monitor for communication with ESP8266
//
// Pins
// Arduino pin 2 (RX) to ESP8266 TX
// Arduino pin 3 to voltage divider then to ESP8266 RX
// Connect GND from the Arduiono to GND on the ESP8266
// Pull ESP8266 CH_PD HIGH
//
// When a command is entered in to the serial monitor on the computer
// the Arduino will relay it to the ESP8266
//
//AT+CIOBAUD=9600
#include <SoftwareSerial.h>
SoftwareSerial ESPserial(2, 3);
void setup()
{
Serial.begin(9600); // communication with the host computer
//while (!Serial) { ; }
// Start the software serial for communication with the ESP8266
ESPserial.begin(9600);
Serial.println("");
Serial.println("Remember to to set Both NL & CR in the serial monitor.");
Serial.println("Ready");
Serial.println("");
}
void loop()
{
// listen for communication from the ESP8266 and then write it to the serial monitor
if ( ESPserial.available() ) { Serial.write( ESPserial.read() ); }
// listen for user input and send it to the ESP8266
if ( Serial.available() )
}
hey, I changed the 9600 baudrate and use this code to connect to cayenne. this is on the serial monitor.However my cayenne dashboard shows Arduino is offline
The serial monitor looks like this if I use my code ASLI.ino.txt without adding a rfid scanner, and my cayenne dashboard looks normal, I can control it from there