Is there a way to transmit commands from PoMoCo over bluetooth?
It would be nice for not just to get the little guy untethered a bit and have him walk.
Is there a way to transmit commands from PoMoCo over bluetooth?
It would be nice for not just to get the little guy untethered a bit and have him walk.
My understanding is that you can use the bluetooth like any normal serial device.
Here are the link for the documentation https://github.com/ArcBotics/Hexy/wiki/Bluetooth
I have verified that I can communicate to the board over bluetooth in the Arduino IDE via uploading a sketch to the board.
When I launch PoMoCo. It says it is trying to connect to the board, and then it says it fails to connect, then my mac connects to the board (verified via the red light going solid on bluetooth and the bluetooth icon in menu bar of mac saying so).
Then a few seconds later the board disconnects.
It seems as if the computer launches PoMoCo before the board is connected and then connects to the board.
Any ideas? Hope this all makes sense to someone.
I can successfully connect and run my Hexy via Bluetooth from my Mac.
If you’ve upgraded to Servotor 1.7, it might be wise to ensure that your Bluetooth module has been re-configured to run at 9600 Baud.
Some basic instructions and Arduino code to do so may be found at the Hexy Wiki
In cause it’s of interest, here are some notes about how PoMoCo connects to your Hexy:
In looking at the PoMoCo code, it first tries to discover all serial devices and then attempts to connect to each with a 2-second timeout until it reaches the first device that responds as a “Servotor” board.
PoMoCo may erroneously report that it has failed to connect even though it’s still going through the list of devices. You can safely ignore that error, just give it some time.
Now, as I previously mentioned, PoMoCo will connect to the first serial device it finds that responds as a Servotor board, that means that, depending on the order in which it’s iterating through the list of serial ports, it may connect via USB first instead of Bluetooth. That’s why it is wise to disconnect the USB cable if you intend to use Bluetooth.
Hope this helps.
Has anyone had any success with BT in Windows 7 or 8? I must be doing something wrong as Arduino can’t even connect to the board via BT. My device manager show two COMs when connected… I’ve uploaded the 9600 baud Arduino code (via USB), reset the device, and uploaded 1.7 (via USB) with no success.
I did a bit of digging into PoMoCo and printed out the readReply and result from the serial query. I don’t see the ‘Trying WIndows Method’ attempt or any output indicating that Python is going into the for loop at line 95 or 111 in servotorComm.py.
I’m convinced this is a problem with Python not working but my Python knowledge lacks.
Thoughts?
NOTE: PoMoCo doesn’t see the device after waiting.
Edit: line number
Thanks for the help. Still not working on my end. Here are the details
[quote=“LuisSala”]
If you’ve upgraded to Servotor 1.7, it might be wise to ensure that your Bluetooth module has been re-configured to run at 9600 Baud.
Some basic instructions and Arduino code to do so may be found at the Hexy Wiki [/quote]
I loaded up the script on my Hexy and it “Failed Programming” multiple times. Reset board, power cycled etc. Nadda. Still failed. Might be missing something?
What did the BT board come set at for rate?
[quote=“LuisSala”]
PoMoCo may erroneously report that it has failed to connect even though it’s still going through the list of devices. You can safely ignore that error, just give it some time.
Now, as I previously mentioned, PoMoCo will connect to the first serial device it finds that responds as a Servotor board, that means that, depending on the order in which it’s iterating through the list of serial ports, it may connect via USB first instead of Bluetooth. That’s why it is wise to disconnect the USB cable if you intend to use Bluetooth.[/quote]
I have no USB plugged in. I waited for PoMoCo to connect for a bit. Nothing. My computer connects to the board for a few moments and then goes to not connected again.
The module defaults to 115,200 baud.
Did you check to make sure the Arduino software the board is a Leonardo?
I didn’t write that code in the wiki page but I took a quick look and it appears like you might need to change the baud rate on the serial connection so that the board will communicate with the module correctly.
I have not tested the following, but given that the bluetooth module is pre-configured for a different baud rate, I believe changing the line that reads:
Serial1.begin(9600);
to this:
Serial1.begin(115200); // Changed from 9600 baud
Serial1.print("AT+BAUD4"); // Added this line to tell the module to change the baud rate to 9600
delay(1100); // Wait a notch over 1 second to make sure the setting "sticks"
So, the complete setup function would look like this:
void setup() {
// initialize the digital pin as an output.
Serial.begin(9600);
Serial1.begin(115200); // Changed from 9600 baud
Serial1.print("AT+BAUD4"); // Added this line to tell the module to change the baud rate to 9600
delay(1100); // Wait a notch over 1 second to make sure the setting "sticks"
}
Once that happens, the sketch will re-configure the module, though you might not see any output.
I’ll try to test it out if I have some time.
Wow! Didn’t even think of doing that! Thank you sharing! 
[quote=“LuisSala”]I can successfully connect and run my Hexy via Bluetooth from my Mac.
If you’ve upgraded to Servotor 1.7, it might be wise to ensure that your Bluetooth module has been re-configured to run at 9600 Baud.
Some basic instructions and Arduino code to do so may be found at the Hexy Wiki
In cause it’s of interest, here are some notes about how PoMoCo connects to your Hexy:
In looking at the PoMoCo code, it first tries to discover all serial devices and then attempts to connect to each with a 2-second timeout until it reaches the first device that responds as a “Servotor” board.
PoMoCo may erroneously report that it has failed to connect even though it’s still going through the list of devices. You can safely ignore that error, just give it some time.
Now, as I previously mentioned, PoMoCo will connect to the first serial device it finds that responds as a Servotor board, that means that, depending on the order in which it’s iterating through the list of serial ports, it may connect via USB first instead of Bluetooth. That’s why it is wise to disconnect the USB cable if you intend to use Bluetooth.
Hope this helps.[/quote]
I’ve tried this step (modifying the Servotor sketch as suggested above) but I still can’t get bluetooth working. Has anyone had different results?
The module pairs with my computer and I get a blinking red LED. Otherwise nothing.
I had to reconfigure my modem for 9600 baud but once that was accomplished I was able to make a connection without additional fuss.
Thanks LuisSala, this works great!
void setup() {
// initialize the digital pin as an output.
Serial.begin(9600);
Serial1.begin(115200); // Changed from 9600 baud
Serial1.print("AT+BAUD4"); // Added this line to tell the module to change the baud rate to 9600
delay(1100); // Wait a notch over 1 second to make sure the setting "sticks"
}
I’m trying to connect via Win7. I was able to pair the PC to Hexy but it does not provide a COM port, therefore i cannot connect to the Bluetooth module. How do i assign a COM port? Please assist.
void setup() {
// initialize the digital pin as an output.
Serial.begin(9600);
Serial1.begin(115200); // Changed from 9600 baud
Serial1.print("AT+BAUD4"); // Added this line to tell the module to change the baud rate to 9600
delay(1100); // Wait a notch over 1 second to make sure the setting "sticks"
}
Hot dang LuisSala, that’s going in the next firmware version for sure. Great idea!
Rob, do you see anything under Devices and Printers?
Yes, I see the Arduino Leonardo under Com4 when plugged into the USB. this works fine. I also see the ArcBotics as a Bluetooth device. When I look at the properties the Serial Port (SPP) 'Dev B is checked. However I do not see a specific Com port for the Bluetooth. Under Device Manger I see the USB connection under Ports (Com & LPT), the ArbBotics Bluetooth is under Bluetooth Radios only. When I try to configure (specifying Com port) I notice the Com port is blank. Let me know if you need additional info.
Would anyone mind writing out the steps they used to get bluetooth working?
FYI:
The code sample I provided was a one-time use thing. Once the module baud rate was set to 9600 it will stick permanently.
It won’t hurt things to keep it there, but you’ll also need to add: Serial1.begin(9600); after the delay because the Bluetooth module is now configured to 9600 baud.
LuisSala you are awesome.
I got it up and running.
The bluetooth still seems to disconnect sorta randomly though. I am only powering the bot with 4 AA pack. I think I may try it again with a pack on the logic thing too.
No problem… Powering the logic port independently will definitely help.
Hmm, I’m experiencing random bluetooth disconnects as well. I’ll have to try using a separate power pack for the logic as well, but I worry about Hexy’s performance with that much weight…
If you’re worried about weight, you can also just use a 9v battery for the logic.