Wednesday, September 26, 2012

Review of $3 eBay PIR Motion Sensors

 I was recently shopping for some bulk components on eBay, when I discovered one of my regular sellers was carrying PIR motion sensors for $3. I expected them to be junk, like most things on eBay that are just too good of a deal to be true, but for less than $6 I figured it wouldn't hurt to play with them for an afternoon.
I was pleasantly surprised with how sensitive these are. As demonstrated in the video below, these sensors can detect normal human motion in a room fairly reliably.  This was not at all expected.  Now I've got a couple project ideas, which I might eventually get to.

Review Video:


As I tried to explain in the video, PIR (Passive InfraRed) motion sensors operate on the principle that humans are a very different temperature than the room around them.  By taking an average of the IR temperature of a room, the motion sensor is able to detect when a human enters the room, or moves in the room, by the change in the average temperature.  On the other hand, the sensor does have to allow for very gradual changes in ambient temperature, since over the course of a day, a room will naturally change several degrees. Move slow enough, and you can hide yourself in this ambient thermal noise. Depending on how good the motion sensor is, this may be inhumanly slow.

The modules were very easy to wire up. 5V between the two labeled power pins, and the middle pin sends out a positive 3.3V pulse on detected motion. The smaller module has a fixed sensitivity, where the larger module has two adjustment pots, but the out-of-the-box settings on it were perfectly functional.  Both sensors seem to have a field of view fairly close to 180 degrees; I didn't bother trying to measure it, since you would typically install this in the corner of a room.

Simply searching eBay for "PIR motion sensor" yields dozens of eBay sellers selling these exact modules.  So who else is now thinking about adding motion sensing to all the projects?

Thursday, September 20, 2012

Geode - Adding an Accessory Power Connector

After recently getting Debian running on my National Semi Geode box, I quickly found the two USB ports on it a little limiting. Like any normal human being, I could just plug in a powered or unpowered USB hub, have my extra ports, and be done with it.  I instead opted to go through the effort of getting a spare USB hub I picked up for $2 at Weird Stuff running on it, which is fitting, since they're both USB 1.1.  It's an interesting USB hub - it was originally designed to be installed in a tower's floppy drive, exposing 5 USB ports on the front panel, and was powered by the standard floppy drive power connector.  It also originally used a custom cable for the USB uplink (which was of course long gone), but the PCB has the pads for a USB B connector, so I soldered that on.
The power supply inside this Geode box is about what you'd expect from a thin client; a modular power supply for 5V and 12V, with a single cable feeding that to the motherboard.  Since this box wasn't designed to ever have any sort of accessories powered by it, it had no need to suffer the added expense of following the ATX standard of a 24 pin motherboard connector and a multitude of extra power connectors for possible accessories.  However, this power supply was at least kind enough to follow the standard color code for computer power supplies:

  • Ground - black
  • 5V - red
  • 12V - yellow
This is all you need for the floppy power connector, so we're in luck.
Solder some wires to the underside of the power supply PCB.


And feed it out through some vents in the box. I salvaged the floppy power connector from a spare ATX power supply I had laying around my (currently very chaotic, post-move) apartment.

The choice application of some telco lacing cord, and some mounting foam tape to affix the hub to the side of case, and I've got a decently patched up solution. Since it's all USB 1.1, it's slow, but this is going to be my apartment's http server (where the bottleneck is my upload bandwidth), and my print server (so pages will print out slightly slower), so the cost of USB 1.1 isn't too prohibitive.

Saturday, September 15, 2012

Booting Linux on a National Semi Geode

 More than a year ago, I bought this "Acute Technologies" thin client at the De Anza flea market for $5.  I poked around with it a little bit at the time, but couldn't get it to do much, assumed it was DOA, and tossed it in one of my parts boxes.
 I recently got an itch to work on a new project for a while, so I pulled this out again to see what I could make it do.  I found this thin client really intriguing because it has the perfect circa 2004 mix of I/O; 2 serial ports, a parallel port, two 1.1 USB ports, and 100bT Ethernet.
