Legacy Forum: Preserving Nearly 20 Years of Community History - A Time Capsule of Discussions, Memories, and Shared Experiences.

ACCELEROMETER

Hitec robotics including ROBONOVA humanoid, HSR-8498HB servos, MR C-3024 Controllers and RoboBasic
16 postsPage 1 of 21, 2
16 postsPage 1 of 21, 2

ACCELEROMETER

Post by Humanoido » Fri May 11, 2007 3:34 am

Post by Humanoido
Fri May 11, 2007 3:34 am

There are two types of accelerometers,
one outputs an analog voltage, and one outputs a digital pulse.
I have the digital pulse version - Memsic 2125 Dual-axis Accelerometer.
http://www.parallax.com/detail.asp?product_id=28017
How to read the pulse output and convert
it to a useful number which can be read by RN?

humanoido
There are two types of accelerometers,
one outputs an analog voltage, and one outputs a digital pulse.
I have the digital pulse version - Memsic 2125 Dual-axis Accelerometer.
http://www.parallax.com/detail.asp?product_id=28017
How to read the pulse output and convert
it to a useful number which can be read by RN?

humanoido
Humanoido
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 574
Joined: Tue Dec 05, 2006 1:00 am
Location: Deep in the Heart of Asia

Post by i-Bot » Fri May 11, 2007 9:56 am

Post by i-Bot
Fri May 11, 2007 9:56 am

Unless there is something very special about this accelerometer, I would get an analog output one instead.

The sensor appears to output a 100 Hz pulse, where the duty cycle indicates the g. You could integrate the pulse, though the response time would be slow for any reasonable accuracy.

Timing through digital inputs would not be accurate or fast enough. Existing inputs (Sonar, motorin, RCIN), eiher have a specfic timing, or work in the range less than 3 millisec ( we need 10).

We could write a new instruction to read this sensor ( a modification of RCIN), but like other time critical inputs, it would disable interrupts for the timer period. This means 10millisec dead time per read.

An external conversion could be done, but likely would cost more than an analog accelerometer and be quite a lot of work.
Unless there is something very special about this accelerometer, I would get an analog output one instead.

The sensor appears to output a 100 Hz pulse, where the duty cycle indicates the g. You could integrate the pulse, though the response time would be slow for any reasonable accuracy.

Timing through digital inputs would not be accurate or fast enough. Existing inputs (Sonar, motorin, RCIN), eiher have a specfic timing, or work in the range less than 3 millisec ( we need 10).

We could write a new instruction to read this sensor ( a modification of RCIN), but like other time critical inputs, it would disable interrupts for the timer period. This means 10millisec dead time per read.

An external conversion could be done, but likely would cost more than an analog accelerometer and be quite a lot of work.
i-Bot
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1142
Joined: Wed May 17, 2006 1:00 am

Accelerometer

Post by viper1 » Sat May 12, 2007 1:02 am

Post by viper1
Sat May 12, 2007 1:02 am

newby here: I have the ADXL320 and need help hooking it up. I only have one AD port available. Can I use just the one port? Where do I Connect for power? And What is the proper code for it to function? Thanks

The R/C RCVR Gyro And Voltage sensing have left me with only one A/D Port :? [/b]
newby here: I have the ADXL320 and need help hooking it up. I only have one AD port available. Can I use just the one port? Where do I Connect for power? And What is the proper code for it to function? Thanks

The R/C RCVR Gyro And Voltage sensing have left me with only one A/D Port :? [/b]
viper1
Savvy Roboteer
Savvy Roboteer
Posts: 37
Joined: Thu May 10, 2007 2:55 pm

Post by i-Bot » Sat May 12, 2007 9:59 am

Post by i-Bot
Sat May 12, 2007 9:59 am

You really need two ports, one for each DOF, so I would drop off the voltage sensing and use that for the second port.

This accelerometer appears to work direct from a 5V supply and give analog outputs directly compatible to the AD inputs.

You don't say if you have a bare chip or if you are using a Sparkfun board. The Sparkfun board adds a couple of capacitors which are needed.

Power on the centre pin of the C3024 AD connectors is 5V, and pin at outside of board is Gnd, so a couple of servo leads will connect the ADXL.

Accelerometers are read using the AD() command

