Hello,
I'm pretty new to arduino and I have looked at many sites or forums that could help answer my question but I could not find any. Anyways, I am currently trying to emulate DD ElectroTech's smart glasses with some modifications of my own. Currently, I have an OLED, HC-08 Bluetooth, and Adafruit Fingerprint Sensor connected to an Arduino Nano.
OLED:
gnd - gnd
vcc - 3V3
scl - A5
sda - A4
HC-08:
gnd - gnd
vcc - 3V3
txd - D2
rxd - D3
Adafruit Fingerprint Sensor:
gnd - gnd
vcc - 3V3
tx - D4
rx - D5
I have attached the ino file below. For some reason, when I upload my program, I can't get my fingerprint sensor and oled to work together at the same time with the bluetooth. Individually, each of them (both hardware and software) work, but, when combined, it does not. It could be because I used 2 different SoftwareSerial for the fingerprint sensor and bluetooth which arduino is not capable of(?). Please let me know if I left something out but any help and advice would be great.
IOSprototype.ino (6.99 KB)
Using two instances of software serial is probably fatal and, more to the point, unnecessary. Put Bluetooth on hardware serial - after uploading. Having software serial on A4,A5 and then sharing with an I2C device is definitely fatal. HC08 should probably be powered by 5v. OLED is apparently I2C and thus innocent.
Sorry about that. I wrote a typo. For the fingerprint sensors, pins D4 and D5 were used not A4 and A5. But, if I move my bluetooth onto the hardware serial (RX and TX I'm assuming) and also put it on 5V, it should work?
Thank you for the response! Really Appreciate it!
Check that Bluetooth uses 5v for power. Upload programme with Bluetooth disconnected.
Okay, I did tinkered around with the code and serial monitor to try to see if I could find the error. Both the OLED and fingerprint sensor are not working as it should, but the bluetooth is after your input. I have shown my setup() code below. For some reason, when I run with the code below, nothing is printed to both the OLED and fingerprint sensor. But, if I change the code as shown by the "!!" below, all of the text shows in the Serial monitor and my fingerprint sensor and bluetooth both work properly. Now, the OLED is the only problem. I've seen some posts where I can't use Serial and display at the same time but do you have any idea about this? Thank you so much!
Serial.begin(9600);
bluetooth.begin(9600);
display.begin(SSD1306_SWITCHCAPVCC, OLED_ADDR);
while (!Serial); // For Yun/Leo/Micro/Zero/...
delay(100);
display.clearDisplay();
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(0, 0);
!! display.println("Adafruit finger"); !! Changing to Serial.println("Adafruit finger");
!! display.println("detect test"); !! Changing to Serial.println("detect test");
display.display();
delay(2000);
finger.begin(57600);
delay(5);
if (finger.verifyPassword()) {
Serial.println("Found fingerprint sensor!");
} else {
Serial.println("Did not find fingerprint sensor :(");
while (1) { delay(1); }
}
Serial.println(F("Reading sensor parameters"));
finger.getParameters();
Serial.print(F("Status: 0x")); Serial.println(finger.status_reg, HEX);
Serial.print(F("Sys ID: 0x")); Serial.println(finger.system_id, HEX);
Serial.print(F("Capacity: ")); Serial.println(finger.capacity);
Serial.print(F("Security level: ")); Serial.println(finger.security_level);
Serial.print(F("Device address: ")); Serial.println(finger.device_addr, HEX);
Serial.print(F("Packet len: ")); Serial.println(finger.packet_len);
Serial.print(F("Baud rate: ")); Serial.println(finger.baud_rate);
Your code is incomprehensible, probably because it is incomplete. You appear to have three instances of serial, which I believe is one more than you need, and I guess only one works, Bluetooth.
Wow, that was stupid. I just deleted the Serial.begin line and it worked all of a sudden. This is probably a dumb question, but did this work because there were 3 different Serials being used (mySerial, Serial, bluetooth) or does it have something to do that I didn't use Serial at all in my code. Thank you so much!
Using three serials when you only need two is definitely not the sort of thing you want to show your mother. If you don't have serial at all in the code, you can be pretty sure that what is intended to work on serial won't. I assume that whatever was connected to hardware serial , perhaps Bluetooth, did work, but you just got lucky. You appear to be trying to use the finger device on software serial, but don't expect it to work at 57600, and I bet you don't need to either. Use 9600 instead. This is a problem with software serial, not the device.