I am new to arduino. I was using a custom opensource library that is written for arduino uno connection with AD5933 impedance analyzer. However now I want to replace the Uno by Nano BLE or Nano BLE sense. But it doesn't seem to work. Between the sensor and arduino board there is I2C communication. So I am continuing to use the same Wire.h library for BLE boards as well. When I looked into the code of AD5933 library I found that it includes Arduino.h library for compatibility with Arduino conventions. Since now I have replaced the UNO by Nano BLE 33 should I include something else other than Arduino.h? Is that why it is not working? It would be great if you can help. The link to the opensource AD5933 library: AD5933 Arduino Library Quick Guide · WuMRC/drive Wiki · GitHub
I don't understand what you mean. Do you mean I should replace the arduino.h library in the path C:\Users<Username>\AppData\Local\Arduino15\packages\arduino\hardware\mbed_nano\2.5.2\cores\arduino ?
What I do is I just import the AD5933 library into my arduino code along with wire.h library and call some functions from AD5933 library to read the sensor data. It works well with uno but with nano BLE there is no compilation error but once I setup the AD5933 library in my arduino code, even the serial monitor printing doesn't work....
Okay so it is not the Arduino.h library problem then. I am not sure what else is the problem here, because when I went through the AD5933 library I don't see any other board specific things that might cause the issue.
Since you are new to this, are you sure you are selecting Adruino Nano BLE? It is not the same as the "Nano" You have to install the correct board definition files
okay but I also see nothing gets printed on my serial monitor when I setup my two nano ble 33 boards to act as a writer and reader using the tutorial https://docs.arduino.cc/tutorials/nano-33-ble-sense/I2C. I flashed the writer code to one of the nano ble 33 boards and opened serial monitor I see nothing printed. I think the problem is something do with I2C communication.
Okay. I will have to order one of these. In the meantime is there anything else that could be the problem? Also to one of the boards I can upload the code only by entering into bootloader mode manually (by clicking the reset button twice). Every time!.
Yes. Both are 9600. Also I observed one thing that the serial monitor stops working as soon as I make connections to the I2C pins. Until then it works fine.
Have you measured the voltages on both your SCL a SDA pins? They should idle HIGH. If you have things wired incorrectly, maybe something is pulling one of them low which will cause the Wire library to hang, waiting for the proper state.
No I haven't but I don't have access to a multimeter at the moment. But the connections are right. A4 and A5 of one board is connected to A4 and A5 of the other board, with two 4.7k pull down resistors connected to the 3v pin and A4 and A5 pin of one of the boards, as given in that tutorial.
Also now I checked with Uno... So the problem is both the BLE boards can get information via I2C... When i send signals from uno to ble board via i2c to turn on the LED and turn off the LED via serial monitor it works. But when i do the reverse... That is try to send the signal to Uno board from BLE board via serial monitor using i2c... The serial monitor gets stuck and it doesn't work anymore. Any number of serial print statements before using i2c to send something, the serial monitor works fine. But as soon as I send something, serial monitor gets stuck and nothing works.