I created standalone arduino which i am programming with FTDI cable. I added bluetooth module (JY-MCU) and LCD display, to see what's happening. With bluetooth module i am communicating with smartphone and BlueTerm serial app.
I am sending random chars from smartphone (BlueTerm) to bluetooth module on arduino and displaying them on LCD screen. If i am supplying whole circuit with FTDI cable (the one i am using for programming chip), everithing works without errors. But if i disconnect FTDI cable and supplying whole circuit only with 5V (from stable power source), circuit stops working. I can connect BT and smartphone but when i try to send something, nothings happen.
In other way (from BT on arduino to smartphone) works in any case so the problem is only in direction from smartphone to arduino, while supplying without FTDI cable (only wiht +5V on the same input pin)
Below is my simple testing code and circuit of connection (without LCD module).
Btw, i remove BT module every time i am loading new sketch so module is safe. I also tried with another BT module but result is the same.
Source is the same because i am powering from the same FTDI cable (pluged into computer over USB), just that i connect only +5V and GND from FTDI cable (with 2 connection wires).
I found solution for this problem, in case that anyone will have the same problems.
I add 10k pull-up resistor on line, which goes from arduino's RX to TX of bluetooth module. Now it works like it should. I still don't know what's the problem but i think that signal for logical "1" from BT module is too low for arduino.
JY-MCU transmits with 3.3v. Assuming your Arduino is 5v, it doesn't normally care about receiving a 3.3v signal but, if the wire is very long and there are some losses, maybe it isn't enough. Normally, the concern is the other way, with Arduino sending a 5v signal to the JY-MCU's 3.3v Rx.
Nick_Pyner:
JY-MCU transmits with 3.3v. Assuming your Arduino is 5v, it doesn't normally care about receiving a 3.3v signal but, if the wire is very long and there are some losses, maybe it isn't enough. Normally, the concern is the other way, with Arduino sending a 5v signal to the JY-MCU's 3.3v Rx.
I putted voltage divider on other side (TX to BT RX) so that's not a problem. With 10k pull-up resistor on line from BT TX to Arduino RX, it works ok, without errors.
With 10k pull-up resistor on line from BT TX to Arduino RX, it works ok, without errors.
It might do for now but by pulling up that line you are in effect putting 5V on the BT module's output. As this is a 3v3 device this could damage it. Some devices are tollerent to this sort of thing but many are not.
Grumpy_Mike:
It might do for now but by pulling up that line you are in effect putting 5V on the BT module's output. As this is a 3v3 device this could damage it. Some devices are tollerent to this sort of thing but many are not.
Nick_Pyner:
I don't know why you would need to do this. It doesn't sound like a great idea, and it might be better to find out what the real problem is.
I tried direct connection to RX line of Arduino but it didn't work. I tried with two different bluetooth modules and with 3 different boards (Uno, Nano and stand-alone Arduino) but result was the same. The only way i could make it work was to add pull-up on that line. In other way (Arduino TX to bluetooth RX) with voltage divider it works like it should.
I think the problem is that signal for logical "1" from 3,3V BT module is too low for Arduino to understand it but i don't know why or how to fix it. Btw, lines are just a few cm long, i tried on breadboard and PCB -> No luck.
What about using a level shift? There some very cheap ones available on ebay. Or you might build your own with a couple of npn transistors. Definitely the voltage divider is not a solution here because your voltage levels will get messed.
Grumpy_Mike, which type of transistor would fit in this scheme? I used BSS138 but it take me A LOT of time to solder them (they are sooo small). Can you recommend some kind of replacement in TO-92 housing or a little bigger SMD version?
Btw, this thing is not bidirectional, right? If i would like to do bidirectional version i would need to use FET (something like BSS138 just in TO-92 housing, for easier handling).
Grumpy_Mike:
No it is not, you do not need anything bidirectional and you do not need an I2C bus level translator.
I am planning to use it for both sides (also from Arduino TX to bluetooth RX), to avoid voltage divider. I know i don't have I2C but it will work anyway, right? I would like to use this because is small and cheap enough. With this device i don't need 6 (or more) different components on the PCB.
Btw, do you know what would be BSS138 alternative in THT?