Show Posts
Pages: 1 [2] 3 4 ... 202
16  Using Arduino / Programming Questions / Re: Memory problems, sd card stored arrays ... on: August 19, 2014, 10:32:26 am
Why do you think it would be difficult to relocate your project to a Mega ?    Should take about 4 minutes.
17  Using Arduino / Project Guidance / Re: Outputting String (object, not an array of characters ) to LCD on: August 19, 2014, 10:28:19 am
You can only send an object from one device to another,  if both devices know what to do with the object.
18  Using Arduino / Sensors / Re: Reading Honda MAP sensor without adverse affects? on: August 18, 2014, 08:58:31 am
The analog input of the arduino should have fairly high impedance and should not interfere with the circuit between the sensor and the ECU.

It somewhat surprises me that this works off 5V and not 12V.

How are you supplying the arduino ?

Is there a  common ground between the arduino and the ecu 5V systems ?
19  Using Arduino / Sensors / Re: Detecting a seed dropping through a plastic tube on: August 18, 2014, 08:53:26 am
How do the seeds get into this tube ?

The ones I have seen have a small wheel device feeding them in.

I'd be inclined to abandon the idea of trying to see them in the tube,    and instead consider counting the turns of the small wheel.

20  Using Arduino / Project Guidance / Re: Reading multiple encoders using SPI on: August 18, 2014, 08:44:15 am
These encoders don't communicate using SPI.

They output 1/0 pulses,  1024 per rpm,   and you have to count the pulses.    Interrupts are usually used to do this.    For 16 encoders,  you might require a different approach.

Why would you need 16 encoders on a motor ?   One encoder should be sufficient.
21  Using Arduino / Project Guidance / Re: problems with 5 volt relay module on: August 18, 2014, 08:38:12 am
Your relay problem might be related to your input button logic or wiring issues, such as debouncing.

You need to consider these issues separately.

write another sketch with no button in it,   just the relay.

Like this.

const int relaypin = 9 ;

bool state=false ;

void setup()
pinMode( relaypin, OUTPUT );

void loop()
    if ( !state )
        state=true ;
        digitalWrite( relaypin, HIGH );
      state=false ;
      digitalWrite( relaypin, LOW );
      delay(1000) ;

This will try to turn the relay on and off each second.

You can worry about debugging and debouncing your button circuit, separately.
22  Using Arduino / Sensors / Re: Reading Honda MAP sensor without adverse affects? on: August 17, 2014, 11:51:18 am
what answer do you get when the analog voltage results in gearSensor = 550 ?
23  Using Arduino / Programming Questions / Re: FSM diagrams: states and transistions on: August 17, 2014, 11:35:23 am
You can have any convention you like.

If you take the view that the boxes represent the "states",   and the arrows represent the "transitions",     then if you want to label what the actual action is that is taken to transfer from one state to the next,   you have to have captions floating around the picture awkwardly next to the arrows,   as the example in the preceding post shows.

On the other hand,   if you have more of a "flowchart" mindset,   it is the actions or steps of the process which go inside the boxes.   You can use different shapes of box to indicate actions,   final or intermediate endpoints ( "states" ),    and also different boxes for branches.

24  Using Arduino / Motors, Mechanics, and Power / Re: dc motors without arduino motor shield on: August 17, 2014, 05:17:13 am
Not sure exactly what you mean by "alkaline 9V",    it is probably like the other one,  has several tiny batteries in one package  and cannot supply large current.
25  Using Arduino / Sensors / Re: Difficulty Interfacing "High Accuracy Dual Axis Inclinometer TOY0048" on: August 16, 2014, 09:57:41 am
It does tell you,  however,  that the device uses SPI  (  and not I2c,  or analog,  or serial,  or pulses ).

That's better than no information at all.
26  Using Arduino / Sensors / Re: MPU 6050 i2cWrite failed: 2 on: August 15, 2014, 09:25:57 am
You should check very carefully whether the MPU 6050 requires the "stop" or "repeat start" condition.

