I didn’t trip, I was testing gravity. It still works…

A representation of an accelerating space shuttle clarified that a clock at the highest point of the shuttle would pick speedier than one at the base because of gravitational time expansion. Some contended that accelerating on board the shuttle would be the same for both clocks, so they ought to tick at the same rate. Give some thought to it.

Thoughts, motivation, and even guideline can originate from anyplace—however when your attention is on innovation, it gets the contribution from the individuals who concentrate on that point. Raspberry Pi, the mini, single board Linux PC, offers unique undertakings and master counsel on arranging, programming, and electronics ventures. Close by being Raspberry Pi and devices tutorial makers, we get a kick out of the chance to program and tinker and make astonishing things with Computer Science and Electronics squash up. We as of late had the joy of taking a shot at a task utilizing an accelerometer and the thoughts behind what you could do with this gadget are truly cool. So in this task, we will incorporate MMA7455, a 3-axis Digital accelerometer sensor, to measure acceleration in 3 dimensions, X, Y, and Z, with the Raspberry Pi using Python.Let’s see if it pays off.

Step 1: Hardware We Require

We know how troublesome it can be to attempt and take after without knowing which parts to get, where to arrange from, and how much everything will cost in advance. So we've done all that work for you. Once you have the parts all squared away it ought to be a snap to do this task. Take after the going with to get a complete parts list.

1. Raspberry Pi

The initial step was getting a Raspberry Pi board. The Raspberry Pi is a solitary board Linux based PC. This little PC packs a punch in registering power, used as a piece of electronics exercises, and PC operations like spreadsheets, word processing, web surfing and email, and games. You can buy one at any electronics or hobbyist store.

2. I2C Shield for Raspberry Pi

The primary concern the Raspberry Pi is truly absent is an I2C port. So for that, the TOUTPI2 I2C connector gives you the sense to use Raspberry Pi with ANY of I2C devices. It's available on DCUBE Store

3. 3-Axis accelerometer, MMA7455

Produced by Freescale Semiconductor, Inc., the MMA7455 3-Axis Digital Accelerometer is a low power, a smaller scale machined sensor fit for measuring acceleration up along its X, Y, and Z axis. We obtained this sensor from DCUBE Store

4. Connecting Cable

We acquired the I2C Connecting cable from DCUBE Store

5. Micro USB cable

The slightest entangled, however, most stringent regarding power necessity is the Raspberry Pi! The most prescribed and least demanding approach to managing the strategy is by the utilization of the Micro USB cable. A more advanced and specialized path is to give power specifically by means of GPIO or USB ports.

6. Networking Support

Get your Raspberry Pi associated with an Ethernet (LAN) cable and interface it to your home network. On the other hand, scan for a WiFi connector and utilize one of the USB ports to get to the remote network. It's a sharp decision, fundamental, little and simple!

7. HDMI Cable/Remote Access

The Raspberry Pi has an HDMI port which you can interface particularly to a Screen or TV with an HDMI cable. Elective, you can use SSH to establish with your Raspberry Pi from a Linux PC or Mac from the terminal. Likewise, PuTTY, a free and open-source terminal emulator sounds like a smart thought.

Step 2: Connecting the Hardware

Make the circuit as indicated by the schematic showed up. In the schematic, you will see the connections of various electronics components, connecting wires, power cables, and I2C sensor.

Raspberry Pi and I2C Shield Connection

As a matter of first importance take the Raspberry Pi and spot the I2C Shield on it. Press the Shield nicely over the GPIO pins of Pi and we are finished with this progression as easy as pie (see the snap).

Raspberry Pi and Sensor Connection

Take the sensor and Interface the I2C cable with it. For the suitable operation of this cable, please review I2C Output ALWAYS takes up with the I2C Input. The same must be taken after for the Raspberry Pi with the I2C shield mounted over the GPIO pins.

We recommend the use of the I2C cable as it negates the requirement for dissecting pinouts, securing, and bother accomplished by even the humblest mess up. With this significant association and play cable, you can present, swap out contraptions, or add more gadgets to an application suitable. This supports the work weight up to an immense level.

Note : The brown wire should reliably take after the Ground (GND) connection between the output of one device and the input of another device.

Internet Access is Key

To make our endeavor a win, we require an Internet connection for our Raspberry Pi. For this, you have alternatives like interfacing an Ethernet (LAN) join with the home network. Also, as an alternative, a satisfying course is to use a WiFi USB connector. By and large representing this, you require a driver to make it work. So incline toward the one with Linux in the delineation.

Power Supply

Plug in the Micro USB cable into the power jack of the Raspberry Pi. Punch up and we are ready.

Connection to Screen

We can have the HDMI cable connected to another Monitor/TV. Sometimes, you need to get to a Raspberry Pi without interfacing it to a screen or you may need to view information from it from elsewhere. Possibly, there are creative and fiscally clever ways to deal with doing all things considered. One of them is using - SSH (remote command-line login). You can likewise use the PuTTY software for that.

