|RN-USB-X dongle in my PC|
One thing to remember if you get one of those dongles. The default baud rate for the modem is 115200 - make sure you set this in hyper terminal or it won't communicate.
Anyway, I get the dongle working and can talk to it via hyper terminal (you enter $$$ and it switches into config mode). Now it's time for the modem to be connected to the Arduino. It's got 6 pins:
- Serial receive
- Serial send
- Serial ready-to-send
- Serial ready-to-receive
Before trying anything fancy I just connect the GND and Vcc up so the modem has power. In theory I should now be able to connect to to it from my dongle plugged into the PC. Once powered up the LED flashes red, so I go back to hyper terminal. After a bit of reading documentation I type:
Obviously :) In english that's apparently enter config ($$$), set the receiver address (printed on the modem), set mode to 1 (master) so it can connect to things and finally 'C' to connect. To my amazement the LED on the modem turns green. Hurray!
The ready-to-send and ready-to-receive aren't essential, so if you don't bother with them (which I'm not), you just connect them together - that's the job of the blue cable in this close up:
The serial receive and serial send (yellow/green) connect to IO pins so the Arduino can communicate with the modem. Everything is now wired up and I've got a connection from PC to modem. Time for some Arduino code - this is a cut down version of my test:
#define bluToothRx 11
#define bluToothTx 12
The idea is to send messages out to the Arduino over blue tooth, which then transmits it back over the serial connection to the PC. What I'm expecting is:
- I type a message in hyper terminal
- The message is sent through the blue tooth (disgused as a normal COM port) to the modem
- The modem receives it, and passes it to the Arduino
- The Arduino receives it, and sends it over the USB (serial) connection to the PC
- Finally, the message finds it's way to the serial monitor in the Arduino which prints my message!
Sounds like a lot of work to type in one window and see it appear in another, but if it works I know I can communicate over blue tooth.
It kind of works. When I run it and type a character in hyper terminal the signal gets piped into the Arduino, which then pumps it back to the PC. Unfortunately somewhere along the way all the characters are being changed to 255. Then it occurs to me that baud rate was an issue when getting hyper terminal to talk to the modem, so maybe that's the issue here. I take a guess that it's the same as the PC one (115200) , so my final code is:
And lo and behold - it works! Here's a video to prove my awesome blue tooth message transceiver actually exists:
That's all for now. Next up - controlling the robot over blue tooth.