Thursday, September 25, 2008

Real time accelerometer reading via xbee pro

I am working on a project transferring two axis accelerometer data as fast as possible to a pc via xbee pro. Here is what I have discovered:

  • At high speed the xbee picks up noise from the surrounding 50Hz, 220V.
  • I am able to use 5V for VCC, VREF as well as ADC input.
  • The highest transfer rates can be achieved by setting samples before TX (ATIT) to the maximum of 22 (0x16) and sample rate (ATIR) to 1 (ms). You should in theory be able to send data at 1kHz
  • The interface data is critical to be fast in able to read data fast. Xbee transfers data at 250kbps via RF, but the baud rate can only be set up to 115200 at standard data rates.
  • For non-standard data rates you could only set them via a terminal by using the command ATBD and then the speed. I nearly lost contact with one xbee when setting the data rate to 230400. The data sheet says that xbee should handle data rates up to this speed, but I could not talk to the xbee after setting this. I luckily discovered by trial and error that I could interface the device at 240000 baud, and that the true setting was really 250000 bauds (0x3D090).
  • With everything set to maximum I am able to transfer data at approximately 760kHz.

The xbee pack contains the following:
byte 1: 0x7E, the start byte
byte 2-3: packet size
byte 4: API identifier value
byte 5-6: Sender's address
byte 7: RSSI, Received Signal Strength indicator
byte 8: Broadcast options
byte 9: Number of samples to follow
byte 10-11: Active channels indicator
byte 12-N-1: 10-bit ADC values, sent like this: ADC1-MSB, ADC1-LSB, ADC2-MSB, ADC2-LSB and so on
byte N: Checksum of the values sent: see xbee data sheet

N=12+2*ADCs*ATIT, example: 2 channel accelerometer, ATIT=22 => N=12+2*2*22=100

Monday, September 22, 2008

First impressions of ELM327 (ver 1.2A)

I bought a box for on board diagnostics (OBD) for my car with the striking name of "ELM327 (ver 1.2a)" as mentioned earlier in my blog. Unfortunately I haven't been able to test it until today.

Here are my impressions:
  • The box contains two key components necessary to do on board diagnostics: The very versatile ELM327 chip and the FTDI USB to serial cable. I am unsure if they are original.
  • Most of the software solutions I tested had trouble communicating with my car. I have a Skoda Octavia 2003, and it is not recognized as a car with standard OBD/OBD2/CAN. I will have to test it with a different car to see if it is the car or the ELM box that is causing the problems.
  • The software that can communicate and read sensor data are only able to read them quite slowly. I am unable to speed up the connection by changing the update rate or the baud rate. I am not sure if I could change to a higher speed than 9,6kbauds. Perhaps it could be possible to set them by using AT commands?
  • Many of the interesting sensors like the lambda sensor are missing. I am unsure if there is a problem interpreting the car's ECU or if the ECU is not exposing the data to OBD. I have to read a bit about this.
To sum it up - I am pleased that I can read sensor data but sorry that they are too slow to be useful at the moment

Screen shots:

Charts made for my car

Gauges shown

Posted by Picasa

Thursday, September 11, 2008

How to upgrade XBee via FTDI's TTL-232R USB cable

It is quite convenient to use FTDI's USB cable to communicate with the XBee. Recently I found that I was unable to upgrade the firmware of the XBee via the cable. And without the upgrade I was unable to use the IO features of the XBee. Calling "ATD02" would cause an error. After some frustration I found that the problem stemmed from the missing DTR line of the FTDI cable. The solution to the problem was quite simple: Just pull the DTR of the XBee low by connecting it to GND.

Wednesday, September 10, 2008

Short course in mnemonics


Yesterday I attended a quick intro course in mnemonics which was held for free at NTNU for three hours. The presenter was Oddbjørn By, norwegian memory master and international Grand Master. He has also published books under the title "Memo" which contain his teaching in the subject.

The course lasted for about three hours containing small tricks from how to remember the ten largest countries in the world to how to prepare for speaches and exams. He finished the lecture by memorizing a full deck of cards within 1,5 minutes.

I found the lecture very interesting since I recently read the book "Mind Performance Hacks" (MPH), which contains many mnemonic tricks. What was striking was that most of the techniques preferred in the book was also the ones preferred by Oddbjørn By:

The techinque that By seems to prefer in most cases is the ancient "Journey" system described by Ron Hale-Evans. While the journeys are described as "little journeys" by Hale-Evans, By uses big journeys containing more than ten places to store most of the things he would like to remember. Hale-Evans describe a expanded journey system by Scott Hagwood where objects could be stored in "nooks and crannies" for up to ten spaces in each room, making space for ten times the storage capacity (100 containers).

The second techinque By seems to use a lot is similar to the Dominic system in MPH.

A quick explanation of the Dominic system invented by World Memory Champion Dominic O'Brien: The Dominic system uses the letters OABCDESGHN for each number from zero to nine. By combining two letters you could store numbers from zero to ninetynine. The associations are made by a combination of a person and an action, for instance 26=BS=Britney Spears singing "Hit me baby one more time". You could remember four numbers by mixing one person with another persons action, for instance 6326=SC BS=Santa Claus singing "Hit me baby one more time". If you make the list of hundred persons and actions and remember them, you are able to store numbers up to 9999. You could make a story out of characters and actions to store larger numbers or you could make a big hotel with 100 floors to be able to remember more than 10 000 things. A very powerful system.

By's system for storing large numbers is similar to the Dominic, but the letters for the numbers are OITERSCLAg. The letters have a shape similarity to the numbers and easier to remember because they form something similar to a german word. By uses the system a bit different by making the letters the start of a word, for instance 34=TE=TEst,3435=TETRis etc.

The third method, which By seem to use to some extent is the number shape system, but he seems to use it only to support other systems.

To sum the evening up: By's intro course was very inspiring, showing that everybody is able to remember vast amounts of information. The techinques By finds most efficient are also the ones described as most efficient by other sources. You could remember things faster and more smoothly than just practising and repeating, freeing your brain for other tasks. My inspiration led me to start learning the countries of the world and their capitals. Yesterday was North America, today might be Europe. You never know when that might come handy...