Loading

Not responding to Bluetooth commands

Arduino_Nano HC-06 ottodiy

Please Login to Comment

I have not had any luck to get my HC-06 module to work with my Otto DIY+. I have hooked everything up like the guide says, configured the module to the recommended settings using the Arduino and then I used the OttoDIYAPP_122_baudrate9600.ino to program my Otto. I have also succesfully installed the included OttoDIYAPP.apk on my Android device. I can connect to the HC-06 module without a problem, and when I connect using the app the module stops blinking. But when I try to send commands to the Arduino nothing happends. I have done a succesfull loopback test on my HC-06 module and it seems to be working correctly. Can anyone help me?

try to send the commands through arduino serial monitor...
Is the TX is connected to RX and the RX to TX.
Transmitter to Receiver and Receiver to Transmitter
or else nothing send nothing receive.

Same problem here using an HC-05. I was able to configure the module and the Zowi app connects to it but no commands are executed. The Otto DIY Bluetooth Controller app even shows some version data returned from the firmware but, again, no robot commands are executed.

I have narrowed my problem down and now I suspect there is something wrong with my I/O board. When I take the Arduino out of the socket and connect the HC-06 directly to it the RX light flashes when sending commands from the app. But when I plug the Arduino into the I/O board and connect the HC-06 up to it, the RX light just stays on.

In my case at least, this appears to be a software configuration problem. I put a scope on the HC-05's Tx and Rx pins and I can clearly see the data being sent from the Arduino at the baud rate set in the program and the data coming from the phone at the data rate set in the HC-05 configuration. Using 9600 baud on both, the Otto DIY Bluetooth Controller app picks up the name, program id, and battery level fine when Otto_BT_ZowiAPP.ino starts up and I can see the signal on the HC-05's receive line. However, nothing sent from any phone app ever shows up as available data in the main program loop. BT.Available stays at -1.

The software is configured to use Otto.h and SoftSerialCommand.h but not OttoSerialCommand.h, although the latter doesn't help either.

I've tried configuring the UART speed as both 9600,0,0 and 9600,1,0 and that makes no difference either.

I'm pretty much out of ideas. If anyone has a suggestion, I would very much appreciate it.

--Dave

I just did som tests and found that the RX light blinks as it should when I connect the Otto to an external powersupply. But still, it simply does not want to respond to any of the commands from the app. I am also out of ideas at this point...

I tried the same thing with my HC-05 with no success. Its light double blinks when connected but does not blink with data received.

I never get any response sending bluetooth commands with one exception. When I configure the Otto_BT_ZowiAPP.ino file to run bluetooth at 57600 baud, the Otto DIY Bluetooth Controller android app shows the correct Program ID stored in the arduino app (ZOWI_BASE_v2). This is coming over bluetooth so I know it is connected and at the correct baud rate. Nothing else works though in any combination of apps and baud rates. This means the bluetooth module is sending data correctly to the phone but apparently cannot receive data from the phone. Not much but it's a start.

I had some issues when i was mass producing OttOs, maybe some of these might give you more ideas. Its what I did to debug a few to narrow down if it was the BT or the arduino itself.
1.) Some BT modules were not 5v tolerant so I had to voltage divide them to get good data. This would be more of an issue to the phone receiving data, maybe no ACK causes the app to stop sending. (Zowi App is a black box)
2.) Some came programmed with odd baud rates so i checked them using a loop back code until i got confirmation that the AT commands were coming back correct.(See http://forum.arduino.cc/index.php?topic=479135.msg3284359#msg3284359)
3.) One was just bad no hard failure just lots of drops and bad data. Current failure rate from the Big Rock Candy Mountain is 5%. So not too bad.
4.) Test the commands to Otto through USB in the Arduino IDE Serial Monitor. Start with USB before you move to Bluetooth. Enter (excluding <>) <M 1000 1> for it to walk or <H 1> for it to do the happy emote (you should see all the different commands in the .ino file)
5.) Use software serial to keep Bluetooth com separate than USB(Serial) com. That's what I did. It let me debug my code through serial.

Ah, finally a little success. Using some example code (eg Move_BT.ino and Intergration_example.ino) in a repository called PLUS-V03, I was able to get it working via a command line bluetooth connection. This shows the hardware is working, although with some movements, the bluetooth would disconnect maybe due to servo noise,

However, I have been unable to adapt the working code into the more complete programs that interface with the Android apps. It should be straightforward but I don't understand the code objects in Otto_BT_ZowiAPP.ino like in the statements SoftSerialCommand SCmd(BT); and SCmd.readSerial();.Therefore, I've not been able to adapt the simpler forms like int val = mySerial.read(); used in Move_BT.ino.

