Monday, March 24, 2008

Demo day, and our final enclosures

The transmitter, connected to my pink iPod.














Our awesome on/off switch.














An overhead shot of the transmitter. In the bottom left you can see the XBee radio chip. On the middle right, partially obscured by tape, you can see an Atmel AVR Butterfly. On the bottom is the headphone jack.














One of our receiver units. It has the same I/O as the transmitter - a power switch and a headphone jack.














The inside of a receiver. You can see the blue XBee radio chip, a Butterfly, and in the top left corner of the breadboard, a DAC chip.














Our "mobile" receiver. Inside the backpack is a receiver identical to the one in the above photos. The only addition is some cheap powered speakers.














A receiver, hidden inside the backpack.
















Next, some pictures from the Senior Project Expo, taken by our friend Manish. You can see his group's project at http://abstc.blogspot.com/

Kevin (in the red shirt) explains our project to someone.













Toviah (on the left) stares wistfully at Kevin as I (in the middle) contemplate life.













Toviah explains our project as I look on.













I explain our project to onlookers.

Saturday, March 8, 2008

Remaining tasks

1. Construct a second receiver to demonstrate point-to-multipoint network somehow. We need more wire jumper things and we can't find the damn things
2. Make fancy enclosures for our units
3. Try to fix the popping noise
4. PowerPoint presentation
5. Minor code improvements. Mostly power consumption-related, such as disabling the extra ADC pins and the Butterflys' LCDs

Current state

The changes we made took quite some time to figure out, even though they're actually very simple things. But regardless, the result is a working project.

Transmitter



The iPod connects to a headphone jack, which connects to the ADC pin of the Butterfly. Then bits go flying out of the XBee! The MAX232 level converter is not really visible (it's obscured by the white cable).

Receiver



That hideous jumble of wires is a "bus" from the Butterfly's PORTD to the DAC. The DAC output voltage is connected to the headphone jack, which connects to our speakers. You can't see the battery unit in this picture, but it's the same as the transmitter's: 3 AA batteries. Surprisingly, the receiver can run everything off of 4.5V, including the DAC (5V nominal), speakers (7.5V nominal), Butterfly (3V, we only use two of the batteries for it), and the MAX232. Even then, it only takes something like 100mA to operate. The transmitter is as good or better. We've run the units for hours and they still have not exhausted their first set of batteries.

Audio quality is what you would expect with 8 bit samples at ~8,800 Hz. But it actually sounds pretty decent, if I do say so myself. We even have a lowpass filter set up on the input to the ADC pin on the transmitter. We tell ourselves we can hear a difference.

Range seems to be around 30 feet.

The cool thing about this project is that it's digital information being transmitted. This means that we can do all sorts of stuff other than streaming audio.

Thanks to Scott for the pictures. I should've done a better job of choosing pictures from the set for this post.

An update!

Well, a lot has happened since our last update, so I'll try to split it up.

ADC
Originally, we were using some ADC code we found on AVR Freaks. This code did single conversions, which is fine for some applications but obviously not for streaming audio. So instead we put the ADC in interrupt-driven mode and used the "ADC conversion complete" interrupt as its trigger. This is known as free running mode, and it improves the ADC's speed from 25 cycles/conversion to 13 cycles/conversion. Previously, we were using a timer to read the contents of the ADC at regular intervals (8,000 Hz). That was stupid. It resulted in lots of duplicate ADC readings because we would read the ADC output register several times between updates.

We chose a prescaler for the ADC clock that was around 8,000-9,000 Hz. That turned out to be Fcpu/64. When trying to decide on a prescaler, we mistakenly thought the frequency we were registering on our multimeter was the frequency of the ADC, and we were confused as to why it was half what we were expecting. Then we realized that it was because we were checking the frequency by watching a pin toggle each time the interrupt was triggered. It's an obvious mistake and not really worth explaining. Incidentally, it turns out the ADC tops out at around 11,400 conversions/sec when doing 8 bit conversions (slower when doing 10 bit).

DAC
First off, we got the DAC. That's pretty important. Other than that, it's a very straightforward component: send it parallel digital input (12 bits max) and it spits out analog. It can work transparently, which makes things very easy.

The receiver unit receives digital info from its XBee and places it in a circular buffer, which is currently 512 bytes for no particular reason. It also has a timer that plays samples at roughly 8,800 Hz, then deletes that sample after playing it.

With a little tweaking, we got the timer on the receiver to fire at approximately 8,800 Hz, which was about the rate the transmitter was sending at. Unfortunately, any slight difference between the transmitter and receiver rates results in a perpetual popping noise. This is because the two units will inevitably go out of sync and the receiver's buffer zeroes out.

One solution would be to make the DAC not zero out the buffer. Then the popping noise would not be as noticeable, although it isn't really all that noticeable to begin with. Otherwise, we would just have to tweak the clock seed until the receiver's speed is close enough to the transmitter's speed that the popping is not very frequent. I don't think it can be eliminated entirely.

Thursday, February 28, 2008

Breakout Board Order

8 x 2mm 10pin XBee Socket (SKU#: PRT-08272) = $10.00
4 x Breakout Board for XBee Module (SKU#: BOB-08276) = $11.80

Sub-Total: $21.80
Shipping & Handling: $3.30
Grand Total: $25.10

Total project cost so far is $426.28.

XBee Order

3x XBee Series 1 at $19.00 each = $57.00
4x thermistor at $0.13 each = $0.52
4x thermistor at $0.15 each = $0.60
4x thermistor at $0.13 each = $0.52
Shipping = $6.69
Total = $65.33

Total project cost so far is $401.18.

Friday, February 22, 2008

Even more progress

Thursday Update

Since we got the USART working last time, our goal today was to start using the XBees with the Butterflies. First we set up the XBees with the development boards and had them broadcast to each other; then we set up the Butterflies with MAX232s and had them receive a broadcast from one of the XBees connected to a dev board. Writing this makes it sound quick, but it most certainly was not. But we now have a true point-to-multipoint network setup.

And we did some other stuff but it's late and I want to sleep.