Archive for November, 2008

XGameStation Game Console Starter Kit 2.0, Lesson 6

This set of labs represents the “front nine” of the XGameStation Game Console Starter Kit.  I’ve looked ahead a bit, though, and it’s also fair to say that this is the penultimate lesson on hardware.  Lessons 8 and 9 are about prototyping the entire console on a breadboard and assembling the PCB.  Lessons 10-12 are on programming for the console.  While I do look forward to learning more about coding from the Parallax SX28, as I have wanted to do more embedded systems programming in my spare time, I can’t help but feel that much is missing.  There’s a 30-pin expansion header, and no lab that will cover it.  I also find it sad that, despite how the lesson slides allude to cartridge-based systems, boot code to load and copy cartridges, etc, that the XGS Pico seems to not have the necessary hardware for it.  That is, the XGS Pico appears to require reprogramming to change games.  What’s more, the kit ships with a copy of “The Black Art of Video Game Console Design” which was written for and about the XGS Micro, which seems to include a lot of very interesting hardware (like a keyboard), making me feel like I’m not getting the full experience.

Anyway…none of this makes the kit bad.  It does, however.  Having missed opportunities to teach more doesn’t mean it’s failing to teach.

Lesson 6 is basically all about audio.  The three labs deal with making sound first through the old school methods of an oscillator and frequency divider and then with software synthesis techniques– pulse width modulation and pulse code modulation.  I actually put off this lesson for a little while because I wanted to buy a second breadboard to put the basic synthesizer on.  After placing my SX, I wanted to keep it there, and the first lab requires removing it.  A minor frustration, sure, but not insurmountable.  If nothing else, it’s good practice for wiring up the SX in a jiffy.

A basic 4-tone synthesizer.

A basic 4-tone synthesizer.

In working on this lab project, I encountered a familiar problem with this kit– the labs are clear and straightforward but lack information that would be invaluable when troubleshooting.  In this case, when I first pressed a button, the speaker would “POP” but not make any apparent sound.  As I don’t own an oscilloscope and signals in the kilohertz range are too fast to see on a multimeter, I fumbled with some extra capacitors and made the 555 timer IC output a much slower (~1Hz) signal, then replaced the speaker with some LEDs and confirmed each button was providing a correct division of the source signal.  Once I knew that the circuit worked, I suspected the speaker, and I found that the tin on the wires (to prevent fraying) looked a little suspect and didn’t seem to fit in the breadboard well.  So, I clipped the ends off and used some alligator clips to attach the speaker to some new leads.  Pressing a button then gave different faint, almost inaudible buzzes.  I still suspect the circuit needs an amplifier in there somewhere, but I’m not trained enough to know.

Pulse width modulation circuit

Pulse width modulation circuit

The next lab features the Parallax SX28 again.  In this case, you’re working with Pulse Width Modulation (PWM) audio.  I may state this somewhat incorrectly, but essentially, the microcontroller can send square wave pulses of different widths, and as they go through a specially designed RC circuit before reaching the speaker, you gen non-square-wave sounds coming out.  It’s neat, though a touch limited, of course.  I found that this lab went off without a hitch, and I actually had a great deal of fun playing around with the sample code to generate sounds.

Pulse code modulation circuit

Pulse code modulation circuit

Finally, we come to the PCM audio lab.  PCM audio is the kit’s first treatment of an D/A converter.  That is, it’s a means of taking a number of digital outputs and converting them into a single analog value.  This is, of course, pretty critical in generating stuff like audio and video.  The lab itself has an ingenious presentation, offering you the chance to record some audio on your personal computer and play it back in 4-bit PCM on your nascent game console hobby kit.  To do this, you first record some audio using a special tool on your PC, then run it through a program provided by the kit’s creator.  This generates assembly code that can be programmed onto your SX.  I didn’t get the results I expected…the output audio was completely different from the input.  I suspect this may be my own fault, however, as I used a different version of the sound recording tool or perhaps just saved my file at the wrong sampling rate or something similar.  The lab does come with a ready-made program that contains recorded sound, but I didn’t think to try that until I was at work the next day.  My hat is at least off the the authors on including that program, though, as that’s a level of troubleshooting support that the rest of the projects should be at.

Leave a Comment

XGameStation Game Console Starter Kit, Lesson 5

Hey!  It’s microcontroller “Hello World!”  How fun is that?  The labs for lesson 5 introduce the student (that’d be me in this case) to the fundamentals of working with a microcontroller.  That is, hooking it up to power and ground, building its programming circuit, and using its programmer tools to load a binary onto it.  There are three labs in this one; all are essentially flavors of the same fundamental lab.  The easiest one delivers you some blinkenlights (pictured below).  Another demonstrates use of the microcontroller as a seven-segment display driver.  The final one is a sort of crude one-dimension pixel game played with some LEDs and a pushbutton.

