Archive for the ‘Electronics’ Category

Microcontroller course

Monday, June 6th, 2011

As I mentioned in my last post, nearly six months ago, I taught an “Embedded Development” course in the Computer Science department at the University of Mississippi. It was a highly practical course, and the Arduino was our hardware platform of choice. The “brain” of the Arduino is an Atmel AVR ATmega328P microcontroller with 2kB of RAM and running at 16MHz. Instead of using the Arduino language and development environment, we used C and Eclipse.

We started out learning to blink LEDs, to calculate the value of current limiting resistors, and the difference between sinking and sourcing current. We then learned how to use the hardware timers on the AVR to time events (interrupts) and output Pulse Width Modulation signals to vary the brightness of LEDs and create simple sounds.

Four digit, seven segment display setup

Four digit, seven segment display setup

Next, we learned to use a four digit, seven segment display from Sparkfun. This is a fairly common display, and there are lots of examples of how to use it on the Internet. However, I wasn’t happy with any of them. They either ran the display at low currents (resulting in low brightness) or used standard shift registers at higher currents than they were designed for. I came up with a design that used a TPIC6C595 power shift register to control the segments and four 2N3906 transistors that switched power to each digit. I was quite proud of my design, as I’m definitely a programmer, not a hardware guy. We also learned how to convert numbers into binary coded decimal (BCD) for display on the seven segment display.

(more…)

Embedded Development Course

Sunday, December 19th, 2010

Below is the description of a course I’ll be teaching in the spring. It’s the first time I’ve been able to teach a special topics course (i.e., have complete control of the content of the course), and I’m really looking forward to it.

CSci490: Embedded Development
Instructor: Ben Pharr
M W 5:30 PM – 6:45pm
Weir 235

Embedded systems are all around us and are becoming more common by the day. Embedded systems typically perform a few dedicated functions as part of a larger system such as a vehicle, appliance, vending machine, etc. They are often resource constrained in some way, yet must respond in near real-time to events happening in the physical world. Obviously, developing for these systems can be quite different from developing in Java for a desktop application.

This class will use the Arduino hardware to explore embedded development. The Arduino is a development board powered by an Atmel AVR ATmega328 microcontroller. It runs at 16 MHz and has 2kB of SRAM and 32kB of flash.

Instead of the usual Arduino language, we will use ANSI C in order to build skills that are transferable to other embedded platforms.

Topics will include:

  • The C Programming Language
  • Data Representation
  • Computer architecture
  • General Purpose Input/Output
  • Basic electronic concepts
  • Timers
  • Pulse width modulation
  • Analog to Digital Conversion (ADC)
  • Interrupts
  • Serial communication
  • Embedded debugging and troubleshooting

Textbook:
Introduction to Embedded Systems: Using ANSI C and the Arduino Development Environment

Morgan and Claypool Publishers (July 12, 2010)
ISBN: 978-1608454983

Related links:
http://arduino.cc/en/
http://arduino.cc/en/Main/ArduinoBoardUno

Understanding Basic Electronics

Tuesday, October 19th, 2010

Several months ago I started reading Understanding Basic Electronics, 2nd Edition, released this year by the ARRL. I was just nearly finished with it when I decided I should get serious about studying for comps. Last week I picked it back up and finished it.

During my Computer Science education I’ve only had one Electrical Engineering course, ELE335, Principles of Digital Systems. There was an accompanying lab where we played with logic gates, but there was no mention of resistors, capacitors, etc.

Over the past several years, both before and since getting my amateur radio license, I’ve picked up several beginners’ books on electronics. Understanding Basic Electronics is the best I’ve read so far. Most of the material was already familiar to me, but I learned and relearned several things.

It’s a relatively short and quick read. The chapters are broken into 2-3 page lessons. It covers all the basics: Ohm’s law, DC concepts, AC concepts, capacitance, inductance, power, frequency, transformers, impedance, resonant circuits, semiconductors, diodes, transistors, and integrated circuits. There are no experiments, as such, but it gives you a good base with which to move on to other books that do have experiments, like Make: Electronics.

It’s the first in a three book series. I already have the other two, Basic Radio and Basic Antennas, and I’ll be starting on them as soon as I catch up with the reading for my classes.

