Sunday, December 4, 2011

Electronics and Russian Nesting Dolls


Electronics is cool. It’s neat that you can design the devices that you use. It’s neat that things that you can’t see can do so many things. It’s neat to work with analog and digital systems. But, I think one aspect of electronics that is often overlooked that is really neat is that it is very much like a Russian Nesting Doll. 



The biggest doll would be the devices that we use as a complete system – computers, phones, printers, controllers, etc. The smallest doll would be a single transistor (in addition to a few other basic components like LEDs). Then there’s the whole spectrum in between. 

Gates includes things like AND, OR, NOT, NAND, and so on. These are built directly out of transistors.

Components include things like a multiplexer, demultiplexer, arithmetic logic unit, controller, state machines, and so on. These are generally designed by Boolean algebra equations which are just a combination of gates.

Above the components level are integrated circuits (ICs) and processors. These generally have a specific goal and can use either multiple components or only one. For example, an adder could use an arithmetic logic unit (ALU) to do the adding, a register file to store the addends and result, a controller to tell the ALU when to add and what register files to find the addends in.

One of the best things about my digital logic design class was that it taught us how to design a processor in each little step. In other words, if I really wanted to (I don’t at all), I could design a processor that could perform a logic operation (addition, subtraction, or a bitwise operation) out of transistors. Each step just fits within the next as you take a bigger and bigger view of the system.

Electricity for the Gym


While talking about how to give energy to a small town in Guatemala, the suggestions of using exercise equipment came up during the brainstorming process. Although it did not fulfill the requirements for that town, it got me wondering why none of the equipment in our gyms is set up to store energy. After all, after an initial investment, it’s free energy.

On average, you could produce enough energy to power a 25watt light bulb for 8 hours by cycling for one hour (1). And bikes aren’t the only thing that could produce power. Basically anything that moves: elliptical, treadmills, and stair steppers for example could be made to provide power for other electrical devices such as the light, TV, and speaker system.

Without the data about how many people typically use the gym on a given day, how long each person typically spends on the equipment in question (so total time not including stretching and any weight work), and how much power the gym uses in a given day I can only hypothesize what percentage of the total electricity could be provided by the work out equipment. However, I believe it to be a sizable amount and so wish to find someone who I could ask to get these numbers (the real trouble is figuring out who).



All the same, assuming that such a system was possible and practical, I can start figuring out what exactly it would entail. Although including a battery makes the overall transfer of energy less efficient, it allows for energy to be stored and then used at a later time. Assuming the use of a battery, running all of the power generated into the battery would make for less circuitry as a separate control circuit would be needed to make the electricity straight from a bike into usable electricity if it didn’t go through the battery. By storing any energy in the battery before using it, there it only the need for one control circuit to make sure that the voltage and current leaving the battery meet the specifications of the circuit it is powering.

Some pieces of the system to consider:
  1. Wires. While these seem rather simple, wires might actually pose a problem. There are signs in the gym that tell you to leave any possessions in the lockers because they don’t want any accidents. Wires running across the gym floor from the exercise equipment to the battery may be tripping hazards. And not laying the wires on the floor might require more money to route them through the floor.
  2. Battery. This will most likely be the most expensive part of the system. Finding a battery that doesn’t require too much maintenance, is safe, and holds enough power can be challenging. All the same, it’s definitely possible (I already know a lot about battery research from the project for San Mateo – I will expand on this issue in more detail once I get the specifications for the particular system).
  3. Exercise Equipment. The equipment itself uses some of the power it generates in order to power a display and some circuitry to calculate the time, calorie count, distance, and speed. The excess power must be removed from the equipment in a way that does not interfere with these functions.

