Tuesday, January 31, 2012

Flying Experiments

I managed to go flying last Friday after work. Since no one else was able to come along, I decided to do some experiments with the camera.

Last time I mounted the camera on the rear window pointing out. This time I pointed it toward me, instead of out the window. I did a time-lapse of the first half and later on an actual video of the landing.

Not too interesting, but I figured I would share them  here.



Saturday, January 21, 2012

CC2500 Project (Part 6) - Reorganizing

This post is mostly about software, so I'll keep it short.

I re-arranged most of the code so it hopefully makes more sense. My goal is to make the main code hardware agnostic. That way if you want to use a different device, you just change which drivers you're using, but your main code stays the same. Eventually I'd like to be able to support multiple devices from multiple manufacturers.

For a much better description, check out the page (and code) on github here: https://github.com/alvarop/msp430-cc2500
(The README file should have some information)

To keep things interesting, here's a quick video on what I was able to do with the current setup. The RGB LED controller(msp430g2452 + cc2500) is wirelessly connected to the PC(msp430g2533 + cc2500 + usb-to-serial converter).


Friday, January 20, 2012

CC2500 Project (Part 5) -- SPI Problem Solved!

So I wrote last week about getting UART working on the MSP430G2533 but having major problems with the SPI interface... I was so frustrated that I caved in and purchased a Salae Logic analyzer. It finally arrived today, and I had a chance to test it.

Salae Logic in action!
As soon as I opened the box, I connected it to sniff the SPI lines between my msp430 and cc2500 radio. It took me maybe 10-15 minutes to set up everything, including the Salae software to decode SPI on the fly. I ran my radio-setup code and observed the logic output. It seemed like something was happening, but it wasn't quite working.

First capture with msp430g2533
To get a better idea as to what it should look like, I connected my msp430g2452, which had a working SPI link with the radio. The first thing I noticed was an error saying that the clock polarity was inverted. Aha! So the SPI clock on the 2533 was low when idle, while the specification says it's supposed to be high.
So I went into the datasheet and figured out how to fix the clock problem.

'Correct' capture with the msp430g2452
I tried it again and, not surprisingly, it failed. Looking more carefully at the MISO/MOSI lines, I realized that they were backwards! Turns out that the SPI IO pins do not match between the msp4302533 and the 2452. I swapped two wires and everything started working!

While I was really happy I fixed the problem, this means that my previously mentioned PCB will only work with one of the two devices. My plan is to use the more expensive 2533 as a PC-to-radio bridge, since it has both a hardware UART to talk to the pc and hardware SPI to talk to the radio. The cheaper 2452 only has one SPI to use the radio.

Launchpad with cc2500 Radio and Salae logic
In the end, I'm still happy. The Salae logic was extremely helpful and easy to use. It took me less than an hour to solve a problem I hadn't figure out in two days! Now I will be able to focus much more time in coming up with good radio libraries, instead of debugging silly problems.

Sunday, January 15, 2012

CC2500 Project (Part 4)

I haven't been working on this project lately, but I finally got back to programming yesterday. I got the MSP430G2533 which has both hardware UART and SPI. This one will act as a bridge between the PC and the CC2500 radio. It could also be used to drive a serial LCD.

I managed to get the UART working, but for some reason I'm having trouble with the SPI communication with the radio. I've been wanting to get a Saleae Logic analyzer for a while. Now I have a reason!

On the hardware side, I put together a breakout board for the MSP430 and CC2500. It only has a few passives and two LED's along with the MSP430 and a header for the CC2500 module I've been working with. I put them on opposite sides to save space, but that caused some problems.


I want to have the radio and antenna exposed, which means the MSP430 needs to go on the other side. Unfortunately, this means that the pins are all backwards(Top-right is pin 1.) I'll just have to keep that in mind while breadboarding.

Hopefully I'll get the Saleae Logic soon so I can iron out these SPI problems. Once that's done and I have these boards, you should start to see some much nicer projects (and better code!)



Tuesday, December 6, 2011

CC2500 Project (Part 3)

Here's an even smaller update!

Since the MSP430G2452 doesn't have a hardware UART, it's not very useful in communicating with the computer. I could use the bit-banging method to get 2400baud, but I didn't feel like figuring it out.

For my thesis, I implemented a serial-to-radio repeater using the EZ430-RF2500 and a USB-to-serial converter. I was able to modify the code to get it working. It ends up being a 19200baud link. For some reason, I can't get the processor to run at 16MHz without it giving me problems. Since I don't wan't to figure those out now, I'm running it at 1MHz, which prevents me from doing the usual 115200baud. (Not that I really need that speed.)

I then wrote a quick processing sketch to capture audio and send RGB values out the serial port to the microcontroller.

In short, I can now sync the lights to the music wirelessly!

Here's a quick video demo (As you can probably tell, I'm really happy it worked!):


Sunday, December 4, 2011

CC2500 Project (Part 2)

Here is a quick update on the project's progress.

Today I was able to get the radio libraries working better and actually set up constant radio communications across a room. I also wrote an RGB led controller using PWM and combined them together.

Here's a brief video of the result:


So far it's just one microcontroller generating RGB values and sending them to another one. Now I need to work on getting the PC to talk to the first microcontroller so I can control the lights with my computer.

Here's a demo of what I want it to do later. I have it working in the video, but it's fully wired and uses an ARM Mbed for control.

Saturday, December 3, 2011

CC2500 Project (Part 1)

So I've started working on another project... This one includes microcontrollers and radios. The "goal" of the project is to have a very cheap 2.4GHz radio module and libraries to use it. I used the CC2500 radio module for my thesis project, but it was part of the EZ430-RF2500 development kit. The kit itself is nice, but at $20/device, it's not the cheapest.

My first though was to build my own board. I decided against it for several reasons. The first being that the CC2500 only comes in QFN packaging, which would make it a pain to hand solder. The second is that I have no experience designing RF circuits, which would probably result in the thing not working. The last reason is that I found a better alternative.

Turns out that the CC2500 is also used in some PS2 Guitar Hero controllers. They have the CC2500 chip on board and all the passive components (plus antenna!) I figured that would be much easier to work with. It has an SPI interface, so it can talk to most microcontrollers. The best part is that the whole thing costs less than a single CC2500 chip! I was able to get the whole thing for $1.80. (If you buy more than 1000, it only costs $1.35!) The only caveat is that the module has to be purchased from the manufacturer in China, which, at small quantities, makes the shipping a bit expensive.

CC2500 module with breakout board.
Since the header for the board has 0.05'' separation, I had to make a breakout board for testing. I decided to test the radios with an MSP430G2452 microcontroller. I chose that one because is has hardware SPI and is available in 20-DIP package. The hardware SPI is really useful when interfacing to the radio at higher speeds (instead of bit-banging) and the DIP package makes it easy to work with (and fits into the launchpad).

MSP430G2452 in Launchpad with radio.
I started writing my own radio libraries. TI provides a network stack called SimpliciTI, but it's bloated and I don't like it. For my thesis project, I wrote my own lightweight radio library, but it's all set up to work under linux and msp430-gcc. Since I want everyone to be able to use it, I'm porting it to work under TI's Code Composer Studio and putting it on github. So far I only have TI's demo code from slau144h working, but it confirms that all my wiring is ok and the radios work. Since I only have one launchpad, I replicated it on a breadboard. The code just sends a message when a button is pushed and toggles an LED when a message is received.

Breadboard with second radio and MSP430.
The next step will be to get my radio libraries working and well documented...