The other thing I found really interesting about this box was the fact that it was powered by a National Semiconductor branded Geode processor. The Geode had a very short-lived life at National Semi before being bought by AMD and spending the rest of it's days as AMD's low-power x86 core (Which was originally going to power the OLPC project before that project turned into a cluster, for a variety of reasons), so seeing one in the wild and getting it running was an interesting challenge.
For some reason I can't explain, having left it in a junk box to ferment for a year, it happily booted from it's ROM.
It unfortunately runs Windows CE as a RDP client. RDP is a proprietary Windows protocol which seems not to have such good Linux support. Luckily, in addition to being an RDP client, this ROM also includes... a web browser...
Of course, their website is the default homepage, and is long gone.
But it really does work. Amusing, and it does make an honest effort rendering modern websites, but a 300MHz 64MB dumb web browser isn't particularly useful to me at the moment, or exciting.
As for storage, this has a daughterboard with two NAND chips and a controller on it, with a 44 pin connector which I didn't recognize right away.
After following some of the traces, and pondering on the subject for a few days, I realized that this is a 32MB SSD using the standard 2.5" IDE connector.  Traditional 3.5" IDE/PATA is a 40 pin connector, plus the four pin Molex power connector standard in computers before SATA and PCIe showed up and complicated matters. The 2.5" IDE spec is identical, except designed for laptop hard drives; A 2mm pin spacing instead of 0.1", and an extra four pins at the end (41-44) for power and ground.

Conveniently, finding media with >32MB of storage with a PATA interface isn't particularly challenging. I have plenty of 2.5" IDE drives, but the most attractive option was to use a CF card. CompactFlash cards use a 50 pin interface, which supports a mode which is signal compatible with PATA. This is why you can get adapter cards from CF to IDE on eBay for $3; they're just two connectors and a voltage regulator.

Of course, right-angle female 2.5" IDE to CF adapters only come in one orientation. Any bets on which direction it is? Thaaaat's right - the wrong way.  The power supply prevented it from fitting, so I de-soldered the 2.5" IDE connector, flipped it, and jumpered everything back into place.
With the addition of a 256MB SDRAM stick to upgrade the stock 64MB, and we're cooking with gas here.  Lots of time spent on trial and error found that pressing F1 at just the right moment caused the thin client to PXE boot off the network. I already install Linux on all of my systems using PXE, so all I needed to do was tell it to use the x86 installer instead of the 64 bit installer, right?

Would you believe that the Ubuntu installer requires a 686? They call it x86 or i386, but no, you MUST have a 686 to boot Ubuntu.  Would you also believe that this ancient Geode processor is only a 586.  The Ubuntu installer somehow manages to use some instruction set which makes the difference between the 586 and the 686.  This seems kind of silly, because pretty much every revision of the x86 since the FPU migrated on-chip on the 486 has just been proving exactly how complicated you can make a CISC, but bloat does seem to be the Ubuntu way these days...
Reverting back to the ever-dependable Debian did the trick.  Debian 486 network installed and booted on this bad boy just fine.  An 8GB CF card leaves me with a comfortable amount of storage.  The power consumption for this thing isn't amazing, but appreciable; 2.3W off, 6.6W on and idle, 9.2W full load.

I think I might use this system to replace my Chumby as my always-on server, since my 170W file server is a little expensive and loud to keep running all the time.  This thing has comparable specs with the Chumby, with the added advantage of an actual serious operating system (I am getting freaking tired of dealing with Busybox). 300MHz should be plenty to run my TFTP server, printer server, etc on my LAN.  Running my SLO print server off a National Semi x86 would be a nice compliment to the 186 running my parent's print server.

The one thing I'm stuck on now is this 80 pin unpopulated connector labeled PCI next to the power supply. Desktop PCI has more than 80 pins, but presumably this is for miniPCI. I'll need to do some more research on exactly what the pinout should be for an 80 pin PCI variant, and then bodge-wire in a useful expansion card.

For your amusement, I give you the contents of /proc/cpuinfo.  Notice how the flags for supported instruction sets is about a fourth of what you see in modern CPUs: