Archive | Multimeter RSS for this section

Learning to Arduino: Push Button

Getting a little less abstract today, I’d like to talk about the Push Button. Sorry, that doesn’t have a fancy name. Try to contain your disappointment.

The push button is actually very simple in theory. Most push buttons have four contacts. Two of these contacts are connected at all times, and there is a normally open switch between the two “wires”.

push_button1

When the button is pressed, the contact closes. The tricky part comes in the implementation.

pinMode(pin, INPUT): REVEAL YOUR SECRETS!

You’d be yelling too if you’d spent as much time as I trying to figure this out.

A typical application of the Push Button, is in an arduino device. Arduinos have multiple digital pins that can be configured as inputs or outputs. Google Arduino Push Button Tutorial, and you’ll find several tutorials that suggest you implement something similar to this:

push_button

The thing that nobody is talking about: what is the voltage of the digital pin in input mode. This is the thing I’ve been spending the last few hours trying to figure out: how does this work? If the voltage is 0, nothing should happen when the button is not depressed. If the voltage is 5, then nothing should happen when the button is depressed. It turns out, according to my multimeter, that this pin is actually very slightly less than 0 Volts.

As you can see from my diagram, the digital pin is connected to the switch, and the opposite end is connected to a 10K Ohm resistor to ground. On the other side of the switch is 5 Volts. When the switch is open, electrons flow from ground (0 Volts) to the input pin (slightly less than 0 Volts) and digitalRead() returns LOW. When the Push Button is depressed, electrons flow from the input pin (slightly less than 0) to the 5 Volt pin, and digitalRead() returns HIGH.

All is again well in the world.

Learning to Arduino: the Diode

So, what is a diode? A diode is an electrical component that allows current to flow in one direction, but not another. On an electrical diagram, a diode is represented by this symbol:

The physical diode may have a black band on it, this band corresponds with the band on the symbol. One use for a diode is to protect against the power source being hooked up backwards. Let’s look at an example.

In this diagram, the diode is hooked up backwards. This configuration is said to be reverse biased. In this configuration, ‘no’ current will flow across the circuit. In fact, if the current exceeds the diode’s Maximum Repetitive Reverse Voltage (VRRM), the diode will be damaged. This value can be found on the diode’s datasheet. When I say ‘no’ current flows in this configuration, I actually mean a negligable amount of current flows. More on this in a minute.

In this diagram, the diode is hooked up in the correct direction. This configuration is said to be forward biased. In this configuration, current will flow across the circuit. How much current? Well, according to Ohm’s Law:

1.5 Volts / 10000 Ohms = 0.15 Miliamps

But let’s check just to be sure… If we set our multimeter to amps, and we measure, we get… 0.1 Miliamps… …that doesn’t seem right…

Well, the bad news is that it is just one post into this series, and we’ve already come across an exception to Ohm’s Law. To figure out the current across a diode, we need to use the Shockley Ideal Diode Equation. Do yourself a favor: don’t waste your time trying to figure this out. Just use the Voltage/Amperage curve graphs provided on the datasheet for your diode and save yourself a headache.

Therefore, you will see a somewhat level amount of current flowing through your diode, then suddenly it will shoot up. If this happens, it’s time to consider that you need a different diode.

Learning to Arduino: Ohm’s Law

For a good six months now, I’ve been trying to “get into Arduino”. I’ve been doing this mostly by a) throwing money at it and b) just trying stuff. This has been going about as good as you’d imagine. Reflecting back on when I first tried getting into programming, I think about how much better I got at it when I stopped trying to learn C++ and started learning how to program. Similarly, I’ve been spinning my wheels trying to learn to Arduino, perhaps it’s time to learn how electronics work.

In the spirit of this, I’ll be writing this series of blog posts about this. These posts will serve as reference material for myself so I don’t have to google how a diode works, or whatever. Hopefully it’ll prove useful to others as well. I’m not claiming to be an expert. This is my understanding of things, as I go along. If I say something that’s not true, please let me know!

Definitions

Volts refer to the difference in electric potential between two points.

Amperes, or Amps, refers to the flow of electrons between two points.

Ohms refers to the resistance to the flow of electrons that some substance has.

Some Context

As you may remember from chemistry class, an ion may be positively (if it has more protons than electrons) or negatively (if it has more electrons than protons) charged. Long story short; atoms and molocules do not want to be positively or negatively charged. They will shed or gain electrons until they have equalized their charge. This positive/negative charge differential creates the Volt. The process of electrons flowing from negative to positive creates the Amp. While in transit, the flow of electrons can be impeded depending on the substance they are traveling through. This process of impediment creates the Ohm.

Ohm’s Law

Ohm’s law states that the current through a conductor between two points is directly proportional to the potential difference across the two points. Two variables are said to be proportional if a change in one always results in a change in the other, and the two changes are always related by the use of a constant. In the case of Ohm’s Law, Amps (I) and Volts (V) are the variables, and Ohms (R) is the constant. The formula for Ohm’s Law is:

I = V / R

Basically, if we have two AA batteries (3 volts) connected through a 10,000 Ohm resistor, then 0.3 miliamps are flowing across the wire.

0.0003 = 3 / 10000

Using this, given two of the values, we can calculate the third. Given Amps and Ohms, we can determine Volts:

V = R * I

Given Amps and Volts, we can determine Ohms:

R = V / I

“No Resistance”

So, maybe you hooked a multimeter up to a piece of copper wire, and measured no resistance. Let’s plug that into the Ohm’s Law formula:

I = V / 0

See the problem? The good news is that in the real world, there is no such thing as “zero resistance”. Even the purest copper wire has some amount of resistance. If your multimeter says zero, just keep turning the knob to finer settings until you get some number greater than 0. If you don’t get there, just call it 0.0001 or somesuch really small number. It may not be exact, but it’ll be good enough. The real world isn’t binary, after all.

Meanwhile, fancy scientists wearing fancy labcoats are trying to create Superconductors with 0 resistance. We’ll let this be their problem.

%d bloggers like this: