Triple Axis Accelerometer quest

You might notice that im asking alot of different stuff around here and i hope that i am not anoying anybody with this...

So another thing i am working on is a level, like this thing only digital:

So i bought a Triple Axis Accelerometer Breakout - MMA7260Q to do the sensing. And i want to use 10 leds to show the reading.

The first thing is hooking up the accelerometer.

I can hoop up the Z, X and Y pins to the ANALOG IN of the Arduino, ok thats easy.

But what about the vcc and the slp pins? The data sheet says 3,3v but the Arduino puts out 5v. As you might have noticed in other posts, i am horrible when it comes to electronics...

How do i hook it up, and why? Or can somebody give me a little pointer how to do this?

Again, thanks loads :-)

ps. made it to Junior Member already asking all kinds of silly questions :-)

This might be what you are looking for (http://www.sparkfun.com/commerce/product_info.php?products_id=8745). And you can do it yourself as well , there are a lot of IC chips can be used for this logic level (5v to 3.3v) conversion (http://www.maxim-ic.com/app-notes/index.mvp/id/3007).

i cant imagine that i would need such a thing... I am kinda stunned and shocked about it. I saw some videos online with this sensor but i never saw this in between it all...

Not that i dont trust you answer but i want to have a second opinion on this :-)

The other thing you could do is run the Arduino/ATMega on 3.3V (I think you have to dump the external oscillator, though, and go with internal only - plus you would need a different bootloader put on the ATMega, etc). Plenty of information out there on how to do this.

I got the same accelerometer. I used a 3.3V regulator for the accelerometer's supply voltage, and also wired that 3.3V to the arduino's AREF input. As I didn't use other analog inputs, I didn't need to think about their levels, and could connect the accelerometer directly.

It is not strictly neccessary to connect the AREF input, but you will get a better resolution if you do (when you have less than 5V range). It is however neccesary to supply the accelerometer's Vcc with those 3.3V.

The 3.3V reg was a HT7133 from here: http://www.bitsbox.co.uk/vregs.html

The data sheet says 3,3v but the Arduino puts out 5v

Which Arduino do you have? Relatively new ones have 3.3V from the FTDI USB chip.

Here's a USA supplier for a Low-Drop-Out (LDO) regulator; this would drop 5V down to 3.3V e.g. LP2950CZ-3.3 Less than $1. [edit]I have no commercial link to newark, I just thought a USA supplier may be helpful[/edit]

You don't need a logic level converter for the MMA7260Q output as they are into Arduino analog pins, as raron explained.

The accelerometer doesn't produce any logic level output signal, but the MMA7260Q selects are inputs. You could tie them to ground/3.3V if you are happy with that. Alternatively, you could use two resistors as voltage divider for each select, with the top of each voltage divider tied to an Arduino digital output, and the middle of the voltage divider to the MMA7260Q select's input (and the bottom to ground).

HTH GB

I got the arduino duemilanove. The latest model i think.

But anyway, us suppliers arnt real handy for me, im from holland. But i found a nice uk seller https://www.skpang.co.uk/catalog/index.php

They have alot of arduino stuff and i bought the Logic Level Converter, this is a easy way to do this i think :-)

I also bought the "Make: Electronics Book" so i can get more into the electronics stuff :-)

I got the arduino duemilanove. The latest model i think.

Then it has a 3.3V pin already, you are good to go.

But anyway, us suppliers arnt real handy for me, im from holland. But i found a nice uk seller https://www.skpang.co.uk/catalog/index.php

Sorry, wasn't sure where you are. You have some good suppliers in the Netherlands.

They have alot of arduino stuff

Yes, I buy stuff from them ...

and i bought the Logic Level Converter, this is a easy way to do this i think

Not as easy as 4 resistors, but your money. A high-voltage driving a low-voltage is easier than low driving high.

I also bought the "Make: Electronics Book" so i can get more into the electronics stuff

Good idea.

GB