While I do not know enough yet to do the calculations about how much power could be produced, the size of the battery needed, and the cost of such a system, I do know enough to start looking for someone to ask for the information needed. If it works out and I find someone who can help, you’ll find an update (I'm hopeful to find the information as you can tell by this post getting its own label in expectation of more to come).

  1. http://www.gizmag.com/the-pedal-a-watt-stationary-bike-power-generator-create-energy-and-get-fit/13433/

Christmas List Part IV: Multimeter Part I: Voltmeter

While researching how a multimeter worked, I figured that each part would be fairly simple and I could do one journal on the whole thing. Well, that’s just not the case. Because I like to fully understand a system from all different levels, I decided to break the multimeter down into its components to have more manageable topics. To start: the voltmeter (old school style).

Part 1: A device to react to changes in voltages.
Like so many other moving pieces that move based on a changing electric current (such as a motor), the D’Arsonval movement relies on the interactions between electricity and magnetism. It consists of a coil, permanent magnets, a spring, and a pointer (1). When electricity is run through the coil, the coil wants to turn just as inside an electric motor. However, unlike an electric motor, a spring force acts resists the turning. The result is that the coil (and the pointer that is attached to the same axle as the coil) turns until the two forces are in equilibrium. So the force from the magnetic field generated by the electrostatic magnet (the coil) acts to turn the pointer until it exactly cancels out the spring force that opposes it. The trick to measuring the current,

Wait a second… I thought we were talking about a voltmeter, not an ammeter (which measures current). Yes, we are, I’ll get to that in Part II.

Anyway, the trick to measuring the current is that the strength of the magnetic field generated is based on the voltage applied to the coil (1). So the more current you apply, the more the coil wants to turn inside the permanent magnet’s field and the further it can turn before the spring force stops it. 

D'Arsonval Movement. Source 1.

It turns out that a D’Arsonval movement is a very sensitive device to measure changes in current. In general, the maximum current that it can handle is 1mA.

Part II: Using that device to make a voltmeter.
Because Ohm’s law states that V (voltage) = I (current) * R (resistance), it is easy to see how a D’Arsonval movement could be used to measure voltages if you knew its resistance. However, because the internal resistance is so small (sometimes only 1kΩ), a D’Arsonval movement on its own could only measure very small voltages (1mA*1kΩ=1V) and we often want to measure larger voltages (2).

The solution: a voltage divider. By putting a big ol’ resistor in series with the D’Arsonval movement, you lower the current and burn off a lot of the voltage on the resistor (2). Importantly, since you know the current (remember that’s what the D’Arsonval movement is measuring and current is the same in series), you know how much voltage was dropped over the resistor. Given this figure:


In order to find the maximum voltage that this voltmeter can measure, assume the maximum current possible of 1mA. The total resistance is 500Ω from the D’Arsonval movement + 9.5k Ω from the resistor = 10kΩ. Therefore, the maximum voltage V = I*R = 1mA * 10k Ω = 10V.

In the same way, a different value of the resistor would allow the D’Arsonval movement to measure different voltage ranges (2). Thus, in a voltmeter that has the turn dial that lets you choose a range of voltages, the circuitry inside is moving a switch (or a turn pot but that would be less precise) to activate a certain resistor (2).

Part III: The voltmeter.
To measure voltage, you place the voltmeter in parallel with the device you want to measure voltage across. Therefore, the lower the resistance of the voltmeter, the more it disturbs the circuit. Although a small amount of current must flow through the voltmeter in order for it to be able to get a reading, the current should be negligible compared to the current through the device which the voltmeter is trying to measure voltage across. Thus, the ideal voltmeter has infinite resistance.
Looking at the figure, another way to put it is that without the voltmeter, Ir1 would be the same as Itot. The voltage drop over the resistor in question is therefore V = Itot*R1. However, when the voltmeter is connected, it draws a current equal to Iv. The current through the resistor is changed to Ir1 and the voltage drop is now equal to Ir1*R. The change in voltage drop over the resister caused by the voltmeter is:
ΔV = Itot*R1- Ir1*R
      = R1*(Itot-Ir1)
      = R1*Iv
Obviously you want your meter to change the circuit by a very small amount, so you want to minimize ΔV. Since you can’t change R1, you can minimize ΔV by minimizing Iv, which is equivalent to maximizing the resistance of the voltmeter because resistance and current are inversely related.

Now you see why I didn’t try to cover the ammeter and ohmmeter in the same journal.
  1. http://www.engineersedge.com/instrumentation/electrical_meters_measurement/darsonval_movement.htm
  2. http://www.allaboutcircuits.com/vol_1/chpt_8/2.html

Amateur Radio

I got my first amateur radio license in my sophomore year of high school because my club members convinced me to and because I was interested in the electronics aspect of the hobby. A year later I got my second license because I was still interested in the electronics aspect, it was easy, and so that I’d have more of a right to make other people in my club go for higher licenses. Now I’m considering whether or not to go for the third (and final) license. A list of reasons (definitely not in the order of importance as a first reaction) to get or not to get the license:


Looking more closely at the reasons listed on both sides, it seems like the left side outweighs the right. While bragging rights may not be the best reason to get a license, increased knowledge of electrical systems does seem like a good one. After all, I do want to be an electrical engineer and that involves gaining some knowledge about a lot of different electrical systems. While I might not specialize in communication technology, the knowledge may carry over to other projects and help me in the long run. And amateur radio is a great way to get experience due to its hands-on nature.

Looking at the right side, the first and last reasons are small and solvable by using winter break to study. The middle two are the more troubling ones. However, the second I hope to change and the third can be accepted as a small loss. Now that I've convinced myself of the correct choice, I just need to actually do the studying.

Supercapacitors


One of the largest issues with producing electric cars is that we just don’t have the battery technology to make an attractive product.  But what if we don’t design a better battery but rather a better energy storage device? What’s the difference? Well, some people are hoping that advances in capacitors will allow their use in the place of a battery in systems such as the electric car.

Supercapacitors (which are exactly what they sound like – capacitors that can hold a lot of charge) are promising in certain aspects. They have an insanely fast charge rate (in theory as fast as you can pump charge into them), automatically stop charging themselves when they are full (so you don’t need a circuit to detect full charge like you do with a battery), and have a longer life than batteries (in theory an infinite number of charging cycles) (1). In particular the faster charging cycle attracts attention for those looking for a battery for an electric car. After all, one of the issues many people have with electric cars is that they take so long to charge; you cannot just stop by a station and be “filled up” in a minute as a gasoline car can. A supercapacitor would allow for a charging station to quickly refill the charge for an electric car.

But nothing is free. There are numerous disadvantages to supercapacitors that explain why they’re not already being used. Probably the biggest issue is that the discharge for a capacitor (shown below) is exponential (2). 

Capacitor Discharge Curve. Source 2.

If you had a 2.5V capacitor and a circuit that needed at least 2V, then only .5V out of your 2.5V, or only 20%, are of any use. Of course you can do all sorts of tricks (putting capacitors in series and parallel or using a device to step up the voltage at the expense of current) to make your capacitor last a little longer but the problem remains. And if you’re going to connect a huge array of these supercapacitors in series and parallel to achieve something that’s close to matching the performance of our best batteries, then you better have a very big car that can support a lot of weight because another problem with supercapacitors is that they hold less energy than a battery by a factor of about 20 (2).

Now you might be asking, okay so I know that supercapacitors are unlikely to be used as a battery in an electric car, but is there any use for these things? Yes, there is. Railguns (there may also be other uses but this is one example at least). The railgun at the Naval Research Lab is designed so that “up to 2 MA of current will be available to launch 1-kg projectiles to greater than 2 km/s velocities” (3). Basically a railgun needs a large amount of power supplied really quickly. And that’s exactly what supercapacitors as good for.

If you want to see a video of a railgun (just a warning: there’s a lot of maintenance that has to occur between shots which is also shown in the video), check out: http://www.youtube.com/watch?v=MVtYWZRd6iI.

  1. http://batteryuniversity.com/learn/article/whats_the_role_of_the_supercapacitor
  2. http://www.play-hookey.com/dc_theory/rc_circuits.html
  3. http://www.nrl.navy.mil/content_images/06Materials%28Meger%29.pdf

Saturday, December 3, 2011

Bike: Measure Incline

Recently I’ve been working out at the gym more often (i.e. I had never done so before college). I’ve found that I prefer the bike because I used to bike to work out at home but I don’t have a bike here. While I prefer a real bike, the one benefit of the gym bikes is that they can use the known resistance of the setting you’re using plus the speed of your pedaling to calculate calories burned. While I have a device to keep track of miles and average speed on my bike at home, it cannot count calories burned because it has no way to know the resistance because that’s a function of not only the gear setting but also of the incline (obviously going up a hill is more difficult than going downhill).

Really, it’d be nice to have a way for the bike to get the angle of incline and from that calculate the calories burned in the same way that the electric bikes do that. So I was thinking about how you could go about this and came up with the idea of an IR sensor of some sort. Basically, if a source of infrared could be placed on the front of the bike, the detector (in the form of a long, thin rectangle) could be placed on the part that holds up the seat. The source would have to be able to stay pointing toward the seat support at all times and have to be able to respond to changes in the incline. This could be possible using a device like a gyroscope or maybe even a simple mechanical device. Either way, the source would tilt in response to an incline and the detector would be able to measure the distance between the default position (when the terrain is flat) and the current position. There is a maximum angle that the bike could measure with this system that is based on the distance between the source and the detector and the length of the detector. This is just an estimate for one dimension for a bike:



Just as I found the maximum angle possible using trigonometry, each point along the detector would correspond to an angle that could be looked up in a memory storage device. Thus, with just a few simple components, a device that already measures the speed and distance could be expanded to measure the calories you burned as a function of your weight.

Alternatively, you could just use a device that measures the angle on its own like those found in phones.

Finite-State Machines: Mealy vs. Moore


Most electronic devices have multiple finite-state machines (FSM) inside them. Basically, a FSM has multiple states. Each state has a set of outputs that achieve whatever the goal of that state is. An input (such as a clock pulse or the press of a button) leads to the FSM changing state.

A diagram for a FSM that I designed for my digital logic design class is below. It is a controller for a gumball machine that keeps track of how much money has been inserted (gumballs cost 20cents) and indicates what to output (gumball and how much change). The possible inputs are nickels, dimes, and quarters. The boxes represent the four states (which keep track of the total amount of change). The lines between the states are the instructions for which path to follow for any input. Each state has three arrows leaving it – one arrow for each possible coin inserted. The FSM stays in the current state if no coin is inserted. The blue describes the coin inputted and the red describes what the output of the gumball machine is. 



Of course, this state diagram is just a big picture that would need to be translated into electrical components. But it gets the idea across of what a FSM is. Now, there are two kinds of FSMs: Mealy and Moore. The output from a Mealy FSM depends on the current input. The output from a Moore FSM does not. To translate, when a FSM is changing state (generally on the high part of a clock pulse) it can venture out on the arrow without fully going into the next state until the clock is low again. So while the clock remains high, the FSM (if we anthropomorphize it) can look into its different options by seeing where the arrows lead but it can’t quite step onto the next stepping stone.

In a Mealy machine, the outputs occur on the arrows. In a Moore machine, the outputs occur on the stepping stone. Therefore, when a Mealy FSM “explores multiple pathways” during a single cycle of the clock (there are many different inputs in a short time), the output changes. If you could put in a nickel then a dime really quickly while the above (Mealy) FSM was in the 15cent stage, then you’d get two gumballs and 5cents change before the gumball machine controller actually transitioned into the 0cent (start) state. The clock would probably be set fast enough to not allow that but if it weren’t, you’d get a lot of free gumballs.

Mealy FSMs are nicer because they have fewer states than Moore FSMs. But, often the behavior of having multiple outputs during a single cycle can be a problem. So, if you can use a Mealy FSM then you’ll save some components. But a Moore FSM is easier to design in some ways and can be used for more applications.