Computing stuff tied to the physical world

Archive for 2008

Rabbits

In AVR on Dec 21, 2008 at 15:56

Microcontrollers with attached RF transceivers are starting to multiply like rabbits around here:

2328FCA4-BD04-461B-942B-6DBE8DA17EA0.jpg

This is an Arduino Mini Pro with an RFM12B. The nice property of this combo is that the mini has on-board 3.3V regulation, which is the voltage required for RFM12B’s, and with a little tweaking of the FTDI connector the Arduino itself can be made to run at that same voltage. This avoids the need for level conversion.

That brings the total number of functioning RFM12B’s to four right now. Two have been in permanent use for monitoring energy & gas consumption for over a week now.

The other two, including this new unit, will allow me to further refine the software. A first advance has already been implemented: the receiver code is now interrupt-based, leaving the MCU free to handle other tasks at the same time.

Failure

In AVR on Dec 20, 2008 at 15:56

Failures are worth documenting too… here is one:

4DAFC86E-3DB0-4141-9797-402D7068F1B8.jpg

This was intended to become a general-purpose 868 MHz wireless solution: a low-end receiver + transmitter from Conrad, alongside an 868 MHz RFM12B which is likely to become my workhorse module. The receiver + transmitter are compatible with the FS20 wireless remote protocol, and allow listening as well as controlling these devices.

Well, most of this stuff didn’t work once hooked up. For various reasons actually – from bad sensitivity to using the wrong module (turns out that RFM12 unit was in fact for 433 MHz, doh).

In an attempt to salvage this thingamagic, I decided to replace & rewire the whole thing. It is now a 433 MHz receiver + transmitter, and an RFM12, also working on 433 MHz. The whole has been put aside for now, but maybe one day it can be made to work with some 433 MHz stuff, such as this or some cheap weather sensors.

Due to the switch to a lower frequency band, all three antennas are now 17 cm long wires.

The microcntroller is an Arduino Nano, btw. This is a 16 MHz 5V unit with a mini-USB port.

More readings

In Software on Dec 19, 2008 at 15:55

Here is the latest display showing on my screen:

7474AFF5-C9D3-4DA7-B5E3-492EE65C15DB.jpg

Updated in real time, with new readings coming in every few seconds for electricity and gas and every few minutes from the weather station (still sitting here in the office for now, so the values are bogus).

Different 868 MHz units

In AVR on Dec 18, 2008 at 15:54

Here’s a small but fairly general-purpose setup:

37DAF000-31B3-4F42-AAEB-F41E0851AF40.jpg

At the top right is the NSLU2, a very useful little NAS box with two USB ports plus Ethernet. It has been re-flashed to run a standard Debian Etch Linux system – using a 4 Gb USB stick plugged into the upper USB slot on the back. The other three connections are: ethernet, power, and an un-powered USB hub.

Plugged into the USB hub are three RF units – from left to right:

  • the RFM12B, hooked up to an Arduino Mini Pro
  • a simple 868 MHz receiver, connected to a USB Boarduino
  • the CUL plug, with its own ATmega and CC1101 transceiver

Each of these uses the same 868 MHz RF band, but with different transmission modes and protocols.

You’re looking at a micro-power 4-CPU cluster with a total power consumption of 3.5 watt. This is now a test rig for collecting various kinds of data.

This is not a mouse

In AVR, Hardware on Dec 17, 2008 at 15:53

The CUL is a small gadget which combines a CC1101 RF module with a USB-enabled ATmega processor in a very small unit:

AF108B36-7BA1-4902-AAB4-62917B0EEF16.jpg

So, yes, it has a tail and it plugs into a USB port, but it’s not a mouse. This thing can receive and decode messages from 868 MHz devices such as the FS20 home control unit, the KS300 weather sensor, and more. Technically, it could also send out such messages since the CC1101 is a transceiver, but apparently the 1.07 firmware isn’t quite there yet.

Switching stuff

In Hardware on Dec 16, 2008 at 15:51

Today, some simple “KAKU” remote switches came in. These are both by KlikOn-KlikOff – the first one is an older setup I was already using, with up to 12 different codes:

5178D8B8-5919-4468-89B0-B194DC94A909.jpg

The second is a newer model with up to 256 different codes – it’s heavily discounted (€14 for 2 units plus transmitter), probably because this type is being replaced by a newer model which uses unique unit codes:

47189E65-1B9A-4213-A21A-AE5585C20CFF.jpg

The drawback with both of these, as compared to the FS20 models by Conrad, is that you can’t control them at the plug – you have to locate the remote and press buttons on it. But then again, at these low prices per unit … you get what you pay for.

These units use 433 MHz signalling, there’s code for Arduinos which understands the KAKU protocol.

Energy & Gas Consumption

In Uncategorized on Dec 14, 2008 at 15:49

These last few days, a little application has been running here which tracks energy (i.e. electricity) and gas consumption in the house, in a little window of its own:

A3E7A251-C3E5-4ABD-868E-D522D66731D3.jpg

That’s 640 watt and 1.333 m3/hr. These values are normally updated a few times a minute. There are still some wrinkles in the software, such as the gas consumption not adjusting properly when the meter stops fully, i.e. when no pulse is received once the central heating turns off.

The following systems are involved in this setup:

  • some sensors and a transmitter based on an RBBB Arduino with an RFM12B
  • a USB-powered receiver based on an Arduino Mini Pro with its own RFM12B
  • a Linux server, i.e. a modified version of the Bubba/II NAS in this case
  • the Mac notebook I usually work on, though it could be anything really

Only the first 3 items above need to be always on, with a combined power usage of less than 10W. Every 3 seconds, sensor readings are transferred and stored on the server, using a trivial text format for now. This proof-of-concept setup uses rsync to transfer the log from the server to the notebook every 20 secs, so the above window isn’t yet as real-time at it could be.

But even with such a crude setup it is easy to keep an eye on consumption – and by simply switching appliances on and off one can deduce their approximate power consumption.

Better Mousetrap

In AVR on Dec 12, 2008 at 15:48

Now that RF transmissions work better, it was a small step to create a better house usage monitor. This one supports four sensors:

3E7468D6-0CFD-439D-91D9-8E41BAD8FB67.jpg

Only two sensors are being used so far (all sensor inputs are identical).

Sensor #1 watches the electricity meter rotations using the SY310 sensor:

CBCE0CCB-9B9B-4960-9F00-81FA934B304D.jpg

Sensor #2 is a QRD1114 which tracks a little mirror mounted on the last digit “0” of the gas meter:

87BF22D8-4722-46F6-A76B-2C3775CEEE14.jpg

The sensors were described in a previous post. Proper positioning turned out to be crucial, so there’s a fair bit of scotch tape to hold everything in place!

Good RF with RFM12B

In AVR, Software on Dec 11, 2008 at 15:38

Yippie. Got a simple blinking LED demo running on RFM12B’s after lots of head-scratching. Had to understand ATmega’s SPI mechanism to get there, but these two boards now talk to each other over the air, uni-directionally:

Good RF

That’s an Arduino Mini Pro (which runs at 3.3V internally, as does the RFM12B). Power comes from the FTDI cable, but with a special hack to drive the raw power input from it, not the default VCC connection. This way, the on-board 3.3V regulator is used to lower the voltage for both the MCU and the wireless module.

The other board is a bit of a mess, has the same Mini Pro, but some other stuff which is partly a left-over from earlier experiments:

Good RF

Here a USB interface is used to provide 3.3V power. It’s functionally identical to the first board: with RFM12B’s the same setup can be used as transmitter or as receiver.

The top board is the receiver – its picture shows the green LED on, i.e. correct packet reception!

The hookup is very simple, just 5 wires between RF module and MCU, and 2 power pins / 1 pull-up / 1 antenna wire on the RF module is all it takes. The 5 wires are standard SPI plus an IRQ line:

  • MOSI (MCU) –> SDI (RFM)
  • MISO (MCU) <– SDO (RFM)
  • SCK (MCU) –> SCK (RFM)
  • SS (MCU) –> nSEL (RFM)
  • PD2 (MCU) <– nIRQ (RFM)

It took some work to get the software working. The trouble with this stuff is that until you get both transmitter and receiver working properly, it all remains a bit hard to debug. And there are quite a few registers to set up on the RFM12B to make it do its magic.

But after some tweaking, the rfm12xmit and rfm12recv sketches for the Arduino IDE started working. First with bit-banged SPI coding, but then also with the ATmega168’s built-in SPI hardware. Which is nice, because all exchanges now take place at 1..2 MHz (i.e. 8..16 µsec per 16-bit command). All I/O with the RF module uses simple busy polling for now.

The RF range and quality of reception with the RFM12B is considerably better than my earlier 868 MHz AM setup. Packets now easily get across 3 layers of stone/concrete and all of them appear to be arriving properly.

Update – here’s the C source code for the xmit and recv sides.

Update 2 – the connections for MISO and MISO as listed above were reversed – many thanks to José Xavier for pointing this out. The text above has been fixed.

Wireless RFM12B Module

In Hardware on Dec 10, 2008 at 15:36

A new 868 MHz module came in today, which uses FSK as modulation method:

388C7E29-2302-4882-B86E-33B3CC8060AF.jpg

This is a tiny 16×16 mm RFM12B module. It contains a transceiver and can be connected with a 4-pin SPI bus plus an IRQ pin to send/receive bytes using interrupts. Documentation is a bit sketchy, but there are a few different code samples on the net.

This version is for SMD mounting (with 2mm pins, again). But it’s easy to add a few wires and use this in a 0.1” grid breadboard. The antenna used here is an 82 mm straight wire.

IR Sensors

In Uncategorized on Dec 8, 2008 at 15:35

Here are two new home-made sensors, improving on this one they will soon replace:

8CF78CD3-58D0-48C5-9A03-97A964CB0317.jpg

The top one uses a QRD1114 sensor, which produces an analog signal, whereas the lower one is based on the SY310 with a built-in comparator to generate a digital output. The intended range is around 5..15 mm, hopefully just right to detect the 0-digit reflector on the gas meter and the the rotations of the energy meter, respectively.

Both of these sensors are connected to a 3-wire audio jack cable: shield = ground, ring = +5V, and pin = signal. Both sensors use a 330..470 Ω resistor to drive the IR-LED and a second one of 10..100 KΩ as pull-up for the output signal.

Home Control

In Hardware on Dec 7, 2008 at 15:34

The FS20 system by Conrad is a simple RF-based set of modules to turn various appliances on and off. The transmitter looks like this:

E7ABA8B9-8392-407F-A9F8-226F4C0E230A.jpg

The most basic on/off remote control switches are as follows, shown with central European power plugs:

4CF33024-50D4-4DB4-A610-0A6087235D4B.jpg

They have an on/off toggle on the unit, which is a big plus over simpler units. The other useful aspect of these units is that they operate over the 868 MHz band, and that the details of the FS20 protocol are available. Several projects exist which can receive and/or transmit the corresponding signals.

Definitely not the most beautiful design, but hey, they get the job done…

Timer Interrupts

In AVR, Software on Dec 6, 2008 at 15:33

Here is some new interrupt-driven receiver code. This receiver is considerably better at identifying correct packets, regardless of what other bit patterns are coming in. The new code is based on a state machine which takes pulse times and gaps into account, detecting all valid sequences of pulse widths and rejecting all outliers. The main code is:

AA4D1C74-E3E3-41B7-BD67-90E432711496.jpg

Then, in the main loop, this code picks up the results:

EFC8BB55-ECC5-4553-9C8D-17CB1F9A92CC.jpg

Also, with an interrupt driven design the receiver no longer depends on timing loops and is free to spend its time in other logic. It is now possible to run multiple state machines in parallel, decoding a variety of different signal patterns.

Bad Reception

In AVR, Hardware on Dec 5, 2008 at 15:32

This is a USB Boarduino with an 868 MHz receiver connected to it:

A6EB094C-7303-4B2F-BC23-8568A44B55F1.jpg

The antenna is a short 82 mm wire. Just like the one used in this setup. Given the same software, it receives the same signals.

