Go Down

Topic: Strange. It works together with serial connected but doesn't without serial (Read 1 time) previous topic - next topic


I have a system with mega 2560, BH1750 (an i2c light intenity sensor), and a gsm module using soft serial.

I have tested with the system together with these modules while the 2560 is connected to my pc with the serial monitor on. And it works fine.

But when I unplug the usb cable to pc and power the whole system with an external power supply through the other power socket on the 2560 board (the round one, not the usb one), the main program seems to work, but the communication with the i2c seems to fail and seems the 2560 didn't get expected read from the BH1750 sensor.

I can imagine when the usb is connected, the hard serial might have some conflict with other ios, but can't imagine this-- the reverse way... what can this be?

Since I do let 2560 print a lot information to the hard serial for debug purpose, could this be that the hard serial buffer somehow full and then affect other parts?

Thanks a lot.


Which external power supply?

Can you provide a wring diagram?
Can you provide your code?

Why use SoftwareSerual if you have three additional hardware serial ports?
If you understand an example, use it.
If you don't understand an example, don't use it.

Electronics engineer by trade, software engineer by profession. Trying to get back into electronics after 15 years absence.

Go Up