Then it has a 3.3V pin already, you are good to go.

Damn, i can slap myself on the head right now, i didnt see that pin...

So ok, in that case im going to check out the data sheet again en make a fritzing image for you guys can give me an ok on that :-)

This should be it, if im correct :-)

For the people that are looking for the gs pins: (I dont need it so i didnt put them in my schematic.)

Next step, the code.

First im going to check if i can get a reading from the sensor.

Apparently this sensor can count down from 700 very well with the analogRead code:

Output:

695
695
695
694
694
694
694
694
694
694
694
693
694
694
693
693
693
693
693
692
692
692
692
692
692
692
692
692
692
692
692
692
692
692
692
692

Code:

 void setup() {
  Serial.begin(9600); 
 }

 void loop() {
  // read the analog input into a variable:
   int analogValue = analogRead(0);
   // print the result:
   Serial.println(analogValue);

   delay(100);
 }

Why isnt it giving me any output that i can understand?

What happens when you tilt the accelerometer?

SLP input is also a 3.3V one, you should not connect that directly to a digital output that can have 5V. Besides it needs to be HIGH (3.3V) to not sleep.

Alright in that case i will have to wait for the converter to get here... I hope that it will make alot more sense then :-)

[edit]Or can i use the 3,3 output of the arduino for the slp? This pin is always high right?[/edit]

Alright in that case i will have to wait for the converter to get here

Or you could use two resistors, you just need to pull up an input with a max of 3.3V (approx) with a 4.3V-5V, so resistors would be fine.

[edit]Or can i use the 3,3 output of the arduino for the slp? This pin is always high right?[/edit]

Even better, pull-up SLP to 3.3V with a resistor

GB

Even better, pull-up SLP to 3.3V with a resistor

I am sorry for this incredible dumb question but how exactly do i do that? I mean the pull up thing is a thing i could understand, its always up so thats ok :-). But the resistor part... Why and how?

Cant wait for the book to get in, the whole electronics thing is really becoming a problem :-[

You can tie SLP to Vcc, that will work.

It's an old habit. I tie pins via a resistor, e.g. 1K. It used to matter. The idea is to reduce the impact of electrical noise on the pin.

Don't worry about it. GB

Update of the fritzing layout.

Thanks for the tip, i will try it right after i get back from work :-)

That should work.

Just to deal with the GS1 and GS2 inputs for any folks looking at this thread.

According to the data sheet, the sensitivity of the device is 1.5g by default, but can be decreased to 6g.

The Sparkfun datasheet for the MMA7260QT says that the sensitivity (to acceleration) of the device is programmed by putting a LOW or HIGH on those pins, but the pins are internally connected to LOW with a pull-down resistor, so you don't need to do anything for 1.5g.

Table 3 says which sensitivity corresponds to each permutation, so it can select 1.5g, 2g, 4g, or 6g. It very much depends on what you want to do. You could tie GS1 and/or GS2 to 3.3 if you wanted to change that. If you needed to change it under Arduino control, then you'd use a couple of resistors to connect a digital out pin from the Arduino to those accelerometer inputs.

I'd expect 1.5G would be the best for a 'level'. So use it without connecting GS1 or GS2 anything.

HTH GB

It's an old habit. I tie pins via a resistor, e.g. 1K. It used to matter. The idea is to reduce the impact of electrical noise on the pin.

With TTL chips (we're talking 1970s, 80s) tying an input to +5V would definitely cause circuit malfunction. Tying it to ground wouldn't. Even with MOSFET circuitry (all modern logic) tying an input to the positive rail is more likely to cause problems if there are spikes on the supply rail (there are always spikes on the supply rail). The resistor acts as a potential divider with the input protection diodes to limit any damage to the input FET's gate oxide layer should a big positive spikes be present.

If running 15V CMOS logic at 5V there is no issue at all with connecting inputs to +5. If running an expensive microcontroller at 0.5V below its maximum rating, I think the resistor isn't a bad thing.