Go to Post If winning that individual match is more important to you than being there in the first place, then I believe you've got your priorities in the wrong spot. - Tom Bottiglieri [more]
Home
Go Back   Chief Delphi > Technical > Control System > Sensors
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 15-01-2012, 22:40
ggorsuch ggorsuch is offline
Registered User
FRC #2471 (Team Mean Machine)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2010
Location: Camas, WA
Posts: 21
ggorsuch is an unknown quantity at this point
ADXL345 accelerometer problems

We are having trouble getting our accelerometer to work. I have it hooked up to the digital sidecar with I2C, and am getting no reading from it.
We are using the 8 slot crio with java. Everything has been updated to the latest.

Any ideas?
Reply With Quote
  #2   Spotlight this post!  
Unread 15-01-2012, 22:46
kinganu123 kinganu123 is offline
Registered User
FRC #1747
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Piscataway, NJ
Posts: 243
kinganu123 is on a distinguished road
Re: ADXL345 accelerometer problems

We need more info
How is it wired? What is it wired to? How are you programming it (what is the code)?
__________________
Reply With Quote
  #3   Spotlight this post!  
Unread 15-01-2012, 23:36
ggorsuch ggorsuch is offline
Registered User
FRC #2471 (Team Mean Machine)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2010
Location: Camas, WA
Posts: 21
ggorsuch is an unknown quantity at this point
Re: ADXL345 accelerometer problems

It is wired using the 4 i2c pins of the accelerometer to the 4 i2c pins on the digital sidecar.
Here is our code:
Code:
package edu.wpi.first.wpilibj.templates;


import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.*;
import edu.wpi.first.wpilibj.ADXL345_I2C.AllAxes;

public class RobotTemplate extends IterativeRobot {
    ADXL345_I2C accelerometer;
    
    public void robotInit() {
        accelerometer = new ADXL345_I2C(1, ADXL345_I2C.DataFormat_Range.k4G);
    }
    public void autonomousPeriodic() {
        ;;
    }
    public void teleopPeriodic() {
        AllAxes ac = accelerometer.getAccelerations();
        System.out.println("X: "+ac.XAxis+" Y: "+ac.YAxis+" Z: "+ac.ZAxis);
    }
    
}
Reply With Quote
  #4   Spotlight this post!  
Unread 15-01-2012, 23:44
zaphodp.jensen zaphodp.jensen is offline
Alumni and Mentor of 3130
AKA: Pierce Jensen
FRC #3130 (East Ridge Robotics Ominous Raptors (E.R.R.O.R.'s))
Team Role: Mentor
 
Join Date: Oct 2009
Rookie Year: 2009
Location: Minnesota
Posts: 76
zaphodp.jensen is a jewel in the roughzaphodp.jensen is a jewel in the roughzaphodp.jensen is a jewel in the rough
Re: ADXL345 accelerometer problems

And all of the wires are straight through? (VCC to VCC, SCL to SCL, SDA to SDA, GND to GND)

And can you get a voltage on SDA and SCL? They should be around 5 volts.

If possible, an oscilloscope would be useful in determining whether or not the I2C bus is working. You should hook up a probe to the SDA line, and confirm that the bits are changing.

Last edited by zaphodp.jensen : 15-01-2012 at 23:46. Reason: MORE INFO!
Reply With Quote
  #5   Spotlight this post!  
Unread 15-01-2012, 23:46
ggorsuch ggorsuch is offline
Registered User
FRC #2471 (Team Mean Machine)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2010
Location: Camas, WA
Posts: 21
ggorsuch is an unknown quantity at this point
Quote:
Originally Posted by zaphodp.jensen View Post
And all of the wires are straight through? (VCC to VCC, SCL to SCL, SDA to SDA, GND to GND)
Yes, they are.
Reply With Quote
  #6   Spotlight this post!  
Unread 15-01-2012, 23:48
zaphodp.jensen zaphodp.jensen is offline
Alumni and Mentor of 3130
AKA: Pierce Jensen
FRC #3130 (East Ridge Robotics Ominous Raptors (E.R.R.O.R.'s))
Team Role: Mentor
 
Join Date: Oct 2009
Rookie Year: 2009
Location: Minnesota
Posts: 76
zaphodp.jensen is a jewel in the roughzaphodp.jensen is a jewel in the roughzaphodp.jensen is a jewel in the rough
Re: ADXL345 accelerometer problems

Just checking... And the voltage?
Reply With Quote
  #7   Spotlight this post!  
Unread 15-01-2012, 23:50
ggorsuch ggorsuch is offline
Registered User
FRC #2471 (Team Mean Machine)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2010
Location: Camas, WA
Posts: 21
ggorsuch is an unknown quantity at this point
Not sure about the voltage.
I will check it tomorrow.
Reply With Quote
  #8   Spotlight this post!  
Unread 16-01-2012, 13:31
ggorsuch ggorsuch is offline
Registered User
FRC #2471 (Team Mean Machine)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2010
Location: Camas, WA
Posts: 21
ggorsuch is an unknown quantity at this point
There is about 4.6 volts on the sda and scl.
I am getting a square wave on the scope, but not really sure what I am looking for.
Reply With Quote
  #9   Spotlight this post!  
Unread 16-01-2012, 14:27
ggorsuch ggorsuch is offline
Registered User
FRC #2471 (Team Mean Machine)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2010
Location: Camas, WA
Posts: 21
ggorsuch is an unknown quantity at this point
Got it working!
Used the flat db37 cable included in this years Kop, instead of the old round one.
Reply With Quote
  #10   Spotlight this post!  
