Page 1 of 1

Installation Error Accelerometer on Raspberry PI B +

Posted: Tue Jan 20, 2015 6:53 pm
by w_t
Hi,
would you give me a hand to configure an accelerometer on Raspberry PI B +

These are my components:

- Raspberry PI B+
http://www.amazon.it/Raspberry-Pi-Mo.../dp/B00LPESRUK

- Base Board
http://it.farnell.com/microstack/mic...rry/dp/2434227

- Acelerometer
http://it.farnell.com/microstack/mic...rry/dp/2434229

I followed the official document of the accelerometer:
http://www.farnell.com/datasheets/1860445.pdf

I installed python3microstacknode, launch the command python3 /usr/share/doc/python3-microstacknode/examples/accelcat.py

and gives me this error:

Code: Select all

pi@raspberrypi ~ $ python3 /usr/share/doc/python3-microstacknode/examples/accelcat.py  Traceback (most recent call last): 
  File "/usr/share/doc/python3-microstacknode/examples/accelcat.py", line 8, in <module> 
    accelerometer.init() 
  File "/usr/lib/python3/dist-packages/microstacknode/accelerometer/mma8452q.py", line 115, in init 
    self.standby() 
  File "/usr/lib/python3/dist-packages/microstacknode/accelerometer/mma8452q.py", line 127, in standby 
    self.ctrl_reg1.value &= 0xff ^ CTRL_REG1_SET_ACTIVE 
  File "/usr/lib/python3/dist-packages/microstacknode/accelerometer/mma8452q.py", line 213, in value 
    v)) 
  File "/usr/lib/python3/dist-packages/microstackcommon/i2c.py", line 85, in transaction 
    ioctl(self.fd, I2C_RDWR, ioctl_arg)  IOError: [Errno 5] Input/output error
the base board has a USB for power but I do not think that is necessary, I believe that foods from GIPIO.

What could have happened?

Re: Installation Error Accelerometer on Raspberry PI B +

Posted: Tue Jan 20, 2015 8:35 pm
by DougieLawson
All of the URLs in your posting got mushed by copy'n'paste (you've lost detail in the middle of each URL).

You'll need to activate I2C using the "advanced menu" in sudo raspi-config. Then shut down you Raspberry Pi and pull the power.

The device is I2C. So you need to connect PIN#1 (3V3), PIN#3 (SDA), PIN#5 (SCL) & PIN#6 (GND) on your Pi to the 3V3 (PIN#1), SDA (PIN#2), SCL (PIN#3) and GND (PIN#5) on the RIGHT hand side of your accelerometer board. Make the connections, check the connections, check the connections again.

Image

Reboot the Raspberry Pi.

sudo i2cdetect -y 1
should show a device at address 0x1d

Code: Select all

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- 1D -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

Re: Installation Error Accelerometer on Raspberry PI B +

Posted: Tue Jan 20, 2015 9:19 pm
by w_t
Thank you very much for your response.

These are the URLs in full:

http://it.farnell.com/microstack/micros ... dp/2434227

http://it.farnell.com/microstack/micros ... dp/2434229

http://www.farnell.com/datasheets/1860445.pdf

These are the steps that I have done now:


1) sudo nano /etc/modprobe.d/raspi-blacklist.conf

this is my .conf now:

Code: Select all

 # Blacklist spi and i2c by default (many users do not need them)

 #blacklist spi-bcm2708
 #blacklist i2c-bcm2708
 #blacklist snd-soc-pcm512x
 #blacklist snd-soc-wm8804
 
2) sudo nano / etc / modules

this is my time modules:

Code: Select all

 
 # / Etc / modules: kernel modules to load at boot time.
 #
 # This file contains the names of kernel modules That Should Be loaded
 # At boot time, one per line. Lines beginning with "#" are ignored.
 # Parameters can be specified after the module name.

 snd-bcm2835
 i2c-dev
 
3) sudo reboot

4) ls -la / dev / i2c-0
ls: can not access / dev / i2c-0: No such file or directory

4) ls -la / dev / i2c-1
crw-rw --- T 1 root i2c 89, 1 Jan 20 20:48 / dev / i2c-1

5) sudo apt-get update

6) sudo apt-get install i2c-tools

7) sudo i2cdetect -y 1

this is my result:

Code: Select all

 pi @ raspberrypi ~ $ sudo i2cdetect -y 1

      0 1 2 3 4 5 6 7 8 9 a b c d e f
 00: - - - - - - - - - - - - -
 10: - - - - - - - - - - - UU - - - -
 20: - - - - - - - - - - - - - - - -
 30: - - - - - - - - - - - UU - - - -
 40: - - - - - - - - - - - - - - - -
 50: - - - - - - - - - - - - - - - -
 60: - - - - - - - - - - - - - - - -
 70: - - - - - - - -
 