But somehow, it’s considerably less sensitive – so far this unit won’t pick up the (faint) transmissions from the energy monitor nearly as reliably as the first setup. It’s not a matter of noise signals, antenna placement, or any hardware differences (all physical variations give the same result). Must be moon phases, or something. I’m going to let it rest and focus on other RF options instead.

The original polling setup has been working fine for several days now, btw.

Contraption

In AVR on Dec 4, 2008 at 15:31

This watchamacallit is a hookup to the electricity meter downstairs:

89248D86-7166-454D-88C8-7C711912A943.jpg

It has a sensor concocted from an ultra-bright LED and a phototransistor, which senses when the black marker on the rotating wheel passes underneath it.

This sensor is tied to an RBBB Arduino which tracks and transmits the rotation count every 3 seconds on 868 MHz, using the previously created setup:

D73BA4B6-ECFD-4CE5-84F9-BDDDA6DD129F.jpg

The green transmitter PCB is in front at the top. The whole thing is powered by a 9V adapter.

To deal with quick rotations, the sensor is read out about 100 times per second, also during each 100 msec transmission. These were rough calculations and the transmissions no doubt have considerable jitter due to inaccurate timing. A timer- / interrupt-driven version will probably improve accuracy and transmit range. But for now this crude setup appears to provide acceptable readings.

This Tcl script saves the results to file on MacOSX:

2C7654DB-52CF-40EF-A4CC-D1B16FD14023.jpg

And this is an extract of that log file (showing roll-over and some missed packets):

41E4D41F-D6B3-4FA7-9FEC-9EA8277E47CA.jpg

The 94..97 values are the rotation count. This also shows that the log remains usable even when packets are missed.

Success @ 868

In AVR, Software on Dec 3, 2008 at 15:29

As expected, a lot of the bit-level reception problems with the 433 & 868 MHz wireless issues can be resolved with better packet framing and reception logic. Here’s part of the latest reception log, alll the way across those elusive 3 stone/concrete walls:

93E74FE4-4BB6-4209-A2EE-7700D52833DF.jpg

There are still times when proper reception stutters, but as long as reception recovers within a minute or so that’ll be fine for the purpose of low-rate data logging.

The send format now includes an old-fashioned SYN-bytes-plus-SOH header:

176528F4-75FD-4BB2-B7CA-5CF5EA7105A9.jpg

Reception takes a bit more code, here’s the basic frame reception loop:

86C83486-9950-4FB9-B4BE-8D5FB482ED49.jpg

And here’s the bit-level decoder:

23F292A5-C471-4C4E-A654-96D7A5E10263.jpg

The receiver + serial debugging code takes a mere 3208 bytes so far.

CC2500

In Hardware on Dec 2, 2008 at 15:27

The nice part of this transceiver by Ideetron is that it’s cheaper yet more advanced than the 433 & 868 MHz radio modules by Conrad:

5B1A8AD7-20F8-4ACF-8901-679A993B5432.jpg

I does have that awkward 2mm pin header, but Ideetron most generously threw in a few female headers for free.

This modules uses a CC2500 chip operating at 2.4 GHz. The interface is via SPI commands, which provides various registers to exchange data both ways. All the bit manipulation and byte synchronization is handled, and the communication is bi-directional, allowing for a packet-oriented design with positive acknowledgement.

Unlike the iDwarf kit there is relatively little sample software to get started with this module, so it will take more work to get this going. Having an on-board antenna just like the iDwarf and XBee and using the same 2.4 GHz frequency band, the range might again be insufficient to pass through a few stone walls, but that’s just guessing for now.

From 433 to 868

In AVR, Hardware on Dec 1, 2008 at 15:26

These are the 868 MHz modules from Conrad – receiver on the left, transmitter on the right:

5874AE0B-77D9-48C2-8B90-B01D31126300.jpg

Worked as straight replacements in the 433 MHz setup, but there seems to be some problem with noise. It got a bit better when the receiver was tied to an 82 mm wire as antenna (as shown), i.e. exactly 1/4 wavelength. And that funny transmit antenna wire/coil probably isn’t optimal either…