Maybe I'll be able to find some other complete implementation that works since I'm out of ideas for figuring out why Otto_BT_ZowiAPP.ino and similar apps won't work in my configuration.

Sounds like software from your statements. There are two ways to hook up to the BT module.
1.) If you are just using Serial and SerialCommand then BT_TX -> Nano_Rx(Pin 0) and BT_RX -> Nano_Tx(Pin 1). The problem with doing this is to flash programs you need to unhook the BT_TX line. The USB serial uses these same pins so if two things are hooked up it gets confused.
2.) My preferred way at the cost of a bigger program is to use SoftwareSerial to mimic a 2nd serial port on any two pins. This lets me flash at will and echo back statements from my android app to my USB for a through robot loop back test when building new robot firmware. Somewhere there should be in your code.
SoftwareSerial btSerial(PIN_BT_RX, PIN_BT_TX);
Where btSerial is the name of the new software serial object and the 2 required inputs are the TX and RX pins on the arduino.
This sets up a software serial on those two pins. Then using the updated SerialCommand from Android libraries you set up the Serial Command object with a software serial object:
SerialCommand btSCmd(btSerial);
Now you should have lots of line items linking your command object to the methods based on the first character. EX.)
btSerial.begin(115200); #make sure this matches what you configured your BT to use
//Setup callbacks for SerialCommand commands
btSCmd.addCommand("B", requestBattery);
btSCmd.addCommand("C", receiveTrims);
3.) I didn’t want to mention this before but I am building my own firmware but was distracted by Fallout 4 and Vorpal Hexapod (I see you are also an owner :D). The link to Rowbits is found in the OTTO_GIFs thingy. (https://www.thingiverse.com/thing:2552852) If you go to the back of the pictures you can see how I wired my Ottos. I even made a clip that holds my BT module just over the nano. My goal was to make a firmware like Repetier where changing one config file with your pinout builds your firmware. (See Rowbits_config.h) It is still quite alpha but you can see some code examples of someone mauling the Otto/Zowi firmware. I am normally a Java programmer so working in C is like going back to doing calculus with a slide ruler when you are used to Matlab. I use Platform.io to code now for autocomplete creature comforts and I can’t get it to compile in Arduino IDE without some work to copy main.cpp into an ino file and have a flat directory structure (copy everything out of the sub directories to be next to the ino file and update the includes in the .h files) which I hate for organization reasons, but may do just that to make it easy for people just learning so they can use the Arduino IDE... (Why it can’t just open and compile things in subdirectories I don’t know…)

Otto_GIFS

So glad to be talking with a fellow hexapoder! That got me started with the Arduino and I built the vase too. This is my 3rd arduino project.

Your info all makes sense and is how the programs are organized. I use the 2nd option for the bt module connection. The problem is that the main loop never detects available data. However it is detected when I use the simpler programs even though they both use the same SoftwareSerial library. One other difference is that the simple programs don't make use of USB communications. I wonder if that could be causing a problem. The complex programs also use the OttoSerialCommand or SoftSerialCommand library. I really don't understand what each of the libraries are for.

I'll check out Rowbits to see what I can learn from it. Thanks!

Have you tried replacing some of the librarie files with those found at this Github and connecting the Bluetooth module to pins 0 and 1? I got that tip from the guy who made the app. Still did not do anything for me though... But you should try it. https://github.com/jarsoftelectrical/OTTO-DIY---app

I think I'm confused on the installation of the library files. The instructions say to put all the files into the Arduino folder. However, they contain 2 subdirectories called Otto_hardware serial and Otto_software serial. In each are Otto.h and .cpp which also appear in the main directory. In the hardware one are also OttoSerialCommand.h and .cpp and the in the software one are SoftSerialCommand.h and .cpp. Am I supposed to choose one to use and discard the rest? For bluetooth, do I copy the Otto_software serial contents to the main directory, replacing the Otto.h and .cpp files. If so, I don't understand what the original Otto files were there for in the first place.

I have a feeling I'm missing some basic understanding of Arduino libraries but I haven't been able to find anything that explains so I can understand. Sorry if these are dumb questions but I would sure appreciate the help. Thanks.

--Dave

Again I switched to platform.io because i was used to a Java structure where I could have sub packages to keep all of my code straight and pull the libraries into my src directory since they are not well source controlled. When i first did my coding for Otto I copied all the files found under Otto libraries to my Arduino library folder. For me that was C:\Arduino\libraries.

The fact that you do not have an assignment for the BT on a pin set means you are using a SerialCommand where the support was removed for software serial. To use software serial you can initialize it in your .ino file (see previous code snipet). Just copy the SerialCommand that I use in Rowbits under the "com" subdirectory (it is the pure code from the original author).
Remember you have to pass in the instance of your Software Serial object when you initalize SerialCommand (you created with the pins you are using) or it will just default to using the Serial port which is pins 0 and 1. Also I don't know why the Otto code has a modified SerialCommand, because to save programming space if you are not going to use SoftwareSerial you only have to add #def SERIALCOMMAND_HARDWAREONLY and it doesn't load the software serial libraries and saves the ROM space.

Summary:
To use pins other that 0 and 1 for BT you need Softwareserial.
To use SerialCommand with SoftwareSerial you need a version that supports SoftwareSerial and Otto has versions where someone stripped that functionality out to save space in the ROM.
Its a pain in the but to keep libraries straight in Arduino IDE.

I finally got it working by deleting all the unused hardware serial related libraries and recoding the comms stuff in the .ino file to properly use the SoftSerialCommand library. Thanks for all the help!

--Dave

Happy that it finally worked for you, I am struggling to move Otto with bluetooth, without any success. Can you share your final code and the libraries used? appreciated.

I think I understand about using and initializing SoftwareSerial and agree somehow it's being used for pin 7 but not pin 6. However, since so many bluetooth implementations like this are working for so many people, I think the answer must be simpler, probably having to do with which libraries I'm installing and where they are. That said, I will strip the libraries down to just the ones that deal with SoftwareSerial and then adapt the code to correctly call them.

Is it true that only files in the directories in the Arduino library directory are seen but not those in subdirectories under that?

Major breakthrough! Using OTTO-DIY--app/OTTO_NEW_OTTO_APP.ino (or other implementations for that matter) I am able to control the bot over bluetooth if I move the receive connection (bluetooth module transmit) to pin D0 and keep the transmit connection on pin D7. I have the receive and transmit pins assigned as pins 6 and 7 so it's very odd that one assignment works but not the other. I would really like to correct this since uploading code requires that pin D0 be disconnected. Also, if I assign both pins to D0 and D1, that works as well.

I've tried tracking down the issue but I don't even see anywhere the BT_Rx and BT_Tx variables are even being used in any of the library programs. Maybe they are used directly in SoftwareSerial. They must be used since BT_Tx definitely assigns a pin. BT_Rx has no effect though and it stays on pin D0.

I also had some success using OttoDIYAPP_122_baudrate9600.ino with the Otto DIY android app and some other combinations as well. It works intermittently and maybe that is related to some of the communication going to the serial port instead of bluetooth.

At least this is major progress and it gives me hope a solution is close. Thanks again to everyone who has helped so far.

--Dave

Great info, Lucidwolf. Point by point:
1) I tried voltage dividing the receive and transmit line with no success, although the phone seems to receive data fine and the transmit signal from the module looks good on a scope. Did you need to divide the power itself?
2) AT commands sent to the HC-05 over USB work fine.
3) Since the transmit and receive data look good, I don't think this is a hard failure.
4) Commands through USB work fine.
5) I think I have a software problem since no data is ever received by the software even though it shows up on the Arduino's receive port digital pin 6. I've tried lots of different variations of Otto DIY Plus sketches from GitHub. Is there one in particular you would recommend? I get a bit confused on the libraries included and I don't understand what in means when they include directories like Otto_hardware serial, Otto_software serial and files like OttoSerialCommand and SWSerialCommand which are sometimes in library subdirectories.

Also, I'm not sure if it matters what baud rate I use with the various phone apps as long as the HC-05 configured rate is the same as the rate I program in the sketch. I've tried different rates and they all give the same result.

I guess also that I could have a bad Arduino that does not recognize the received data. I'll try different pins and maybe a different device.

Thanks!

--Dave

I'm totally stuck with connecting my Otto DIY+ to bluetooth. I went with a Nano clone board (Elegoo Nano with CH340 chip) and also a clone Nano I/O shield (HALJIA Nano V3.0 Prototype Shield). I can't upload sketches with the Nnao connected to the shield. But that aside, I have the basic sketches working and Otto walks around and makes noises. I wanted to transition to using the Android APK, however it doesn't do anything after connecting and then pressing the commands via the app.

I've attached photos of the bluetooth module as well as the Nano and shield. I have BT_VCC -> 5V, BT_GND -> GND, BT_TX -> RX, BT_RX -> TX as my wiring.

I ran the "HC06_BT_config.ino" app to setup the passkey and ID, and can connect using the Otto App as well as apps like "Bluetooth Terminal". I added a Serial.println("setup"); and could see that sent to the Bluetooth Terminal, confirming that the sketch could communicate with my phone over bluetooth.

I don't know how to debug this. Do I need to change the MODE=0 to something else? If I try and use Serial.println(MODE) I don't get a value. Any help would be most appreciated.

Does anyone read these forums?