|
|
|
Forum Guru
      
Group: Forum Members
Last Login: Monday, December 27, 2010 5:21 PM
Posts: 55,
Visits: 139
|
|
Jason,
Thanks for the excellent demonstration. The images really helped me understand what you guys were trying to say.
As for the other sensors connected to the IOWizard. I understand that you can only communicate only I2C to the IOWizard and then query each sensor accordingly. But the question is - HOW TO QUERY THE SENSOR.
I know that if i want to read from the sensor i can issue an I2C command like so
i2c r 100 20
Furthermore, I understand that you can toggle the state of the GPIO to whatever you need.
i2c w 100 1 0 0
i2c w 100 1 0 1
i2c w 100 1 0 2
But the problem I am having is basically understanding how to get anything out of the reading. Like I said in the previous comment - will I have to code the exact logic required to make the sensor work.
Please review the code snippet in my last comment to understand what I am trying to say.
I can just simply query the IOWizard on the GPIO and get anything out of it. Simply because all the readings come back as 0 or 1 on GPIO.
When i change the state of the GPIO then i can see that state reflect when i read back the 20 bytes. I am doing this with PING))) sensors so when i set the pin to HIGH i see the LED come on on the PING))) sensor.
However there is a series of steps required in order to make the PING))) sensor work.
Here is some logic i took from the society of robots site that explained the ping sensor and how it worked.
//Make the I/O pin an Output
//Bring LOW the pin that the PING rangefinder is connected
//Bring the pin HIGH for 5 microseconds
//Bring the pin LOW
//Make the I/O pin an Input
//Wait until the pin goes HIGH
//Use a timer to see how much longer it takes for the pin to become LOW
//The time it took to become low is now our raw distance ( in microseconds)
//Divide Raw Distance by two since it includes the time for a return trip of the sonar
//Raw distance * 2257 is our distance in cm
//Raw distance * 889 is our distance in inches
I made the assumption that I would have to code this up via the .NET libs provided using the generic I2C device object in the framework. However that doesnt work either.
Ideas?
-Danny
Animusoft
RUG Community
|
|
|
|
|
Forum Guru
      
Group: Forum Members
Last Login: Monday, December 27, 2010 5:21 PM
Posts: 55,
Visits: 139
|
|
Just thought I would upload some shots of what I have going on over in my end of the world. 
-Danny
Animusoft
RUG Community
|
|
|
|
|
Supreme Being
      
Group: Administrators
Last Login: Monday, October 31, 2011 9:18 PM
Posts: 640,
Visits: 819
|
|
| Danny, Every i2c sensor is different, and sends back data in various formats. You have to understand how the data for each sensor you're attempting to interface is structured. The format of the data that the IOWizard sends back is very well documented, and we've given several examples on how to interface it with the .NET lib. You can take that code and tweak it to interface other sensors, such as the CMPS03 compass from Devantech. We of course have a CMPS03 object in the .NET lib, but you could also use the Generic I2C Interface to query it as well, and get a good handle on what the data looks like coming back from it. You cannot use the IOWizard to query sonars...The IOWizard is strictly meant to allow expansion for analog sensors, and gpio (0/1). If you want to read sonars, connect them to the GPIO port on the Serializer, which DOES support sonar timing within the firmware. Best Regards,
Jason Summerour President, Summerour Robotics Corporation www.roboticsconnection.com
|
|
|
|