Haha lucky for some!
Hello there. What part of sketch do I need to change to make it work with normally open connection? Meaning SWITCH_PIN LOW instead of HIGH and vice versa? I tried to do that with no luck
BR
Hey Zbx!
Sorry its taken so long to reply.
You just need to invert the bits on the following lines:
^^ Change 1 to 0
^^ Change 0 to 1
Inverted!
in code where i put ssid and pass ssid? and which ouput pins are selected in the blynk app? I do not run for a local server…thx
All in settings.h
HI
here is part of my sketch for a (+ve) activated Relay
/******************************************************************************
*
* switch.h
*
*****************************************************************************/
BlynkTimer timer;
int SwitchState, timer1, SwitchDelay;
WidgetBridge gate(vPIN_BRIDGE_GATE);
BLYNK_CONNECTED() {
gate.setAuthToken("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
}
void Switch_OFF() {
digitalWrite(RELAY_PIN, 0);
Blynk.virtualWrite(vPIN_BUTTON_MANUAL, 0);
Blynk.virtualWrite(vPIN_LED, 0);
}
void Switch_ON() {
digitalWrite(RELAY_PIN, 1);
Blynk.virtualWrite(vPIN_BUTTON_MANUAL, 1);
Blynk.virtualWrite(vPIN_LED, 255);
}
void Switch_Toggle(bool state) {
digitalWrite(RELAY_PIN, state);
SwitchState = digitalRead(RELAY_PIN);
if (SwitchState) { SwitchState = 255;
Blynk.virtualWrite(vPIN_LED, SwitchState);
}else{ SwitchState = 0;
Blynk.virtualWrite(vPIN_LED, SwitchState);
}
}
BLYNK_WRITE(vPIN_BUTTON_TIMEOUT) { // remote delay Switch
if ((digitalRead(RELAY_PIN))== 0)
Switch_ON();
timer.setTimeout(SwitchDelay, Switch_OFF);
}
BLYNK_WRITE(vPIN_BUTTON_MANUAL) { // manual button
Switch_Toggle(param.asInt());
}
BLYNK_WRITE(vPIN_TIMER) { // timer Switch
if (param.asInt()) {
Switch_ON();
gate.virtualWrite(vPIN_BRIDGE_GATE, param.asInt());
} else {
Switch_OFF();
}
}
BLYNK_WRITE(vPIN_SLIDER_TIMEOUT) {
SwitchDelay = param[0].asInt() * 60000;
Blynk.syncVirtual(vPIN_BUTTON_TIMEOUT);
}
/*---------------------------------------------------------------------------*/
My Smart Plug
Thanks to Jamin
May I ask what you used as a power supply for the esp
Thanks. Love the title, dangerous
Looks cool!
What’s the BOM?
Bill Of Materials (BOM)
I think the problem is to find the corresponding CASE , BOX or ENCLOSURE available in our countries.
most of us uses AliExpress , ebay or amazon to find products.
For DE
For UK
About my “Grounded 2 Gang Plug Socket” I bought them 2 or 3 years ago from our local market and they remained in there boxes until I saw Jamin Project. the cost was about 1.0 $ per unit.
for the other parts in US $
1- ESP8266-01__________________________2.0 $
2- The CUBE "USB Charger "______________1.0 $
3- 10 pcs AMS1117-3.3 ___________________0.3 $
4- DS18B20 TO-92_______________________0.9 $
5- DS18B20 in Stainless Steel Package______2.0 $
6- 3.5 mm Plug and Socket Stereo _________0.5 $
All these parts can be found at AliExpress or perhaps with a better price in your local market.
Read Here "SONOFF Clone" - Mini-ESP8266 Power AC Relay Controller:
also Explained here Blynk.setProperty(V0, “label”, “My New Widget Label”);
Replace With :
timer.setInterval(10000L, []() {
Blynk.virtualWrite(vPIN_WIFI_SIGNAL, String("Wifi = ") + map(WiFi.RSSI(), -105, -40, 0, 100) + String('%')+ String(" (") + WiFi.RSSI() + String("dB)"));});
it works! thanx
i have noticed i had to change virtual pin to make changes … perhaps theres a bug on the server or something
does that signl icon change with signal strenght or its just simple icon ?
thanx!
No change, but you can change the color of " Signal Strength" according to the signal .