Need help with bluetooth silvermate RN-42 and arduino pro

J-M-L:
Have you tried to

  • upload the code
  • power your unit not from USB
  • disconnect USB cable
  • opening up a Serial terminal on windows and connected to the Bluetooth Serial port

--> see what's happening there?

Yhep I tried . Actually only this method I used. The unit is powered by batteries.

OK then you don't have the USB connected - Using Nick's suggested code

void setup()
{
 Serial.begin(115200);  // Begin the serial at 115200bps for bluetooth
}

void loop()
{
  Serial.println("hello");
  delay(1000);
}

this only works if the BT component is setup to communicate at 115200 on the local serial port with the Arduino.

Have you explored the configuration options from the advanced user guide documentation to ensure you are forcing the actual baud rate?

Note that they say "In some cases, the Bluetooth device manager creates two COM ports on the PC", so make sure you use the right COM port on the PC to see what's being sent from the Arduino side.

What baud rate should I use ? Because at 115200 it gives some those weird symbols.

115200 if you are using the hardware serial as you are with the code above should be totally fine - as long as your device is actually set up @115200

J-M-L:
@nick - not picking on you, just being technically curious here - why do you say

I'm saying this because it is 115200 by default. I'm rpetty sure that, if Bluetooth was an HC-05, which configures @ 38400 on software serial, the OP would not be having all this grief.

While I subscribe to the view that any software serial is a means of last resort only for use by the dying and the desperate, it is not unreasonable, and indeed the most common practice to use software serial to configure a bluetooth with a Uno. I also, like most others, feel that 115200 with software serial is the kiss of death. It just might not be all the time, but there have been enough sufferers on this forum to assure me that seeing it that way is a pretty good idea.

If you have no need to configure the RN-42 and can run it on hardware serial, a state that may actually include the OP, along with most other users, then there probably isn't a problem. Hence my comment above. Same goes if you use a Mega (like me(!)). The rest of the mob are faced with the absurd situation, I think the word is Kafkaesque, where they are obliged to handle the bloody thing at 115200 in order to get past the problems of handling the bloody thing at 115200.

And, as if to insult to injury, have you seen the price of these things, for chrissakes? They are just BT2 devices, after all, but I believe they claimed a range "up to 20m". Probably a lie.

krazilec:
Yhep I tried . Actually only this method I used. The unit is powered by batteries.

Please don't tell us you are using 9v PP3.
Ummm. Actually, I think you might have the USB cable connected, and therefore it may not be a problem.

Nick_Pyner:
Please don't tell us you are using 9v PP3.
Ummm. Actually, I think you might have the USB cable connected, and therefore it may not be a problem.

Nick_Pyner:
Please don't tell us you are using 9v PP3.
Ummm. Actually, I think you might have the USB cable connected, and therefore it may not be a problem.

Actually i have a socket with 3 aaa batteries.

Nick_Pyner:
I'm saying this because it is 115200 by default.

yes but really it is designed specifically to be used with their Arduino Pros hardware Serial by just sticking it into the unit and you get your wireless extension (there is no USB, you use a FTDI to connect)

so 115200 then is not such a bad choice with hardware serial. Add Auto-discovery/pairing requires no software configuration (instant cable replacement) and if it's true they deliver 26µA in sleep mode while still being discoverable and connectable that's good +( level shifting for RX and TX pins and 3 to 6V compliant makes it error proof — part of the complication with some HC-05) then I think that is the value proposition they sell.

the 20m is not what they state for the Silver. (in the doc they state "RN-42 is class 2, which limits the transmit range to about 10 meters", the Gold is RN-41 with high power, up to 100m) but agree it's dated compared to BT LE and expensive

J-M-L:
yes but really it is designed specifically to be used with their Arduino Pros hardware Serial by just sticking it into the unit

Well, I'm betting that is arrant nonsense. The RN-42 is designed and made by Nordic. And you are seriously trying to tell me that it was made specifically for an Arduino that I wouldn't be surprised if you too have never heard of until this saga came up? I also bet Sparkfun had no involvement with the design whatsoever, and probably don't have much effect on the marketing either. It [b]is[/b] possible that Sparkfun designed this version of Arduino with the RN-42 in mind, but that is the exact opposite of what you are saying, and it still doesn't make the RN-42 such a great idea either.

Auto-discovery/pairing requires no software configuration

That can't be anything but a good thing, and all I would need. But there are people out there who would want more.

I would not doubt the 20m capability in sight line because it's BT 2

I would. Everybody else claims 10m line-of-sight with BT2. I have had 15m with an HC-05, but I wouldn't rely on it, and prefer to take it as confirmation that 10m is reasonable.

krazilec:
Actually i have a socket with 3 aaa batteries.

OK. Now I'm not familiar with this version of Arduino, I bet few people are, but it has to be time look at what is really happening in the power department.

Ignore my comment about USB cable

You specifically said this is a 5v 16MHz board. So why are you trying to power it with 3xAAA? This cannot possibly be kosher, and may be the root cause of all your problems. If you are having any problems with Arduino, sailing too close to the wind with batteries usually makes things worse. I think you are a couple of points above the wind.

IF you really meant you have 3.3v board AND it really is a good idea to use not only three cells but also AAA, it is probably an 8MHz board, and that means it is risky to use 115200, even with hardware serial.

You can power with 3xAA or 3xAAA, just need to connect to 5V on the power header, and not thru the barrel jack or Vin as those both go thru the 5V regulator.
If a 3.3V board, connect to Vin to go thru the 3.3V regulator.

I have the 3.3v/8mhz and the socket is connected to battery port.

