Communication problem with HC-05

208 views
Skip to first unread message

Francisco Jose Gragera Cerrajero

unread,
Aug 2, 2018, 11:35:48 AM8/2/18
to Vorpal Robotics Forum
Hello, following this project I have mounted a robot, it works wonderfully in demo mode, but I have a problem with gamepad control.

1. The HC-05 modules are understood, at least the lights indicate that there is a communication.
2. All nanos are programmed with the latest version of github
3.  I have reviewed the communications and they are correct.
4. The robot does not do anything, when I press the gamepad, the robot remains stopped

I put two screenshots of how the two modules are programmed, the only strange thing is the different version of the firmware, I do not know if this is really important.
One detail is that the module with older firmware does not show information about the AT + NAME command, but he can change it.


Steve Pendergrast

unread,
Aug 2, 2018, 11:53:26 AM8/2/18
to Vorpal Robotics Forum
First, I'm assuming you self-sourced since you're programming the modules yourself, please confirm that.   I only ask because certain types of problem are more common among self-sourcers and other types of problem are more common among people who buy our kits, so it helps me narrow down what coudl be wrong.

If you are getting the correct blinking lights to indicate the modules are paired (blink-blink pause ... repeating) then what you're showing seems to be correct (uart baud of 38400 is correct as well).  This means either the modules are not hooked up to the nanos correctly or something else is wrong that causes the buttons not to be detected.  You could of course connect both modules via USB to a terminal emulator running at 38400 and see if they actually talk to each other as expected. You'd need a USB to Serial cable of some kind but it seems you already have that as I can see from your screen shots.

Assuming that's all good, let's make sure the buttons are working before going farther.

On the gamepad, change the line of code "debug = 0;"  to  "debug = 1;" around line 36, then flash this onto the gamepad.

After that, a serial monitor will show you what buttons are pushed.  #MA: will tell you which matrix button is pushed and #DP:  will indicate which DPAD button is pressed.

Make sure you're getting reasonable values out for those. The matrix buttons will come out as a number, the DPAD will come out as a letter (f = forward, b = backward, l = left, r = right, w = special).

Francisco Jose Gragera Cerrajero

unread,
Aug 2, 2018, 12:52:47 PM8/2/18
to Vorpal Robotics Forum
First of all thank you, it is the second place, it is a self-programmed robot, I made the change in line 36 with debugging in value 1
When I open the serial monitor at 9600 baud, it shows an automatic pulse and continues with the value # S = Wls
When I hit the pad or the matrix I get an answer, but it is a pulsation that is repeated several times and then another value is repeated continuously (see screenshots and video)



Steve Pendergrast

unread,
Aug 2, 2018, 2:42:40 PM8/2/18
to Vorpal Robotics Forum

Those outputs look good.  The W1f means "walk 1 mode, forward" for example.

So, let's review:

1) The robot hardware works because demo mode works. This rules out electrical or motor problems on the robot.
2) The gamepad buttons are working, and the gamepad is trying to transmit the protocol to the bluetooth module.
3) The bluetooth modules are blinking in the correct way to indicate they are paired and they are talking to each other.
4) The configuration screen proved that you are setting both uarts to 38400 baud, which is what the gamepad and robot want on the connection to the bluetooth modules.

The only thing left is the connection between the gamepad nano and gamepad hc05, and the connection between the robot nano and robot hc05.

Be sure that the TX and RX lines on both gamepad and robot are hooked up to the correct nano pins.

Also, sometimes you will get a bad jumper wire that doesn't make a good connection. Try swapping in new TX and RX wires.

A way to debug which is having the problem would be to take the robot hc05 and hook it up to a terminal emulator, and see if you get data coming in when you turn on the gamepad. You won't be able to read some of what transfers over because there is a binary protocol happening with length bytes and checksum bytes which are not printable characters. However, you should see things like "W1f" for walking forward or "F1s" in fight mode 1 with no button pressed.

If you see nothing, or you see total binary garbage, then something's wrong with the connections.

Francisco Jose Gragera Cerrajero

unread,
Aug 2, 2018, 3:34:07 PM8/2/18
to Vorpal Robotics Forum
I discard the connection cables between nano and HC-05, I have changed them all and I have also checked continuity with a cable tester and it is ok.

I am close to giving up, I do not understand the problem. the only strange thing between the two bluetooh modules is that they respond differently to the AT commands, I think they have different version of firmware and maybe this is the problem. I have made another video of the problem so you can see what is happening.


To test the robot with the terminal can be done with the arduino COM and the USB cable?

Thank you very much

El jueves, 2 de agosto de 2018, 17:35:48 (UTC+2), Francisco Jose Gragera Cerrajero escribió:

Francisco Jose Gragera Cerrajero

unread,
Aug 3, 2018, 12:32:21 PM8/3/18
to Vorpal Robotics Forum
I have crossed the slave and master modules but I can not communicate. I have reviewed all the cominications:

Robot (HC-05 Slave)
TX = D3
RX = D2

Nanopad (HC-05 Master)
TX = A5
RX = A4

I have also connected the robot to the arduino terminal and this is the result

Thanks


El jueves, 2 de agosto de 2018, 17:35:48 (UTC+2), Francisco Jose Gragera Cerrajero escribió:
Reply all
Reply to author
Forward
0 new messages