spacer

Transistor Logic

Another day, another circuit, this one is a little more complex than the LED/Resistor circuit I made the other week. Having read about transistors I decided to design and build a NAND gate. The final circuit is very similar to the one discussed in the XGS ebook (below is the original circuit schematic from the very same ebook – which I highly recommend; a print version will be out soon as well :) )

NAND Gate Schematic

Aside from been a little blury the photo below shows my version of the NAND gate circuit built from two transistors, 3 resistors, two switches and an LED. The hardest part was finding a suitable 5V regulated power supply. I really need to buy a variable supply.

NAND Gate built

The far right of the image is where the +5V power is sourced, the far left is used as GND. The LED is connected to the +5V line via a resistor which results in the LED been lit by default. At the bottom right you should be able to make out the two switches, these connect the +5V supply to the base node of the two transistors (via one of the two 10Kohm resistors). Thus the switches control the input for the two transistors 1 or 0.

The collector of the first transistor is connected to the same resistor as the LED, with the emitter of this transistor feeding the collector of the second transistor. Finally the emitter of the second transistor is connected to GND.

The result of this is that when both switches are closed, the base of each transistor receives a sufficient voltage to start conducting from collector1 to emitter1 which feeds collector2 to emitter2 and finally running to GND. This gives us a working NAND gate. A 1 & 1 signal will result in a 0 i.e the LED will be off since both transistors are conducting to ground. Any other combination will result in a 1 as one (or both) transistor does not conduct, so we get a flow through the LED.

To most this probably isn’t the slightest bit impressive, its hard to appreciate the amount of background knowledge needed in order to understand how and why even simple circuit works, as well as analyse it; until you have done it yourself. So although it isn’t much to look at, I’m please with myself none the less :)

One lesson to take away from this is that it’s only once you begin to understand the basics that you start to finally realise how much more there is yet to learn. BTW I managed to get the joystick position to control the state of the LED that I mentioned in my previous XGS blog entry.

 

Every project needs blinking LEDs

Although I’m slowly working my way through the Design your own console ebook, theres a lot to learn, so I took a bit of a break last night and took a more hands on approach.

I built a very simple LED circuit and connected it to the XGS via the expansion port. That was the easy part, I then spent the next hour or two reading about the SX52 in order to program it to blink the LED on and off. It might not sound much, but considering I know very little about electronics and have never programmed the SX52 before, I’m pretty chuffed. In fact I’d rate the blinking LED achievment along the same lines as seeing your first triangle rendered via openGL, it doesn’t appear to do much but there was a lot of background work involved in getting that far :)

The XGS includes a lot of source code for a number of different hardware and software projects which I’m going to work through, although I prefer to try my own methods from scratch first. That way I can see just how far I can get from my own knowledge before getting stuck and having to refer to the working examples for hints/help.

So with that said, tonights challenge is to get the Joystick to light up an LED when you moved it in a specific direction. The circuit is about as simple as it gets, an LED, a resistor and a logic gate. Now I just need to find out how to talk to the joystick via the SX52.

Once I’ve built a more interesting circuit I’ll post up some screenshots. Although until I learn more about the overall hardware in the XGS the screenshots won’t be all that impressive :P

 
 
© 2005-2007 Gary Preston
Figment Games is hosted by DreamHost
Entries (RSS) and Comments (RSS).