Monthly Archives: November 2011

The art of capacitive touch sensing

I didn’t get a lot of electronics hacking done, but I found myself again playing with capacitive sensing. I found this interesting article on the EE Times website:

The art of capacitive touch sensing

It also pointed me at the following pretty cool Youtube! vid by the folks at Nerdkits:



My experimentation thus far has been mostly confined to using the CapSense library for the Arduino. This library is pretty simple to use, but it has a number of quirks that make it somewhat cumbersome for the uses that I had for it. I’m currently working on a “better” (for my purposes) version. Stay tuned.

The Sparkfun Serial LCD

I was driving around various Silicon Valley electronics and surplus stores (like HSC and Anchor Electronics) and decided to stop in at Microcenter. I remembered that they supposedly were beginning to stock items from Sparkfun and the Maker Shed. And, indeed they do! I found a Serial LCD module from Sparkfun that I thought might be fun to have, so I got one:



A couple of quick caveats though:

  • The module has absolutely no documentation in the box. A quick bit of searching revealed the datasheet for the device, and that was helpful (although not the clearest that I’ve seen). If you are familiar with HD44780 devices, you’ll have no problems.
  • The pigtail they ship with it connects to the JST connector, and uses stranded wire. Not the best thing to plug into breadboards and the like. I soldered some female headers onto the unpopulated connector, and that worked out better.
  • It doesn’t appear that you can load custom characters over the serial interface like you can with the traditional interface. Bummer.

Still, it was dead easy. If you want a simple module to do some simple display tasks with only three wires, it works just fine.

Apologies for slow website this morning…

You might be experiencing slow response to my website this morning. I think it is merely the perils of using inexpensive shared hosting, but I’ve filed a support ticket and hope that it will get resolved shortly. I appreciate your attention, and hope you will persevere in reading, even if the site seems a bit slow.

I can’t complain too much: my website costs me about two lattes a month to run, which means that I don’t need to annoy anyone with advertising and the like to provide it for you. But that being said, I would like my website to run smoothly and quickly for my users. Anybody have any good, cheap and reliable hosting that would be appropriate for running a website that sees 500 or so visitors a day? What’s this I hear about cumulous computing?

Diode temperature sensor update…

Lee mentioned that the there was a way to change the analog reference used on the analog inputs to the Atmel AVR to an internally generated 1.1V, which would give me a lot greater resolution (about little over 1mV per step). Indeed, a little quick searching yielded that it was not only true, but dead simple: the Arduino provides an “analogReference” call. If you simply call it in your setup() routine with the argument INTERNAL, you’ll get a 1.1V reference.

To test it out, I did another run, pretty much the same as before, but illustrating the values read after changing to the internal 1.1V reference. Again, I began with the diode in air, then pinched it, released it, pinched it, then released it, then placed it next to a cold can of Diet Coke I had sitting next to me.

Seemed to work pretty well!

Kragen mentioned that the Atmel also had in internal temperature sensor as well. Indeed, it appears that you can simply do an analogRead(8) to access an internal “virtual pin” that links to an internal temperature sensing node. (On the Arduino Mega boards, the pin will be a different one) Read about it more here. I’m currently just using an old ATMega168 which doesn’t seem to have that capability, so I haven’t tested it. It appears that the sensor is noisy and uncalibrated, but it might be useful in some applications. When I dust off one of my more recent boards, I’ll give it a try.

Okay, time for breakfast.

Using a 1N4148 diode as temperature sensor…

I had an application where I wanted to detect temperature. No big deal, lots of good temperature sensors exist. But of course, I don’t have any of those. Rather than order something from sparkfun, I thought I’d just try to see what I could do with the stuff I had on hand. What I had on hand was about 100 1N4148 diodes that I got for about a penny a piece.

The idea is that the forward voltage of diodes is temperature dependent. For every degree Celcius the diode increases, the forward voltage should drop by 2mV. So, I decided to test this idea. I configured the analog input pin 0 on my Arduino to be an input, and then activated its internal pullup resistor. I then wrote a program which averaged a bunch (1000) of readings in an attempt to get a stable, relatively noise free signal.
I logged the values beginning at room temperature, then held the diode between my fingers, and then released it a couple of times. Here’s a graph of the resulting data values:

You can see that when I grab the diode, the forward voltage drops rather quickly, but when I release, the signal returns to the original value, somewhat more slowly. Room temperature in my house is around 70 degrees (21 degrees C) and body temperature is 98.6 is about 37 degrees C. The difference would then be about 16 degrees C, and we might expect a difference of 32 mV, but I experienced a difference of only about 16mV. At least part of this can be attributed to the fact that your finger temperature isn’t actually that close to 98.6.

This simple experiment demonstrates a couple of problems: the values returned by analogRead() are noisy, and quantization error is significant. The analogRead call returns a 10 bit number, which means that each bit is about 4 mV, or about 2 degrees C. We could use an operational amplifier to multiply the voltage to make it easier to read, which might help. Consider that an experiment for the future.

A cool little computer: FIGnition

I keep looking for cool projects where people build small computer and microcontrollers, more or less from scratch. Today, I ran across FIGnition:

FIGnition is a £20 educational DIY computer which works like an 8-bit home Micro: outputting to composite video and ready to be interactively programmed from the moment you switch it on. It has  8Kb of RAM; 384Kb of storage; an 8-key keypad and runs a variant of FIG-Forth. It uses USB for power; firmware upgrades and program downloads.
via fignition – Libby8dev

Very cool little Forth-based computer, using at ATmega168, a small 8K serial RAM and an SPI flash memory chip. You can either buy a PCB board, or you can assemble it on strip board. Lots of good ideas!

A Low Power 477Thz beacon

I mentioned that Roger, G3XBM was shifting from the very low frequencies to much higher frequencies. His interest has already uncovered some links that I hadn’t seen before. One very cool thing was his discovery of a local 477Thz beacon (that’s red light) that is aimed roughly in his direction at a distance of around 30km. The beacon is the work of GB3CAM, and uses ten 10mm red LEDs, running with about 400mw DC power input. What a cool idea! The entire circuit consists of a PIC processor and an XR2206 monolithic function generator.

Check it out!

It appears that the UKNanowaves group on Yahoo! is a pretty lively group. I’ll be watching this closely.

Arduino PPT Solar Charger

A conversation I had recently got me on the topic of solar energy, and introduced me to something I hadn’t heard of before: maximum power point tracking. The basic idea is solar cells exhibit a complex non-linear relationship between illumination, temperature and resistance. This is usually represented by an curve that (for a given temperature and level of illumination) shows the relationship between current and voltage. Let’s swipe the diagram from wikipedia:

To maximize the transferred power, we want to maximize the power of the solar cell. This means operating the DC/DC converter at the particular point along the I-V curve where the area under the rectangle is maximized. Tim Nolan has designed a pretty cool circuit that when combined with an Arduino can do precisely that:

timnolan – Arduino PPT Solar Charger.

The details of the design are a bit beyond me at the moment (I’ve studied it for about 20 minutes) but the basic idea is to sample the voltage (via a voltage divider) and the current (derived from the voltage drop across a very small current sense resistor, amplified by an op amp), and then use the PWM capabilities of the Arduino to serve as a switching dc/dc converter. Very neat little circuit. I’ll study it more in the future.

Codec 2 at 1400 bits/s from David Rowe

I’ve mentioned Codec 2 a few times in the past, but for those who don’t rememember, David Rowe has been working on a very low bitrate codec optimized for speech applications. This is of interest in amateur radio because we don’t have a suitable speech codec which isn’t patent encumbered (if for instance, DSTAR’s AMBE codec was not encumbered by patents, we could create open source versions which would be compatible with the DSTAR network).

David just announced that’s he’s got the codec down to 1400 bits per second. Check it out: it sounds pretty good.

Codec 2 at 1400 bits/s « Rowetel.

Even if you are’t interested in amateur radio, there are reasons to think this might be useful. David says that:

  • At 1400 bit/s you can send 45 phone calls in the same bandwidth required for a standard 64 kbit/s phone channel.
  • 1400 bit/s is 175 bytes/second
  • A 30 second voice mail can be stored in 5250 bytes
  • A 30 minute pod cast can be stored in 308 kbytes.

Very cool.

A nifty partition of 1..16

Courtesy of Phil Harvey’s Puzzle « Programming Praxis, I discovered that the numbers from 1..16 can be partitioned into two 8 element sets, with these nifty identities!

2+3+5+8+9+12+14+15 == 1+4+6+7+10+11+13+16
22+32+52+82+92+122+142+152 == 12+42+62+72+102+112+132+162
23+33+53+83+93+123+143+153 == 13+43+63+73+103+113+133+163