Nick_Pyner:
And you are seriously trying to tell me that it was made specifically for an Arduino that I wouldn't be surprised if you too have never heard of until this saga came up?

I did use one and we lost it in a lake when trying out with students an experimental self guided small fast boat which hit rocks way too fast... it was working as advertised.

Anyway I think what I'm saying is getting lost in translation there.

I'm saying that I could see as their value proposition informing their design choices for the "bluetooth silvermate RN-42" as an easy to use companion for their arduino pro. The default behavior and features being influenced by the Arduino Pro form factor and appetite to make a quick buck... :slight_smile:

Now I don't know if this is their intent, I don't work for them...

krazilec:
I have the 3.3v/8mhz and the socket is connected to battery port.

Time to read reply #29 again........... last para.

Nick_Pyner:
IF you really meant you have 3.3v board AND it really is a good idea to use not only three cells but also AAA, it is probably an 8MHz board, and that means it is risky to use 115200, even with hardware serial.

And... What should I do ? Change the rate to 38400 ? Or change the battery to something more powerful?

Today I tried to enter in cmd ( those $$$ ) and it worked fine at 115200 and 9600. I have a feeling that I do something wrong in serial monitor or I forget something on programming . Shouldn't I give some get commands from computer ?
Also I noticed that if I give those "$$$" in serial monitor from arduino sometimes works sometimes don't with no reason ( the connection is made in both situations ). If I use putty it always works .

I have a feeling that I do something wrong in serial monitor

Are you using the arduino IDE serial monitor? What are you connecting to?

krazilec:
I give those "$$$" in serial monitor from arduino sometimes works sometimes don't with no reason

I suspect the reason is that it is an 8MHz board. I understand they are flakey @ 115200, and it looks very much like you are proving it.

It seems that you are actually doing everything right that you can, and possibly always have, but the hardware isn't up to the job. Running 115200 with 3.3v is a bad idea with hardware serial, and therefore very likely a nightmare with software serial - indeed, a worse nightmare than usual. If it works on rare occasions, it could actually be down to a weather phenomenon.

In short, while I might have been just tiny a bit bombastic to say RN-42 is a poor choice for Arduino, I'm dead right in your case.

Since you ask what to do.......

The first thing to do is consider your situation and what your real intentions are. At the moment you are just playing around.

You make no mention of plural Arduino or Bluetooth, and therefore I assume you are missing out on what is probably the sole redeeming feature of the RN-42 - it's ease of employment in Arduino<>Arduino communication, using hardware serial and no keyboards involved, i.e. exactly the opposite of what you are currently trying to do.

I assume you have what you want in the Arduino department, it works fine, the power supply is what you want, and you are satisfied in every respect - except for the grief with bluetooth.

So, I suggest you stick with the Arduino, put the RN-42 in the bottom drawer, and get an alternative bluetooth.

The obvious choice is an HC-05 or HC-06. In their bare form, these are 3.3v devices but I wouldn't wish that on you, and you should get one on a breakout board or (gasp!) a shield. About 99% of the breakout boards are 3.6 - 6v and unsuitable for you, but there are others that are kosher. I have seen a dual voltage HC-05, and a 3.3v only HC-06. Both are postage stamp like the RN-42.

Then there is this
http://www.ebay.com.au/itm/Arduino-Bluetooth-Shield-HC-06-BT-Module-for-Arduino-UNO-MEGA-5V-3-3V-/380951761114?hash=item58b27e90da:g:7jcAAOSwPhdVFl2l
which is a nice piece of work, particularly as it is on a short form shield. It uses an HC-06, but that may be entirely satisfactory for your purposes.

The advantages of the HC-0x family are

It is 100% kosher for use with Arduino
It runs at 9600 by default and therefore happily runs on software serial
It can easily be made to do anything the RN-42 can do
Everybody knows, loves, and understands it.
It is (usually) one hell of a lot cheaper than a RN-42

The only disadvantage I can think of is that dual voltage and 3.3v versions are a bit hard to find, even ephemeral, on eBay, and I bet they are more expensive. But I submit that is what you need.

The only caveat is that, if you really need to run at 115200, and I bet you don't, the HC-0x are no better for that than the RN-42, and you need a 16MHz Arduino.

I've just had a thought. Try inserting some delays

  bluetooth.begin(115200);  // The Bluetooth Mate defaults to 115200bps
  bluetooth.print("$");  // Print three times individually
delay(10);
  bluetooth.print("$");
delay(10);
  bluetooth.print("$");  // Enter command mode
  delay(100);  // Short delay,

as a forlorn last shot.....

Also I noticed that if I give those "$$$" in serial monitor from arduino sometimes works sometimes don't with no reason ( the connection is made in both situations ).

Do you have another arduino running @16MHz? Double check if that would work there on hardware Serial. That will confirm your likely challenge is frequency related

I have only 1 arduino connected through bluetooth to my PC . In the end I want to put a rgba sensor on my arduino who transmits data to PC through bluetooth. That's all. The arduino is 3.3v/8mhz . Also I think I forgot to say that on my arduino I have a protoshield v2 ( like in the image below ).

J-M-L:
Are you using the arduino IDE serial monitor? What are you connecting to?

Yes. Now I switched to putty

J-M-L:
What are you connecting to?

What do you mean ?

J-M-L:
Do you have another arduino running @16MHz?

No. I have only 1 arduino 3.3v with 8mhz.

Let's say I consider to change the bluetooth. Which one should I choose ( I already have a shield on arduino. I don't think it is a good choice to put another shield on it ) .

This one is good ?
bluetooth HC-06 UART (RS232 TTL) SLAVE Arduino / PIC / AVR / ARM / STM32