Unread 16-01-2012, 16:25
abrightwell abrightwell is offline
Lead Software Engineer
FRC #0342 (Burning Magnetos)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2010
Location: Charleston, SC
Posts: 20
abrightwell is an unknown quantity at this point
Re: ADXL345 accelerometer problems

Interesting. We are having the same problem. We tried replacing the old round cable with the flat one and nothing worked. I'm certain that the flat cable is either bad or just needs to be re-built (currently working on that one). However, I'm curious why the flat cable would work in your situation as opposed to the round cable.

We have hooked our accelerometer up to an o-scope and all seems fine.

Does anyone else have any other suggestions?
Reply With Quote
  #11   Spotlight this post!  
Unread 16-01-2012, 16:30
ggorsuch ggorsuch is offline
Registered User
FRC #2471 (Team Mean Machine)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2010
Location: Camas, WA
Posts: 21
ggorsuch is an unknown quantity at this point
Quote:
Originally Posted by abrightwell View Post
Interesting. We are having the same problem. We tried replacing the old round cable with the flat one and nothing worked. I'm certain that the flat cable is either bad or just needs to be re-built (currently working on that one). However, I'm curious why the flat cable would work in your situation as opposed to the round cable.

We have hooked our accelerometer up to an o-scope and all seems fine.

Does anyone else have any other suggestions?
Did you flip around the connector as described on the KoP website?
Reply With Quote
  #12   Spotlight this post!  
Unread 16-01-2012, 16:54
abrightwell abrightwell is offline
Lead Software Engineer
FRC #0342 (Burning Magnetos)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2010
Location: Charleston, SC
Posts: 20
abrightwell is an unknown quantity at this point
Re: ADXL345 accelerometer problems

That's what we just did and sure enough it worked. Makes sense as when we Ohm'ed it out, pin 1 went to pin 15 on the other end. I didn't think to check the KoP website, but I'm definitely going to check it out. It still seems like a curious situation that the flat works for the accelerometer but the round doesn't. :-/ Oh well, I'll take it at face value for now.

Thanks for the follow up!
Reply With Quote
  #13   Spotlight this post!  
Unread 05-02-2012, 20:31
Bob649 Bob649 is offline
Technical Mentor
FRC #0649 (Fish)
Team Role: Mentor
 
Join Date: Feb 2012
Rookie Year: 2010
Location: Saratoga HS
Posts: 7
Bob649 is an unknown quantity at this point
Re: ADXL345 accelerometer problems

Hello all,
We are having the same problem. We are using Java, and I can see traffic on the i2c bus with a scope, but no way to decode it. Signal integrity looks ok, clocking as expected and I can see packets, but no analyzer to decode the traffic.

Symptom is no values returned. We don't have labview and so far I am unable to find the wiring diagram or any diagnostic. Based on this thread I also tried both flat and round cables between cRio and side car.

I used the code in one of the threads and it is simple enough that shouldn't be the issue.

If anyone has it working can you post a photo of the sidecar wiring?

Also, do we have to provide our own pullup resistor on CS? The datasheet says one is required for i2c, but it an external one does not seem to help the situation. Could be two problems though.

Thanks in advance!

Bob
Reply With Quote
  #14   Spotlight this post!  
Unread 07-02-2012, 02:57
Bob649 Bob649 is offline
Technical Mentor
FRC #0649 (Fish)
Team Role: Mentor
 
Join Date: Feb 2012
Rookie Year: 2010
Location: Saratoga HS
Posts: 7
Bob649 is an unknown quantity at this point
Re: ADXL345 accelerometer problems

Hello all,
(Apologies if replying to myself is bad form, just wanted to let this thread know the problem was solved.)

Hello all,
I found it - it was multiple faulty cables to the sidecar. The only one that works is a new flat cable from this year that I repaired according to the instructions on the KoP site. It looks like I probably had two problems at the beginning and after I fixed the other one, had the faulty cable issue. Once I got it running, it has been stable.

I will post some photos is anyone is interested in seeing some documentation of an end to end system including some scope shots of traffic.
I guess the "bad" cables must be good enough for the low order PWMs and other channels we were using to fool me.

So the moral of the story, even if you are sure your round cable is good, ONLY use a new flat cable without a twist until you get it working. Then switch other items one at a time so if it stops working you know what it was that went wrong.

Thanks to all who replied!

Bob
Reply With Quote
  #15   Spotlight this post!  
Unread 07-02-2012, 07:59
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: ADXL345 accelerometer problems

Quote:
Originally Posted by Bob649 View Post
Hello all,
(Apologies if replying to myself is bad form, just wanted to let this thread know the problem was solved.)
It's definitely good to follow up with the resolution. That way others who find this thread when searching for information on a similar problem can see how it was fixed.

Quote:
So the moral of the story, even if you are sure your round cable is good, ONLY use a new flat cable without a twist until you get it working.
We've been using an official round cable on our programming testbed for months. It wasn't until a week ago that we tried the I2C connection to an ADXL345, and it took a couple of hours of failure before I remembered some people describing making it work with a ribbon cable instead. So I repaired the KOP cable (chipped of a little plastic by accident in the process), swapped it in, and had instant success.

Has anyone managed to use I2C with the original white 37-pin cable?
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 21:59.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi