Raspberry PI based ROV

Anything to do with the Raspberry Pi
perfo
Posts: 151
Joined: Jan 27th, 2015, 12:05 am

Re: Raspberry PI based ROV

Post by perfo »

Am I right in thinking the RTIMU lib thing will auto detect my sensor board ?
User avatar
Moki
Posts: 119
Joined: Oct 21st, 2014, 2:19 am
Location: The Netherlands

Re: Raspberry PI based ROV

Post by Moki »

perfo wrote:Am I right in thinking the RTIMU lib thing will auto detect my sensor board ?
Yes, you are.... and No... i don't think the RTIMUlib will support the ADXL345.

But good news for you, i found a sollution ;)

Type the following command's at the prompt for your Raspberry PI

Code: Select all

sudo su -
git clone https://github.com/timbit123/ADXL345.git
npm install i2c@0.1.8
npm install async
node test.js
Your output should look like this:

Code: Select all

pi@rov-v1 ~ $ sudo su -
root@rov-v1:~# git clone https://github.com/timbit123/ADXL345.git
Cloning into 'ADXL345'...
remote: Counting objects: 32, done.
remote: Total 32 (delta 0), reused 0 (delta 0), pack-reused 32
Unpacking objects: 100% (32/32), done.
root@rov-v1:~# cd ADXL345/
root@rov-v1:~/ADXL345# npm install i2c@0.1.8
npm http GET https://registry.npmjs.org/i2c/0.1.8
npm http 304 https://registry.npmjs.org/i2c/0.1.8
npm http GET https://registry.npmjs.org/bindings
npm http GET https://registry.npmjs.org/underscore/1.2.4
npm http GET https://registry.npmjs.org/coffee-script/1.3.3
npm http GET https://registry.npmjs.org/repl/0.1.3
npm http 304 https://registry.npmjs.org/bindings
npm http 304 https://registry.npmjs.org/underscore/1.2.4
npm http 304 https://registry.npmjs.org/coffee-script/1.3.3
npm http 304 https://registry.npmjs.org/repl/0.1.3

> i2c@0.1.8 install /root/ADXL345/node_modules/i2c
> node-gyp rebuild

make: Entering directory '/root/ADXL345/node_modules/i2c/build'
  CXX(target) Release/obj.target/i2c/src/i2c.o
  SOLINK_MODULE(target) Release/obj.target/i2c.node
  SOLINK_MODULE(target) Release/obj.target/i2c.node: Finished
  COPY Release/i2c.node
make: Leaving directory '/root/ADXL345/node_modules/i2c/build'
i2c@0.1.8 node_modules/i2c
âââ bindings@1.1.1
âââ repl@0.1.3
âââ underscore@1.2.4
âââ coffee-script@1.3.3
root@rov-v1:~/ADXL345# npm install async
npm http GET https://registry.npmjs.org/async
npm http 304 https://registry.npmjs.org/async
async@0.9.0 node_modules/async
root@rov-v1:~/ADXL345# node test.js
Roll: 0.031096373492499996 Pitch : 0.0615756370390006 Yaw : -9.682793414487
Roll: 0.0682263716925 Pitch : 0.0615756370390006 Yaw : -9.721391413087
Roll: -0.1174236193075 Pitch : 0.09900763523899947 Yaw : -9.991577403287
Roll: -0.0802936211075 Pitch : -0.013288359360998925 Yaw : -9.798587410286999
perfo
Posts: 151
Joined: Jan 27th, 2015, 12:05 am

Re: Raspberry PI based ROV

Post by perfo »

Well splendid is all I can say.. it worked just as you said...
I had a good search and I couldn't find anything related to reading my sensor board over I2C..

So this is showing the accelerometer data so this will show zero (or near enough) on all axis if nothing is moving.
I had a look at the code but couldn't quite figure out how I expand this to show Gyros, compass and pressure.
I erroneously thought it would be a simple matter of putting in the right address for the board then reading certain memory locations but it appear more complex than that...
I can see where the accel function is being accessed in index.js from test.js but not how it's working over all , I mean how it's doing it...

If I can get to the point where I can see all the sensor data on a web page (doesn't matter about formatting) and say get a button pressed on the client keyboard to do something on the PI then maybe I'd be away.
I read all the stuff on the graphics on the link you sent me and I read the socket.io stuff and did the example chat room and it has cleared a lot up. I must admit I hadn't even realised nodeJs was operating as the server.. Ok I'm hooked on this method now...I'm going to read the W3 tuts on java next...
Thanks for your help on this Moki....I may not be a totally lost cause just yet :)
User avatar
Moki
Posts: 119
Joined: Oct 21st, 2014, 2:19 am
Location: The Netherlands

Re: Raspberry PI based ROV

Post by Moki »

Yer welcome... and remember... if it was easy... everyone would be doing it.
User avatar
olegodo
Posts: 222
Joined: Aug 30th, 2013, 9:47 am
Location: Bergen, Norway

Re: Raspberry PI based ROV

Post by olegodo »

If it was easy.. I would be able to do it! :lol:
perfo
Posts: 151
Joined: Jan 27th, 2015, 12:05 am

Re: Raspberry PI based ROV

Post by perfo »

any clues how I can get the rest of the data from it ? I'll search for data sheets etc if I know what I'm looking for...
thanks
User avatar
Moki
Posts: 119
Joined: Oct 21st, 2014, 2:19 am
Location: The Netherlands

Re: Raspberry PI based ROV

Post by Moki »

What board did you buy? (didn't find any reference of a pressure sensor on the boards i found)

This guide should give you all the info on the ADXL345 chip, http://www.analog.com/static/imported-f ... DXL345.pdf
Mostly the REGISTER MAP will be most usefull. (Not for the faint of hearth)
User avatar
Moki
Posts: 119
Joined: Oct 21st, 2014, 2:19 am
Location: The Netherlands

Re: Raspberry PI based ROV

Post by Moki »

perfo wrote:any clues how I can get the rest of the data from it ?
What i think the procedure would be, is this.

Write to a register.
Wait for a signal or timeout... Or keep reading until you dont get an error.
(This all depends on the board you have, ofcourse)
Then read the register, you need.

And repeat.
perfo
Posts: 151
Joined: Jan 27th, 2015, 12:05 am

Re: Raspberry PI based ROV

Post by perfo »

http://www.ebay.co.uk/itm/121454806870? ... EBIDX%3AIT

Hmm I had a thought though would I access the data as if the chips where independent of each other ? or has the whole thing been bundled together and so sort of handler passes the data through.
User avatar
Moki
Posts: 119
Joined: Oct 21st, 2014, 2:19 am
Location: The Netherlands

Re: Raspberry PI based ROV

Post by Moki »

That would depend on the design of the board, i think.

Sometimes they add multiple chips to an i2c board, normally every chip would still have its own i2c address. And sometimes you only access an ADC chip, which would get its data from other chips on the board.
Post Reply