I want to send some commands to my RN42 Bluetooth Module over the serial port using hterm. But i does not respond. I can connect to the bluetooth modul and the status LED blinks right.
I tried to send $$$ to change to command mode (modul should respond with cmd but does nothing) and 0x00 to disconnect.
Do you guys know what could be wrong?
A couple things that I have run into that you could try:
Ensure that the baud rate of hterm is set to the default 115k
Depending on the firmware version of the RN42 you may have to enter command mode within a one minute time frame. Try power cycling the module and sending the $$$ as soon as possible
Related
I followed this tutorial for emulating my Raspberry pi model B as a bluetooth Keyboard. I am able to identify the pi as a keyboard when searching for connection.
The pairing part is working fine also, I am using the following command for pairing:
sudo blue-simple-agent hci0 <mac address>
The tutorial asks to run the PiTooth code in one terminal and it will initialise the required ports (control and interrupt ports), read the SDP record, advertise the sdp record and it will listen for connection in the control and interrupt port. Then open another terminal and use the above command to pair with the client.
It is getting paired but it not reflected in the other terminal, which is still like "waiting for connection. The following is the part of the python code where it is listening for connection and connecting:
class Bluetooth:
HOST = 0 # BT Mac address
PORT = 1 # Bluetooth Port Number...
def listen(self):
# Advertise our service record
self.service_handle = self. service.AddRecord(self.service_record)
print “Service record added”
# Start listening on the server sockets
self.scontrol.listen(1) # Limit of 1 connection
self.sinterrupt.listen(1)
print “Waiting for a connection”
self.ccontrol, self.cinfo = self.scontrol.accept()
print “Got a connection on the control channel from “ + self.cinfo[Bluetooth.HOST]
self.cinterrupt, self.cinfo = self.sinterrupt.accept()
print “Got a connection on the interrupt channel from “ + self.cinfo[Bluetooth.HOST]
The whole code is really big and I don't like to enlarge the question. Please view this google doc for the code:
https://docs.google.com/document/d/1hEyprvN1MyFqyczL9Qh07_-pJjRvBIEkomiJhLHcXiQ/edit?usp=sharing
Can anyone help me solve this issue. Or is there any problem with the code. Is there any alternative ways to listen for connection.
The issue is resolved. It was an out-of-box solution actually. The problem was with the operating power of the pi. The pi was powered from my laptop's USB port and it's voltage was about 4.4V. USB ports usually provide only 500 mA, 5 V. Raspberry pi need a voltage source of about 4.75 to 5.25V and current in range of 700 to 1000 mA for optimum performance. Exactly how much current (mA) the Raspberry Pi requires is dependent on what you connect to it. For reference about power supply. I just changed the source, I fetched power via a 1000 mA 5v adapter and checked the voltage in the pi, it was about 4.64V and it worked fine.
What I want to do
I need to test the presence and status of a GPS module on a specific serial port
/dev/ttyS2
but I can't find any command that do so.
Additionnal informations
I'm running on a fedora 15 distro.
I can successfully launch a gps daemon with
gpsd -G -n /dev/ttyS2
and check the daemon informations with
cgps
Everything is fine with the values returned (my module is alive and connected). However, this command doesn't allow an external program to easily check if it's working as it should.
Any suggestions? Thanks !
Write a program (inside the external program) that connects with the specified serial port and baud rate.
Asuming the GPS chip is configured to send in NMEA format via the serial port,
you will receive NMEA sentences once a second.
Each such NMEA line starts with $GP (for GPS chips).
If you receive that then the chip is working.
To receive more detailed configuration settings, you have to read the manual of the GPS chip manufacturer.
I am curently looking to find out wheter it is possible to Bluetooth connect an arduino or similar micro controller to the pebble watch using the RN-42 Sparkfun RN-42 adapter
I currently am having difficulty connecting to the pebble, as the board just times out.
Thanks
The RN-42 can, using bluetooth. The following will get you paired, and the watch MAY accept a ping:
SF,1 //factory reset
SP,9999 //takes care of the pairing code
SM,6 //pairing
SA,4
SY,0000 //power
SW,0640 //sniff mode
R,1 //reset so settings are saved/active and pebble should ask to connect
To pass app messages you need to pass some information to the watch, see http://dexwatch.blogspot.com/2015/12/more-on-pebble.html for the full details.
I am trying to achieve that my arduino-built device connects automatically to a device after it is switched on. The board is an Arduino Mini Pro and the bluetooth module is the Bluetooth Mate Silver (RN42). The devices are already paired, the bluetooth module is in slave mode, the remote device (in this case a normal laptop) is discoverable. I am using the SoftwareSerial library provided with the Arduino software.
Here is my setup:
void setup()
{
Serial.begin(9600); // Begin the serial monitor at 9600bps
// bluetooth
// set baud rate to 9600
bluetooth.begin(9600);
// start command mode
bluetooth.print("$$$");
// reply delay
delay(100);
// set to slave mode
bluetooth.println("SM,0");
// reply delay
delay(100);
// set device pin to 0403
bluetooth.println("SP,0403");
// reply delay
delay(100);
// connect to pixelsense
bluetooth.println("C," + remoteMAC); // remoteMAC is a string with the mac address
// reply delay
delay(2500);
// leave command mode
bluetooth.println("---");
// reply delay
delay(100);
}
I read the command set of the RN42 and I think the commands are correct. I can connect to Arduino via bluetooth but the other direction isn't working. I also tried using the master mode or storing the remote mac in the flash instead of using a string. From the documentation it should be possible to initiate connections from the RN42, but I haven't quite found out how this works in details. Can anyone provide any help to solve my issue?
EDIT: The device does not seem to enter command mode at all. At least the flash lights don't indicate that. Is there anything wrong with the commands so that the command mode cannot be accessed?
After nearly a week, I came across a solution. Actually it seems to be important that there is any program that accepts a bluetooth connection. I tried it the whole time with the Windows 7 Bluetooth dialog menu entry "Receive a file" but that did not work. So I used a third party program that listens for incoming connections and that actually worked. Basically everything I did was fine except for the missing connection listener.
Sometimes if I upload new code to the Arduino there is the problem that the connection cannot be established. This can be solved by removing and readding the bluetooth device.
The code for the RN42 Bluetooth Client above works. The library SoftwareSerial provided with the Arduino software is used.
I think you may need to put some delay after bluetooth.begin(9600), to let set its baudrate and then issue print command.
You can enter into the command mode only in 60s after the module is powered on. You can see if the timer is still counting using the status LED(if it blink 2 per second). Sorry for my bad english.
On startup the RN-42 needs 500ms before it can enter command mode try 'delay(500);' before 'bluetooth.begin(115200);' and that should get you there. Also CTS should be tied low
as can be seen on page 45 of the document found at the link below.
https://cdn.sparkfun.com/assets/1/e/e/5/d/5217b297757b7fd3748b4567.pdf
PG 45
"3.3 INTERFACING TO A MICROPROCESSOR
Roving Networks Bluetooth devices can connect to 3.3-V (only) microprocessors using
the UART interface. When interfacing with a microprocessor, use the following guidelines:
• The Bluetooth device power, ground, RX, and TX signals must be connected and
CTS should be held low or tied to RTS.
• The Bluetooth device can go into command mode 500 ms after booting.
• The microprocessor should send $$$ with no carriage return or line feed to enter
command mode.
3.3.0.1 HOW DO I KNOW THE MODULE IS READY FOR COMMAND MODE?
500 ms after rebooting, the module is ready for command mode. You send $$$with no
carriage return.
3.3.0.2 WHICH HARD SIGNALS SHOULD I CONNECT?
You should connect power, ground, RX, and TX. CTS should be low or you can connect
or tie it to RTS."
I have an issue where i have connected my linux server to a serial port. There is a continous flow of data from serial port which comes through epabx.
In Minicom i get first call's data and from second call it goes offline.
I dont see any data.
Can some one help me on this.
Thanks for all the help given by you. Finally i have got the error solved.
God knows how i started getting the data.
But still i am listing the steps i performed to get correct data.
Sometimes data from serial port wont be capturing in the processing form application.
It may be because of the following issues.
1.Serial port not connected properly.
2.Serial port cable not working.
3.Some pins on serial port are damaged or connection lost.
Note: For above all reasons contact the client person or person in charge of epabx systems.
4.Data not getting displayed on hypertiminal.
This is a common issue in linux which uses minicom as hyperterminal.
Sol: Check the version of the minicom before running it on linux. If the version is minocom 2.1 then some process would be blocking the incoming data.
Uninstall minicom 2.1 and reinstall minicom 2.0
It is said that gate 8 process would block the incoming data.
minicom may be responding to control characters in your data. I'd recommend something simple but effective like
od -t x1 -t a /dev/ttySomething
to dump your data in both hex and as text.
You should also check that your port settings are correct i.e. bitrate, parity, stop bits, flow-control. Sometimes, when your settings are not correct, you will end up with weird results. Also, you need to check that your protocol is only sending texts as Carl mentioned.