Electric circuits

At the risk of prolonging this “electronics course” and boring everyone after the past two installments about power and switching regulators, here are some thoughts about electronic circuits.

I find the hydraulic analogy very useful, as long as you don’t push it too far. There is a (thick) book called Practical Electronics for Inventors by Paul Scherz (2007) which manages to construct analogies for just about all types of electronic components. It’s a stretch, but it does help understand things.

It’s quite easy to see how a small current can control a larger one. It also falls short, because “current” is really “pressure” in this case. My suggestion would be: do look at those analogies if you want to quickly build a mental model of how a specific component works, but keep the limitations of such analogies in mind.

The neat thing about electricity, is that you can completely understand a circuit by just applying a bit of logic. By which I mean: reason how it probably / sort-of works. And predict some of its behavior. It really pays to invest a bit in understanding electronics circuits.

There is a whole world to discover when you get into this. There are lots of conventions to figure out, but the neat thing is that these conventions are pretty much standardized by now. Electric circuits have been around for a couple of centuries, even if some of the newer components are only decades old.

Even without knowing all the conventions, you’re probably able to guess many of the components. Connectors (PORT1, SV1), resistors (R1, R2, R3, R4), capacitors (C1, C2), a transistor (Q1), two LEDs (LED1, LED2), and a box marked “LM555D” which is an integrated circuit for building timers and oscillators.

How it works would be a bit of a long story for this post, but let’s make a guess:

C1 is charged up because it’s connected between + (VCC) and - (GND)

there are two resistors (R1 and R2) which limit the current flowing into it

the charge on C1 is measured through pin 6 of the chip (THR, i.e. threshold)

pin 7 (DIS, i.e. discharge) is actually an output, which can be either open or low

What the LM555D does (consider it magic for now), is watch the voltage level on THR. When it is low, DIS is not connected. The capacitor will charge up, until THR reaches a certain voltage.

At that point, the chip (through magic), decides to pull DIS low, i.e. put it at almost 0 volts, i.e. ground level.

While DIS is low, something completely different happens: with pin 6 being at a fairly high voltage, and DIS low, capacitor C1 will start to discharge, with current flowing into R1 in the opposite direction.

At some point, the THR voltage will be very low again, at which point the chip (magically) decides that it’s time to disconnect DIS. Then the cycle repeats: C1 will start to charge up through R1 and R2, etc… ad infinitum.

We haven’t even looked at the rest of the circuit yet. I’ll leave it at that for now, just mentioning that the transistor is there to drive a strong current through the LEDs in a rapid ON/OFF pattern.

The components are dimensioned in such a way that this circuit oscillates at… 38 KHz. Which “happens” to be what most remotes send out as well.

There is a lot more to say about electric circuits, of course. I just wanted to point out that there is a huge amount of information you can glean from such “schematics” of various circuit diagrams.

Since everything made at Jee Labs is open source, you can dive into all of this. Look for the PDF’s linked on the various hardware pages if you’re interested.

It’s fun. It’s enormously informative. And unlike my use of the term “magic” there is really nothing special going on at all. It’s only magic until you dive in. If you have questions about how JeeNode pins are hooked up, for example: check out the manual (PDF). It’s all in there!

Update – for entertaining introductions of the main electrical components, there are a couple of short videos by Collin Cunningham on the Gizmodo website.

Yes. Well, C2 is a “decoupling cap” which affects all components (it filters out some noise on the power line). It’s normal to sprinkle a few 0.1µF caps in various places in a circuit to get a better (stable) power supply everywhere.

The TSOP34838 does the reception and decoding all by itself. It detects an IR signal pulsing at 38 KHz and has all the amplification + filtering built-in. So the receiver side of this sort of IR communication is really extremely simple, in terms of connections and components.

Great with some technical background on the circuits. Being a electric engineer it’s nice to see these “simple” analogies you use, making it simple to understand even for the not-so-technical savvy people. Keep up the good work (As suggested by Mike above, a few good topisc for future posts could be to dive into some of the discrete components used in different JeeLab projects)

Also quite a ‘magic’ component, the TSOP34838. I noticed on the IR plugs, when utilising only the receiver (TSOP) and with no infrared source pointing at it, you sometimes gets a brief drop in voltage, enought to set this !ir.digiRead2() function to true. I was wondering if there was a way to add to the circuit to prevent these false readings?

The thing to note though, when there’s a constant 38khz signal pointing at the TSOP, its as stable as you can’t believe. Even with direct ambient light and distances over 5m.

I’d try to do this in software: ignore short glitches based on their duration.

Note also that although the 38 KHz carrier is easily detected, you can’t be sure of where the signal comes from, as might be important in your case of using it for beam interruptions. Any remote will be picked up.

One idea would be to “modulate” the 38 KHz beam, by pulsing it at 500 Hz, for example, i.e. 1 ms on, 1 ms off. Then the receiver can make better decisions based on whether it really is receiving this particular pulsating signal, and not something else or some glitch.

I picked up an understanding of most of this as a teenager, while tinkering with it all – first analog, then digital, then microcontroller-based. There are absolutely tons of marvelous and clever circuits out there, and nowadays all of it can probably be found online.

I’ll see if I can fold in some more stories about this stuff, without completely turning it into an electronics-only weblog. Because, believe it or not, there are just as many neat tricks and inventions to discover on the software side, and on the mechanical side!

Another big task ahead: start indexing these 650+ posts, preferably with a brief summary. Long overdue!