Friday, April 1, 2016

Dealing with the Bluetooth connection between a HC-06 module and a PC.

Asking yourself why the HC-06's status LED keeps blinking after pairing with your PC?.
Asking yourself why after entering "1234" pairing code the HC-06 status changes to "Connected" and then to "Paired" after just few seconds?.
The answer is: THIS IS NORMAL.
I recognize that I was expecting the HC-06 module status to behave as my Bluetooth speakers or my Bluetooth headphones after pairing: Always connected. Wrong!!!. 
After dealing with the communication problem between the HC-06 Bluetooth module and my Windows 10 PC, I unexpectedly got the connection and solve the problem.
After many fails, I focused in test the wiring between the Arduino UNO and the HC-06 module. For this I decided to send from the Arduino an AT command to change the module's name from "HC-06" to "ArduinoBT01" and it worked. So I isolate the problem to the HC-06 and PC side.
I'm assuming that you're familiar with the Arduino stuff. You got here because you're dealing with the HC-06 communication and you should have a good level. Anyway feel free to ask in the section at the end of this post. 
This is how I got the communication:

1) This is the sketch I used as a test to send data to the PC via the HC-06:

I keep it very short and simple. The FOR cicle is just because I like to see things changing in the terminal screen.
2) Pairing the HC-06 module with my PC: During the pairing process the status of the module in the "Manage Bluetooth devices" dialog window were, in sequence, as follow: "Ready to pair", "pairing" (here is when the manager asks for the "1234" code), "Connected" (just for few seconds) and then "Paired". Before, during and after this sequence the HC-06's status LED was blinking.

After pairing the HC-06 module, I got two new com ports: COM34 and COM35 (this may be different in your setup). The right com port to open and receive the data in the PC is the one indicated with direction "Outgoing" in the PC's Bluetooth settings as follow:

Yes, believe or not, to receive the data you must open the "Outgoing" port. This sounds illogical to me. During my firsts tests I wasted a lot of time trying to catch the data from the "incoming" COM35 port.
3) Monitor the received data in the PC: I like to use CoolTerm to monitor and/or catch the data from the COM ports. As soon as I opened the COM34 port to receive data, the HC-06's status LED changed to a BEAUTIFULL SOLID ON.

As soon as I closed the connection, the LED changed to blinking again.
So, the LED will be solid ON only while the outgoing COM port is opened and under control of CoolTerm during the data transmission from the Arduino.
Take a look of the COM34's configuration shown in the bottom of the CoolTerm window. Mysteriously, the CoolTerm speed setting was 14400bps and the speed in the device manager for COM34 was 9600bps. Every time I tried to open the COM34 port with 9600bps, I got this error:

I did never set the speed to 14400bps, I guess it was done automatically by CoolTerm and after that I got unexpectedly the received data. After others tests I found that it only works with 14400bps. Crazy bug!!. I will test this with puTTY.
My tests were limited to send data from the Arduino to the PC. I will be conducting more tests sending data to the Arduino.
I hope this helps!!
All comments are welcome (English or Spanish)
(Sorry for bugs in my English)
PD: Other useful tools that help me a lot to finally get the communication after wasting my time with the COM35 port were: TUMS and famotidine.

Wednesday, November 11, 2015

Issues with the YIHUA 853D Rework Soldering Station USB power output

Note: Please use your browser's translation service to translate from Spanish. Everybody is welcome to leave comments in English or Spanish. Thanks.

Problemas con la salida USB 5Vdc de la estación de soldadura YIHUA 853D

Compré la estación de soldadura YIHUA 853D en Septiembre 2015. Hasta ahora todo funciona bien hasta que decidí poner a cargar mi celular en la salida USB de la estación. Normalmente me gusta monitorear el voltaje, la corriente y la carga que utilizan mis dispositivos (celular, tablet, etc). Así que siempre uso un pequeño monitor de puerto USB. Lo que encontré es que el voltaje de salida de la estación de soldar ni siquiera llega a 5.00Vdc sin carga. Además está muy mal regulado pues el voltaje se cae varias décimas de voltio al conectar mi celular para cargar (Samsung S5).

Aclaro que el monitor USB utilizado para medir no es de precisión, sin embargo, como referencia también coloco las lecturas hechas con el cargador USB original del mi celular en donde se observa que el voltaje de salida es un poco mayor de 5V con carga.

Esta es la estación YIHUA 853D (click en cualquier imagen para agrandar):

YIHUA 853D Soldering rework station
YIHUA 853D Soldering Station

Esta es la lectura del voltaje del puerto USB, SIN CARGA. Se leen 4.88Vdc:

YIHUA 853D Soldering rework station

Este es el voltaje de salida cuando conecto mi celular a cargar. Se leen 4.35Vdc y 0.23A:

Como referencia, estas son las lecturas del mismo monitor USB utilizando el cargador original del celular. Se leen  5.32Vdc (alto pero bastante buenos, no?) y 1.11A:

Algo bien interesante es que el celular ajusta la corriente de carga dependiendo de la "musculatura" de la fuente de 5Vdc donde está conectado. Muy inteligente!!!. Esto significa que en el caso de mi celular, este tomaría más tiempo para cargarse con la estación de soldar que con el cargador original gracias a que la salida no mantiene un nivel adecuado de voltaje. Si el celular no tuviera este comportamiento podría tratar de sacar más corriente y el voltaje podría caer aún más. Muy decepcionante!!.

Finalmente, la salida USB de 5Vdc de la estación de soldar es de mala calidad y no está bien regulada. Me pregunto si alguien más pudiera hacer la misma prueba para constatar si el problema es mi estación solamente o esto es un defecto de fábrica.

Bienvenidos sus preguntas y/o comentarios en Español o Inglés.