While waiting for my RF boards to arrive from Sparkfun, I started another project (ooh, look! Something shiny!). I have always liked building things that I could carry around with me, so I decided to build my own PDA. I had the graphic LCD and plenty of processors laying around. I figured adding an RF link back to the PC would not only make it more functional but also help produce code that would be useful for the Spoka project. I also figured that I could combine it with my Tricorder project (notebook pages 3-12) and add as many sensors as I could fit in this little OKW enclosure.
The processor is an ATMega32. I have added a 128 X 64 graphic LCD, a 2.4GHz RF Transceiver, battery-backed real time clock, 2 axis accelerometer, linear Hall effect sensor, and a white led flashlight. The IR receiver is not connected yet. I still plan to add an RGB color sensor and an IR transmitter.
The source code was compiled with WinAVR and is available here. The library for the graphic LCD is from Gregor Horvat (http://www.indata.si/grega/) for the compatible HD61202 controller. After updating a few deprecated commands, it worked first time! I can’t remember where I got the library for the DS1307 clock that I converted for the DS1305. If anyone recognizes it, please let me know. The defines for the NRF24L01 came from S. Brennen Ball.
As you might be able to see from the screenshot, I am currently reading the battery voltage (upper left), magnetic field strength (upper right), x and y acceleration (lower left), and the current time (lower right). The cross-hairs and “bubble” in the center of the screen form a 2-axis level. See the picture of it in my hand for an example with the unit tilted on one axis. The RF transceiver is working well and capable of exchanging data with a PC base unit that connects via serial at 115200 baud.
(BTW, my order arrived from Sparkfun, but I’m having so much fun with this project, I may not get back to Spoka)
I finally managed to send some data over the RF link. Somehow I managed to break the printf function, so I only saw the data on the scope as it clocked out of the transceiver on the SPI bus, but it was the correct data. Here’s a hint if you are using the NRF24L01 chip. Go to the Nordic website and make sure you have the latest datasheet. There is a step by step guide to the minimum config for enhanced shockburst mode. Once I had all of my generic SPI problems worked out, it just fell into place. Now to wrap it all up into a nice library and install it on a robot!
After playing around with the idea of getting an SD card running in order to get enough storage for the data structures described in my last post, I decided that it would be better, if not neccessarily easier, to get an RF link up and running and prototype the learning algorithm on the PC. So I pulled out the Mirf-V2 that I have bought from Spark Fun for just such an occasion. After perusing the forums for a while I realized that this is a tricky beast to get running, but it should be worth the effort. I also came to the decision that I am not going to hurry, but instead I am going to enjoy the process.
Knowing all of this, I began programming the base unit that will connect to the PC and convert serial to SPI for the Mirf. I built this board almost a year ago, and it has an ATMega8, a MAX233, a 7805 and a Mirf. I had a little trouble getting the SPI working, but using the scope, I managed to figure out the problem.
Finally knowing that I would need two to tan.. er send data, I wired the Mirf up to an ATMega128 breakout board that I also got from sparkfun. Tomorrow I can start writing code that will make the ’128 board send a packet continuously, and receive it with the Mega8 board.