Show Posts
Pages: 1 [2] 3 4 ... 189
16  Using Arduino / Programming Questions / Re: Saving RF24 signals to memory on: July 27, 2014, 09:01:00 pm
Your scheme doesn't seem to be very reliable.   If you miss a message,   your system won't do anything.
17  Using Arduino / Storage / Re: SD card adapter bought on ebay on: July 27, 2014, 03:04:58 pm
I have one of those,  and it works fine with 5V supply and 5V on the signal lines.
18  Using Arduino / Networking, Protocols, and Devices / Re: I2C scanner finds devices but not I2C bus (??) on: July 27, 2014, 02:54:33 pm
do you actually have a ds1307 ?
19  Using Arduino / Networking, Protocols, and Devices / Re: How are communication protocols chosen for some sensor/device? on: July 27, 2014, 02:52:12 pm
They choose the protocol which is most likely to be used by the customers they expect to sell their chips to.
20  Using Arduino / Sensors / Re: IMU and Arduino: with or without an on-board digital processor? on: July 27, 2014, 02:42:48 pm
My previous comments were related to the flight control boards which actually have another arduino type processor in them,   not the so-called processor of the  MPU  gyro chips.   But the purpose of those is fundamentally the same,    to take some of the processing load off the other processor.
21  Using Arduino / Programming Questions / Re: VirtualWire on arduino Due on: July 27, 2014, 02:37:30 pm
Two likely problems:

where it says something is not declared in this scope,   the usual reason is that the compiler cannot find an #include file,   which is missing,   or in the wrong place.

second possible reason,   all those register names may be specific to the 8-bit processors,   and that library that you are trying to use might not be usable on the 32-bit Due processor.
22  Using Arduino / Programming Questions / Re: what is the difference between char and int and why can you not convert them? on: July 27, 2014, 02:32:15 pm
Quote
This is so annoying now!!!!! Now I am very confused!!!!

Instead of wasting time with your random nonsense,  how about buy, borrowing, begging or downloading an elementary programming textbook and reading it ?

What do you really expect us to do ?  Spending countless hours manually typing out a customised version,  just for you ?
23  Using Arduino / Motors, Mechanics, and Power / Re: Serial monitor crash when relays switch on main power on: July 27, 2014, 08:50:56 am
Quote
Is it that I need to connect the arduino and relay 5v DC to a common ground?

That's a good question.

Usually,  the answer would be yes.   But since the input to the relay module uses an optoisolator,  you don't need to,  because their is no opportunity for current to flow between the arduino and the relay board.
24  Using Arduino / Programming Questions / Re: I'm having trouble getting my stepper motor to turn once every hour on: July 27, 2014, 08:23:52 am
quarter stepping mode is a bad idea if you want to hold the position for a long time.

A stepper motor will stop better at a full step position,  holding at a quarter step position requires more continuous current.
25  Using Arduino / Sensors / Re: Barometric Presure sensor BMP180 on: July 26, 2014, 10:35:55 pm
It appears (supposedly) as a constant in the code,   perhaps it was intended to be a configurable number.

In the actual code,  it's use is related to least-significant-bit rounding,    and not as an actual numerical context at all.  If you add -32768,  and then right shift 15 bits,   that is what it does.
26  Using Arduino / Sensors / Re: Barometric Presure sensor BMP180 on: July 26, 2014, 10:20:10 pm
Quote
**
Karma: 58
Posts: 2794
View Profile
Email
Personal Message (Offline)
   
   
Re: Barometric Presure sensor BMP180
« Reply #31 on: Today at 01:29:29 am »
   Bigger Bigger Smaller Smaller Reset Reset Reply with quoteQuote Modify messageModify Remove messageRemove
Looking at the code I have here,   I seem to have two different versions of the temperature calculation,  which are different.   I had to "fix" it, for some reason, which I don't fully recall now.

I am not 100% certain,  but it appears that the first calculation is the wrong one,    and the second one is correct.

