Arduino ADC problem continue...

As previous article , now the problem will be resolve .

Previously mentioned , I used the " 3-axis accelerometer(ADXL330) " connection to XBee1 use ADC mode , and XBee1 will sent data to XBee2 .

The XBee2 connection to Arduino , and the Arduino use USB transmission line connection to PC .

When I use ADC model , each data form I received liked 7E 0 E 83 56 78 1C 0 1 E 0 3 EC 3 EC 3 EE B4 .

And the data form is :

7E Start Delimiter 000E Length (14bytes from here to checksum) 83 API Identifier: 16-bit A/D 5678 Source address. 1C RSSI 00 Option Byte 01 Sample Quantity 0E00 Channel indicators 0E00=0000 1110 0000 0000 = A2, A1, A0 03EC Value for channel A0 03EC Value for channel A1 03EE Value for channel A2 B4 Checksum

Now how can I further analysis " 3 EC 3 EC 3 EE " ?

May need to back up a little. How is the ADXL330 output getting measured? According to the datasheet the ADXL330 is powered from 3V, with 3.3 I would expect being typical.

Per Table 1 on page 3 and Figures 13,14,15 of the datasheet http://www.sparkfun.com/datasheets/Components/ADXL330_0.pdf one would expect the output to be sitting at ~1.5V.

Where is the reading of 3EC coming from? 3EC hex = 1004 decimal. An arduino ADC running from 3.3V would output ~465 for a 1.5V input. An arduino ADC running from 5V would output ~307 for a 1.5V input. If the arduino ADC was using internal Vref of 1.1V and 1.5V was being sampled, a reading up towards 1023 might result (3FF).

What ADC and reference voltage is putting out 3EC?

To CrossRoads :

Actually , there is no clearly marked on the accelerometer . So I guess it's ADXL330 .

They have 6 pins : VCC , ST , GND , X , Y , Z , respectively.

VCC connect to 3.3V , X connect to XBee's ADO(pin20) , Y connect to XBee's AD1(pin19) , Z connect to XBee's AD2(pin18) .

Finally I use Arduino development software , then click the " Serial Monitor " print result use "16hex" on the screen .

What ADC and reference voltage is putting out 3EC ? ? What's your mean ?

Ok, Per Xbee documentation, those three pins are Analog Inputs with a default state of Disabled:

18 AD2 / DIO2 Disabled Analog Input 2 19 AD1 / DIO1 Disabled Analog Input 1 20 AD0 / DIO0 Disabled Analog Input 0

See page 94-95 of this spec sheet: http://ftp1.digi.com/support/documentation/90000976_K.pdf

In particular: "Analog samples are returned as 10-bit values. The analog reading is scaled such that 0x0000 represents 0V, and 0x3FF = 1.2V. (The analog inputs on the module cannot read more than 1.2V.) Analog samples are returned in order starting with AIN0 and finishing with AIN3, and the supply voltage. Only enabled analog input channels return data as shown in the figure below. To convert the A/D reading to mV, do the following: AD(mV) = (A/D reading * 1200mV) / 1023"

So if the ADXL330 outputs are sitting a ~1.5V, and the max Xbee reading is for 1.2V, then a reading of 3EE would be in the right ballpark. You might need to use 2 resistors (say 10K each) and divide down the ADXl330 output so it sits at ~0.75V and moves up & down from there as the accelerometer changes.