ATTiny85, I2C , and Servo Control

Hi there,

I posted here earlier about connecting an ATtiny to an LCD via I2C protocol. (and that is all up and running now).

Basically that was so I could debug a problem I'm having between an I2C sensor IC and a servo.

The I2C sensor is connectd to PB0 and PB2 on the ATtiny which works fine by itself (that is what I was able to confirm by connecting an LCD).

Then I connect a servo to PB1 on the ATtiny (two of the three other pins are used by USB to program the ATtiny so have stayed away from using them, and the other is the reset pin so havent used that one either).

Now, the servo appears to work (I have an initializing sequence where the servo moves), but the sensor obviously no longer works (however I am unable to read what the sensor is getting as there is not enough room on the Attiny to run my I2c sensor , the "SimpleServo" library, and the LCD library all in one program.

My major questions are - how could the servo library and the I2C sensor readings be interfering with each other?

Could this be something to do with them both using a timer/ interrupting each other.

This is beyond me so if anyone understands the Attiny enough to comment, that'd be great.

Cheers,
Hayden

Try stronger pull ups on I2C, maybe noise from the servo is causimg this. You may try to read the I2C communication via another chip.

Does Servo + LCD work at the same time (if you don't try to talk to the sensor to save space)?

Is the servo running off the same power supply? What have you done to prevent noise that the servo puts onto the power rails from causing problems for the other devices?

Does Servo + Sensor work if the servo is not connected?

If you have a scope, look at the power and idle I2C lines while the servo is moving.