ROBOTC.net forums
http://robotc.net/forums/

Change the I2C address of the HiTecnic IRSeeker V2
http://robotc.net/forums/viewtopic.php?f=62&t=4621
Page 1 of 1

Author:  JMS [ Mon Jun 11, 2012 10:45 am ]
Post subject:  Change the I2C address of the HiTecnic IRSeeker V2

Hi

My kids have been using 2 IRSeeker V2 on their robocup junior soccer bot with the NXT brick.
Due to weight limitations they started using the Arduino Uno R3. The issue is it only has 1 I2C line and they need to use 2 IRSeekers.
Is there any way of changing the I2C address of one of the sensors. I've been looking everywhere and was unable to find a solution.
Can anyone give us some help?
Thank you

JMS

Author:  mightor [ Mon Jun 11, 2012 10:52 am ]
Post subject:  Re: Change the I2C address of the HiTecnic IRSeeker V2

No, I'm afraid it's not possible.

- Xander

Author:  NeXT-Generation [ Mon Jun 11, 2012 11:00 am ]
Post subject:  Re: Change the I2C address of the HiTecnic IRSeeker V2

Why exactly do you need to change the address? Can't you just use Xander's bit-banged Arduino SW I2C library? RobotC doesn't support HW I2C yet, do they?

Author:  mightor [ Mon Jun 11, 2012 11:06 am ]
Post subject:  Re: Change the I2C address of the HiTecnic IRSeeker V2

It does not support I2C yet and it will not have a bit banged I2C implementation either, afaik.

- Xander

Author:  JMS [ Mon Jun 11, 2012 11:44 am ]
Post subject:  Re: Change the I2C address of the HiTecnic IRSeeker V2

Thank you for your answers.

I saw you using the NXTshield with the arduino. Could this be a solution for using both sensors one in each bank.
I also looked at your I2C library and will try to use with all the other sensors we need (compass and ultrasound).

JMS

Author:  Dennis Mabrey [ Mon Jun 11, 2012 1:43 pm ]
Post subject:  Re: Change the I2C address of the HiTecnic IRSeeker V2

Couldn't he just create two separate bit banged I2C libraries to use two separate buses? The current one you made that uses the pins of 2 & 3 and another that uses two other pins? For example digital pins 4 & 5. You would have to change the pragmas at the top:
Code:
#pragma config(Sensor, dgtl4,  SDATA,               sensorDigitalOut)
#pragma config(Sensor, dgtl5,  SCLK,                sensorDigitalOut)


Of course he will be eating up two extra digital pins.

PS: Just curious will this be for the RoboCup Jr in Mexico City?

Author:  NeXT-Generation [ Mon Jun 11, 2012 9:57 pm ]
Post subject:  Re: Change the I2C address of the HiTecnic IRSeeker V2

Dennis Mabrey wrote:
Couldn't he just create two separate bit banged I2C libraries to use two separate buses? The current one you made that uses the pins of 2 & 3 and another that uses two other pins? For example digital pins 4 & 5. You would have to change the pragmas at the top:
Code:
#pragma config(Sensor, dgtl4,  SDATA,               sensorDigitalOut)
#pragma config(Sensor, dgtl5,  SCLK,                sensorDigitalOut)


Of course he will be eating up two extra digital pins.


That's what I was talking about.

Author:  Dennis Mabrey [ Mon Jun 11, 2012 10:52 pm ]
Post subject:  Re: Change the I2C address of the HiTecnic IRSeeker V2

Oh I wasn't sure if that was what you meant.

Anyway if he is doing this for the Robocup Jr competition I doubt he would want to use this beta version of RobotC. The competition starts next Monday in Mexico City. Sort of short notice to make all the changes now and test.

Also his idea of using the NXTShield I guess would work. The only thing is he switched to the Arduino for weight reasons because of the NXT. The NXTShield (at least the one I have for the mega) has some mass to it. His robot might end up being over the weight limit again.

Author:  starwarslegokid [ Wed Jul 11, 2012 12:46 am ]
Post subject:  Re: Change the I2C address of the HiTecnic IRSeeker V2

I have an idea for future reference, better late than never.

If you have a breadboard handy and need two of the same addressed sensor hooked to one i2C buss, try hooking a logic level mosfet in between each sensor and the i2c buss (on the sensor power line or the return signal line). In the software you can then turn on one mosfet at a time and only allow one sensor to report back on the buss, essentially making your own multiplexer.

I haven't tried it, it should work. I do not know what a mosfet would do on the data lines tho. It should work well if the mosfet just cuts the power to the sensor and only supplies power to one sensor at a time.


Scott B-)

Author:  mattallen37 [ Sat Jul 14, 2012 10:23 am ]
Post subject:  Re: Change the I2C address of the HiTecnic IRSeeker V2

That might work, but it would be better to use an I2C multiplexer that is intended for that purpose.

Author:  starwarslegokid [ Sat Jul 14, 2012 2:39 pm ]
Post subject:  Re: Change the I2C address of the HiTecnic IRSeeker V2

mattallen37 wrote:
That might work, but it would be better to use an I2C multiplexer that is intended for that purpose.


I agree, sometimes its a good learning experience since your using an arduino and can wire those things up fairly easy B-)

If you need a multiplexer, this one would work great: You would send the multiplexer i2c commands and switch it between the different sensor ports. http://www.hitechnic.com/cgi-bin/commer ... ey=NSX2020

Scott B-)

Author:  Dennis Mabrey [ Sat Jul 14, 2012 4:14 pm ]
Post subject:  Re: Change the I2C address of the HiTecnic IRSeeker V2

starwarslegokid wrote:
If you need a multiplexer, this one would work great: You would send the multiplexer i2c commands and switch it between the different sensor ports. http://www.hitechnic.com/cgi-bin/commer ... ey=NSX2020

Scott B-)


For NXT projects this works fine but for Arduino one would have to strip an NXT wire and hook the 5 and 6 wire (blue and yellow) to the SDA and SCL.

Instead I would experiment with something like the Texas Instruments PCA9543A chip. It is an I2C MUX chip that is used for resolving I2C address conflicts.

It is $2.83 from Mouser and I think I might order one just to see if I can get it to work.

Author:  mattallen37 [ Sat Jul 14, 2012 9:13 pm ]
Post subject:  Re: Change the I2C address of the HiTecnic IRSeeker V2

@Dennis Mabrey, that is exactly what I meant. There are other versions I have seen as well, which would support different numbers of buses.

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/