⬆️ ⬇️

Uploading sketches to Arduino via Bluetooth

When programming the Arduino, it is sometimes desirable to do without a physical connection via USB to a computer, for example:





On the Internet you can find several publications on this topic, but all of them are fragmentary and there is no completely ready solution. Also, despite the simplicity and obviousness of the design, there are several small difficulties that are ready to thwart the whole event. About how to overcome them, I want to talk in this article.



The Arduino board is connected to a Bluetooth module for wireless upload.



I used the cheapest Bluetooth-modules with the straightforward name "Bluetooth-module HC-05 (HC-06)". On ebay they can be found from 200 rubles. apiece, in domestic stores - from 500 rubles. I advise you to take the module already soldered on the adapter "for the Arduino", the difference in money is minimal, and saves time on assembling the interface circuit.

')

image



And if you got a module without an adapter card?
In this case, you will have to assemble the adapter circuit yourself. The instruction is here.




We need HC-05, but since it is extremely difficult to visually distinguish them, there is a great chance that HC-06 will be in the hands, even if the package says “HC-05”, as it happened to me:



image



Is it possible to distinguish HC-05 from HC-06?
You can try to distinguish in appearance, if not all the legs of the Bluetooth module are sealed or have a multimeter at hand. In HC-05 to the LED, unsoldered on the module itself, there is a conductor from leg 31, and in NS-06 from leg 24.



image



The photo shows that the only 24th leg is soldered on the whole row, it is one hundred percent module HC-06.





Fortunately, HC-06 can be reflashed in HC-05, but you will have to find a computer with an LPT port and spend a few hours. Instructions for flashing can be read here . From myself I want to add that the firmware did not take place under Windows7, I had to install Windows XP, and also in the BIOS, change the LPT port mode to EPP 1.7.



Detailed LPT port settings
The switching of LPT-port modes and settings in the Device Manager was especially tiring, so I’ll immediately give you the correct screenshots. BIOS:

image



In dispatcher:

image



Why reflash?
The HC-05 firmware, unlike the HC-06, when connecting, changes the signal at the 32 pin - this is necessary in order to hard reset the programmable Arduino and start the fill process. You can not reflash, and press the RESET button on the board every time before pouring, and you need to catch the right moment, which is extremely inconvenient. It looks like this




So, we have on hand the module HC-05. Now you need to set the parameters of work. To switch to the parameter setting mode, you need to solder the last, 34th leg to the power supply 3.3v.



image



Then we connect to the computer via any USB-UART-TTL adapter and in the terminal we give the following sequence of commands:



AT

AT + RESET

AT + ORGL

AT + ROLE = 0

AT + POLAR = 1.0

AT + UART = 57600,0,0

AT + INIT

AT + INQ



If you want to change the standard password for pairing, then in addition:

AT + PSWD = 5678



If you want to change the name of the device, then in addition:

AT + NAME = RemoteArduino



After that, the module is turned off, the jumper with 34 legs is removed and proceed to the final refinement of the module. This can be done directly on the HC-05 board, but it seemed to me more convenient to do this in the form of an adapter card for direct connection to the Mini Pro.



image



To automatically reset the Arduino when a connection is established, you need to bring the 32nd foot to the connector, for this I cut off the WAKE-UP output that was unnecessary for me and labeled it as RESET. The adapter scheme is as follows:



image



The LED will show an established connection.



On this with soldering everything, but pouring still does not work. The fact is that the Arduino IDE at each attempt to fill the sketch clears the COM port buffers, which causes the BlueTooth connection to be closed and the download canceled.



To avoid this, you need to fix the configuration of the Arduino IDE, which is located in the file C: \ arduino \ hardware \ arduino \ boards.txt . We open this file in a text editor, look for the section corresponding to the board with which we work (I have this Pro Mini 5V) and add the following line:



pro5v328.upload.disable_flushing = true



Do not forget to change the first word in the string, for example, for Arduino Uno it will be:



uno.upload.disable_flushing = true



Now pouring should earn. A small annoying detail remains - when we go into the Arduino IDE menu and select the “Tools” item, the program “freezes” for a few seconds. The fact is that with each access to this menu item, the program goes through all the available COM ports in the system, but in a non-optimal way, which leads to large delays. To remove this delay, you need to replace the rxtxSerial.dll library with a modified version, which can be found here . Who are interested in the details of the problem, may familiarize themselves with the thread on the forum Arduino .



Here is another option with the Arduino TX Power and TX button:



image



The scheme of the second option (the Bluetooth module is different, so the pins are located differently and the Pro Mini is not original, but “Deek-Robot”, the pinout is mirrored):



image



The circuit takes up minimal space, connects quickly, does not require configuration. It also remains possible to enable the Arduino IDE to enable Serial Monitor and receive data from the device as if connected via USB.



PS

It turned out that there are ready-made such converted modules , and maybe someday we will see them on sale in our country.

Source: https://habr.com/ru/post/235727/



All Articles