How do I mix i2c voltages?

I am building a project around a Teensy 2.0++ using Arduino for programming. It is running on 5.0v in order to keep the clock at 16MHZ. One of the devices that is being controlled is a fan motor with PWM control. However, the specs on this fan say that the maximum pulse voltage must be no more than 3.6V. This is a funny sized fan so replacement isn't an option. I figured that the best way to address the problem would be to program an ATtiny45 as an i2c slave, and run that on 3.3V. The problem I encounter is that i2c doesn't exactly play nice like this. The "low" pulses from the Teensy are over 3.3V even without pullup resistors. Does anyone else have a trick for this? I know there are other ways to go about this particular goal, but now that the question is in my mind, I must learn how to mix i2c voltages!!!

One of the devices that is being controlled is a fan motor with PWM control. However, the specs on this fan say that the maximum pulse voltage must be no more than 3.6V.

Why won't a voltage divider work to lower the voltage?

Or a simple transistor circuit?

Much easier to reduce the PWM voltage I would think.


Rob

Graynomad:
Much easier to reduce the PWM voltage I would think.


Rob

I'll have to try a voltage divider on the i2c signal pins.

As for reducing the PWM peak voltage...would this be by external means like a zener diode, or is it possible to do this with code?

I've already gotten around the i2c for this project by attaching a 4.7K resistor and a 1UF cap to the PWM output from the arduino, so that the AtTiny gets an analog input of 0-3.3V, and then it converts that to a PWM voltage with 3.3V peaks. This reduces the usable PWM scale from 0-255 to 0-169, but that is still enough for this project.

The "low" pulses from the Teensy are over 3.3V even without pullup resistors.

That sounds very wrong, have you got a common ground?

The best way if the peak voltage on the fan has to be kept that low is to use a 3V3 regulator and use a transistor to switch the motor driven from the regulated voltage. There is not enough current from the arduino's 3V3 regulator to drive a motor.

There are buffer chips you can use to front-end any I2C bus, like the P82B96:

You could use that to extend an I2C bus over long distances and run it at, say, 12VDC for improved signal/noise ratio. The only problem is using these chips gets expensive fast, as they cost more than the darned ATmega chips themselves...

I've already gotten around the i2c for this project by attaching a 4.7K resistor and a 1UF cap to the PWM output from the arduino, so that the AtTiny gets an analog input of 0-3.3V, and then it converts that to a PWM voltage with 3.3V peaks. This reduces the usable PWM scale from 0-255 to 0-169, but that is still enough for this project.

5v PWM -> 3v3 analogue -> ADC -> 3v3 PWM

and the end result is an 85 trying to drive a motor which it wasn't designed for and I would think can't possibly do (unless it's a very small motor).

That's two processors and an imprecise analogue control link :astonished: to do a really simple function. Man you should have come here first and followed Mike's advice :slight_smile:

Do you have the specs on that motor?


Rob

The fan motor is 12V, the PWM pulses are just to control speed; almost no current load. In retrospect I really should have used a more simple method...I have an attiny45, a cap, and a resistor to do the job (I needed the 3.3v regulator for other parts of the project anyway), and I guess I could have done it with just two resistors and a zener diode for safety.

It is actually:
5V (pulse peak) PWM never going over 67% > PWM to analog conversion by resistor and cap > 3.3v analog to PWM converter.

Now that I think about it, the i2c idea was REALLY dumb...but now that I know how to make 5V and 3.3V i2c play together, I can wire up the RTC that way (it works with 5.0v but they recommend 3.3v)...and the next time someone searches for it on google, hopefully this thread will come up.