I have made a perfboard shield for my UNO and i am doing a lot of testing and debugging and figuring things out with the software as i improve my robot, but every time that i need to upload a new sketch to test, i have to disconnect the RX and TX pins. So, i'm wondering if i can just solder a switch so that i do not need to unplug the Bluetooth module from the perfboard every time when uploading a new sketch.
I plan to use a switch like this one. I assume that i do not need any pull-up or pull-down resistors?
Miniature Slide Switch SPDT 3 Pin PCB 2 Position 1P2T Side Knob Handle High 3mm SK12D07VG3
My question is: what pins do i need to disconnect? RX or TX or both? I've done some experimenting on my own, and i found that just disconnecting the RX connection between the Bluetooth module (HC-05) and the Arduino UNO is enough to allow the sketch to upload successfully, but then i also searched online and i found some conflicting advice about disconnecting both RX and TX? Is that necessary? Why?
My idea is to use the above switch that will disconnect the RX pin and connect it to ground? Or can i just leave it floating when disconnected?
Railroader:
Not knowing Your B T module and not knowing Your used I/O pins I give You a guess: Can You run the B T via Software Serial, using to digital pins?
I mentioned it in the first post, it's HC-05. I'm using an Arduino UNO R3, but i never used software serial before, and from my research, it seems like it's not such a good alternative to hardware serial due to being much slower and some other issues. But i will consider it and experiment with it but for my current project, i would like to stick to hardware serial.
What is in Reply #1 is probably the best solution, but you could certainly use a simple switch to disconnect the Bluetooth module.
If you have found that disconnecting the Bluetooth module from the Arduino RX pin is sufficient then I would go with that. I don't think it will do the Bluetooth module any harm to leave its TX line floating but you could connect it to GND with (say) a 4k7 resistor.
The reason the Bluetooth TX pin needs to be disconnected is because in the serial system the idle state is HIGH so the 5v from the Bluetooth module will confuse the Arduino and prevent it detecting serial signals from the PC.
I also use UNO R3 in a number of applications. I use Software Serial when communicating with a GPS, NEO-6M, and I have not faced any trouble with it. Tha baudrate used is 9600. I can't tell whether S S can run at higher baudrates than that. It is enough for my application.
With a 1P switch disconnect the Arduino RX (BT TX) pin.
I'd use a DPST (2P1T) or DPDT (2P2T) switch to disconnect both RX and TX of the BT module. Eventually use a resistor to keep the BT RX pin (Arduino TX) in the idle state when disconnected.
DrDiettrich:
With a 1P switch disconnect the Arduino RX (BT TX) pin.
I'd use a DPST (2P1T) or DPDT (2P2T) switch to disconnect both RX and TX of the BT module. Eventually use a resistor to keep the BT RX pin (Arduino TX) in the idle state when disconnected.
Very useful info. So, i am going to use this switch as i think it can be soldered onto the perfboard:
Mini Vertical Slide Switch Rated Load 50V 1A On/Off/On DPDT 2P2T 6 Pin Vertical DIP Slide Switch
What value of resistance is recommended? And how is that value calculated?
Also, what do you mean by 'idle state'? Is that similar to a pull-down resistor?
DryRun:
I'm using an Arduino UNO R3, but i never used software serial before, and from my research, it seems like it's not such a good alternative to hardware serial due to being much slower and some other issues.
Why do you worry about BT speed and other issues if you have never used it before.
Seems you are trying to create problems that are not there.
Just use SoftwareSerial. Examples are in the IDE.
Use other solutions if/when you run into problems.
Leo..