logo
NodeMCU Phone Ringer
Phone Ringer

This little project with the NodeMCU and a PCR-SIN03V12F20-C
is to make an old house phone ring, it needs to be one that works on the two wire system.
You could send the command from a Web Browser address bar,
format: ip-address/RING1 ,eg: 10.220.1.22/RING1
would trigger the Ring 1 command.

format: ip-address/RING2 ,eg: 10.220.1.22/RING2
would trigger the Ring 2 command.

See in Sketch 

PARTS

1 x WeMos D1 USB NodeMcu Lua V3 CH340G ESP8266 Wireless Internet Development 5-9V
or
1 x NodeMCU Lua ESP8266 ESP-12 WeMos D1 Mini WIFI

1 x PowerDsine pcr-sin03V12F20-c
1x Plastic Project Box to suit your requirements,
I used 100mm
x 100mm x 50mm inside diameter

1 x 12v dc Power Supply
2 x 2N2222A Bipolar Transistor NPN
1x Red LED
1x Blue LED
4 x 10k Ohm Resisters
2 x 1k Ohm Resisters
2 x 470 Ohm Resisters
1 x 330 Ohm Resister
4 x PUSH BUTTON
1 x Small PCB
1 x power socket to suit your 12vdc power supply
1 x phone socket to suit your phone type

Some other components depending how you would like to connect the wires to the PCB, eg pin headers, terminals.











Phone Ringer        Phone Ringer

Phone Ringer        Phone Ringer

Phone Ringer        Phone Ringer

Phone Ringer       Phone Ringer

In the below picture on the left is the PCR-SIN03V12F20-C, this is the unit that steps up the 12vdc to 70v 20Hz to make the bell ring.
The picture on the right is the dc to dc step down conerter, search LM317 DC-DC, its very important to power this unit with the 12v power supply
you intend to use and ajust the output to 5v before using it in this project.

Phone Ringer       

Phone Ringer
click picture to enlarge

Below are the Sketches for Phone Ringer that works, it may not be the best put you can change it to suit your own designs


/*

 MerrittSoft
 Phone_Ringer
 30/03/2020
 Language: C++/Arduino
 Thank you to those people that made the Libarays in this project posable.
*/

#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>


ESP8266WebServer server;


const int output = D1;
const int output2 = D2;
const int button5 = D5;
const int button6 = D6;
const int button7 = D7;
const int button8 = D8;

char* ssid = "Network Name";
char* password = "Network Password";

int Ringing1 = 0;
int Ringing2 = 0;
int Ringing3 = 0;
int Ringing4 = 0;


void setup()
{
 pinMode(output, OUTPUT);
 pinMode(output2, OUTPUT);
 digitalWrite(output, LOW);
 digitalWrite(output2, LOW);

 pinMode(button5, INPUT);
 pinMode(button6, INPUT);
 pinMode(button7, INPUT);
 pinMode(button8, INPUT);


 WiFi.begin(ssid, password);
 WiFi.hostname("Phone_Ringer");
 WiFi.mode(WIFI_STA); // added works with some boards to stop the wifi broadcast.
 //WiFi.mode(WIFI_AP_STA); // added works with some boards to start the wifi broadcast.
 Serial.begin(115200);
 while (WiFi.status() != WL_CONNECTED)
 {
   Serial.print(".");
   delay(500);
 }
 Serial.println("");
 Serial.print("IP Address: ");
 Serial.println(WiFi.localIP());

 server.on("/", []() {
   server.send(200, "text/plain", "Meltronica");
 });

 // below are the commands that activate the Ring Pattons
 // eg. the /RING1 is the command you add to the end of the ip address of the Phone_Ringer (NodeMCU) eg. 10.220.1.20/RING1   This can be done in a Web Browser on the same network

 server.on("/RING1", RING1);

 server.on("/RING2", RING2);

 server.on("/RING3", RING3);

 server.on("/RING4", RING4);


 server.begin();
}

void loop() {

 if (WiFi.status() != WL_CONNECTED)
 {
   ESP.reset();
 }

 server.handleClient();

 Ringing1 = digitalRead(button5);
 if (Ringing1 == HIGH) {
   delay(1000);
   Ringing1 = digitalRead(button5);
   if (Ringing1 == HIGH) {
     RINGSOUND1();
   }
 }
 Ringing2 = digitalRead(button6);
 if (Ringing2 == HIGH) {
   delay(1000);
   Ringing2 = digitalRead(button6);
   if (Ringing2 == HIGH) {
     RINGSOUND2();
   }
 }
 Ringing3 = digitalRead(button7);
 if (Ringing3 == HIGH) {
   delay(1000);
   Ringing3 = digitalRead(button7);
   if (Ringing3 == HIGH) {
     RINGSOUND3();
   }
 }
 Ringing4 = digitalRead(button8);
 if (Ringing4 == HIGH) {
   delay(1000);
   Ringing4 = digitalRead(button8);
   if (Ringing4 == HIGH) {
     RINGSOUND4();
   }
 }

}

void RING1()
{
 delay(1000);
 server.send(204, "");
 RINGSOUND1();
 return;
}

void RING2()
{
 delay(1000);
 server.send(204, "");
 RINGSOUND2();
 return;
}

void RING3()
{
 delay(1000);
 server.send(204, "");
 RINGSOUND3();
 return;
}

void RING4()
{
 delay(1000);
 server.send(204, "");
 RINGSOUND4();
 return;
}
/*            Below you can make the ring pattons you want for the 1 to 4 buttons by adding
             digitalWrite(output, HIGH);
             digitalWrite(output2, HIGH);
             delay(100); changing the delay time
             digitalWrite(output, LOW);
             digitalWrite(output2, LOW);
             delay(100); changing the delay time
*/
void RINGSOUND1()
{
 digitalWrite(output, HIGH);
 digitalWrite(output2, HIGH);
 delay(441);
 digitalWrite(output, LOW);
 digitalWrite(output2, LOW);
 delay(163);
 digitalWrite(output, HIGH);
 digitalWrite(output2, HIGH);
 delay(441);
 digitalWrite(output, LOW);
 digitalWrite(output2, LOW);
 delay(1974);
 digitalWrite(output, HIGH);
 digitalWrite(output2, HIGH);
 delay(441);
 digitalWrite(output, LOW);
 digitalWrite(output2, LOW);
 delay(163);
 digitalWrite(output, HIGH);
 digitalWrite(output2, HIGH);
 delay(441);
 digitalWrite(output, LOW);
 digitalWrite(output2, LOW);
 return;
}


void RINGSOUND2()
{
 digitalWrite(output, HIGH);
 digitalWrite(output2, HIGH);
 delay(2000);
 digitalWrite(output, LOW);
 digitalWrite(output2, LOW);
 delay(1000);
 digitalWrite(output, HIGH);
 digitalWrite(output2, HIGH);
 delay(2000);
 digitalWrite(output, LOW);
 digitalWrite(output2, LOW);

 return;
}


void RINGSOUND3()
{
 digitalWrite(output, HIGH);
 digitalWrite(output2, HIGH);
 delay(3000);
 digitalWrite(output, LOW);
 digitalWrite(output2, LOW);
 delay(1000);
 digitalWrite(output, HIGH);
 digitalWrite(output2, HIGH);
 delay(3000);
 digitalWrite(output, LOW);
 digitalWrite(output2, LOW);

 return;
}


void RINGSOUND4()
{
 digitalWrite(output, HIGH);
 digitalWrite(output2, HIGH);
 delay(3000);
 digitalWrite(output, LOW);
 digitalWrite(output2, LOW);
 delay(2000);
 digitalWrite(output, HIGH);
 digitalWrite(output2, HIGH);
 delay(3000);
 digitalWrite(output, LOW);
 digitalWrite(output2, LOW);

 return;
}

www.000webhost.com