Make: Electronics

Wednesday, February 24th, 2010

For about two months now, I’ve been spending most of my spare time reading and doing experiments out of Make: Electronics. My spare time has dwindled now that I’m back to teaching and taking classes. It’ll dwindle even more as I get into semester projects.

I’m now up to Experiment #16 in Make: Electronics; about half way through. I’ve learned a good bit, even though the book is definitely aimed at newbies. I have skipped a couple of experiments that didn’t seem like they offered enough new experience for the amount of effort they would require.

I would recommend the book to anyone with one disclaimer: be prepared to spend a lot on tools and supplies. I’m also not terribly fond of the author’s recurring intruder alarm example. I feel like he could have come up with a better project. On the other hand, I don’t know of a better hands-on, beginner’s guide to electronics.

For now, I’m suspending my efforts on the book to finish up my DDS-60 card. More on that soon.

PanaVise Junior

Thursday, February 4th, 2010

The other day I forgot to mention a very important part of my soldering gear: the PanaVise Junior. It’s a miniature vise. Its jaws have grooves that make it perfect for holding small circuit boards. The best part is that it’s only $16, with free shipping from Amazon. I wouldn’t solder without it.

PanaVise Junior in action

PanaVise Junior in action

PanaVise makes a whole series of vise bases and heads, and I’ll probably end up with several of their products, but Junior model is absolutely perfect for working on small circuit boards.

A similar product is the ubiquitous “third hand,” as seen here. I have one of those too, but I don’t use it nearly as often as the PanaVise Junior. Some people actually use them to hold to hold small circuit boards while working on them, but either their third hands are much sturdier than mine or they’re crazy. It’s nice for attaching connectors to wires and that sort of thing, but I wouldn’t say it’s essential. I got mine for $4-5 from an electronics supplier. For that price, it’s not a bad deal for occasional use.

Along the same lines, I have a pair of medical hemostats that I use for holding things. For instance, a lot of projects will require you to solder headers onto a circuit board. It’s virtually impossible to get the headers to stay where you want them. I use the hemostats to hold the headers while I solder one pin. Remove them, check for alignment, reclamp, and solder the far pin, then remove and solder all the other pins. It makes dealing with headers much easier. It got mine from SparkFun for a few dollars.

Soldering gear

Tuesday, January 26th, 2010

I started playing around with electronics about a year ago. You can make do with a breadboard for a while, but if you stick with electronics long enough you’ll eventually get around to soldering. I actually started soldering kits right off the bat, but I agonized over what gear to buy. I agonize over any major purchasing decision (and most non-major ones), so this isn’t new for me. I’ve been very happy with my gear, so I thought I’d share it to make the decision-making process a little easier for others. I’ve been meaning to post about my gear for a while now, but actually tinkering with electronics has taken priority. Last week a friend of mine mentioned he was looking at buying a soldering iron and related gear, so I thought it was time to finally get around to it.

I got a Circuit Specialists Soldering Station for $45. It’s a 40 watt temperature-controlled station. I have the one with the digital temperature display, but they have an analog version for $5 less. The analog one is more than accurate enough, but I like the digital look. It comes recommended by others, and I have no complaints. The grip on the iron gets a little hot, but not to the point of being uncomfortable. I’ll probably upgrade eventually, but I expect it’ll be several years. You could probably get by with a non-temperature-controlled iron, but I think this one is definitely the best bang for buck.

For through hole work I use a 1.2mm chisel tip. Most people would probably use the next size up, but I enjoy the extra control the smaller tip gives you. For surface mount work I use a 0.8mm conical tip.

I decided on 63/37 Kester 285 solder, in 0.031″ diameter for through hole and 0.015″ diameter for surface mount. The 63/37 refers to the percentages of tin and lead in the solder. The 285 refers to the type of flux. Flux helps the solder stick to the objects you’re trying to solder. While solder sticks to metals like copper very well, it doesn’t stick to oxides very well. Unfortunately, the high temperatures involved in soldering cause accelerated oxidation. Flux helps prevent oxidation and also serves as a wetting agent, causing the solder to flow. Some fluxes must be cleaned off the board after soldering. I don’t have time for that, so I settled on Kester’s 285, the most active flux I feel comfortable leaving on a board. There are also “no clean” fluxes, but they tend to not perform as well. Especially while you’re learning to solder, stick with something like Kester 285. You can also get lead-free solder, but it’s not beginner friendly either.