8) python3 /usr/share/doc/python3-microstacknode/examples/accelcat.py

result:

Code: Select all

 pi @ raspberrypi ~ $ python3 /usr/share/doc/python3-microstacknode/examples/accelcat.py
 Traceback (most recent call last):
   File "/usr/share/doc/python3-microstacknode/examples/accelcat.py", line 8, in <module>
     accelerometer.init ()
   File "/usr/lib/python3/dist-packages/microstacknode/accelerometer/mma8452q.py", line 115, in init
     self.standby ()
   File "/usr/lib/python3/dist-packages/microstacknode/accelerometer/mma8452q.py", line 127, in standby
     self.ctrl_reg1.value & 0xff = ^ CTRL_REG1_SET_ACTIVE
   File "/usr/lib/python3/dist-packages/microstacknode/accelerometer/mma8452q.py", line 213, in value
     v))
   File "/usr/lib/python3/dist-packages/microstackcommon/i2c.py", line 85, in transaction
     ioctl (self.fd, I2C_RDWR, ioctl_arg)
 IOError: [Errno 5] Input / output error
 
Nothing has changed.

The accelerometer is mounted in the socket of his Base Board, I have not mounted with flying connections.

Re: Installation Error Accelerometer on Raspberry PI B +

Posted: Tue Jan 20, 2015 9:45 pm
by DougieLawson
You need to wire it to your RPi. The software parts are ready to go when you get the hardware done.

Four wires, from four pins on the RPi to the four sockets I identified on your accelerometer.

Re: Installation Error Accelerometer on Raspberry PI B +

Posted: Wed Jan 21, 2015 6:06 pm
by w_t
Hi,
I connected the wires as you told me, nothing, as usual, it seems that does not see him, I disconnected the accelerometer and the usual result, so I guess it does not see him.

The Base Board that I bought is just for the accelerometer and the Raspberry, it seemed impossible that she was the cause.

I have to enable other settings on Raspberry stalks in addition to activating I2C-config ??

Re: Installation Error Accelerometer on Raspberry PI B +

Posted: Wed Jan 21, 2015 6:22 pm
by BMS Doug
w_t wrote:Hi,
I connected the wires as you told me, nothing, as usual, it seems that does not see him, I disconnected the accelerometer and the usual result, so I guess it does not see him.

The Base Board that I bought is just for the accelerometer and the Raspberry, it seemed impossible that she was the cause.

I have to enable other settings on Raspberry stalks in addition to activating I2C-config ??
Please connect up the wiring as you think it should be connected and post a photograph of it somewhere (and linkto the photo here).

Re: Installation Error Accelerometer on Raspberry PI B +

Posted: Wed Jan 21, 2015 8:54 pm
by DougieLawson
w_t wrote:Hi,
I connected the wires as you told me, nothing, as usual, it seems that does not see him, I disconnected the accelerometer and the usual result, so I guess it does not see him.
Does the output from sudo i2cdetect -y 1 differ from before? I may have got the address wrong when I read the code library.

The wiring should be trivial. That manufacturer's diagram (that I posted earlier) was clear enough.

Re: Installation Error Accelerometer on Raspberry PI B +

Posted: Wed Jan 21, 2015 9:10 pm
by w_t
I took 5 pictures of how I connected the accelerator to Raspberry.
Since the Pin are exactly in sequence, just engage in the inverted position the throttle GIPIO.
- 3V3
- SDA
- SCL
- NULL
- GND

I attach 3 images.

Re: Installation Error Accelerometer on Raspberry PI B +

Posted: Wed Jan 21, 2015 9:15 pm
by w_t
the output sudo i2cdetect -y 1 is identical to the first and will not change even if the accelerometer detachment

Re: Installation Error Accelerometer on Raspberry PI B +

Posted: Wed Jan 21, 2015 9:42 pm
by DougieLawson
w_t wrote:I took 5 pictures of how I connected the accelerator to Raspberry.
Since the Pin are exactly in sequence, just engage in the inverted position the throttle GIPIO.
- 3V3
- SDA
- SCL
- NULL
- GND

I attach 3 images.
That won't work. Your NULL isn't a null pin.

You need to use Dupont wires to wire the right pins to the right places.

Image

Re: Installation Error Accelerometer on Raspberry PI B +

Posted: Thu Jan 22, 2015 5:44 pm
by Manofmilk
Hi guys,

I am having the exact same problem, except I also am using the Microstack Base board, which is supposed to make this more straightforward - the board is connected correctly to my pi (a B+) and there is only one place the accelerometer can attach to the baseboard. I'm a total n00b to such things and I have to say the Microstack instructions were not particularly good at all and missed a lot of steps out but I have now struggled through using a lot og Googling until I am in the same place.

