I've set up a Serial port via a Bluetooth module (HC05). I'm using a JavaFX app that I wrote to read the serial port, plot the acceleration values (via ADXL345) and write back to the serial port an alarm bit (1 for ON and 0 for OFF) whenever a certain function of accelX reaches over a value.
The weird part is, whenever Arduino detects ON bit and turns on the buzzer, my acceleration values become quite noisy! I've checked my codes both in Arduino side and Java side and couldn't find a problem.
Then I put a LED instead of buzzer and to my surprise it turned on without interfering with accel. readings !!
I really don't know what is the problem with buzzer. Can anyone help?
Here is my suspicion:
I'm using a break out board for ADXL345. I'm not sure whether it can tolerate 5 volts. I connected Uno's 3.3 volt to it's Vcc and I'm using I2C for communications. (with two 4.7k pull-up resistors connected between it's SDA and SCL pins and Uno's 3.3v).
Could it be that the buzzer when turned on somehow draws so much current that interferes with those pull up resistors?
Here is the photo of my setup (the lower red line is 3.3v and upper red line is 5 vols both coming from Uno. All grounds are connected together):
And here is the readings of accels. in IDLE:
And I get these reading out of Serial Port:
But whenever I tilt the breadboard (limit for alert is 20 degrees), it correctly beeps, but due to noisy accelerations, buzzer starts, stops, starts in a random pattern: