| Author |
Message |
|
JamesD
Novice
Joined: Sun Feb 04, 2007 12:48 am Posts: 69 Location: Australia
|
 Stacking multiple sensors on one port
I found this on the info file associated with the mindsensors compass.
How is this done? Do you need to program it into your driver? Is it overly complex? What do you need to do it? Can you only combine it with a digital sensor such as a touch sensor?
Any info on this topic would be appreciated!
Thanks
James
|
| Tue Aug 14, 2007 7:02 am |
|
 |
|
starwarslegokid
Moderator
Joined: Wed Jan 31, 2007 3:39 am Posts: 298 Location: San Diego, California. USA
|
Mindsensors is developing some amazing sensors using the I2C protocol. I'm no expert by far lol and anyone correct me if im wrong.
Whats going on is the NXT sends digital messages that contains a address in each message. Each computer chip or sensor has a address saved in its registry and when it reads a message with the same address, it completes the commanded action. These addresses can be changed on the sensors registry and can all be hooked in parallel on the same port since each one has a different address.
I have a few of there sensors and the default address of the sensors is 0x02 but can be changed using there Utility Program that runs on Robot C. The other thing you must do is change the address that is in your code to match the new adress on your chip. Mindsensors sample code has a variable for the address and its easy to change. Also, you have to send a message to your sensor to turn ADPA on, otherwise you will cause communication problems due to some sort of electrical resistance problem with multiple sensors hooked up (I don't fully understand this part lol sorry).
You can hook up one standard sensor to one of these sensor expanded ports, but iv never done it before and don't know if you have to do anything else. Anybody done this?
Hope this helps ya out
Scott B-)
_________________Mmmm Legos B-) My Robot Projects: http://www.freewebs.com/robotprojects/
|
| Wed Aug 15, 2007 3:49 am |
|
 |
|
JamesD
Novice
Joined: Sun Feb 04, 2007 12:48 am Posts: 69 Location: Australia
|
Hi All,
Just to confirm, does this mean I could only stack a digital sensor such as a touch sensor(digital input) with an analog sensor such as the compass sensor or the light sensor.
In otherwords, is it possible to stack 2 light sensors or a light sensor & compass (All of which I believe are analog, please correct me if I'm wrong)?
Thanks
James
|
| Tue Aug 21, 2007 3:44 am |
|
 |
|
starwarslegokid
Moderator
Joined: Wed Jan 31, 2007 3:39 am Posts: 298 Location: San Diego, California. USA
|
You can only use one analog sensor and then any number of I2c capable sensors. The compas sensors from Hi-technic and Mindsensors support I2c, and the Sonar sensor that comes in the kit does as well. All the other kit sensors are analog. The compass and sonar have an analog mode, but you wont be able to hook multiple on the same port unless they are using I2c.
Scott B-)
_________________Mmmm Legos B-) My Robot Projects: http://www.freewebs.com/robotprojects/
|
| Tue Aug 21, 2007 12:52 pm |
|
 |
|
k_kirk
Rookie
Joined: Wed Nov 14, 2007 1:44 pm Posts: 10
|
Hi everyone. My first post here so a big thanks to all of you who make the RobotC such a well supported product and ofcourse to its creators for making it all happen.
I bought a Split-Nx from Mindsensors (SPLIT-Nx supports digital sensors with changeable I2C addresses - http://www.mindsensors.com/index.php?mo ... PAGE_id=79) and a bunch of new digital sensors. There is no sample code on mindsensors site for sensor stacking.
Is there any one out there who has done this and succesfully used multiple sensors one one port? Can you kindly post some code samples? It will be most appreciated.
I take it you would not use the RobotC sensors wizard to set the code up and would manually code the const statetements for the sensors right?
Thanks & Best Regards,
KK
|
| Fri Nov 16, 2007 2:58 am |
|
 |
|
starwarslegokid
Moderator
Joined: Wed Jan 31, 2007 3:39 am Posts: 298 Location: San Diego, California. USA
|
hi k_kirk
You don't have to change much code to use multiple sensors on one port, the big thing is to change the addresses of all the sensors so each one has its own. All mindsensors sensors come with the default address of 0x02.
Once you change all the sensors addresses you then have to change the address that the code will send messages to. If you download the Sample Mindsensors code, the address will also be 0x02, change these to the sensors new corresponding adress. (On my website, I changed the address on my compass driver from 0x02 to oxC2, take a look at it to see whatneeds to be changed, just 1 line of code)
On my website, I posted a I2C Explorer and I2C address changer code. Mindsensors made this code, but they took it off their site for some reason. The I2C Explorer will search a NXT Port (default S1) for all the I2C devices plugged into it and display their names and addresses. Its really useful to make sure each sensor has its own address. The I2C Address changer changes the address of the sensor, pretty simple.
Let me know if this helps, and good luck B-)
_________________Mmmm Legos B-) My Robot Projects: http://www.freewebs.com/robotprojects/
|
| Sat Nov 17, 2007 10:26 pm |
|
 |
|
k_kirk
Rookie
Joined: Wed Nov 14, 2007 1:44 pm Posts: 10
|
Super! This is great help. Most appreciated.
|
| Tue Nov 20, 2007 11:46 am |
|
|