If you need more detailed help, let us know.
You really need two ports, one for each DOF, so I would drop off the voltage sensing and use that for the second port.

This accelerometer appears to work direct from a 5V supply and give analog outputs directly compatible to the AD inputs.

You don't say if you have a bare chip or if you are using a Sparkfun board. The Sparkfun board adds a couple of capacitors which are needed.

Power on the centre pin of the C3024 AD connectors is 5V, and pin at outside of board is Gnd, so a couple of servo leads will connect the ADXL.

Accelerometers are read using the AD() command

If you need more detailed help, let us know.
i-Bot
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1142
Joined: Wed May 17, 2006 1:00 am

Accelerometer

Post by viper1 » Mon May 14, 2007 9:24 pm

Post by viper1
Mon May 14, 2007 9:24 pm

i-Bot wrote:
You don't say if you have a bare chip or if you are using a Sparkfun board. The Sparkfun board adds a couple of capacitors which are needed.

If you need more detailed help, let us know.


I have the ADXL320 from Sparkfun. I thought the caps were onboard the ADXL??

I did remove the Voltage sensing cicuit so now I have two Spare A/D ports

If RN1 is running a subroutine such as "push-ups" wouldn't this trigger the ADXL to run the "standup from front" subroutine?
i-Bot wrote:
You don't say if you have a bare chip or if you are using a Sparkfun board. The Sparkfun board adds a couple of capacitors which are needed.

If you need more detailed help, let us know.


I have the ADXL320 from Sparkfun. I thought the caps were onboard the ADXL??

I did remove the Voltage sensing cicuit so now I have two Spare A/D ports

If RN1 is running a subroutine such as "push-ups" wouldn't this trigger the ADXL to run the "standup from front" subroutine?
viper1
Savvy Roboteer
Savvy Roboteer
Posts: 37
Joined: Thu May 10, 2007 2:55 pm

Acceleromter

Post by viper1 » Mon May 14, 2007 9:39 pm

Post by viper1
Mon May 14, 2007 9:39 pm

Also Ive been searching everywhere and cant seem to find how to connect the ADXL to the MR3024. I have Six pins: VDD, GND, X, Y, Z, and ST. Any info about this would be greatly appreciated. I know VDD is power, do I connect this one to the center A/D port? But not sure about the others. :?
Also Ive been searching everywhere and cant seem to find how to connect the ADXL to the MR3024. I have Six pins: VDD, GND, X, Y, Z, and ST. Any info about this would be greatly appreciated. I know VDD is power, do I connect this one to the center A/D port? But not sure about the others. :?
viper1
Savvy Roboteer
Savvy Roboteer
Posts: 37
Joined: Thu May 10, 2007 2:55 pm

Post by i-Bot » Mon May 14, 2007 10:06 pm

Post by i-Bot
Mon May 14, 2007 10:06 pm

Make no connection to the Z and ST pins.

Take two servo cables (one only really needs one wire). The board is powered from the 3 wire servo cable using the centre pin to give VDD, and the pin at the outside ot the controller board to give GND. The X and Y outputs connect to the AD inputs closest to the centre of the board on both cables

Read using the AD commands for the ports used.
Make no connection to the Z and ST pins.

Take two servo cables (one only really needs one wire). The board is powered from the 3 wire servo cable using the centre pin to give VDD, and the pin at the outside ot the controller board to give GND. The X and Y outputs connect to the AD inputs closest to the centre of the board on both cables

Read using the AD commands for the ports used.
i-Bot
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1142
Joined: Wed May 17, 2006 1:00 am

Post by viper1 » Mon May 14, 2007 10:26 pm

Post by viper1
Mon May 14, 2007 10:26 pm

Awsome! Thanks i-bot
Awsome! Thanks i-bot
viper1
Savvy Roboteer
Savvy Roboteer
Posts: 37
Joined: Thu May 10, 2007 2:55 pm

Accelerometer

Post by viper1 » Mon May 14, 2007 11:07 pm

Post by viper1
Mon May 14, 2007 11:07 pm

Ok Im still a little confused, well allright then alot confused Ive got my four pin header soldered to the ADXL and Im getting ready to make my connections. You mentioned earlier about using Capacitors, will i actually need these to calibrate the bandwdth or can I leave it as is? And if I do, what type of caps do I use and do they go only on the X and Y leads?