Trying to follow the instructions in the data sheet (http://www.farnell.com/datasheets/1860445.pdf) I get the same error as you if I try and run the example script. If I follow the manual interactive options (note there seems to be a typo in the PDF that adds '.hardware.' to the module loaded) then I get this:

pi@rasppibplus /usr/share/doc/python3-microstacknode/examples $ python3
Python 3.2.3 (default, Mar 1 2013, 11:53:50)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import microstacknode.accelerometer.mma8452q
>>> accelerometer = microstacknode.accelerometer.mma8452q.MMA8452Q()
>>> x, y, z = accelerometer.get_xyz()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3/dist-packages/microstacknode/accelerometer/mma8452q.py", line 168, in get_xyz
buf = self.i2c_master.transaction(reading(self.i2c_address, 7))[0]
File "/usr/lib/python3/dist-packages/microstackcommon/i2c.py", line 85, in transaction
ioctl(self.fd, I2C_RDWR, ioctl_arg)
AttributeError: 'I2CMaster' object has no attribute 'fd'


Any help or suggestions much appreciated, its been an uphill struggle so far!

Re: Installation Error Accelerometer on Raspberry PI B +

Posted: Thu Jan 22, 2015 5:56 pm
by w_t
Hi,
I connected as you told me, but it does not work, remained as before.

Re: Installation Error Accelerometer on Raspberry PI B +

Posted: Thu Jan 22, 2015 6:45 pm
by DougieLawson
w_t wrote:Hi,
I connected as you told me, but it does not work, remained as before.
Is the device faulty? Or worse, have you damaged your GPIO pins?
Try other I2C devices, try another Pi, try another accelerometer.

Re: Installation Error Accelerometer on Raspberry PI B +

Posted: Thu Jan 22, 2015 7:54 pm
by w_t
is, in fact, I'm feeling right now ODROID C1, update some things and then try.
Do you know how it went in a bit.
Thank you very much for your patience

Re: Installation Error Accelerometer on Raspberry PI B +

Posted: Thu Jan 22, 2015 8:45 pm
by w_t
Absurd .... on "ODROID C1 with Ubuntu LTS 14:04" I do not see in / dev / i2c-the first

I do not know what to do !!

Sorry, I could say from scratch, step by step how to do to install the accelerometer?

thanks a lot

Re: Installation Error Accelerometer on Raspberry PI B +

Posted: Fri Jan 23, 2015 12:31 pm
by BMS Doug
w_t wrote:Absurd .... on "ODROID C1 with Ubuntu LTS 14:04" I do not see in / dev / i2c-the first

I do not know what to do !!

Sorry, I could say from scratch, step by step how to do to install the accelerometer?

thanks a lot
you'll need to check the ODroid forums for support with that device.

Re: Installation Error Accelerometer on Raspberry PI B +

Posted: Sat Jan 24, 2015 12:41 am
by MoXzilla
Hey, I am currently working with the same problem along with the GPS from microstack cant get either to work but update files here https://github.com/microstack-IoT with it all updated I get error.

Code: Select all

pi@raspberrypi ~ $ python3
/usr/share/doc/python3-microstacknode/examples/accelcat.py
Traceback (most recent call last):
  File "/usr/share/doc/python3-microstacknode/examples/accelcat.py",
line 3, in <module>
    from microstacknode.hardware.accelerometer.mma8452q import MMA8452Q
ImportError: No module named hardware.accelerometer.mma8452q
pi@raspberrypi ~ $

Re: Installation Error Accelerometer on Raspberry PI B +

Posted: Mon Jan 26, 2015 7:38 am
by Manofmilk
Hi MoXzilla,

If you look at my post a few up I believe that the '.hardware.' part of the module name may be incorrect. I have the GPS module working so am happy to help you getting that up and running and we'll see what we can do about the accelerometer together.

Re: Installation Error Accelerometer on Raspberry PI B +

Posted: Mon Jan 26, 2015 5:41 pm
by w_t
sorry but I did not understand, read and write with google translator and I think that has mistranslated the post

Re: Installation Error Accelerometer on Raspberry PI B +

Posted: Thu May 28, 2015 11:09 am
by mattat01
I had the same problems as some of you. I'd given up when persistence got the better of me and I came across this: https://github.com/microstack-IoT/pytho ... e/issues/1

You could have received one of the 'couple' of boards made without the connection between JS2 and JS3.
microstack_accelerometer.jpg
Missing Connection
microstack_accelerometer.jpg (46.41 KiB) Viewed 3549 times
You need to bridge this connection (I stuck a bent staple in the holes, but soldering may be better)!

I eventually got the GPS working and then finally this solved my issues. Works like a charm when enhanced with a staple.