...but I'm still kind of new to the whole Arduino/electronics thing. It should be a pretty simple setup, and not a very useful one, but I've got to start somewhere, so this will be my first non-tutorial project. Here's what I know so far:
-When you push the doorbell, electricity (should be about 10v, presumably DC) flows from a transformer through the switch to the chime circuit, which is nothing more than an electromagnet that is on while the switch is held and off otherwise.
-I don't want more than 5v hitting the Arduino, so I will need some way of stepping down the current.
-I can't just run a wire or resistor from the chime section to the Arduino, but I'm not sure how to connect it.
All the Arduino needs to know is whether there's current flowing or not, so I just need to wire it to a digital pin. A resistor would step down the current. I don't want to wreck the Arduino, so someone check my math here: Ohm's law is V=IR, so if we want to get it down to, say, 4v with a max current of 30 mA (just to be safe), we get 6=0.03R, therefore R=200 ohms. That seems like a rather small resistor to be stepping down all that current, but if it's right, then it's right. So now the question is how I would go about wiring everything up so that I'm not stealing too much current from the chime, but the Arduino can still sense whether it is active or not. I read another forum thread here:http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1257015102/5. It's almost the same setup, but the explanations are a bit too technical for me at this point (I still only have a basic understanding of these things). If there's already a switch in the doorbell circuit, why can't I just connect the resistor from the chime to the Arduino? Why would I need an op-amp? Can I just use a transistor instead? How would I wire that all up? Thanks.
You should meassure the voltage to make sure what you are dealing with.
Then you could make a simple voltage divider to give you a (max) 5V signal you could read with a digital pin, protected with a suitable current limiting resistor.
How would I check whether it's AC or DC, and if it's AC, am I going to have to convert that to use it? I'm not very good with a multimeter yet. I was going to check the voltage to make sure I get my math straight. Speaking of which, I was trying to confirm my math from earlier, but I wasn't sure how to set up a simple circuit to test it out. If I just connect the resistor from positive to negative, it takes the full voltage rather than dropping it, so I'm obviously not doing something right...
How would I set up the voltage divider? I've just been learning about those, so I'm still not 100% on how to set one up. Would I just connect one resistor, say 100 ohms, to the contact coming from the doorbell and another resistor, say 300 ohms (or thereabouts) to the contact leading back to the transformer, then connect those together to the digital pin?
While not "necessary", for a beginner, putting a relay or an opto-isolator between your doorbell circuit and your (fragile and expensive!) Arduino might be worth the learning effort.
(Second circuit is what you want. Doorbell on left, Arduino on right.)
If your doorbell turns out to be running on AC, then remember that computer speeds and human speeds are very, very different. An AC signal directly into an opto-isolator will create an on/ off/ on/ off.... signal out the other side.
Don't be put off... it is worth the early learning chores!!
So the opto-isolator is basically just the same thing as if I had an LED and a photoresistor in one package. That's easy enough to understand. I could probably make a simple one myself using that concept and a bit of programming with the Arduino. So the question with that is if the LED side can operate on the AC from the house while the other side operates on the DC from the Arduino. I don't think Radio Shack sells opto-isolators (they aren't listed on the web site, anyway), so I may build my own version. What do I need to know about AC to get that to work?
Also, I'd still like to know about the voltage divider method. As a newcomer to electronics, I'd like to learn as much as possible about the different ways to do things and what the advantages are of each method.
a voltage divider is not about absolute values, it's about the ratio between the two resistors. There are many possible solutions for a given input and output voltage.
Have a play with with: http://www.raltron.com/cust/tools/voltage_divider.asp
it might give you a better understanding.
Don't be overwhelmed by the range of devices available.
First narrow the chase to "single gate" (aka "single channel) devices.
Then look just at the "transistor output" devices. (Unless you like spending money!) They're the cheap, simple ones which is all you need.
====
A voltage divider can certainly be made to work... but it is harder to wire something unfortunate to your Arduino if you have an opto-isolator protecting it. If not absolutely needed for the doorbell project, opto-isolators are useful in many situations, and you might as well add the "tool" to your repetoire. The word ISOLATOR in the name is a hint!
I know about the ratios, I was just using the values as an example to make sure those would work. What I mostly need to know is how the voltage divider would connect to the Arduino.
First why don't you figure out what the arduino will be doing once the doorbell is pressed. If you could remove the chime and electrical system from the equation then you will simplify your life. Plus you can develop your idea without hacking your homes doorbell up or buying a new doorbell system. If you break it down to that then you can use a basic push button during your development and testing fazes.
good advice, you can mock everything else up first, then when your ready to kill, erum .... enhance your doorbell you will be ready with a much shorter "no doorbell" time
I don't want to replace the doorbell, so I won't be doing that. In terms of a mockup, I don't have anything that will output AC, as far as I know. And it's a very simple device, the contacts are just screwed in place, so it's incredibly easy to add stuff to it without any destruction.
If I'm making a mockup of an AC circuit, it would make sense to have something that does AC. If I skip the mockup, then no, I don't need anything that outputs it. I'd still like to know how to wire the voltage divider. I can probably figure out how to run my makeshift opto-isolator with AC without too much trouble, though if someone could just tell me if I need to do anything special to have an LED work with AC, that would also be nice.
I need to do anything special to have an LED work with AC, that would also be nice.
Just use a series diode to protect the LED from too high of reverse voltage (PIV rating) and the proper size series resistor to limit the current flow and you should be there. I think most homes here use 24vac for their bell circuit.
Just use a series diode to protect the LED from too high of reverse voltage
... and remember that the Arduino will see "on/ off/ on/ off..."
The fix for that is something along the line of the following untested code. It says "look at the input a bunch of times... enough to span a half cycle of the AC... and if it is "on" at any time, assume that the AC is present."
boButtonPressed=false;
for (int i=0; i <= 10; i++){
if (digitalRead(BellPin)==HIGH) {boButtonPressed=true;};
delay(5);
}
(You'd probably have to play with the "5" and "10" to get the right numbers)
... and remember that the Arduino will see "on/ off/ on/ off..."
I was reading up on rectifiers to see how the diode AC conversion thing works, so I just want to make sure I'm understanding correctly. Are you saying the Arduino will see on/off because the conversion only says the positive half of the current?
If I'm using an opto-isolator, the on/off cycles should still be fast enough to keep the LED lit, right? My theory for that is that, since AC is 60 Hz, the LED will be blinking 30 times a second (since it's a half-wave rectifier), which ought to be fast enough that the photoresistor can't tell the difference, in which case it will only be sending "on" signals when the button is actually pressed.
One last question about the diode. My meter can't measure more than 200 mA and I blew a fuse while trying to measure the doorbell, so I'm fairly certain it delivers more than that. If the diode can only take 1 A, would it be better to put the resistor before the diode just to be safe? Or will that mess with the whole rectifier thing?
Well, rather than be annoying with more questions, I decided to just try it out. I used a 1N4001 diode, a 470 ohm resistor, and an LED hooked up, in that order, to the chime circuit. I tested it earlier and it runs at around 10v, sometimes a little more, so I figured I'd be safe and go with the 470 ohm (also, I don't have any resistors between 330 and 470). I tested it out and the LED lights up. Nothing seems to break, so now the next step is to find a way to attach the LED and photoresistor into one unit. After that, it's all programming, so I think I should be set. I'm just using this as a simple project that will alert the computer when the doorbell dings, ideally also using a Processing app to pop something up on the screen and/or play a sound. While it won't be that useful as is, the idea is that you could, for example, attach an XBee or something and send the chime signal to another floor of the house where you normally can't hear the doorbell. Never miss another signature-required delivery again! Mostly, it's just a way to make sure I've got the fundamentals of designing a circuit, writing the Arduino code, and writing Processing code to make it useful.