It’s great to finally feel like I’m getting to the meat of the project, that is, using a microcontroller to do things.  All in all, these lessons are fun and definitely produce an air of excitement.  There’s nothing quite as much fun as plugging in the programmer key and watching it all work.  I also can now definitely understand the author’s choice in microcontroller (the Parallax SX).  It’s very easy to program and its debugging is easy to control.  It’s a good beginner’s chip.

Of course, inevitably, I have to mention what seem like the road blocks to learning.  Both of these are minor complaints and should be taken as such.  The first is that I don’t think enough attention is paid to what could possibly go wrong.  Specifically, this is the first lab in the entire kit that both has a large number of “moving parts” and which also carries the warning about how easy it is to break some of them (like the SX Key).  This lesson could greatly benefit from some material on how to debug common problems safely.  In my case, I had a problem with my programmer circuit.  The result was that the SX Key Editor could sense the SX Key and would attempt to program the microcontroller, but would then die complaining “Could not create VPP”.  I knew the problem was with my programmer circuit, but the error didn’t give me much to go on and there wasn’t much help to be found through web searches, since most of the material I found was about having oscillators on the same line as the programmer pins for the microcontroller.  I eventually decided to dissect the programmer circuit, and finally found that I’d accidentally run a wire to the wrong pin.  Lesson learned, of course, but it would have been a huge help to even see the lab materials contain information about common errors you can encounter and what you should check.  It’s nice to feel like you’re not completely out in the weeds on your own.

My other complaint is that the author provides sample code sufficient for the student to finish the lab without digging into SX assembly at all.  In fact, it brushes it aside as unnecessary to have because there’s plenty of information out on the Web.  I understand the author’s perspectives and priorities here, but there’s plenty of information on basic circuit theory on the web, too, and that got 4 dedicated lessons, each with several labs in them.

I’m going out on a limb here, but I used to teach so I feel qualified being out here.  Teaching programming by dissection is a pedagogical failure.  It’s roughly the equivalent to learning Japanese by listening to the same handful of J-pop albums over and over again.  You learn the songs, sure, but you don’t know Japanese.  Seeing how a functioning program works isn’t the same as learning how to build one on your own, and it generates little more than a shallow parroting of known idioms.  Is sample code essential to a learn-at-home kit?  Absolutely.  What’s also essential, though, are extra labs without code that push the student through writing code on his/her own.

That said, the lesson achieves its effect, which is to get your feet wet with the microcontroller and drills into you the most important rule of working with a new microcontroller — do not do anything before you first get power, a programmer, and a blinking LED to work.  That’s “Hello world!” and it’s essential to do it every time.  If you don’t, you’re just asking for trouble.  I can deal with this.  It’s pretty common for me to write a “Hello world!” for every driver, service, and application, proving first that I at least have the boilerplate structure right.  It’s good to see someone teaching this responsibly.

Blinking LEDs from Lesson 5, Lab 1

Blinking LEDs from Lesson 5, Lab 1

Oh!  You’ll notice an extra LED in this photo, off to the left.  That’s not part of the lab at all.  Basically, the barrel connector I was sent is mildly defective and sometimes the wall wart doesn’t make enough contact, causing issues.  I got tired of constantly testing to see if I had a power supply problem, so I put an extra LED on to let me know that the power’s on.  I also added a simple switch so I could turn the power on and off without unplugging the wall wart.  It’d be nice to see these added to the labs in general.  It’s convenient and easier on your parts.

Leave a Comment

XGameStation Game Console Starter Kit 2.0, Lessons 1-4

As mentioned previously, I am working my way through the labs of the XGameStation Game Console Starter Kit 2.0.  This represents my first experience working with electronics, prototyping on a breadboard, etc.  I get the feeling that I’m fairly well placed in the target demographic Nurve had in mind with this kit, which is, of course, why I want to track my progress and provide some review of the kit.

First off, there’s opening up the kit and unpacking the parts.  The kit is well-packaged and has a detailed manifest of all of the parts contained.  I immediately went out and bought a crafting box to keep all of the components, the tools, etc.  The manifests contain some pictures and diagrams, so I figured I’d keep them on hand anyway.

The book which comes with the kit is clearly written by an expert in the field and, as such books go, the pedagogy is above average.  It is, however, a book published by SAMS, and it carries with it all of the usual problems associated with this publishing company.  A large number of the figures are misprints, often being duplicates of the previous or next figure.  Other diagrams are backwards.  Copy editing also seems to be lacking, as I’m not sure a book on microcontroller systems needs a segue on how Captain Kirk is “the original space pimp.”  These errors are frustrating but don’t substantively detract from the book which is itself a fast and informative read and prepares one well for the projects to come.

