Show Posts
Pages: 1 ... 55 56 [57] 58 59 ... 68
841  Using Arduino / Sensors / Re: Accelerometer attached to 1m cable on: June 14, 2012, 02:01:52 am
A digital signal (I2C, SPI) could be a problem.
You could use an accelerometer with analog outputs. A few meters of cable would only introduce noise to the analog signal, but would not disturb any digital communication.
842  Using Arduino / Sensors / Re: MPU-6050 how to change rate of MPU generated fused data on: June 14, 2012, 01:56:57 am
You could try a new sketch for testing the HMC5883. I have added links in the magnetometer section:
Those sketches are very simple, but you need to update the Wire.send by Wire.write.
843  Using Arduino / Sensors / Re: MMA7260QT Accelerometer Help on: June 13, 2012, 06:05:22 pm
The benefit of the real 'g-force' or the raw analogRead() value for the offset is better to read code.

This is your module:
That module is 5V tolerant. It looks as if there is a voltage regulator for 3.3V  on the module.
So you should connect it to 5V.
According to the cheatsheet, also the range selection pins could be connected to 5V or GND.

Mostly the z-axis is up.

If AREF is not connected (to 3.3V) anymore, the default range of the analog input is 5V again.
So you have range 2g selected.

The way you adapted the example code is okay.
I would like to take it one step further (expect some errors in the code, I didn't test it):
// MMA7260QT Accelerometer
// The range is set with two pins (g-Select1 and g-Select2).
// It can be set to : 1.5, 2.0, 4.0 or 6.0 g
// The output signal is regardless of the voltage.
// It is :
//      800mV/g for range 1.5 g
//      600mV/g for range 2 g
//      300mV/g for range 4 g
//      200mV/g for range 6 g
// For 2 g range, and the accelerometer at 3.3V,
// and an analog input with 5V reference (=DEFAULT),
// the calculation is this:
//     voltage = raw * 5V / 1023steps
//     g =  voltage / 600mV
// However, if the Aref is connected to 3.3V, the
// full range is 0 ... 3.3V for 1024 steps.
//     g = analogRead(channel) * 3.3 / 1023.0 / 0.6;


void setup()
  // The y-axis points up, so the y value should be 1g for the earth gravity.
  // The values are the values at start. The 1g for the z-axis is taken
  // care for later in the program.
  center_x = give_me_my_g (ACC_X);  // value at 0g (horizontal)
  center_y = give_me_my_g (ACC_Y);  // value at 0g (horizontal)
  center_z = give_me_my_g (ACC_Z);  // value at 1g (pointing up)

void loop()
  // The z-axis offset "center_z" is not at zero g, but at 1 g.
  // So add 1 to the acc_z.
  acc_x = give_me_my_g (ACC_X) - center_x;             // remove the center (the offset)
  acc_y = give_me_my_g (ACC_Y) - center_y;             // remove the center (the offset)
  acc_z = give_me_my_g (ACC_Z) - center_z + 1.0;  // remove the center (the offset), add 1

double give_me_my_g (int channel)
  double g;
  // analogRead can be used without setting the pinMode.
  // 5.0 : The default range of the ADC, (3.3 if Aref connected to 3.3V)
  // 1023.0 : the maximum raw value at the maximum voltage
  // 0.6 : the number of mV/g. It is 600mv/G for 2g range.
  g = (double) analogRead(channel) * 5.0 / 1023.0 / 0.6;
  return (g);

An example of someone with that kind of module:

->edit: I thought that the y-axis was up, but it is the z-axis, this post changed for z-axis.
844  Using Arduino / Microcontrollers / Re: Debugging UNO standalone - Help needed on: June 13, 2012, 11:35:38 am
I'm glad you have a workaround.
Thanks for the photo.
845  Using Arduino / Sensors / Re: MMA7260QT Accelerometer Help on: June 13, 2012, 10:40:56 am
That's good I think.

I don't know if your values are good 'g-force' values.

You use the offset to get everything close to 0.0.
For a balancing robot for example, the default for the Z-axis should be 1 g.
If the sensor is horizontal flat, the Z-axis is pointing up, and that would be 1g.
This could be done in the setup() part.
Flipping it upside-down would make the Z-axis -1 g.

In your case, you need to measure the motion, so you need the relative acceleration. So in your case calibrating everything to 0.0 might also be okay.

You might to change your code. Use the offset eighter as the real 'g-force' or as the analogRead() values. At this moment it is not obvious what the unit of "center_z" is. And you also need to add some comments.
846  Using Arduino / Sensors / Re: MMA7260QT Accelerometer Help on: June 13, 2012, 02:06:05 am
If you use your sensor just as in the photo, is it upside-down ?

If you check the datasheet, the zero-g is about 1.65V, but it's not calibrated. So you might have to calibrate the zero-g values to zero in program code.
847  Using Arduino / Project Guidance / Re: Arduino + Twitter + Electric Valve + USB + Plants? on: June 13, 2012, 01:56:12 am
You could read this thread:

What is outdated ?
848  Using Arduino / Programming Questions / Re: Arduino + Ethernet + DS1307 overflow(?) error on: June 13, 2012, 01:52:50 am
Do you use this libary ?

I'm looking at the library right now, but it is not easy to understand.
You could have a ram or stack overflow, or the Time library could have problems with rollover.

You check timeStatus() for timeSet, but can you check which value it is ? Is it "timeNotSet" or "timeNeedsSync".
If it is "timeNeedsSync" you might just ignore that value and try once more.

You might have a rollover problem in you own code.
If you use millis() for example.
Can you measure somehow how long it takes to freeze ? Is it the same every time ?
849  Using Arduino / Microcontrollers / Re: Atmega32 support for arduino 1.0.1 on: June 13, 2012, 01:39:25 am
The question has been asked before :

The answer was: It's not going to work.
850  Using Arduino / Microcontrollers / Re: Debugging UNO standalone - Help needed on: June 13, 2012, 01:35:18 am
That's hard to tell, because there are many things that could be wrong.
The information you give is just a fraction of what would be needed to pinpoint the problem.

Did you try to use the original Uno firmware for both chips ? Does the Arduino Uno use Optiboot? I'm not sure about that.
If you did, the might be something wrong with the hardware of the ATmega16u2. Can you check that once more againgst the schematic of the Uno ?

But why not use an Arduino Uno in the first place ? It already acts as a com-port to the PC, and it is working.

Did you check out the new Arduino Leonardo ? The Arduino 1.0.1 has already examples for the Arduino Leonardo to make it behave like a keyboard of a mouse with its USB bus.
851  Using Arduino / Programming Questions / Re: 74HC595 basics on: June 13, 2012, 01:26:43 am
Don't cross-post:,109704.msg823827.html,109711.msg823866.html,109719.msg823901.html,109713.msg823871.html
852  Using Arduino / Sensors / Re: Would a 3v Negative Voltage Spike Damage the A/D converter? on: June 12, 2012, 11:24:37 am
It might damage the input.

You can use a resistor of 1k to 10k in series with the input.
That will almost not reduce the maximum input frequency, due to the high impedance of the input.

If you use a diode, use a schottky diode. Most of them can handle high frequencies with ease.

What is the minimum pulse length for an interrupt ? I think it is about 100ns, but I can't read it in the datasheet.
853  Using Arduino / Microcontrollers / Re: Read an ATtiny13 on: June 11, 2012, 05:39:30 pm
Why not buy a very cheap USBasp programmer and read the firmware and also read the fuses.
That way you can always set the original firmware and fuses back.

Once you have that working, you could use the Arduino as an ISP.
This is a good starting point:
854  Using Arduino / Sensors / Re: Gyroscope-L3G4200D & Arduino Mini Pro Compatibility on: June 10, 2012, 08:17:23 pm
The original Arduino Pro Mini is with an ATmega168. But everything should be the same.
I would prefer a Uno, Nano or Pro Mini with an ATmega328.

If the Arduino board doesn't have the 3.3V on board, you could use that sensor from Pololu, which has a voltage regulator itself and even an I2C voltage shifter ( ).

The Nano has got an 3.3V on board. In that case you don't need the sensor board with voltage regulator and you can do without the I2C level shifter.

How to use the pins, is reading the datasheet and checking the Pololu schematic.

CS: datasheet: "1" for I2C. Pololu schematic: already "1" with pull-up resistor.
SDO: datasheet: in I2C mode SDO = SA0, lowest bit of address. Pololu schematic: pulled high, addres bit is '1'.
According to table 13 of the datasheet, the I2C-address will be 0xD3 for reading, and 0xD2 for writing.

So you connect Vin to +5V and connect GND, SCL, SDA. That's it.

The L3G4200D is not yet in the Playground sensor section:
855  Using Arduino / Sensors / Re: MPU-6050 how to change rate of MPU generated fused data on: June 10, 2012, 07:54:44 pm
You sure take a deep dive into the MPU-6050.

These pages:
have a function inv_init_config(), which sets the fifo rate at 50Hz. Is that of any help ?

You could ask Jeff.
Pages: 1 ... 55 56 [57] 58 59 ... 68