And the code that ive seen used only mentions a single AD, Example:

I know I'm asking alot but I am eager to learn. I Love Robotics and have just recently been able to really spend time with this favorite hobby of mine.

robot_tilt

robot_tilt:
A = AD(6)
IF A <h40> &ha0 THEN GOTO tilt_front
RETURN
tilt_back:
A = AD(6)
'IF A < 30 THEN GOTO forward_standup
IF A < &h40 THEN GOTO backward_standup
RETURN
tilt_front:
A = AD(6)
'IF A > 200 THEN GOTO backward_standup
IF A > &ha0 THEN GOTO forward_standup
RETURN
Ok Im still a little confused, well allright then alot confused Ive got my four pin header soldered to the ADXL and Im getting ready to make my connections. You mentioned earlier about using Capacitors, will i actually need these to calibrate the bandwdth or can I leave it as is? And if I do, what type of caps do I use and do they go only on the X and Y leads?

And the code that ive seen used only mentions a single AD, Example:

I know I'm asking alot but I am eager to learn. I Love Robotics and have just recently been able to really spend time with this favorite hobby of mine.

robot_tilt

robot_tilt:
A = AD(6)
IF A <h40> &ha0 THEN GOTO tilt_front
RETURN
tilt_back:
A = AD(6)
'IF A < 30 THEN GOTO forward_standup
IF A < &h40 THEN GOTO backward_standup
RETURN
tilt_front:
A = AD(6)
'IF A > 200 THEN GOTO backward_standup
IF A > &ha0 THEN GOTO forward_standup
RETURN
viper1
Savvy Roboteer
Savvy Roboteer
Posts: 37
Joined: Thu May 10, 2007 2:55 pm

Post by i-Bot » Tue May 15, 2007 6:04 pm

Post by i-Bot
Tue May 15, 2007 6:04 pm

Since you have the Sparkfun board, the caps are already on the board.

Looking at the ADXL datasheet, the output is 1.5V for 0g, 1.326V for - 1g and 1.674 for + 1 g. . This seems a little less sensitive than your example code.

Your example does not say if A is a byte or an integer. If A is an Integer the AD output is in the range 0 to 1023 for a voltage of 0 to 5V. If it is a byte then it is 0 to 255.

So make the if statements correspond to this.

Also the orientataion of the sensor is also important.

Finally, get just front / back working first.
Since you have the Sparkfun board, the caps are already on the board.

Looking at the ADXL datasheet, the output is 1.5V for 0g, 1.326V for - 1g and 1.674 for + 1 g. . This seems a little less sensitive than your example code.

Your example does not say if A is a byte or an integer. If A is an Integer the AD output is in the range 0 to 1023 for a voltage of 0 to 5V. If it is a byte then it is 0 to 255.

So make the if statements correspond to this.

Also the orientataion of the sensor is also important.

Finally, get just front / back working first.
i-Bot
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1142
Joined: Wed May 17, 2006 1:00 am

Accelerometer

Post by viper1 » Tue May 15, 2007 6:44 pm

Post by viper1
Tue May 15, 2007 6:44 pm

So if I plug X into A/D (6) and Y into A/D (7), I would Declare A(6) as a "BYTE" and A/D(7) as a "BYTE"?

Then if he's standing up normally the reading at the two ports would be somewhere in the middle of 0-255? Say 126, So if Rn1 were to fall all the way forward X would be closer to 0 or 255 depending on the mounted position of the ADXL board? Could you post an example of what the code might look like? :roll:
So if I plug X into A/D (6) and Y into A/D (7), I would Declare A(6) as a "BYTE" and A/D(7) as a "BYTE"?

Then if he's standing up normally the reading at the two ports would be somewhere in the middle of 0-255? Say 126, So if Rn1 were to fall all the way forward X would be closer to 0 or 255 depending on the mounted position of the ADXL board? Could you post an example of what the code might look like? :roll:
viper1
Savvy Roboteer
Savvy Roboteer
Posts: 37
Joined: Thu May 10, 2007 2:55 pm

Accelerometer??

Post by viper1 » Sun May 20, 2007 8:20 pm

Post by viper1
Sun May 20, 2007 8:20 pm

So if I plug X into A/D (6) and Y into A/D (7), I would Declare A(6) as a "BYTE" and A/D(7) as a "BYTE"?

