4/22/2006

Your Mind Is Your Own Matrix (A Non-Engineering Post)

Although I've decided to make this blog totally dedicated to everything and anything electrical engineering, I had a very bizarre experience this morning, bizarre enough to warrant a NEP (non-engineering post).

Last night, I was crashing at my buddy's place and studying for my Digital Control Systems exam, which I had this morning. At my buddy's place, I had the luxury of sleeping on his living room floor with a sleeping bag. When I woke up this morning, I had to wake myself up three times!

[read: Rick must be on some sort of drug induced hallucination]

I assure you that I am NOT on a drug induced hallucination but instead I believe I've reached a new level of exhaustion. The first time I woke up, I found myself waking up in my own room, from my own bed instead of this living room floor. I even "got up" and went to the washroom. The bizarre thing is that I was fully aware that I was still sleeping at my buddy's place.

So I forced myself to wake up and this time I found myself waking up in the living room, but at place instead of his! Now I'm thinking to myself, "This is fucked!" and I finally managed to wake myself up in the correct place, on the correct living room floor.

Anyways, has anybody else had strange sleep/exhaustion stories they'd care to share?

4/21/2006

Project Suggestions: Round #1 Complete

For those of you who remember, a few weeks ago I've posted some project suggestions from Wen. These suggestions were as follows:

1. hacking an RC car so you can control it from a computer
2. a hexapod (six-legged) robot
3. a solar RC car
4. a microcontroller/microprocessor (not the chip, just the support hardware)

So far, only Bao has showed any sort of interest (thx!) and has voted for #1, hacking an RC car so you can control it from a computer. Sounds fun! I'm sure if I actually showed you guys a working version of this project, then it'll interest you guys enough to vote next time.

With any design project, it requires specifications or objectives to help keep the project, well, objective. If the project doesn't have any specifications, then I won't have any direction. So, to begin, here are some objectives to hack an RC car:

1. Determine what kind of PWM signals are generated by the remote controller.
2. Use a microcontroller to 'hack' the remote controller, overriding its PWM signal generator.
3. With the microcontroller, generate necessary PWM signals to instruct car to move.
4. Create user-interface to control RC car. WASD would be the simpliest UI scheme.

Since I've been using the MC68HC11 microcontroller for a while, I can prototype with it. I know I can get my hands on code to detect keyboard strokes from a computer, so incorporating that into a UI shouldn't be too difficult. I just hope I don't need to create a custom RF transmitter, even though I can get my hands on a very basic and inexpensive RF transmitter.

Anyways, if you still want to vote for one of the four projects, go for it! The project with the most votes will be my second project.

4/18/2006

Surface Area (and the Unwashed)

For those of you who frequent, or periodically stumble here, may have noticed that I've increased the width of my blog in an attempt to "maximize" its surface area. Maximize the surface area of what you might ask? My laptop resolution. At the moment the width is set at 1024 pixels so that means anybody viewing my blog at 1024 by 768 pixels or higher will view my blog the way I intend it to. For everybody else, who's running anything at a lower resolution, it's time for an upgrade. Or just make use of the horizontal scrollbar in your web browser.

The only reason why I've decided to widen the width is that I will eventually be uploading schematics and various photos of my project in their various stages of completion. For those unfamiliar with engineering schematics, they can become overly large if everything was crammed into one figure. Even a simple circuit can take up a lot of space and it's possible that I'll need to split a design into several subfigures for the sake of presentation.

With that in mind, I'll obviously start off with the high-level design (block diagram) and incrementally progress towards the low-level design (ie.: microcontroller, sensors, discrete components, et al). So, stay tuned!

4/13/2006

In Need of Lab Gear

Ok everybody. I know my blog is "Rick's Lab" and everything but I'll be honest with everybody. I don't have access to the proper lab equipment at home.

For those of you who don't know what basic equipment an EE requires, here's the run-down:
1. A three terminal, variable DC power supply that can give me at least +20.0-volts and -20.0-volts and if possible the +7.0-volts. This is probably about $150 to $250.

2. A digital multimeter that I can switch between DC and AC (rms) measurements, test diode/transistor conduction, measure decibels, etc. This is probably around $275.

3. An oscilloscope for measuring frequency/AC signals. If I had access to a digital oscilloscope then I can use it for spectrum analysis. Around $1500.

4. Function generator to generate sinusoids, square-waves, sawtooth/triangular at varying frequencies and amplitudes. Around $300 to $400.

