Problem:
Calibration:
Read more- I have no remote controlled garage door.
- I have to open it manually.
- my brother took my car every time for fun.
- so that's why I build this so now when I come near to the door it will open and it also has a car status feature that tells me that my car is there or not on a webserver by webserver I can also control the garage door.
- so in this project, we are using RSSI(received signal strength indicator).
- if you want to know more click here.
- this program is given by Arduino.
#include <SPI.h>
#include <WiFi.h>
char ssid[] = "yourNetwork";
char pass[] = "secretPassword";
void setup()
{
WiFi.begin(ssid, pass);
if (WiFi.status() != WL_CONNECTED) {
Serial.println("Couldn't get a wifi connection");
while(true);
}
else {
long rssi = WiFi.RSSI();
Serial.print("RSSI:");
Serial.println(rssi);
}
}
void loop () {}
- this will give you an idea about RSSI.
- so now we can use RSSI values to control devices.
- so we will create an access point on Nodemcu(turning on wifi hotspot of Nodemcu).
#include <ESP8266WiFi.h>
const char* ssid = "Car";
const char* password = "12345678";
void setup()
{
WiFi.softAP(ssid, password);
}
void loop() {}
- the SSID of AP is Car.
- this will stay on in Car.
- their vis also a Nodemcu that opens and closes the door when the car comes near to the garage.
- and it also has an ultrasonic sensor on the ceiling of the garage.
- that calculate distance and find that car is there or not.
- so here you can see that CAR STATUS: if the car is in the garage this will print parked in green color and if the car is not there this will print not there in red color.
- below that, you can also see that ECFD: if you will write 1 there it will open the door and it will automatically close after 1 min.
- use that in case of emergency or the car transmitter is not working.
- this will also help you.
if (rssi > (-50) && rssi != 0)
- here you can put the value as per your convenience.
#include <ESP8266WiFi.h>
const char* SSID = "car";
int32_t getRSSI(const char* target_ssid) {
byte available_networks = WiFi.scanNetworks();
for (int network = 0; network < available_networks; network++) {
if (WiFi.SSID(network).compareTo(target_ssid) == 0) {
return WiFi.RSSI(network);
}
}
return 0;
}
void setup() {
Serial.begin(115200);
pinMode(0, OUTPUT);
}
void loop() {
Serial.print(rssi)
int32_t rssi = getRSSI(SSID);
if (rssi > (-50) && rssi != 0)
{
digitalWrite(0, 0);
}
else
{
digitalWrite(0,1);
}
- now upload this program in your receiver and open serial monitor.
- and open an AP with SSID car in your smartphone or just upload the program of AP on another board and find the best value when the door opens when you are close to the door.
- if you have any problem with it then do let me know in the comment section.
Comments