Expanding Your 2313 Experimenter System

In the book Introduction to Microcontrollers, I alluded to the ability to expand your 2313 Experimenter System (2313ES.)  On page 70, I showed a drawing of a breadboard attached to a 2313ES.  This week, we will go ahead and expand our 2313ES with a medium-sized breadboard – this will provide pretty decent expansion capability, but will allow the 2313ES to keep it’s portability.

To start off, you will want to pick a piece of plastic, or something, to use as a base.  In this example, we use a plastic base plate from Tamiya (http://www.wrighthobbies.com/product.php?productid=62&cat=16&page=1 – Eddy was thinking about offering the base plates separately, write to him and ask him about this,) but you could use just about any

This is actually a cutting board which was included with a cheese & cracker gift set purchased years ago. It will make a nice little development kit base.

This is actually a cutting board which was included with a cheese & cracker gift set purchased years ago. It will make a nice little development kit base.

flat-surfaced item.  Consider a small piece of thin plywood, a small piece of metal, or plastic, cut from the side of something from the trash, a small clipboard without the metal clip, or maybe even the inside of the lid of a plastic pencil case (back-to-school specials abound right now.) The important thing here, is to just make sure that your kit and breadboard (and battery box, if you want it,) will fit.

Once you find your base, peel the backing off of the sticky foam tape on the bottom of your breadboard, and stick the breadboard into place on your base.   Next you can solder two small pieces of jumper wire to the two power rail holes on your 2313ES printed circuit board 2313ES Exp-1(PCB.) Now, peel the backing off of the 2″X2″ foam tape that was included in your kit, and use it to mount your 2313ES near your breadboard.  Then plug the the power wires into the power rails of your breadboard (you could also use the left-most holes in the power rail female headers, of your 2313ES, for a less permanent solution.) Finally, mount your battery box (if you want it) to your base; make sure that you leave access to both the sliding door and the power switch, as they are on opposite sides of the battery box.  Also, if your breadboard has dual power rails on the top and bottom, you will need to connect the two +V, and the two Gound, rails, as we have on the right side of the photos.

Once you get your 2313ES and breadboard mounted, you will want to test the connections 2313ES Exp-2to make sure that everything is wired up properly. You can use a simple “blinkenlight” (http://www.instructables.com/id/Ghetto-Programming%3a-Getting-started-with-AVR-micro/#step6 – this is the same as the small test device that you built while testing your 2313ES,) to test power; place the negative lead (the one with the resistor) into the ground power rail, and the positive lead into the 2313ES Exp-3+V power rail.  Place the power selection jumper over the Pgmr jumpers and connect the programmer and the LED should light up.  You can also simulate the blinkenlight by just plugging an LED and resistor in to the breadboard.

If the LED does not light up, there is a bad connection between the 2313ES and your breadboard.  Remember to disconnect power before changing any of  the wiring, here. Recheck the wires connecting the two pieces.  If you soldered the wires to the holes in the 2313ES, then disconnect one from the breadboard and temporarily replace it with a jumper plugged into the 2313ES’ female header for the power rail.  Connect power again and check that the LED lights up.  If it does, then the wire that you replaced is bad; recheck the soldering and maybe replacing the wire.  If the LED still does not work, then remove power, temporarily replace the other wire and check again.  Again, do not forget to jumper the top and bottom V+ and Ground rails together.  LESSON LEARNED – When I first connected this breadboard, I accidentally connect both V+ and Ground to the same rails – not good!  Fortunately, this system is pretty durable.  The USBASP (or the USB port on the computer) detected the short, and just shut down the power to prevent damage.  As soon as I corrected that goof, everything worked again.

Once you get the LED to light, you may want to permanently mount the LED and resistor.  2313ES Exp-4Take a look at the photo for how you may want to do this.  Once you get the parts placed and working, you will want to cut the leads short (make sure that you remember which LED lead is for the cathode (negative.)  This will keep the LED and resistor neat and out of the way – in fact, you may want to use a tiny bit of glue, or epoxy (or hot glue) to 2313ES Exp-5keep them in place, it will be more durable that way.

This will provide a quick, and easy, pilot light, to let you know when your 2313ES has power applied.  Just remember that the LED does draw power, even if you are not running any useful program on your Tiny2313 chip.  This is not a lot of current, about 20mA, but it will help to drain your battery, if you are using the battery pack.  Just make sure that you turn off the power switch on your battery box when you are not using the experimenter kit.

Next week, we will start adding stuff to the breadboard expansion.  Stay tuned.

School of Hard Knocks

It has been said that a wise man learns from his mistakes; however a wiser man learns from the mistakes of others.  I often tell people that the School of Hard Knocks has the highest tuition, but turns out the best graduates.  Well, I have some doozies, and we will take a look at some of them every now and then.  Hopefully, you can learn from some of my mistakes and not have to make all of them yourself.

I want to show you the layout of my first effort on the new Tiny2313 Experimenter’s System:

Purty, ain’t she?  This PCB provides a microcontroller, three LEDs, two push-buttons, a pot (variable resistor), a speaker, a photo-transistor and a thermistor.  Additionally, there is a diode to protect against connecting the battery backwards, and (with a 4-cell AA battery) the voltage drop will not take controller below it’s operating specs.  Also, notice that the LEDs have both ends available, so the student can learn that an LED can be connected to common ground (for an active high signal) or a common high (for an active low signal.)

This took several hours, first getting the layout correct and then the connections for the programmer cable.  I was especially proud of the idea of providing the option to draw power from a battery or from the programmer.  In addition, there are plenty of access points for ground and power available for the experimenter’s use.  All in all, pretty good – or so I thought at first.

Take another look at the board, when I started adding the components to it:

Notice the trouble yet?  No, well, here is another view:

Sorry about the quality of the photos here.  Anyway, if you have not noticed the troubles, take a look at where the speaker mounts, near the left side of the board.  The 2-pin female header mounts directly in front of the speaker port.  This is just to the right of the pot and just in front of the push-buttons.  Here is what I noticed only after I started mounting components: the speaker sticks straight up out of the board, and will block the push-buttons and crowd out the pot!  There are also a couple of other less prominent errors in this board: several of the components will not fit into their holes (the push-button’s ground pin does not line up with the hole for it – too close to the lead pins.) and some of the components are too close to their female headers – you cannot get both in at the same time.

Answer: build a mock-up protoboard:

What I did here is to print out a picture of the PCB (my CAD program allows a photo-view of the board, if yours does not, just print out the artwork.)  Take the printout from your CAD program and cut out about an inch beyond each edge of the board.  Take that paper and glue it onto a slightly larger-sized piece of foam board (you can get foam board in Wal-Mart in the office supplies section, or most office supplies, or crafts, stores.)  I used a cheap Elmer’s glue stick, but you can use any glue, just be careful that the glue does not wrinkle the paper – excess liquid glue can make the paper wrinkle.  Next take a safety pin and poke a hole through the skin of the foam board at every through-hole, and component-hole, in the printout.  Finally, insert one of each component into the foam board, right where it should go on the PCB.  This way, you can make sure that everything fits and also get a feel for the overall layout of the board.

You may notice that I made several changes in my experimenter’s system PCB layout.  I opened up the spacing for the push-buttons, moved the speaker to the rear of the board, and added a couple of servo ports.  Also, since the 2312 is, how should I put this? Analog-challenged, maybe?  I removed the pot (that freed up the room for the servo ports.)  I also moved the ground and +V rows of pins and moved them over to the right-side of the board, and also added a single pin for each set of holes.  This provides for a 1×10 header plus an additional pin that can be used to provide power to an optional solderless breadboard.

One other change that you may have noticed is that I changed the 6-pin programming port over to the more standard 10-pin STK500-compatible port.  In searching for suppliers, most of the 6-pin programmers that I found were more than the cost of the 10-pin programmers.  The choice was pretty clear, I could either change the programmer port on my board, or I could purchase the 10-pin programmers along with a 10-pin to 6-pin adapter. So…

Alas, in changing the programming port, I also introduced another bug.  Take a look at the left side of the left-most push-button.  You will notice that the trace for the MISO signal from the programmer port to the Tiny2313 chip actually touches the component hole for the female header.  I need to move the SCK trace down a bit to make room for the MISO trace to avoid the component holes there.

One additional change, that I am considering: since the 2313 does not have a real ADC (Analog to Digital Converter) on-board, analog input goes into an analog comparator.  This only compares the voltage of the analog input and gives a single-bit input to say whether the one input is above or below another analog input.  If I create a small (say 4-bit) resistor ladder for a DAC (Digital to Analog Convertor), then the output from that could be fed back into one leg of the analog comparator to then test the analog input and thus compute the voltage of the unknown analog input.  That seems to be the way to go for the next version.  Any thoughts from you?

Product Testing

Having worked in different types of technical support, on and off, for many years, I enjoy reading the stories at Tech Tales (www.techtales.com.)  Recently, I saw a tale that has a direct bearing on our engineering practices:

Wrong Plug

Posted 04/01/2002 by Greg

I used to work for a large electronics retailer, selling TV’s and VCRs. Basically, salesmen were responsible for doing phone support for their customers (if a customer called us instead of the retailer’s toll-free help line) since we got dinged if a customer returned a product we sold them (both a loss of commission and a negative impact on our performance rating).

I had one customer issue that was a bit difficult.

For some reason, their VCR clock kept re-setting itself to blink “12:00” overnight as if it had lost power. Instead of calling me, they called Circuit City’s help line and were told to return it because it was defective.

I spotted them when they brought it back in and asked what was wrong. They told me and I asked one simple question: “where do you have it plugged in?” They said “we plugged it into the outlet in the back of the cable box.”

Sadly, the cable boxes used in that area had a fun little trick. When you shut off the cable box, it cut power to the outlet, cutting power to the VCR every time they turned off the cable box. They were smart enough to set the clock on their VCR, but this power loss kept making it blink “12:00”, which was very frustrating for them.

They’d plugged the VCR into the back of the cable box because they didn’t have a spare outlet.

I sold them a power strip for $8, had them unplug the cable box from the wall, then plug the box and VCR into the strip.

Problem solved. And how did I know to ask this question? Because a few months earlier I’d plugged my bookshelf stereo (poor man’s home theater system) into the back of the cable box and watched it reset its clock a couple of times before I figured out why it was happening.

So was my customer a dummy? I never think someone’s stupid because something that’s obvious to me isn’t obvious to them (i.e. I figured out the cable box problem without help when it happened to me, but they didn’t). If that was the case, I’d have to consider myself a complete retard every time I needed the expertise of a lawyer, doctor, plumber…

I’d say the idiot was the guy who designed the cable box.

Even the best tech support is no substitute for a well-thought-out product. If every designer/manufacturer of hardware or software had to beta test it on their parents or grandparents before releasing it, we’d have a much better world all around.

http://www.techtales.com/tftechs.php?m=200204#6076

Notice the last paragraph; Greg is absolutely right!  When you design a new product, don’t ignore the testing.  Your new product will undergo two different levels of testing: Alpha and Beta.  These levels are named for the first two letters in the Greek alphabet.  The first level of testing (Alpha) is the testing that you (and your team) perform on your new product.  After the Alpha testing is complete, but before you release your beast into the wild, you will need to do some Beta testing.  This is where you get hold of outsiders and have them test your product.  You use others because you cannot anticipate every way that a customer can (ab)use your product.

Ideally, your Beta testing program will encompass several steps.  First, you will want to select a couple of other engineers, or other technically oriented people (but make sure that the testers were not involved in the design of your product – that would still be Alpha testing) and ask them to check out your product.  Give each tester one of your products and ask them to spend some time with it and to list any problems or troubles and any questions that they come up with to which they cannot find the answers in your documentation.  After the Beta-1 testing is complete, compile the lists from all the testers and correct each issue, either in the product’s design, or in your documentation.

After you have correct each issue found by your technically oriented testers, hand out a couple of products to some decidedly non-technical people.  These could be friends or relatives, non-technical students or nearly anyone else who may want to purchase your product.  Children can be really good at finding weaknesses in a product (as long as this is an age-appropriate product.)  These people will test your product in ways never imagined by technically-oriented people.  They will find ways to make your product fail that no self-respecting tech would try.  Again, have each tester write a list of troubles and questions and resolve each issue in your design or in your manual.

It is traditional to pay Beta-Testers by providing one of your final products as a thank you gift for their work.  By following this test procedure, you can correct issues like the cable box outlet which kills power to the plugged in appliance before they make a customer angry.