There has to be a good way to use this to make a cool geometric puzzle as well.\

Bonus: Are there any other values of N such that the numbers from 1..N can be split into two sets, each of which have the same sum, sum of squares, and sum of cubes?

Spoiler: Yes, there are.

ANGST: the Arduino n’ Gameduino Satellite Tracker

I’ve stopped hacking on my Arduino/Gameduino satellite tracker for now. Here’s the final video demonstrating it running:


I’m currently working on the final schematic which will be posted on this permanent page. The code will be available github.com, for right now, it includes the library that I wrote that does the satellite prediction. I’ll be updating the code sometime later this week.

If you take it and use it, let me know: it will motivate me to do more with the code.

JeeNode v6 Kit from Modern Device

I’ve been playing a great deal with Arduinos lately, and have acquired a couple of Xbees to experiment with wireless. But Xbees, cool as they are, are kind of expensive for many tasks where a much simple RF link could suffice. Today, I ran across the JeeNode, which is available as a kit from Modern Device for just $22.50, and that includes a 915Mhz RF link. You’ll need an FTDI cable to program it, just like any other low cost Arduino. Pretty neat!

JeeNode v6 Kit | Modern Device.

Xv6, a simple Unix-like teaching operating system

I like operating systems. My first exposure to Unix was a revelation. Unix was a complex operating system that provided useful facilities for programmers, and it wasn’t written in assembler and locked away: it was written in C (the same language that you use to write ordinary programs for Unix) and it was understandable.

This was enhanced by The Lions Commentary on Sixth Edition Unix. It’s a brilliant commentary, clearly describing the source code for the Sixth Edition Unix. It filled a gap in the practical learning of operating systems for a generation of students.

But, well, it’s aging. It’s hard to use the Sixth Edition code, because it’s written for a PDP-11, in an archaic dialect of C, and well… we can do better.

Luckily, that’s what MIT thought too. They created an ANSI C version of the Sixth Edition Unix, compiled it for the x86 architecture in a way that could be run under the QEMU or BOCHS emulator. Here’s the page:

Xv6, a simple Unix-like teaching operating system

It’s less than 8K lines of C, under the MIT license. Seems like the kind of thing that could prove useful: bookmarked for future perusal.

VK3YE’s USB port powered 40 metre milliwatt transmitter on air

I was looking for beacon circuits, and ran across VK3YE’s USB powered 40m transmitter. Unlike most simple beacon transmitters, this one transmits double sideband, which makes voice transmission possible. I like the basic idea!

USB port powered 40 metre milliwatt transmitter on air – YouTube



Very cool. He’s also got an awesome awesome YouTube channel, with over 180 vids uploaded. Lots of good information on crystal radios, homebrew, and low power operation. Snoop around! I was particularly intrigued by this video showing low power SSTV operation:



KD1JV on boost and buck converters implemented with an ATtiny13V

Legendary QRP hacker Steve “Melt Solder” Weber has some awesome stuff on his website, particularly if you are interested in homebrew ham radio gear.   (Indeed, it appears he’s about ready to offer his legendary ATS-4 5 band rig kits again, experienced kit builders might want to check it out.)   But what drove me to his website this morning is quite clear exposition of buck and boost voltage converters in PDF form. Remember my ATtiny13 powered Halloween pumpkin? It was inefficient: about half of the power consumed in the circuit was simply lost as heat in the current limiting resistor. Had I read Steve’s exposition a month out from Halloween, I might have tried to do better.

Here’s the relevent circuit cribbed from his PDF:

Pretty simple! A couple of things to note: the NDT2955 is a logic level P type MOSFET, which turns fully on with a gate threshold of just 4V. Readers may remember that my own experiments with the IRF510 didn’t succeed in some small part because the IRF requires 10V to switch entirely on. Secondly, the ATtiny13 is powered directly from a 6V supply, through two diodes. These are there simply to drop the voltage to the 5.5V level which is the maximum safe amount. The ATtiny13V is very forgiving on voltages, and can operate all the way down to 1.8V, long after the batteries will have given up the vast majority of their power.

I’ll try to work through the equations and design a similar driver for my 1W Cree LEDs. To build it, i’ll need to come up with an appropriate MOSFET. Stay tuned.