I bought my solder from Digikey in 1lb. spools. It runs $20-30 per spool.  It’s hard to find good solder in small amounts. Radio Shack has small quantities of solder, but I have no idea if it’s any good. If you’re just getting started in this hobby I’d be glad to give you some solder. There’s no way I can use it all before it goes bad. (This type of solder has a shelf life of three years or so.)

I also have a flux pen, but I’ve only used it a couple of times when hand soldering surface mount ICs.

You need a way to clean your soldering iron’s tip. Most irons come with a cheap sponge that you wet. I use a Hakko 599B tip cleaner. It looks like a pot scrubber, but it has flux on it that cleans your tip. It also doesn’t drop the temperature of your tip like a wet sponge.

Sometimes you need to remove solder. There are two basic ways to do this: a desoldering pump or desoldering wick. The pump seems to be the old standby, but I’ve had way more luck with wick. I never use the pump these days. I use TechSpray wick and it does a good job. I use size #3 for through hole components and size #2 for surface mount.

I use Xcelite 378M pliers and 170M shear cutters. Amazon has them for $14 as a pair. You can make do with a small pair of regular pliers, but cutters like this are virtually essential. Home Depot carries an identical set under the Cresent brand.

Good lighting is essential for this sort of thing. While not ideal, I use a Petzl headlamp when soldering. Magnification is also important. I have a 10x jeweler’s loupe that I use for checking joints after the fact. I’d love to have a lamp/magnifier combo that clamps to my desk, but they’re expensive, and I’m sure my kids would find a way to break it. One of those magnifier visors would be nice too.

So, yes, getting setup to solder is a little on the expensive side, but it’s not bad compared to a lot of hobbies, you don’t have to buy it all at once, and it’s a good skill to acquire. Let me know if you have any questions.

NorCal Dummy Load

Friday, January 15th, 2010

I started building electronic kits about this time last year. (My grandmother got me a soldering iron for Christmas.) At this point I’ve built several kits, but I’ve only gotten around to posting about a couple of them. This kit, the NorCal Dummy Load was my third project, the first being the MintyBoost, and the second being a AVR microcontroller programmer that I haven’t had a chance to post about yet. More on that one later. I built this kit back in February of 2009. You can see all the photos here.

Dummy load in vise, on desktop.

Dummy load in vise, on desktop.

So, what the heck is a dummy load? When you’re testing a transmitter, you can’t just transmit without anything connected to the output. You could fry your final amplifier. So you need a dummy load that presents the correct impedance, 50 ohms in most cases. As it just so happens, I’m getting ready to build a transceiver, and will need a dummy load for testing. Also, this particular dummy load involves several surface mount (SMT) parts, and I wanted a little practice with those before beginning my next project, the Softrock Lite II 30m software-defined receiver.

NorCal Dummy Load

This kit was designed and sold by NorCal QRP, a low-power (QRP) ham radio club based in Northern California. They have put together several kits over the years. They actually retired this kit a couple of years ago, but I inquired on the qrp-l list and someone had one they weren’t planning on building.

Some hams are intimidated by surface mount (SMT) components, and rightly so; they’re pretty small. Have a look below. The small black thing to the right of the penny is a 2.2 kOhm SMT resistor. SMT components come in different sizes. This size is referred to as 1206, which means it’s 0.126″ × 0.063″. It’s one of the larger sizes of SMT components.

1206 SMT resistor compared to penny

As it turns out, soldering SMT components isn’t too bad. I used a small tip on my soldering iron and small solder (0.015″ diameter) and had no problems. There were no SMT integrated circuits on this project, but there would be on my next project.

Tonight I started on another SMT project, but using solder paste, a griddle, and an embossing gun instead of solder and a soldering iron. More on that later.

Short review of Getting Started in Electronics

Monday, December 28th, 2009