Then if he's standing up normally the reading at the two ports would be somewhere in the middle of 0-255? Say 126, So if Rn1 were to fall all the way forward X would be closer to 0 or 255 depending on the mounted position of the ADXL board? Could you post an example of what the code might look like? :roll: HELP
So if I plug X into A/D (6) and Y into A/D (7), I would Declare A(6) as a "BYTE" and A/D(7) as a "BYTE"?

Then if he's standing up normally the reading at the two ports would be somewhere in the middle of 0-255? Say 126, So if Rn1 were to fall all the way forward X would be closer to 0 or 255 depending on the mounted position of the ADXL board? Could you post an example of what the code might look like? :roll: HELP
viper1
Savvy Roboteer
Savvy Roboteer
Posts: 37
Joined: Thu May 10, 2007 2:55 pm

Accelerometer

Post by viper1 » Sun May 20, 2007 9:12 pm

Post by viper1
Sun May 20, 2007 9:12 pm

I think I've got it figured out, The only thing i'm confused about is, Why the extra AD port The original template only mentions one AD port int the program for both frwd and backward tilt what would be the other? The ADXL from sparkfun has X and Y. Cant I just use the X to sense if RN1 has fallen frw or backward? What would Y be for???
I think I've got it figured out, The only thing i'm confused about is, Why the extra AD port The original template only mentions one AD port int the program for both frwd and backward tilt what would be the other? The ADXL from sparkfun has X and Y. Cant I just use the X to sense if RN1 has fallen frw or backward? What would Y be for???
viper1
Savvy Roboteer
Savvy Roboteer
Posts: 37
Joined: Thu May 10, 2007 2:55 pm

Accelerometer

Post by viper1 » Mon May 21, 2007 12:30 am

Post by viper1
Mon May 21, 2007 12:30 am

I finaaly stumbled my way through the code and Got the tilt_high to work for my RN1 to forward_standup, Thats with the X connected to AD(7) Now I have the Y connected to AD(6) but am stumped about how to configure the code for it, so that he will standup from his back???????????
I finaaly stumbled my way through the code and Got the tilt_high to work for my RN1 to forward_standup, Thats with the X connected to AD(7) Now I have the Y connected to AD(6) but am stumped about how to configure the code for it, so that he will standup from his back???????????
viper1
Savvy Roboteer
Savvy Roboteer
Posts: 37
Joined: Thu May 10, 2007 2:55 pm

Accelerometer

Post by viper1 » Mon May 21, 2007 12:32 am

Post by viper1
Mon May 21, 2007 12:32 am

I finaaly stumbled my way through the code and Got the tilt_high to work for my RN1 to forward_standup, Thats with the X connected to AD(7) Now I have the Y connected to AD(6) but am stumped about how to configure the code for it, so that he will standup from his back??????????? This is what my code looks like now.

robot_tilt:
A = AD(7)
A = AD(6)
IF A > 250 THEN RETURN

IF A <160> 160 THEN GOTO tilt_high

RETURN
tilt_low:
A = AD(6)
'IF A < 30 THEN GOTO forward_standup
IF A < 160 THEN GOTO backward_standup
RETURN
tilt_high:
A = AD(7)
'IF A > 200 THEN GOTO backward_standup
IF A > 160 THEN GOTO forward_standup
RETURN
I finaaly stumbled my way through the code and Got the tilt_high to work for my RN1 to forward_standup, Thats with the X connected to AD(7) Now I have the Y connected to AD(6) but am stumped about how to configure the code for it, so that he will standup from his back??????????? This is what my code looks like now.

robot_tilt:
A = AD(7)
A = AD(6)
IF A > 250 THEN RETURN

IF A <160> 160 THEN GOTO tilt_high

RETURN
tilt_low:
A = AD(6)
'IF A < 30 THEN GOTO forward_standup
IF A < 160 THEN GOTO backward_standup
RETURN
tilt_high:
A = AD(7)
'IF A > 200 THEN GOTO backward_standup
IF A > 160 THEN GOTO forward_standup
RETURN
viper1
Savvy Roboteer
Savvy Roboteer
Posts: 37
Joined: Thu May 10, 2007 2:55 pm

Next
16 postsPage 1 of 21, 2
16 postsPage 1 of 21, 2