Go Down

Topic: i2cRead failed (Read 2021 times) previous topic - next topic

mrmimi1900

Jun 14, 2014, 12:01 pm Last Edit: Jun 14, 2014, 12:16 pm by mrmimi1900 Reason: 1
Hi,

I build a balancing robot.
When the robot starts I get good signals from MPU6050.
The dc motors start to work.
I use arduino motor shield. I add an extra battery to the  motor shield.
After some seconds, when motors need more power, I receive  i2cRead failed: 2 or i2cRead failed: 4.
It seems that the motor activities disturb the i2c reading.
I added delay(50) in loop function but without success.


Any idea?

Regards, Mr Mimi

raschemmel

Draw a schematic of how you powered the arduino (which input) and how you powered the motor.
Describe the hardware in more detail:
Identify motors (with link or datasheet)
Identify motor driver   (with link or datasheet)
Identify battery  (with link or datasheet)
Take measurements of arduino power motor power voltages when you get the error  and post those.
Is the arduino running off the same power source as the motor ?
Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,
DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

mrmimi1900

Hi,

the setup is quite simple

arduino uno board
arduino motor shield
2 dc motors are connected to output of arduino motor shield
both arduino uno board and arduino motor shield are powered by a 350mAg LiPo battery with 2x3.7V
battery is connected to VC of arduino motor shield
I added 0,1 µF capacitor to the dc motors to reduce any noise
I measure between 3,5 and 4V output at the arduino motor shield

The data sheet of the dc motors is:

Operating Temperature: -10°C ~ +60°C
Rated Voltage: 6.0VDC
Rated Load: 10 g*cm
No-load Current: 70 mA max
No-load Speed: 9100 ±1800 rpm
Loaded Current: 250 mA max
Loaded Speed: 4500 ±1500 rpm
Starting Torque: 20 g*cm
Starting Voltage: 2.0
Stall Current: 500mA max
Body Size: 27.5mm x 20mm x 15mm
Shaft Size: 8mm x 2mm diameter
Weight: 17.5 grams


Thanks a lot for helping!
Mr Mimi

raschemmel

Quote
both arduino uno board and arduino motor shield are powered by a 350mAg LiPo battery with 2x3.7V


You can't do this .Motors always need to have their own separate power supply. You should expect the error you are getting and others as long as you continue to violate this unwritten rule of arduino power system wiring.

What does your above statement mean ? Do you have a cable from that battery with a 3.5mm plug on the end that you plug into the ext pwr barrel jack on the arduino ?
Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,
DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

mrmimi1900

#4
Jun 14, 2014, 06:45 pm Last Edit: Jun 14, 2014, 06:51 pm by mrmimi1900 Reason: 1
Hi,

MotorShield Image: http://arduino.cc/de/uploads/Main/MotorShield_R3_Front.jpg
I added the 2 cables of the battery to the VIN and GND input of the motor shield.
The ardunio board seems to be powered by the  motor shield.
I will add a 9v block battery to the ardunio board.

Regards, Mimi

raschemmel

#5
Jun 14, 2014, 06:59 pm Last Edit: Jun 14, 2014, 07:00 pm by raschemmel Reason: 1
You need a better understanding of how motorshields work. All the 5V logic on the shield comes from the arduino. You can clearly see the motor power screw terminals on the shield labeled "Vcc" & GND so don't tell me it gets its motor power from the arduino. . Your motor power should obviously be connected to the motor shield motor power connector screw terminals and the arduino should be powered from the Vin or barrel jack input or USB. Ideallys both power sources are separate and only share a common ground. Your problems stem from the fact that you did not know that you cannot power the arduino and the motor shield from the same battery. You need separate batteries. The sooner you fix that the sooner your error will go away.
Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,
DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

mrmimi1900

Hi,

thank you  for your patience with a newbie.

adding a 9V extra power supply did not change the situation. (I run it before with USB cable for testing)
any more ideas?
as I use standard hardware what else can I change?
Can I measure somehow why MPU6050 does send error 2 or 4?

Regards, Mimi

raschemmel

Quote
adding a 9V extra power supply did change the situation. 


What does this mean ? Your post title cites and error. Your comment here does not say whether the error has been eliminated or not .
What IS the current situation anyway ?
Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,
DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

mrmimi1900

#8
Jun 14, 2014, 07:11 pm Last Edit: Jun 14, 2014, 07:33 pm by mrmimi1900 Reason: 1
Hi,

sorry for the typo
adding a 9V extra power supply did NOT change the situation

In the ardunio IDE I see valid responses for some seconds and then MPU6050 ends with error 2 or 4

I  add an image of the robot.

Regards, Mimi

raschemmel

Is A4 => SDA
   A5=>SCL ?
What pins are the 9V battery connected to ?
Does the MPU6050 work ok by itself with no connection to the robot ?
Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,
DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

mrmimi1900

#10
Jun 14, 2014, 07:54 pm Last Edit: Jun 14, 2014, 07:59 pm by mrmimi1900 Reason: 1
Hi,

A4 => SDA
A5=>SCL

MPU6050 I tried with 5Vand 3.3V pin from arduino.
The 9V is connected to the standard voltage connector of the arduino board.

As I mentioned for some seconds the values are ok from MPU6050.
But when I start moving the robot it starts failing.

If I set the power to 0 in the sketch everything works fine.

Regards, Mimi

raschemmel

Do you have common grounds ?
Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,
DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

mrmimi1900

Hi,

between MPU6050 and motor shield?

Mimi

raschemmel

Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,
DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

mrmimi1900

Hi,

not sure how to do that.
There is a GND pin on the motor shield that is connected to the GND pin of the board it self.
The board GND pin is connected to the GND of the MPU6050.

Do you suggest to connect GND of the motor shield voltage with GND of the MPU6050?
I just want to double check.

Regards, Mimi

Go Up