I am trying to use two Pixart IR-Cameras (Wiimote) on the arduinos I2C Bus.
Since they have the same slaveaddress I have to multiplex.
I found a solution for two nunchuks here:
http://www.wiimoteproject.com/tech-chat/2-nunchuck-with-arduino-help/msg8262/#msg8262
Now the IR-Cam does have a Reset-Input, wich prevents it from working, when pulled low. (It does not respond on the bus)
Could I use this to multiplex the to cams?
I know there are no specs out there but maybe one can say something general about switching the reset about 200 times per second?
Harmful? Good Idea? ...?
Flicker won't allow you to post images any more so you will have to click on this:-
It shows the way to switch the I2C lines rather than hold one device in reset. This allows much more rapid switch over from two devices with the same I2C address.
I doubt rhe camera will be able to do much useful work in 5ms.
It probably has boot and BIST that take that long.
Ok thanks. So forget the reset.
Mike thats a multiplexer ic youre suggesting?
Like those?
I see 2bit selection lines and 4 possible slaves. And they seem to be 5V tolerant, so I could provide VCC 3V3 while switching slaves directly from the arduinos IO-Pins?
Yes a quick look at the PCA9540B data sheet shows that it can be used as voltage level translation as well as switching between two channels. My only reservation is that switching between the channels requires a few I2C bytes to be exchanged and that is obviously slower than directly switching an analogue multiplexer.
Interesting to note that in the link you posted http://www.wiimoteproject.com/general-discussion/2-nunchuck-with-arduino-help/msg8262/?PHPSESSID=fb9120b5d047beb57e898d1a2f540a31#msg8262 the circuits don't actually work (and they say so) and they seem puzzled as to why. Well the reason is that the data line is a bidirectional data line and their arrangement only allows unidirectional switching.
As I am from computer science, I often have problems figuring out why some "simple circuit" works or should work.
What puzzled me most with the transistor switching was, that the basis gets a 5V high from the Atmel, while desiring 3V3 on the C-E line?
I thought he said, it did not work through a pnp, which he wanted to use to need 1 pin less?
I also thought that choosing the address via I2C is a bit of a waste. Especially for the desired fast access to the IR-cam and the fast switching rate.
So I need to look for analog multiplexers instead it seems.
I thought he said, it did not work through a pnp, which he wanted to use to need 1 pin less?
Yes he did say that as well which makes no sense.
If you want to do a bi directional voltage translator you need two transistors wired up emitter to collector and collector to emitter and base to base. Take the bases and connect that to 3V3 (either supply or potential divider) the one emitter collector pair goes to the 5V side and the other pair the 3V3 side. You need a pull up tot he respective supplies on both side of this arrangement. The clock needs only voltage translating in one direction.
Looks like I got lucky. I found a MC14053BCP on some old board.
http://www.produktinfo.conrad.com/datenblaetter/150000-174999/173355-da-01-en-4051_4052_4053.pdf
Triple 2-Channel is more than I need, but that should to the trick.
Since I still have to get a "real" 3V3 oszillator could I use the third line to multiplex the 25mHz clock to both cameras?
Or should I just run both cameras parallel on one osz.? (Or one osz. for each?)
Putting it all together I would use something like this LD1117V33
(http://www.produktinfo.conrad.com/datenblaetter/125000-149999/147028-da-01-en-LD1117V33_Spannungswandler_Datenbaltt.pdf)
for the level conversion.
Then I supply 3V3 to the cameras, the oszillator(s) and the multiplexer, which gets its selection pins wired directly to the arduino.
Anything wrong? Anything missing?
D1117V33
......
for the level conversion.
That is a voltage regulator it is no good as a logic level converter.
could I use the third line to multiplex the 25mHz clock to both cameras
Not at all sure what you mean by this. If you require a 25MHz clock (25mHz is some what slow) you should apply it continuously to both chips not switch it.
That is a voltage regulator it is no good as a logic level converter.
I thought changing VCC from 5V to 3V3 was all I needed? I think once again I used the wrong terms with "level" conversion? I am not trying to transfer between 5V and 3V3 data lines, if that's how it sounds.
- Supply 3V3 as VCC to both cameras. (additionally pull the reset high)
- The I2C lines from the arduino will also be pulled up to the 3V3 and bits are coded by pulling down.
- The multiplexer will switch the I2C lines between the cameras and will also have the 3V3 supply. (ranges from 3V to 18V)
- The selection lines of the multiplexer will be wired directly to the arduino since the mp. is tolerant and will only switch the 3V3 lines to the cameras.
The Pixart-Cam originally has a clock input which is connected to a 24,xxxmHz oszillator in the wiimote.
Currently I use a Hosonic 11C as replacement. (Since it has officially 5V +/-10% I dont wanna use it on 3V3 for a longer time and will switch to some other.)
So the freq. is required by the camera, hence I don't really understand what you mean when you say "slow".
That's not supposed to be the I2C clock! (P.Cam uses fast I2C)
Is there some freeware/online tool where I could draw the schematics? Maybe that would shed some light ...
if that's how it sounds.
Yes it was.
The I2C lines from the arduino will also be pulled up to the 3V3 and bits are coded by pulling down.
The arduino I2C library enables the internal pull ups so make sure you hack this library so they are not.
will also have the 3V3 supply.
No need you can run it off 5V it will pass through the signals.
I don't really understand what you mean when you say "slow".
You said it was 25mHz - that's milli hertz or about one cycle every 40 seconds. It should be 25MHz. 
Since it has officially 5V +/-10% I dont wanna use it on 3V3 for a longer time
I think you will need to run it at 5V and level shift the clock down, a simple transistor will do.
Yes it was.
Sorry. I'm working on that.
So one would only say "level conversion" with sth like this?
You said it was 25mHz - that's milli hertz or about one cycle every 40 seconds. It should be 25MHz.
Oh my. It really ain't that easy to translate and look after all those little letters. ^^
Thanks again.
Running the muxer off 5V is even better.
About the internal pullups. I deactivated them in twi_init(). But working on different PCs I sometimes forgot but never experienced problems.
Could you point out some situation where internal + external pullups would be problematic?
As a side note, the ir-cam demands about 23-24mA (milliAmpere).
So it shouldn't be a problem to supply it from the ftdi, if one is just experimenting. (two cameras is a different thing though ...)
Could you point out some situation where internal + external pullups would be problematic?
If you had a 5V arduino feeding into the I2C of a 3v3 device and the arduino had it's internal pull ups enabled this would but 5V onto the I2C line which could blow up the data input lines of a 3V3 device.
Hm. That might be a hint that the camera is at least a little 5V tolerant.
Actually, as long as I use the external pullups on 3V3 I don't get any change in Voltage if the internals are on or off. The SDA is pulled to ~3.4V either way?
Actually, as long as I use the external pullups on 3V3 I don't get any change in Voltage if the internals are on or off.
That is very interesting, I didn't know that. The internal pull ups are about 30K so if you have something like 10 times lower it is possible (as you have proved) that this is enough to shunt the excess current off to the 3v3 line. It makes sense.