I really endorse not only finishing reading before doing the presentation slides and labs, but I suggest reading well ahead of the presentation slides.  Especially early in the book, the chapters build on each other, and having the broader first exposure makes it easier to follow along with the slides and lab lessons.

The presentations appear to have some minor problem with them.  They’re done with PowerPoint and the audio seems to cut out early on most slides.  My solution was to load all the audio MP3s on a playlist and play the playlist, advancing the slides when I hear proper pauses.

So, now for the labs.  I’ve done most of the labs for lessons 1-4 at this point.  Essentially, these are activities that cover introductory RC circuits, using SPICE, the basics of working with DIP ICs, combinational logic, flip-flops, and state machines.  Some of these labs are done on a breadboard.  Others are done using software provided in the kit.

The first thing I must comment on is this — Nurve needs to do a better job checking the parts they include in the kit.  The first time that this bit me was in a lab for Lesson 1, where I was asked to use a specific current-limiting resistor in series with a LED, only to find I had no resistors with that specific amount of resistance.  Sure, I had some that were close, but I’m a roockie with electronics and I wasn’t sure if I could use one of those.  After scraping around the parts lists, triple-checking several times, consulting websites on resistor color codes, and fretting, I finally found a tiny note that some parts had been replaced with comparable parts that would work fine even if specific resistances/capacitances/whatever weren’t reflected.  This might be comfortable to someone who knows what they’re doing.  I didn’t, and as a good engineer, I don’t just cavalierly reinterpret instructions without knowing what’s going on.

Additionally, One of the more important parts of Lesson 3 involves developing a timer using the famous 555 timer IC.  This IC can change the frequency of its output based on the resistors and capacitors you tie to some of its pins.  Critical in finishing the labs in Lesson 3 and others is wiring up the timer IC to a 10uF capacitor to provide a 1.2Hz signal.  The problem is…the kit does not contain an extra 10uF capacitor.  It does contain a 10uF capacitor, but this component is already dedicated to supporting the voltage regulator.  When I contacted Nurve about this oversight, they did not respond.

So, now for some pictures.

The most visible fun in Lesson 1 is hooking up the voltage regulator and then confirming it works by hooking a LED to its output:

Hooking up a LED to the voltage regulator.

Hooking up a LED to the voltage regulator.

Later on, you get to the more fun stuff.  Other labs don’t make for particularly good photography, so I’ll skip ahead.  Lesson 3 includes playing with logic gates.  You can see here as I tap on the inputs for an OR gate.  The gate stops output to the LED when one or both of the inputs is depressed:

An OR gate output through a LED.

An OR gate output through a LED.

It’s at the end of Lesson 3 where I discovered the lacking of the parts.  The goal was to build a 4-bit binary counter.  To do this, you tie the output of the 555 timer IC into a binary counter so that it counts on every beat of the timer’s output.  First off, the breadboard becomes horribly cluttered under this project.  Secondly, I had to go buy a new capacitor before I could build the timer.  So, to at least develop skills, I hooked up the counter circuit and then manually set a state on it.  You can see it registered through the LEDs:

A 4-bit counter with a hand-set state

A 4-bit counter with a hand-set state

When I finally did drag my butt to Radio Shack to get the necessary components, I had limited work space and felt I’d learned enough about working with the counter that I didn’t want to have to get bogged down.  So, I instead just designed a circuit for the timer and showed that it’d blink a LED…this is the electrical equivalent of “Hello World!”  I also want to point out here that the barrel connector for the AC adapter is quite flaky.  Until I can replace this part, too, the best I can do is struggle to seat the connector and plug and then put in a simple switch to turn on and off the supply voltage.  I strongly encourage that Nurve consider making this the standard power supply circuit in the future, as the barrel connector is weak and subject to wear, it’s a good lesson, and once the voltage regulator is seated on the breadboard, it’s foolish to remove it.  So, why not make this more robust and user friendly with a simple switch?

Making a LED blink with a 555 timer IC

Making a LED blink with a 555 timer IC

Future labs beyond this point increasingly dive into the SX microcontroller and speak more to critical aspects of design and implementation of the XGameStation Pico.  I’m grateful for these early labs because they’ve helped me build confidence that will serve me well on the more interesting labs.  I feel, however that Nurve needs to do more to explain the variance in its parts, to ship less brittle components, and to make sure everything the student needs is already in the box.  A once-over of their book with an editor would help, too.  No part of this will stop the determined student of digital design, but these tripwires can really stymie the cautious or those without more prior training.

I’ll be back with more tales on this project in another week or two.

Leave a Comment