Now, I know these are extremely expensive but these are the most basic pieces of equipment an EE needs for anything. If anybody has an EBay account and doesn't mind helping me look for some equipment, I would appreciate the effort a lot. Or if anybody has connections to a company that's getting rid or selling old equipment, let me know.

Or if you're very very generous, I'll accept equipment donations as well.

Of course, there's always the possibility of me building my own equipment. For example, the DC variable voltage supply shouldn't be too difficult to design and construct as long as I use the proper voltage regulators, rectifier and transformer.

Hm, it's possible that my first project is to design and build my own DC variable voltge supply with a LCD screen this summer. Anyways, I'll accept equipment donations wherever possible.

4/12/2006

RU's Design Project Open House 2006: April 28th

Hey guys! Come down to Ryerson and attend my Design Project Open House on April 28th.

For those of you who wish to commute to Ryerson, here are instructions, just in case.

Here's some directions if you plan on coming:
1. Get to Square One.

2. Use Bus Routes 20 East or 26 East to get to Islington station.

3. From Islington station, ride the eastbound subway till the Bloor/Yonge interchange.

4. Walk up the stairs to the southbound Bloor subway.

5. Ride it to Dundas and get off.

6. You are now underneath the Eaton Centre. Exit the station via Eaton Centre on your left or the stair well on your right.

7. Walk north along Yonge to Gould Street. If you see the Hard Rock cafe, you're facing the wrong direction. If you see Sam the Record Man, you're facing the correct direction.

8. Walk east along Gould to the intersection until you see the George Vari Engineering Center. It is across from the Rogers Communication Centre.

9. Enter the George Vari Engineering Center and there should be signs telling you which floor the Open House is on.

See you there!

4/09/2006

Project Suggestions: Round #1

I was just chatting with Wen on MSN today (technically it would be 'yesterday' since today is now Sunday and this happened Saturday around 4 to 5) and he was making a few suggestions for EE projects I can try posting up onto my blog.

It's an excellent idea and I think everybody can take a few minutes to suggest some project ideas that I can design and hopefully post here.

So far Wen has suggested:
- hacking an RC car so you can control it from a computer
- a hexapod (six-legged) robot
- a solar RC car
- a microcontroller/microprocessor (not the chip, just the support hardware)

These are great ideas and are worthy challenges. For now I'll take these suggestions and how's about if everybody were to vote on one of these four ideas? During the summer I'll design the project with the most votes and post the design on the blog when I'm done.

If you want to suggest a project, I prefer projects with few to no mechanical parts since I'm an electrical and not a mechanical engineer and I don't want to deal with mechanical devices. That means absolutely no full sized Gundams or similar mechanical projects.

4/08/2006

Mini EE Project #1: Debouncing a Bouncing Button

Premise:
I'm sure everybody has come upon the lovely situation that sometimes there's a lag whenever you press a button on a TV remote, especially if its one of those cheap replacement remotes that you spent less than $10 on, figuring you'd save some money and the energy for getting up and touching the TV (whoa, touching the TV?)

This lag comes from a poorly designed switch mechanism, but first, what's inside a switch? A switch, no matter how many pole-throw combinations there are, is a mechanical device. The simpliest switch is a 1-pole-1-throw (1P-1T); flick it once into its on position, flick it again into its off position. Whenever a switch (or button) is open or closed, a moving metal strip or disk comes into contact with a stationary metal contact. This metal strip or disk would vibrate, or bounce whenever it moves about and it's this bounce that can wreck havoc with whatever you're doing. How do we get rid of this bounce? We do something called "debouncing".

Debouncing The Switch (or Button):
Whenever a switch needs to be debounced, we can have a software solution or a hardware solution but we never use a software and hardware solution in tandem. If we did, the switching would result in a chaotic behaviour.

Software solution:
The software solution is the easiest but not the best debouncing technique. If circuit footprint (the surface area your circuit requires) is very small and adding more hardware is out of the question, then you have no choice but to use the software solution.

Anyways, to debounce a switch using software, we can create a delay that is equal to the total bounce time of the switch whenever a switch is opened or closed. Or, an alternative is to assert a switch state depending on what position the switch was put into. Asserting a switch state would require two input pins (one for each position) instead of one input pin into whatever microcontroller you happen to be using. This can be shown in the following code snippet:

if ( switch_hi() ) state = ON;
if ( switch_lo() ) state = OFF;

Hardware solution:
Ah, here's the fun, slightly more cumbersome but far more reliable solution: hardware! Debouncing a switch through hardware requires several discrete devices: a switch or button of any shape or form (in this case, a 1P-1T normally open), a capacitor, two resistors, a Schmitt trigger hex inverter IC (I prefer the CMOS 74HC14 over the TTL 74LS14), and a power source.

On the left is the debouncer circuit. To calculate the component values, we must first know the hysteresis range of the Schmitt trigger. We can look at the datasheet, or if you don't trust it, set up a test jig. First, power up the Schmitt trigger IC with 5-volts by referring to the data sheet. Next connect the output of one Schmitt hex inverter to an oscilloscope if you have access to one, if not a multimeter is sufficient. Then, connect a variable DC voltage supply to the Schmitt hex inverter input.

Starting at 0-volts, the output should currently read 5-volts. Slowly increase the input voltage until the multimeter jumps to 0-volts. The current input voltage is the lower hysteresis range. Then starting at 5-volts, the output should currently read 0-volts. Slowly decrease the input voltage until the multimeter jumps to to 5-volts. This jumping of voltages is done by the internal hex inverter; give it a high signal, you get a low signal and vice versa. Good job! You've found the Schmitt trigger hysteresis!

Now, let's take a look at the debouncing circuit. Whenever the switch is open, the capacitor charges up to 5-volts, making the Schmitt trigger output 0-volts. Closing the switch allows the capacitor to discharge to 0-volts, making the Schmitt trigger output 5-volts. By closing the switch, we complete a circuit and the capacitor discharges through R2. To calculate the value of R2, we use the equation that goverms a discharging capacitor.

R -> resistor R2, in Ohms
C -> the capacitor in Farads
t -> time in seconds
Vth -> the voltage across the capacitor at time t.
Vfinal -> the voltage initially on the capacitor.

Depending on your switch and Schmitt trigger characteristics, your component values will differ. For the particular push buttons I used as part of my design project, I had a bounce time of 0.2 msec (milli-seconds). For a worst case scenario, I considered the Schmitt trigger upper hysteresis value of 1.9-volts (Vth). Vfinal is the IC supply so that would be 5-volts. Since it is easier to find resistors of a particular value, we first choose a standard capacitor value. For me, I chose a capacitor with the value of 0.1 uF (micro-Farad). Crunching the numbers we get 2 KOhms (kilo-Ohms) for R2.

Now to calculate R1, we have to use a similar equation. Almost the same as before but instead, we use Vth of 0.5-volts so that the voltage across the capacitor is ensured to be less than the lower threshold of the Schmitt trigger hysteresis so we don't risk triggering the Schmitt trigger low (remember: low in, high out and high in, low out). This time around, we are calculating the resistance when the capacitor is charging so the resistance value we obtain is R1 and R2 in series (Rtotal = R1 + R2). To find R1, subtract R2 from the resistance value you just calculated. Again, when I crunch the numbers, I obtain 17 KOhms or R2.

So there you have it, you've calculated the necessary component values to debounce a switch.

Next:
Mini EE Project #2: The LED Driver

P.S.: If anybody is curious as to how I got those equations, just Google 'capacitor charging equation' and you should get a hit. For those of you who want to try this out, you can pick up electronic parts from Sayal or Active Electronics at Matheson and Dixie. Sayal has better deals and if you're lucky, pick up some nice speakers for your car audio system.

Here's a parts list:
- 0.1 uF capacitor (these guys look like small biege disk with two legs on them. if you can see printing on the capacitor, look for '104')
- 17 KOhm resistor (these guys don't really exist, but instead grab a 16 KOhm and a 1 KOhm and put the two in series)
- 2 KOhm resistor (if you can't find it at Sayal, Active Electronics will have it. or just put two 1 KOhm resistors in parallel)
- 74HC14 CMOS Schmitt trigger hex inverter (just ask the Asian guy at Sayal and he'll find it for you)
- a push button (if you don't want to calculate new component values, find a red 1P-1T push button that has a black body and a nut)
- some wire (a roll of solid core is usually cheaper than multi-strand. solid core is stiff wire and multi-strand is soft/flexible wire)
- solder and soldering iron (go for 70 Sn 30 Pb solder if you can find it, if not go for 60 Sn 40 Pb. a higher watt soldering iron means it heats up faster and heats components up faster too)
- a breadboard (it's a plastic rectangular board that has a lot of holes in it. this is used for testing a circuit before you go and solder together a more permanent version)