Still, a bit noisy, lots of spurious pulses, and only occasional CRC-valid reception. It looks like much of the problem is caused by the crude bit-start synchronization software. Needs more work, clearly.

iDwarf

In AVR, Hardware on Nov 30, 2008 at 01:06

The iDwarf system is a wireless 2.4 GHz radio module with an ATmega168 inside. The starter kit comes with two sensor nodes with built-in battery holder and one “hub” which interfaces to (and runs off) USB:

FF9594F6-CC35-447F-B154-1DA8EA2E60D2.jpg

The daughterboards showing on top are the actual modules, the rest is part of the starter kit, i.e. sensor node and hub interface boards.

Several software examples were included, with hex files ready to try. It took me a while to figure out that I had to also set up the fuse bits – as delivered, the 168 is completely empty:

5155AE0B-173E-4E88-BB6C-A065628E2F7F.jpg

And just changing some ’s to /‘s in the source was all it took to re-compile these examples from source on MacOSX (the actual radio driver code is linked in from a library, no source, though).

Having a fully programmable chip to customize, with over half of its memory free makes this a more flexible option than XBee’s, at about the same price.

First trials indicate that the range of these little modules is a bit limited. They didn’t maintain a connection across three layers of stone & concrete (floors / walls) – a hefty requirement, but all within a single home. Still, it’s impressive what a pair of tiny on-board antennas can accomplish.

Wireless at 433 MHz

In AVR, Hardware on Nov 29, 2008 at 01:03

This was an experiment to learn about low-power / low-range wireless communication using a 433 Mhz transmitter / receiver set from Conrad. The transmitter was tied to an RBBB board and accessed via an FTDI-USB cable:

22545025-0C64-4DBE-9519-A1CC31BB8891.jpg

The receiver was mounted on a proto shield with breadboard, on top of a standard Arduino:

F5812B9B-C1D7-41EF-AD8F-E66AC4BE54A1.jpg

The software for this requires some attention due to the crude communication system.

Basically, the transmitter is turned on and off by a serial bit stream, i.e. this is not FM or even AM, just the presence and absence of a signal. To make this work properly and get say 20 bytes of data across, you have to go through the following sequence:

  • turn on the signal for a few milliseconds so the receiver adjust its AFC (assuming it has one)
  • send a unique bit pattern so the receiver can synchronize to receive data as individual bytes
  • send the data bytes, i.e. the “payload”
  • send a 2-byte CRC so the receiver can verify proper reception
  • turn off the signal for at least a few dozen milliseconds to avoid hogging the radio channel
  • re-send the whole packet one or more times to deal with interference and collisions

Even then, correct reception is not guaranteed – that would require a transceiver setup with two-way acknowledgement.

Data is sent using Manchester code, a phase change trick which keeps the on and off times equal, on average. The signalling rate is only 1000 baud (i.e. 1 millisecond per bit) and even then the error rate is quite substantial.

The CRC is calculated via standard code from the avr-libc library. A little trick is used to simplify the code: when the two CRC bytes are appended in little-endian format, the receiver can calculate its CRC including these bytes and verify that the result is zero.

The C test code is in the download area – for both the transmission and the reception version. It uses busy loops for (rough) timing. An interrupt-driven version using one of the 168’s hardware counters would have been preferable, to generate a jitter-free signal and to be able to handle other tasks during reception.

The results indicate that the transmitter really needs an external antenna wire to cross more than a meter (!) or so of air. With antenna, the signal barely makes it through one (reinforced) concrete wall in the house, which is insufficient for my purposes, but an 868 MHz version will probably overcome this limitation.

Interface Woes

In Uncategorized on Nov 25, 2008 at 00:59

Ouch. It looks like there are two different Arduino Mini Pro’s around – a 5V @ 16 MHz and a 3.3V @ 8 MHz version. I thought I had the latter, but a quick check tells me otherwise. Which is no good when you’re trying to hook up 3.3V modules that do not tolerate 5V levels!

Oh well, just order the right one and wait for it to arrive…