Code:

  X1 = ((latest_raw_temp - (int32_t)ac6) * (int32_t)ac5) >> 15;
  X2 = ((int32_t)mc << 11) - (X1 + md)/2;     // round up
  X2 /= (X1 + md);
  B5 = X1 + X2;


Code:

  int32_t  X1 = ((latest_raw_temp - (int32_t)ac6) * (int32_t)ac5) >> 15;
  int32_t  X2 = ((int32_t)mc << 11) / (X1 + (int32_t)md);
  int32_t  B5 = X1 + X2;
  float    temp = (float)((B5 + smiley-cool >> 4);
  temp /= 10;                                   // divide by 10


This algorithm may have been intended for a device with a 32 bit int type.

Two further comments on this.

The mc<<11  will also potentially overflow if it is done as a 16 bit calculation.   It is important to have the cast in this line to ensure this happens.

The apparent big difference between the two calculations of X2 is not what it seems.  The result will actually the almost the same.    By subtracting half of the amount you are going to divide by,  before doing the division,   this has the effect of correcting the rounding of the least significant bit in the result of the division.   
27  Using Arduino / Sensors / Re: Barometric Presure sensor BMP180 on: July 26, 2014, 10:10:13 pm
Quote
Oh, and they all read MB = -32768

If you look at the code,   MB is not even actually used !
28  Using Arduino / Sensors / Re: Barometric Presure sensor BMP180 on: July 26, 2014, 09:58:47 pm
This is the code which I was using

Code:
B6 = latest_B5 - 4000;
  X1 = ((int32_t)b2 * ( (B6 * B6)>>12 )) >> 11;
  X2 = ((int32_t)ac2 * B6) >> 11;
  X3 = X1 + X2;
  B3 = ((((int32_t)ac1*4 + X3) << oversampling) + 2) / 4;

  X1 = ((int32_t)ac3 * B6) >> 13;
  X2 = ((int32_t)b1 * ((B6 * B6) >> 12)) >> 16;
  X3 = ((X1 + X2) + 2) >> 2;
  B4 = ((uint32_t)ac4 * (uint32_t)(X3 + 32768)) >> 15;
  B7 = ((uint32_t)latest_raw_pressure - B3) * (uint32_t)( 50000UL >> oversampling );

29  Using Arduino / Sensors / Re: Barometric Presure sensor BMP180 on: July 26, 2014, 09:57:17 pm
The sensors which have a big value for AC1,  don't work,  because AC1 x 4 will overflow in the calculation of B3,   because it is performing a 16 bit calculation there,  unless you tell it otherwise.

But if the sensor happens to have small value of AC1,  you don't get this problem,  because it still fits in 16 bits.

You will observe that in Bosch's calculation,  AC1 is 408  and Leo's example ha 408 also,   but Jacob and Erhja  have 8000  and 9000 there,   which will overflow when multiplied by 4.
30  Using Arduino / Sensors / Re: Barometric Presure sensor BMP180 on: July 26, 2014, 08:29:29 pm
Looking at the code I have here,   I seem to have two different versions of the temperature calculation,  which are different.   I had to "fix" it, for some reason, which I don't fully recall now. 

I am not 100% certain,  but it appears that the first calculation is the wrong one,    and the second one is correct.

Code:
  X1 = ((latest_raw_temp - (int32_t)ac6) * (int32_t)ac5) >> 15;
  X2 = ((int32_t)mc << 11) - (X1 + md)/2;     // round up
  X2 /= (X1 + md);
  B5 = X1 + X2;

Code:
  int32_t  X1 = ((latest_raw_temp - (int32_t)ac6) * (int32_t)ac5) >> 15;
  int32_t  X2 = ((int32_t)mc << 11) / (X1 + (int32_t)md);
  int32_t  B5 = X1 + X2;
  float    temp = (float)((B5 + 8) >> 4);
  temp /= 10;                                   // divide by 10

This algorithm may have been intended for a device with a 32 bit int type.

Pages: 1 [2] 3 4 ... 189