<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>How anomaly ADXL345 data UART? needed help</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/28536/how-anomaly-adxl345-data-uart-needed-help</link><description>Here is calibration of UART data using ADXL345. 
 and the data is followed by x, y &amp;amp; z value, for example x = -42, y = 20, z = 268. and then after calibrated 10x which is I got mean value from (x,y,z*10 of data)/10.0..
I&amp;#39;ve got x = -26237, y = -18,</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 18 Dec 2017 11:56:10 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/28536/how-anomaly-adxl345-data-uart-needed-help" /><item><title>RE: How anomaly ADXL345 data UART? needed help</title><link>https://devzone.nordicsemi.com/thread/113019?ContentTypeID=1</link><pubDate>Mon, 18 Dec 2017 11:56:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0e545136-5f6a-4e9a-943a-204d0324c76b</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;I was thinking more like this:&lt;/p&gt;
&lt;p&gt;From your mbed code:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;while (1) 
{
	ble.waitForEvent();
	wait(0.1);
	accelerometer.getOutput(readings);
	uart1.printf(&amp;quot;\n%i, %i, %i\n&amp;quot;, (int16_t)readings[0], (int16_t)readings[1], (int16_t)readings[2]);

	int avg1 = calibratex();
	int avg2 = calibratey();
	int avg3 = calibratez();
	// Print the values, etc.
	// ....
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I think that if you read the data immediately after you power up the accelerometer like you do now, it is not certain that the accelerometer has actually had the time to do any real measurements and hence you get bad data. If you start to measure periodically, or at least try again a short while after you power up the accelerometer, you will find out if this is the case.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How anomaly ADXL345 data UART? needed help</title><link>https://devzone.nordicsemi.com/thread/113018?ContentTypeID=1</link><pubDate>Sun, 17 Dec 2017 09:54:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f0f20b54-b1cc-421b-b52a-35e12cc27b48</guid><dc:creator>mantap</dc:creator><description>&lt;p&gt;do you mean like this one..&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;accelerometer.setPowerControl(0x08);   
 wait(0.1);
 int avg1 = calibratex();
 wait(0.1);
 int avg2 = calibratey();
 wait(0.1);
 int avg3 = calibratez();
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I&amp;#39;ve tried before using while(1) for looping that measurenment data once. but it&amp;#39;s look like the same problem..&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How anomaly ADXL345 data UART? needed help</title><link>https://devzone.nordicsemi.com/thread/113017?ContentTypeID=1</link><pubDate>Fri, 15 Dec 2017 11:43:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:68c7cce9-d5f1-4f8c-a115-39e984d14158</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Your calibratex, y, and z functions look identical to me. Hence it must be something weird going on with your input value. You only call calibratex() once, and that is immediately after you have powered on the ADXL345. Maybe the sensor havn&amp;#39;t had the time to sample a valid value yet. It could be interesting to see what would happen if you put a small delay between these two lines&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;accelerometer.setPowerControl(0x08);   

int avg1 = calibratex();
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It could also be worth trying to call calibratex() from within your while(1) loop and monitor the values at regular intervals.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How anomaly ADXL345 data UART? needed help</title><link>https://devzone.nordicsemi.com/thread/113015?ContentTypeID=1</link><pubDate>Thu, 14 Dec 2017 01:24:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:31ac1586-67dd-4489-8537-f8eea840a94a</guid><dc:creator>mantap</dc:creator><description>&lt;p&gt;can you explain it with the code? because the problem of sensor is located just at x array.. I thinks It&amp;#39;s not about hardware problem but after change from 2&amp;#39;s complement to array string..
perhaps explain the raw x value with the mean&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How anomaly ADXL345 data UART? needed help</title><link>https://devzone.nordicsemi.com/thread/113016?ContentTypeID=1</link><pubDate>Wed, 13 Dec 2017 16:02:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4361efbf-f9f3-4f09-ba5b-9521ff169054</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Have you tried to print both the raw x value and your mean x value? Remember that you will always have the gravitational force of 1g and that will show on one of your axes. Depending on your range settings x=-25822 might actually be correct and just your accelerometer measuring gravity.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How anomaly ADXL345 data UART? needed help</title><link>https://devzone.nordicsemi.com/thread/113014?ContentTypeID=1</link><pubDate>Tue, 12 Dec 2017 15:54:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3d1ed180-541d-480a-a84d-b5adca827dc4</guid><dc:creator>mantap</dc:creator><description>&lt;p&gt;thank you for your answer, my code is fine..  sorry for just just wrong variable in my code statement. this is the full link for my  &lt;a href="https://os.mbed.com/users/asyrofi/code/nRF51_ADXL345_UART/"&gt;mbed code&lt;/a&gt;. but why there is wrong calculation for x array.&lt;/p&gt;
&lt;p&gt;for example I have x=-27, y=48, z 280.. after 10x mean calcutation. that&amp;#39;s show x=-25882, y = 47, z=220. the main problem is why x calculate -25882 ? after 10x mean calculation must be -25 without 822 (-25,882) for example..&lt;/p&gt;
&lt;p&gt;how to replace last 3 value of the sensor?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How anomaly ADXL345 data UART? needed help</title><link>https://devzone.nordicsemi.com/thread/113013?ContentTypeID=1</link><pubDate>Tue, 12 Dec 2017 14:10:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:415ce036-b175-465d-ac19-841754f4c75b</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Not sure if this is the solution, but there is an inconsistency in your three calibration functions:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;int calibratex()
{
	int readings[3] = {0, 0, 0};
	led1=1;
	long int sum1  = 0;
	for (int i=0; i&amp;lt;10; i++)
	{
		accelerometer.getOutput(readings);
		xval[i]=(readings[0]);  //nilai x adxl345
		sum1 = yval[i]+sum1;                                     // &amp;lt;- BUG???? Should it be xval?
	}

	xavg=sum1/10.0;

	led1=0;     
	return xavg;
}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>