Meanwhile, here’s another kind of impedance mismatch:

AA303983-E727-4ADA-BC8F-FB6F93F40E20.jpg

The obnoxious 2 mm vs. 2.54 mm pinout. Yuck.

Sequential Clock

In AVR on Nov 24, 2008 at 00:58

Here’s a little clock project with a twist – it displays the current time on a single large 7-segment LED display, by briefly showing each of the digits one after the other.

[youtube=http://www.youtube.com/watch?v=V6v_k74JX1s&hl=en&fs=1]

Note the transition from 12:20 to 12:21. The little red blinking light at the bottom is the actual DCF77 radio signal, one pulse each second, with a long/short duration to encode each bit.

This project uses a Boarduino as brains, a DCF77 radio receiver, a large Kingbright 7-segment display, a 2981 LED driver, a bunch of 470 Ω current limiting resistors (1K for the decimal point), and a 6..12V DC power supply:

7FCA442F-4941-4FE3-83D7-165DDDF08616.jpg

On the left are the power plug and 5V regulator, on the right of the Boarduino you can see the reset button, 2×3-pin ICSP header, and 6-pin header used for programming with a USB-FTDI cable. On the far right is the 2981 chip used to drive the LED segments with 8..14V.

The radio print is soldered directly to the Boarduino (digital I/O pins 2..5) in such a way that the reception antenna with L/C circuit fits is snugly between the radio print and the display module. For simplicity, the radio’s +5V and ground are also provided by the Boarduino via digital I/O pins – they are fixed on startup as “1” and “0” outputs, respectively.

I used wire-wrap wire to make the connections because it’s so thin and solders very easily:

B90EEE26-03CD-4A1C-B5BB-6941278B450C.jpg

One nice software gimmick is that the clock starts by displaying a personalized greeting, since this project was made as birthday gift for a friend. Once the proper DCF77 radio signal has been decoded, the display switches to showing the current time; this usually takes two to three minutes after power-up. The clock will continue to run on its own with ≈ 0.5% accuracy in the absence of valid radio signals.

The C source code can be downloaded here. It decodes the DCF signal and encodes / drives the 7-segment display in a continuous loop.

ZIF-ICSP

In AVR on Nov 23, 2008 at 00:56

Several times now, I had to use an Arduino board to program an ATmega chip via the ICSP socket (to change fuse bytes or to set up / change the bootloader). Which works fine, but at some point the IC socket is probably going to wear out.

So I made this ZIF-socketed board, just for ICSP programming use:

1A90CF83-C68E-4668-9253-2807033D872B.jpg

The LED and 16 MHz resonator are not strictly needed, but this way the board also lets me run a test program at full speed and report its status via the LED.

XBee Adapters

In Hardware on Nov 21, 2008 at 00:55

Apart from the XBee shield, there are several other options to hook into that module with its non-standard 2-mm connector.

The simplest is a little breakout board which brings things back to “normal” 2.54 mm PCB units:

E7BB993A-F73F-4F65-BF0A-F433463AA494.jpg

Next up is AdaFruit’s adapter which connects to an FTDI cable or plugs into a breadboard:

E3660697-2BFA-4E23-B5A7-50762746D780.jpg

Finally, there is the Xbee Explorer USB which ties it directly to a slave USB port:

9610D76F-4ED5-4409-BDB9-B5C8E417C10B.jpg

The adapter is probably the most convenient to embed and to use stand-alone, since it does all the voltage regulation and conversion in a simple package.

Raven

In AVR on Nov 19, 2008 at 00:54

The AVR Raven is an interesting successor to the AVR Butterfly. It has two ATmega processors on board, one drives an advanced transceiver for wireless use. This explains the double set of ICSP/JTAG headers:

F2777F55-E2C1-4AFE-AF6A-20CF6DD1A424.jpg

Haven’t had much chance to play with it yet, other than to verify that the Ravens and the USB-stick base station work (current software requires a Windows server).

Mini Pro

In AVR on Nov 16, 2008 at 00:53

The Mini Pro Arduino (specs) is another way to embed an ATmega168 processor:

A3B2E20D-0457-4B1E-B1D4-FFB39FF4ECF1.jpg

I added the pin headers, though one could also use this as a very flat embedded module by wiring directly to the circuit pads.

This one runs at 8 MHz and uses a 3.3V regulator (which means the I/O pins are also at that level). It’s not a kit, due to the use of SMD components.

USBtinyISP

In AVR on Nov 14, 2008 at 00:51

The USBtinyISP is a kit for a USB-connected AVR compatible ICSP programmer:

D1FE8EDE-CE2E-4C59-9DB1-F01E30160FE7.jpg

On the left are two cables, with 6-pin and 10-pin ICSP plugs, respectively. Inside is a pre-programmed ATtiny chip plus some level converters for use with 3.3V hosts (do need to remove a jumper for that).

Built into avrdude by using the “-c usbtiny” option. No need to specify port or baudrate (unlike some other programmers). To make this the default programmer, I added this line to my ~/.avrduderc:

        default_programmer = “usbtiny”;

This little device works really well.

Arduino on Lithium

In AVR on Nov 13, 2008 at 00:50

LiquidWare has a Lithium Backpack which goes underneath an Arduino:

F074CFE8-38C4-4C26-8E77-102853E17928.jpg

It needs two wires to feed the regulated 5V power + ground lines directly into the Arduino (I could have also connected them to the ICSP header). The switch on the battery board which is just visible in the lower left corner let’s you select between using and charging the Li-Ion battery.

Which is good, given that Lithium batteries can be a bit, ehm, finecky to deal with…

[youtube=http://www.youtube.com/watch?v=dOMfdH76oi0&color1=0xb1b1b1&color2=0xcfcfcf&feature=player_embedded&fs=1]

Pololu 3π

In AVR on Nov 12, 2008 at 00:47

Pololu produces the robot, with two independently driven wheels plus ball caster, an ATmega 168 for smarts, and on-board power that allows it to autonomously move around. The 3pi comes pre-assembled, and is smaller and much more maneuverable than the Asuro kit I built recently.

There’s an impressive intro on the Pololu site:

The nice thing about the 3π is that it is fully Arduino-compatible and that it comes with two nice programs, for advanced line-following and maze searching, respectively.

So I set up a little track in a drawing program and printed it out, taping the 3 x 4 pages together to create a little track. Unfortunately, I couldn’t get 3π to successfully follow the line; perhaps the printed inkjet ink does not have sufficient contrast for its infrared eyes? The robot only barely follows the line, and goes off track into a spin all the time.

I will need to create a better track with black tape one day, as suggested on the Pololu site.

Still, this was very educational. I found out about proportional–integral–derivative (PID) controllers, and how they help create feedback-based control loops that push mechanical systems to their limits without overshoot or erratic behavior.

Update 2008-11-29 : indeed, with black masking tape 3π works just fine!

XBee shield

In AVR, Hardware on Nov 11, 2008 at 00:46

Here’s an Arduino shield for the XBee wireless 2.4 GHz module (v2, as kit from NKC Electronics):

1210A577-DF1B-4397-A0C1-AD1F36E86F86.jpg

I haven’t been able to find the hardware schematics or board layout, looks like it’s proprietary…

If you look closely, you’ll see that the board underneath it is a new Arduino Duemilanove, which auto-senses power between the plug and the USB port.

Nunchuk

In AVR on Nov 9, 2008 at 00:45

The Wii Nunchuk controller is really just an I2C device, with a triple-axis accelerometer, an X-Y proportional joystick, and two push buttons. Breaking it out of its case allows us to connect it in ways it was never meant for:

EC19CAFA-DD22-4B24-8A54-DD7B726365D1.jpg

It’s very easy to hook up to an Arduino and there’s a good example on the web to read out all the sensors. I’ve tweaked it a bit to use pins 8 and 9 as the I2C/TWI interface.

Connections above are as follows: red = +3.3..5V, white = ground, green = SDA, yellow = SCL.

Boarduino & RBBB

In AVR on Nov 7, 2008 at 00:44

The Boarduino is an Arduino clone intended for use on a breadboard (the picture below is from another project):

DE0B0236-5C25-4581-86F3-7C78A4DC152E.jpg

There’s a DC version with an FTDI connector for programming (shown above), as well as a USB version (which powers and programs the board). Since there is an ICSP header, I decided to leave out the IC socket from this kit.

The Real Bare Bones Board (RBBB) is an even lower-end version. It’s smaller than the Boarduino and omits the ICSP header:

82E0DC14-A626-4ECD-BC8E-D577F4089A66.jpg

Due to its low cost as a kit, this would be a great option for permanent embedded use.

Butterfly

In AVR on Nov 6, 2008 at 00:43

The AVR Butterfly is a cheap demo board for the ATmega169V with on board LCD, sensors / switches, and RS232 interface:

B8B516FA-7F69-4405-94A7-11585FCEB0AC.jpg

I added the RS232 and ICSP headers to be able to boot-load and re-program it, and successfully tried Forth on it.

Asuro

In AVR on Nov 3, 2008 at 00:42

Asuro is a simple robot, which I ordered as a kit from Conrad. The mechanical construction is entirely based on an epoxy board which also holds the electrical circuit. The brains consist of a C-programmable ATmega8, the older 8 Kb version of the 168 chip used by Arduino’s.

Here’s the result of a few hours of tinkering:

03BE6F57-ECD4-46E9-A9A5-72F116770B40.jpg

Another cost saving feature is the IR-link, which can be used to re-flash the program. It does require line-of-sight to function, and has a limited range of 1 to 2 meters as far as I can tell:

IMG_2617.jpg

The above image shows the RS232 serial board that came with the kit. I must have made a mistake while building it – because it didn’t work. Luckily, I had also ordered the ready-made USB version, which works fine.

The test program pre-loaded into the Asuro activates all elements (LEDs, front switches, motors) as a way to test proper operation of each of them. It was most useful to chase down and resolve a few small build problems. There are photo-sensors which can be mounted underneath for line-following, but I chose to add some connectors for a prototype board instead. The reasoning being that these sensors could always be added back via such a prototype board.

So, does it work? I can’t really tell.

I couldn’t find any ready-made programs to make it do anything robot-like such as driving around and dealing with obstacles, or light-seeking/-evading behavior. And it’s clear that any form of intelligent control will require some serious programming and testing. Besides, the motors were very noisy and coarsely controlled, so I doubt it really can do things with any level of grace…

But I had a good time building this thing, and learned quite a bit about what it takes to make a little autonomous robot.

Minty Boost

In Uncategorized on Nov 1, 2008 at 00:39

Intrigued by LadyAda’s description of the Minty Boost kit, I ordered and built one. It delivers a stable 5V supply from 2 AA batteries to a USB plug, so you can use it to charge/power USB devices.

7BAF910A-D457-4B2E-B5AC-4C05E1587D3C.jpg

Trivial to build and works as advertised.

Garage LED

In Uncategorized on Oct 31, 2008 at 00:37

Solder fumes, ahhh that brings back memories…

Today, I built a little ultrasonic sensor to help me park the car. Took the easy way out and just purchased a simple kit from Conrad:

7E98E6D9-A151-4DF0-8C3F-95B5087BB95A.jpg

Now, instead of driving the car up to the point where some cardboard boxes leaning against the wall move, and then backing up, I can drive until a red LED comes on, and then, ehm… back up ever so slightly until the LED goes off. Progress!

Well, at least it gets rid of the old cardboard junk I was using as “bumper”.

Arduino

In AVR on Oct 25, 2008 at 00:32

Fascinating: the AVR “ATtiny” and “ATmega” chips from Atmel can be programmed in standard C and C++. The chips cost a few Euro each, the compiler is gcc, and there’s a ready-to-run package for Mac, Linux, and Windows. There’s even a low-cost standardized hardware platform, called Arduino. It’s all open source, software as well as hardware designs.

Here’s the Nano version (specs), with on-board USB, ready to be plugged into a breadboard:

AD3A91CD-9920-49B2-A217-A8DDBC86A99B.jpg

Wow. Low-end computing sure has come a long way.