I'm currently busy with a project and facing a small problem with my ADXL345 and a speaker next to it.
The idea:
I found an old phone horn and I want to attach this to a Bluetooth module. In the phone horn I attached a ADXL345. When the phone rings and you pick up the phone horn the phone should automatically answer the call. I want to use the readings from the ADXL345 to see if you pick up the phone horn.
I thought about a tilt sensor too but the thing there is that the phone horn cannot lie in all positions. The ball in the tilt sensor can roll down and make some contact.
The code on the nano is running that standard example code to see if everything works. Output is fine as long as there is no incoming call.
As soon as the phone receives a call the speaker (where you hear the other persons voice) is activated and from there the ADXL345 doe snot output anything anymore. This until you hang up and reset the nano.
The cable is a 8 wire cable, for the mic there is one wire with shield. The rest has no shield.
At the top the Bluetooth module, on the right the nano.
The ADXL345 is at the microphone side (small 3d printed part to attach the mid and ADXL345):
When i take out the speaker and ring again the sensor still disconnects and there are no values sent anymore. The only way it keeps working when the phone rings is when I disconnect the speaker wires from the connector (of course ).
I was not expecting that I2C was so vulnerable for a low signal amplitude for the speaker.
Is there a workaround to be able to receive calls and have the ADXL345 keep working?
Thanks for your reply
There is no hook switch. It's just the phone horn. I got it working last night, I was forgotten to connect both devices to the same ground. Unfortunately today it does not work anymore.
Maybe a 4 way tilt switch will do the job? To see if there is any change from the tilt sensors before and after picking up.
Good idea though! I'll try three of them. Was looking for the 4 directional tilt sensor but they only sell in USA and difficult to get them. Hope this sensor works when you pick you the horn normally. I dont want to trigger the sensor by bumping onto my desk when the phone rings for example.
My guess is you are using a filterless class D amplifier to drive the speaker, and crosstalk from the class D outputs in the cable is interfering with the I2C bus - what value pullup resistors are you using with the I2C bus? Perhaps making them smaller (2k2?) might help.
I think it's 4K7. I'm using the stock resistors from the AXL345 board.
The Bluetooth module is a Bk3254 Bluetooth module. The amplifier is indeed a class D: HT6872