This is the code we ended up with #define PULSEPIN 3 // Pulse Pin To Digital Pin 3 #define SIGNALPIN 7 // Signal Pin To Digital Pin 7 #define LED LED_BUILTIN // Working With The LED Built In #define CODELENGTH 7 // Define how many digits the code is #define RELAYPIN 8 #define RESET 9 const int secretCode[CODELENGTH] = // Array to hold the secret code - each element should contain one digit 0-9 {8,6,7,5,3,0,9}; const unsigned long debounceDelay = 100; // Debounce time - the time used to make sure terminal contact bouncing doesn't produce false events const int d=70; // The Delay Time For LED To Blink At The Wrong Password // Working variables used to keep track of the counts always start at 0 int codeDigits[CODELENGTH] = // Array to store received integers {0,0,0,0,0,0,0}; int currentDigit=0; // Var to keep track of which digig in the array we are on int pulseCount=0; // Var to keep track on how many pulses in the current digit have been counted bool pulseTriggered=false; // Var to keep track of if the current pulse has been counted unsigned long lastDebounceTime = 0; // Var to hold the last time the pulse pin was toggled bool ledState = false; // Var to hold the current LED state bool previousSignalState = false; // Var to keep track of when we transition out of a dialed digit void setup(){ Serial.begin(9600); // Start Serial connection for print commands pinMode(PULSEPIN,INPUT_PULLUP); // Define the pin mode for the dialer pulse pin pinMode(SIGNALPIN,INPUT_PULLUP); // Define the pin mode for the dialer signal pin pinMode(RESET,INPUT_PULLUP); pinMode(LED,OUTPUT); //led As OUTPUT pinMode(RELAYPIN,OUTPUT); digitalWrite(LED,LOW); // Make sure that the LED is off on startup digitalWrite(RELAYPIN,LOW); } void loop(){ /* * Read the states of the current pulse and signal pins into temp working variables. * Since the inputs are active low (0v is an active true state), these variable take * on the oppisite state (are inverted) so that the code logic is more readable. * * If the circuite is setup as active high then remove the not symbol (!) and change * the pinmode of PULSEPIN and SIGNALPIN in the setup loop to INPUT. */ bool pulse = digitalRead(PULSEPIN); bool sig = !(digitalRead(SIGNALPIN)); bool reset = !(digitalRead(RESET)); if (reset==true){ digitalWrite(RELAYPIN,LOW); for (int i=0; i < CODELENGTH; i++){ codeDigits[i] = 0; } currentDigit=0; // Var to keep track of which digig in the array we are on pulseCount=0; // Var to keep track on how many pulses in the current digit have been counted pulseTriggered=false; // Var to keep track of if the current pulse has been counted ledState = false; // Var to hold the current LED state previousSignalState = false; // Var to keep track of when we transition out of a dialed digit } /* * First, see if the signal line is activated. If it is then test to see if a pulse * has been detected that wasn't already detected and isn't a bounce of the mechanical contacts.
*/ if (sig == true){ //Serial.print("processing signal"); Serial.print(" ");Serial.println(pulse); if ((pulse == true) && (pulseTriggered == false)){ //Serial.println(pulse); if ((millis() - lastDebounceTime) > debounceDelay){ pulseCount++; // Add one(1) to the pulse count variable lastDebounceTime = millis(); pulseTriggered=true; } } /* * if the signal line and pulse trigger are activated but the pulse line is not * then we need to reset the trigger for the next pulse */ if ((pulse == false) && (pulseTriggered == true)){ pulseTriggered=false; } previousSignalState = true; } else { /* * If the signal line is not active then either nothing is happening or we just * ended the number and the pulse count is our digit. First check to see if the * signa line was previously activated and if so set the current digit in the array * then, increment and reset counts * Valid pulse count are 1-10 and if there are pulse counts below 1 or greater * than 10, ignore them */ if (previousSignalState == true){ //Serial.println(pulseCount); if (pulseCount == 10){ codeDigits[currentDigit]=0; } if (pulseCount < 10){ if (pulseCount > 0){ codeDigits[currentDigit]=pulseCount; } } /* * Next increment the digit count and reset the pulse count and trigger */ currentDigit++; pulseCount=0; pulseTriggered=false; previousSignalState = false; } } if (currentDigit > (CODELENGTH - 1)){ //test and reset //Serial.println("test"); bool codeCompare = true; for (int i=0; i < CODELENGTH; i++){ if (secretCode[i] != codeDigits[i]){ codeCompare = false; } codeDigits[i] = 0; } currentDigit=0; if (codeCompare == true){ Serial.println("Correct"); correctCode(); } else{ Serial.println("fail"); falseCode(); } } } void correctCode(){ // Function that exectures when the correct code is entered if (ledState == false){ digitalWrite(RELAYPIN,HIGH); ledState = true; } else { digitalWrite(RELAYPIN,LOW); ledState = false; } } void falseCode(){ // Function that executes if the wrong code is entered for(int j=0;j
Love it..adding to my todo list...and I snicker at the peeps that don't get the "Jenny" connection...even if your a millennial you'd of thought the song would have passed by them at some point...
@@FlippinRejects My pleasure! I really love what you've done and hope you'll give some thought to my "sleep timer" idea. :) I'm a telecom enthusiast and collector myself and love to see new life put into those devices that served us tirelessly.
Thanks Flippin Rejects for the code and the inspiration. I was able to make to make a similar lamp and added a wifi arduino so I could also power on and off the lamp using my smartphone. Keep on making these videos.
Haha. Thank you so much. This one turned out just the way I had hoped. In my rain stick videos ending to was brought to my attention that my feet and ankles were beyond pale. You gotta do what you gotta do. Thanks for watching
Thank you for checking it out. Brass tubing is pretty useful in this type of situation. Very easy to bend, but even easier to bend too much. Thanks for subscribing as well.
Wow, that's super cool! I just posted a video of making one too, although my switch is also the dial, it is not quite elaborate as yours! Thanks for sharing!
Thank you for checking out the video. I got the lights from my local Lowes, but these are similar and would work. Feit Electric BPXNFTD/2/RP Xenon 20-Watt MR11 Halogen Light Bulb a.co/d/aPIl95n
Any hints as to what kind of LED bulbs those are? IE either a part number or Amazon link? Just searching for small LED spotlight on Amazon is not turning up anything useful.
I used some small xenon bulbs I bought from my local Lowes similar to this link Feit Electric BPXNFTD/2 Xenon 20-Watt Halogen MR11 Bulb www.amazon.com/dp/B0031AJZL6/ref=cm_sw_r_cp_apa_i_2TA46DA88546BW9ATNS2 But you could look at car under chassis or rock lights that are LEDs. Just make sure they are small enough. There isn't too much room in the handset once you start running wires. Hope that helps. Thanks for checking this out.
Thank you for checking out the video. I got the lights from my local Lowes, but these are similar and would work. Feit Electric BPXNFTD/2/RP Xenon 20-Watt MR11 Halogen Light Bulb a.co/d/aPIl95n
There are 4 wires from the rotary dialer. Two are for the pulses ( each number) then the other two open when the dialer stops. They are all tied into the arduino at different pins. The code uses a pulse counter to tell what number is being dialed.
Hi, congrats it's an amazing project ! I have several quesitons for you ! Could you please give us more information about your hardware parts ? There is 4 wire from rotatary encoder to ardnuino, ok. But i dont undersand how to power on you GU10 lamp. You said you use an 5V relay. So you are using LED buld 5V? is it possible to have a detail scheme for the electronics part and a list from hardware parts? sorry dude, many quesitons but .. REALLY AWESOME :) Need one :)
Thanks for watching. Outside of what I have put in the video, I don't have a schematic drawing or anything. I make these projects up as I go and I tend to not be very organized.
I have thought about that for a while, but I am not sure yet. I may eventually raffle off this one some day, but I have no plans to raffle or sell as of yet. Thanks for checking it out. I guess I did kind of ruin it though.
@@FlippinRejects You didn’t really ruin it. There are millions more out there. The model 500 was the most popular phone ever and there are tons available for collectors. I commend you on your creativity. The phone came out great. I collect vintage phones, that’s why I like your novel light phone. Very, very cool. Stay safe. Mark
This is the code we ended up with
#define PULSEPIN 3 // Pulse Pin To Digital Pin 3
#define SIGNALPIN 7 // Signal Pin To Digital Pin 7
#define LED LED_BUILTIN // Working With The LED Built In
#define CODELENGTH 7 // Define how many digits the code is
#define RELAYPIN 8
#define RESET 9
const int secretCode[CODELENGTH] = // Array to hold the secret code - each element should contain one digit 0-9
{8,6,7,5,3,0,9};
const unsigned long debounceDelay = 100; // Debounce time - the time used to make sure terminal contact bouncing doesn't produce false events
const int d=70; // The Delay Time For LED To Blink At The Wrong Password
// Working variables used to keep track of the counts always start at 0
int codeDigits[CODELENGTH] = // Array to store received integers
{0,0,0,0,0,0,0};
int currentDigit=0; // Var to keep track of which digig in the array we are on
int pulseCount=0; // Var to keep track on how many pulses in the current digit have been counted
bool pulseTriggered=false; // Var to keep track of if the current pulse has been counted
unsigned long lastDebounceTime = 0; // Var to hold the last time the pulse pin was toggled
bool ledState = false; // Var to hold the current LED state
bool previousSignalState = false; // Var to keep track of when we transition out of a dialed digit
void setup(){
Serial.begin(9600); // Start Serial connection for print commands
pinMode(PULSEPIN,INPUT_PULLUP); // Define the pin mode for the dialer pulse pin
pinMode(SIGNALPIN,INPUT_PULLUP); // Define the pin mode for the dialer signal pin
pinMode(RESET,INPUT_PULLUP);
pinMode(LED,OUTPUT); //led As OUTPUT
pinMode(RELAYPIN,OUTPUT);
digitalWrite(LED,LOW); // Make sure that the LED is off on startup
digitalWrite(RELAYPIN,LOW);
}
void loop(){
/*
* Read the states of the current pulse and signal pins into temp working variables.
* Since the inputs are active low (0v is an active true state), these variable take
* on the oppisite state (are inverted) so that the code logic is more readable.
*
* If the circuite is setup as active high then remove the not symbol (!) and change
* the pinmode of PULSEPIN and SIGNALPIN in the setup loop to INPUT.
*/
bool pulse = digitalRead(PULSEPIN);
bool sig = !(digitalRead(SIGNALPIN));
bool reset = !(digitalRead(RESET));
if (reset==true){
digitalWrite(RELAYPIN,LOW);
for (int i=0; i < CODELENGTH; i++){
codeDigits[i] = 0;
}
currentDigit=0; // Var to keep track of which digig in the array we are on
pulseCount=0; // Var to keep track on how many pulses in the current digit have been counted
pulseTriggered=false; // Var to keep track of if the current pulse has been counted
ledState = false; // Var to hold the current LED state
previousSignalState = false; // Var to keep track of when we transition out of a dialed digit
}
/*
* First, see if the signal line is activated. If it is then test to see if a pulse
* has been detected that wasn't already detected and isn't a bounce of the mechanical contacts.
*/
if (sig == true){
//Serial.print("processing signal"); Serial.print(" ");Serial.println(pulse);
if ((pulse == true) && (pulseTriggered == false)){
//Serial.println(pulse);
if ((millis() - lastDebounceTime) > debounceDelay){
pulseCount++; // Add one(1) to the pulse count variable
lastDebounceTime = millis();
pulseTriggered=true;
}
}
/*
* if the signal line and pulse trigger are activated but the pulse line is not
* then we need to reset the trigger for the next pulse
*/
if ((pulse == false) && (pulseTriggered == true)){
pulseTriggered=false;
}
previousSignalState = true;
} else {
/*
* If the signal line is not active then either nothing is happening or we just
* ended the number and the pulse count is our digit. First check to see if the
* signa line was previously activated and if so set the current digit in the array
* then, increment and reset counts
* Valid pulse count are 1-10 and if there are pulse counts below 1 or greater
* than 10, ignore them
*/
if (previousSignalState == true){
//Serial.println(pulseCount);
if (pulseCount == 10){
codeDigits[currentDigit]=0;
}
if (pulseCount < 10){
if (pulseCount > 0){
codeDigits[currentDigit]=pulseCount;
}
}
/*
* Next increment the digit count and reset the pulse count and trigger
*/
currentDigit++;
pulseCount=0;
pulseTriggered=false;
previousSignalState = false;
}
}
if (currentDigit > (CODELENGTH - 1)){
//test and reset
//Serial.println("test");
bool codeCompare = true;
for (int i=0; i < CODELENGTH; i++){
if (secretCode[i] != codeDigits[i]){
codeCompare = false;
}
codeDigits[i] = 0;
}
currentDigit=0;
if (codeCompare == true){
Serial.println("Correct");
correctCode();
} else{
Serial.println("fail");
falseCode();
}
}
}
void correctCode(){ // Function that exectures when the correct code is entered
if (ledState == false){
digitalWrite(RELAYPIN,HIGH);
ledState = true;
} else {
digitalWrite(RELAYPIN,LOW);
ledState = false;
}
}
void falseCode(){ // Function that executes if the wrong code is entered
for(int j=0;j
Best one yet! I really like how you have to dial in a special number to get it to turn on and then hanging up turns it off!
Thanks Bruce. This one came out exactly how I pictured it in my head, which rarely happens to be honest.
This is an excellent piece. The dialing to turn on the lamp is very unique
Thank you very much. Thanks for watching.
If ur a certain age you couldn't forget that number even if you wanted to. Damn you Tommy Tutone😵💫
Absolutely. Thanks for checking out the video.
I love lamp!
Yes
Genius use of the dial and the hang up buttons as the switches. Most excellent build. The lamp using the sun reflector 😎 killed me. 🤣
The lamp has to get tan as well. Thanks
Dude! This turned out sooo cool. How creative! Nice job working through the coding issues. Well done sir! Oh and we're neighbors.
Thank you so much. Coding always gives me nightmares. Awesome that we are close. We should collaborate sometime. Thanks for watching.
Checked out your channel. Subscribed. My wife works over in palliative care at Vandy.
@@FlippinRejects no way that's awesome! Let's definitely do something together.
I have been having on to my bright orange rotary airplane phone for 30 years ....40 years now. This is perfect,
Nice lamp!! So very cool.
Thank you very much
Haha can't wait to get more updates on the stock tan line 🤣🤣 awesome build Shane! I love how the off switch is the hang up button. 😎 So cool 👍🍻
Thank you. I figured, even if you were the only one to get that reference, it was worth it.
@@FlippinRejects I am sure others will get the reference, it was pretty blinding in your last video 🤣🤣🤣
Love it..adding to my todo list...and I snicker at the peeps that don't get the "Jenny" connection...even if your a millennial you'd of thought the song would have passed by them at some point...
Awesome. Thanks for checking it out.
I love this, Shane!!
Thanks so much Barry.
Cool, great Idea!
Thank you. Thanks for checking out the video.
zły projekt to jest niszczenie starej unikatowej techniki!!!
Very cool!
Thank you for checking it out.
Nice!
I love how it turned out! Great idea using the handle plunger as the off button.
Glad you like it!
Amazing work😮😮👍
Thank you
Pristine condition phone! Great find and awesome lamp.
Thank you for checking out the video.
@@FlippinRejects My pleasure! I really love what you've done and hope you'll give some thought to my "sleep timer" idea. :) I'm a telecom enthusiast and collector myself and love to see new life put into those devices that served us tirelessly.
Thanks Flippin Rejects for the code and the inspiration. I was able to make to make a similar lamp and added a wifi arduino so I could also power on and off the lamp using my smartphone. Keep on making these videos.
That sounds awesome. Great job. Thank you for the comment.
So flippin cool man! Using the phone number as the on "switch" is brilliant! Haha can't have those sock tan lines for sure!
Haha. Thank you so much. This one turned out just the way I had hoped. In my rain stick videos ending to was brought to my attention that my feet and ankles were beyond pale. You gotta do what you gotta do. Thanks for watching
That is very cool!
Thank you so much.
I LOVE this idea so much!!!!
Thank you so much for checking out the video. Have a great day.
I’m impressed.very clever.great job
Thank you very much
Love it 👍
Thanks 😁
When I saw the IG photo, I couldn't figure out how you did the cord. Pipe! Very clever
Thank you for checking it out. Brass tubing is pretty useful in this type of situation. Very easy to bend, but even easier to bend too much. Thanks for subscribing as well.
Tht is awesome!
Thank you, and thanks for watching.
Wow, that's super cool! I just posted a video of making one too, although my switch is also the dial, it is not quite elaborate as yours! Thanks for sharing!
Super cool. I will check it out. Old rotary phones are awesome. Thanks for checking out my video.
That's awesome!
Oh mann das ist sowas von 😎 cool Top Arbeit
Vielen Dank für das Anschauen des Videos
aye! this is so cool! (this is brooks)
Thanks for checking out the video Brooks.
Incredible amount of engineering in this project, it came out looking fantastic man🤘🤘🤘 great job
Thank you so much. I had a lot of help on the coding side as my coding skills are in need of an upgrade. Thanks for checking it out and subscribing.
@@FlippinRejects makers helping makers is what I'm all about, thank you for subscribing too
Checked out the Maker Mystery Collab video. That is such a cool concept. Looking forward to watching more of your videos.
@@FlippinRejects thank you very much, it was a fun challenge
great build! would you mind sharing where you got the lights from?
Thank you for checking out the video. I got the lights from my local Lowes, but these are similar and would work. Feit Electric BPXNFTD/2/RP Xenon 20-Watt MR11 Halogen Light Bulb a.co/d/aPIl95n
@@FlippinRejects awesome. Thank you !!
I’m gonna try it!!!
From Oklahoma
Aunt debi
Awesome. Let me know how it goes.
very ingenuos!!!my friend
now!put the info how it works ok.
now that will be dandy!!!
Thanks for checking it out. The code for the arduino is pinned here in the comments.
How'd you read the numbers from the dial with the Arduino?
Pulse counter
@@FlippinRejects Thanks, great project!
This is awesome !!!!! How do you wire the power to allow you to switch off the light when you hang up ?
Any hints as to what kind of LED bulbs those are? IE either a part number or Amazon link? Just searching for small LED spotlight on Amazon is not turning up anything useful.
I used some small xenon bulbs I bought from my local Lowes similar to this link Feit Electric BPXNFTD/2 Xenon 20-Watt Halogen MR11 Bulb www.amazon.com/dp/B0031AJZL6/ref=cm_sw_r_cp_apa_i_2TA46DA88546BW9ATNS2
But you could look at car under chassis or rock lights that are LEDs. Just make sure they are small enough. There isn't too much room in the handset once you start running wires. Hope that helps. Thanks for checking this out.
@@FlippinRejects Thank you very much for the reply!
@@Part_121 no problem
@@FlippinRejects This is where I have been coming up short too. Finding bulbs that will fit just right. Thanks.
What type of lights did you use?
Thank you for checking out the video. I got the lights from my local Lowes, but these are similar and would work. Feit Electric BPXNFTD/2/RP Xenon 20-Watt MR11 Halogen Light Bulb a.co/d/aPIl95n
Awesome
Thanks for checking it out
That’s really cool! Is it wired to the original rotary switch or is that a new part added?
It is wired to the original rotary dialer. Thank you for watching.
Flippin Rejects very cool! Would love to know how THAT part was done
There are 4 wires from the rotary dialer. Two are for the pulses ( each number) then the other two open when the dialer stops. They are all tied into the arduino at different pins. The code uses a pulse counter to tell what number is being dialed.
Flippin Rejects genius
Hi, congrats it's an amazing project ! I have several quesitons for you !
Could you please give us more information about your hardware parts ?
There is 4 wire from rotatary encoder to ardnuino, ok.
But i dont undersand how to power on you GU10 lamp. You said you use an 5V relay. So you are using LED buld 5V?
is it possible to have a detail scheme for the electronics part and a list from hardware parts?
sorry dude, many quesitons but .. REALLY AWESOME :) Need one :)
Thanks for watching. Outside of what I have put in the video, I don't have a schematic drawing or anything. I make these projects up as I go and I tend to not be very organized.
Is there a way we can look at the code you wrote? I’m inspired to create one of my own. I may be an engineer, but alas I’m no programmer.
I will try and pin a comment with the code in it. Thanks for watching, and let me know how it goes.
Would you be willing to make one for sale? Thanks, Mark
I have thought about that for a while, but I am not sure yet. I may eventually raffle off this one some day, but I have no plans to raffle or sell as of yet. Thanks for checking it out. I guess I did kind of ruin it though.
@@FlippinRejects You didn’t really ruin it. There are millions more out there. The model 500 was the most popular phone ever and there are tons available for collectors. I commend you on your creativity. The phone came out great. I collect vintage phones, that’s why I like your novel light phone. Very, very cool. Stay safe. Mark
I'd love to buy one too!
You should make it so that after dialing Jenny, you can enter a number of minutes after which it will turn off...
I am sure all of that is possible in the code.
@@FlippinRejects Oh yeah, the sky's the limit.
how much would you charge me to make that for me?
As much of a headache as this one was to build, I don't think I will be building another. Sorry about that.
Makes me want one