Unlike freescale devices,  the MPU6050  works with the default setting for Wire,  not the unusual setting.
27  Using Arduino / Sensors / Re: Interfacing ADIS 16210/PCBZ with Arduino on: August 15, 2014, 09:22:23 am
Is google broken in your country ?
28  Using Arduino / Programming Questions / Re: MATHS help reqired for HSI project. on: August 15, 2014, 02:56:36 am
That accelerometer is an analog device.   The "standard" example codes for it,  return an integer for each axis,  apparently normalised to 100 representing 1g.

You mentioned that you are not using the z axis,   so I assume that you have your x and y axes horizontally and your z vertical.  If you have your x axis pointing "forwards" and your y axis pointing sideways,   then,  for very small angles of pitch and roll,   the x and y readings will represent 100 x the sine of the pitch and roll axes,  in radians,  respectively.

Note the limitations here.  That calculation will only work if the device is not actually accelerating anyway,   and also not subjected to a rotational acceleration.  It's going to work for tilted objects,   not spinning objects.  And it is not going to work for large angles of pitch and roll.

You also need to be clear on what part of your calculations require integer and floating point arithmetic.   If you don't want to use floating point types,   you can work around that but you need to be clear on what you are doing.

your statement that int(0.1) results in 1,   seems to be wrong.   Actually, to the best of my knowledge,  C doesn't even have an INT( ) function.   Matlab and Fortran do....        You can cast numbers to an int, like this
float f = 4.7 ;
int i = (int) f ;                                  //  the result of this is (integer) 4
but that is not actually a function call.

This is how you would calculate the pitch and roll,  representing the tilt of your device in degrees,   where the x and y directions are oriented forwards and sideway,  and z vertical,  provided that the device has no accelerations  and therefore that the numbers coming from the device represent only the static effect of gravity,   and that the numbers are integers normalised to 100 = 1g :

int x ;  // accelerometer reading
int y ;  // accelerometer reading
int z ;  // accelerometer reading

void loop()
   x= accelero.getXAccel() ;
   y = accelero.getYAccel( );

   float  pitch_sine = ((float)x)/100.0 ;       //  this is the sine of the pitch angle

   //  Check that the sine of the pitch angle is within the legal range between -1 and 1
   //  If either part of this section is true,  it means that the device has a substantial actual acceleration,
   //  or that the device is poorly calibrated.

   if ( pitch_sine > 1.0 ) pitch_sine = 1.0 ;
   else if ( pitch_sine < -1.0 ) pitch_sine = -1.0 ;

   float pitch_radians = asin ( pitch_sine )   ;             //  calculates the pitch angle,  in radians
   float pitch_degrees = pitch_radians * 57.3 ;         //  convert result to degrees, multiply by 180/pi


For SMALL angles of pitch and roll,  less than maybe about 20 degrees,    you can use the approximation that the sine of the angle ( in radians ),  is not very different to the angle in radians.     Therefore,  you could use this calculation

int x = accerelo.getXAccel( ) ;              //  x direction component,  normalized to 100 = 1g
int pitch_degrees = x * 57 / 100 ;     

This calculation uses no float math at all.   However,  it will overflow the arduino 16 bit int if the value of x exceeds about 55 .    To be clear why this is,  the product  x times 57 must be less than 32767,  the limit for ints.

However,   this approach is only valid for the range of tilt for which  sine(y) is approximately equal to y ( in radians ) ,  which is for angles less than about +/- 20 degrees,  depending on your tolerance for "approximately".    If you are using this model to measure the range of tilt for which it is appropriate,  then the overflow would not be an issue.

29  Using Arduino / Programming Questions / Re: MATHS help reqired for HSI project. on: August 15, 2014, 02:08:28 am
That code you posted looks like Matlab or something.     No C/C++ code looks anything remotely like that.

30  Using Arduino / Programming Questions / Re: Constructor not called and loop not runnin on: August 14, 2014, 07:22:42 am
#ifndef MyClass_h

When you start your header file with this,   you need to have a   #define MyClass_h   on the next line.
Pages: 1 [2] 3 4 ... 202