As most of you know, I’ve been tinkering with electronics as of late. My interest was piqued due to my exposure to them in Ham radio. There is also a computer science angle with microcontrollers. I’ve built several kits, and have a few in the queue to build, but I also want to work my way toward being able to design my own circuits.

After checking out the reviews on Amazon I settled on Getting Started in Electronics by Forrest Mims. It has glowing reviews, many reviewers crediting Mims for jumpstarting their career in electronics. It’s also very short, at 128 pages.

I’ll be honest, I was disappointed. I’m probably a little more experienced than the target audience for this book, but not by much. While I did learn a few things, I found it to be way too high-level and not at all hands-on.

My next attempt at gaining an intuitive understanding of some electronic concepts will be via Make: Electronics. It’s a relatively new book by the guys at Make Magazine, of which I’m a subscriber. I read an interview with the author and editor a few days ago, and they actually mentioned that their intent was for it to be a modern day replacement for Getting Started in Electronics. (GSiE was originally published in 1983.) From reading about the book, it is decidedly more hands-on. While I’m sure some of it will be repetitive for me, I expect to learn quite a bit as well.

While I’m waiting on that to arrive, I’m going to read a couple of Sherlock Holmes short stories. I hope to see the new movie in the not too distant future, and I don’t want my image of Holmes’ world to be tainted by Hollywood.

ATS-3B and project update

Wednesday, November 4th, 2009

A couple of weeks ago the ATS-3B I posted about a while back became available again, and for the last time. Mine arrived in the mail today. I’m very excited about it. It really is the coolest little kit going right now. I count 19 toroids to wind. Yikes. One on the main board and three on each of the six band modules. Maybe it’s time to invest in an L/C Meter?

While I’m very excited about the ATS-3B, I’m going to force myself to leave it alone until I finish my Softrock Lite II 30m software defined receiver and my Small Wonder Labs SW-40+ 40m CW transceiver.

I’m not sure I’ve even mentioned my Softrock Lite II on the blog before. I’ll have to do a proper post on it soon. I have mentioned it over on Twitter. It is done, as in all the parts are installed. However, I’m not able to receive any signals. The helpful guys on the mailing list tell me it needs a proper 50-ohm antenna. I was trying to use a small piece of wire as an antenna for testing purposes.

I have ordered and received everything I need to build a 30m dipole antenna that will be installed in my attic, at least for now. I’ve even cut the wire to length. I just need to solder everything and put it in the attic. I’ll probably borrow an SWR meter from one of the local hams to ensure it’s resonant on the 30m band. Hopefully the Softrock Lite will just work once it has a proper antenna. If not, I’m confident I can troubleshoot it with the help of the guys on the mailing list.

The SW-40+ is mostly done. All the components are installed on the board. However, I still need to align it, integrate the K12 keyer, and put it in the enclosure. I’ll also need to learn Morse Code before I can get much use out of it. I’ve been practicing occasionally, but I’ll have to put a lot more time into learning it before I’m good enough to try an on-air contact.

I’ve also been tinkering with AVR microcontrollers, but that’s a long-term project, so I’m content to let that sit while I build the ATS-3B.

I hope to get up a post about the backpacking trip soon. Two things are holding it up. Mostly, I’ve been insanely busy since I got back. Secondly, the memory card that has the pictures from the trip on it seems to be corrupted. I’ve ordered a card reader so I can attempt to recover them.

WWVB-controlled clocks

Wednesday, September 23rd, 2009

Even though it seems like I’m always running late, I’m anal about keeping my watch accurate to the second. Thus, I’m a big fan of NTP and radio-controlled clocks. In fact, I’m considering getting one of those “atomic” Casio watches.

Last month NIST updated WWVB Radio Controlled Clocks: Recommended Practices for Manufacturers and Consumers (PDF), its guide to making and using WWVB-controlled clocks. WWVB operates at 60kHz, way down in the low frequency band. A half-wavelength antenna for WWVB would be a little over a mile and a half long. NIST also operates WWV, which broadcasts at 2.5, 5, 10, 20, and 25MHz.

Building a WWVB-controlled clock is on my list of electronics projects, but it’s not one I intend to get to anytime real soon.