Step 3: Python Coding for Raspberry Pi

You can see the Python Code for the Raspberry Pi and MMA7455 Sensor in our GithubRepository.

Before continuing to the code, guarantee you read the standards given in the Readme chronicle and Set up your Raspberry Pi as indicated by it. It will simply relief for a minute to do in light of current circumstances.

An accelerometer is an electromechanical gadget that will gauge acceleration forces. These powers might be static, similar to the constant force of gravity pulling at your feet, or they could be alterable - brought on by moving or vibrating the accelerometer.

The going with is the python code and you can clone and change the code in any way you incline toward.

# Distributed with a free-will license.
# Use it any way you want, profit or free, provided it fits in the licenses of its associated works. # MMA7455L # This code is designed to work with the MMA7455L_I2CS I2C Mini Module available from dcubestore.com # http://dcubestore.com/product/mma7455l-3-axis-low-g-digital-output-accelerometer-i%C2%B2c-mini-module/

import smbus import time

# Get I2C bus bus = smbus.SMBus(1)

# MMA7455L address, 0x1D(16) # Select mode control register, 0x16(22) # 0x01(01) Measurement Mode, +/- 8g bus.write_byte_data(0x1D, 0x16, 0x01)


# MMA7455L address, 0x1D(16) # Read data back from 0x00(00), 6 bytes # X-Axis LSB, X-Axis MSB, Y-Axis LSB, Y-Axis MSB, Z-Axis LSB, Z-Axis MSB data=bus.read_i2c_block_data(0x1D, 0x00, 6)

# Convert the data to 10-bits xAccl = (data[1] & 0x03) * 256 + data [0] if xAccl > 511 : xAccl -= 1024 yAccl = (data[3] & 0x03) * 256 + data [2] if yAccl > 511 : yAccl -= 1024 zAccl = (data[5] & 0x03) * 256 + data [4] if zAccl > 511 : zAccl -= 1024

# Output data to screen print "Acceleration in X-Axis : %d" %xAccl print "Acceleration in Y-Axis : %d" %yAccl print "Acceleration in Z-Axis : %d" %zAccl

Step 4: The Practicality of the Code

Download (or git pull) the code from Github and open it in the Raspberry Pi.

Run the commands to Compile and Upload the code in the terminal and see the yield on Screen. Taking after a few minutes, it will display each one of the parameters. In the wake of ensuring that everything works easily, you can utilize this wander each day or make this wander a little part of a much more prominent task. Whatever your needs you now have one more contraption in your gathering.

Step 5: Applications and Features

The MMA7455, manufactured by Freescale Semiconductor, a low-power high-performance 3-axis digital accelerometer can be used for Sensor Data Changes, Product Orientation, and Gesture Detection. It's perfect for applications such as Mobile Phone/ PMP/PDA: Orientation Detection (Portrait/Landscape), Image Stability, Text Scroll, Motion Dialing, Tap to Mute, Laptop PC: Anti-Theft, Gaming: Motion Detection, Auto-Wake/Sleep For Low Power Consumption and Digital Still Camera: Image Stability.

Step 6: Conclusion

If you've been contemplating to explore the universe of the Raspberry Pi and I2C sensors, then you can shock yourself by making used of the hardware basics, coding, arranging, authoritative, etc. When you're attempting to be more creative in your little venture, it never damages to swing to outside sources. In this method, there might be a couple errands that may be straightforward, while some may test you, move you. In any case, you can make a way and flawless it by changing and making a formation of yours.

For example, You can begin with the thought of a Gravimeter Prototype to measuring the Local Gravitational Field of the Earth with MMA7455 and Raspberry Pi using Python. In the above venture, we have utilized fundamental computations. The basic principle of design is to measure very tiny fractional changes within the Earth's gravity of 1 g. So you could utilize this sensor in various ways you can consider. The algorithm is to measure the rate of change of the vertical gravity vector in all three perpendicular directions giving rise to a gravity gradient tensor. It can be deduced by differencing the value of gravity at two points separated by a small vertical distance, l, and dividing by this distance. We will attempt to make a working rendition of this prototype sooner rather than later, the configuration, the code, and modeling works for structure borne noise and vibration analysis. We believe all of you like it!

For your solace, we have an enchanting video on YouTubewhich may help your examination. Trust this endeavor routes further investigation. If opportunity doesn’t knock, build a door.

About This Instructable



More by Dcube Tech Ventures:Home Automation with Raspberry Pi using Relay board Motion Control with Raspberry Pi and LIS3DHTR, 3-Axis Accelerometer, using Python 3-Axis Accelerometer, ADXL345 with Raspberry Pi using Python 
Add instructable to: