Bluetooth Mate Auto reset for Arduino Wireless Programming

After some research and hard looking i found a Tutorial on how to wirelessly program an arduino via a Bluetooth SMiRF module.

but this requires going through what can become an annoying process.
So i looked at the Bluetooth mate modules sold from sparkfun and the rn-41 data sheet and saw that there was a "remote DTR (pin 33) " and a "Remote RTS (pin 34)" which weren't connected on the Bluetooth mate boards i was wandering if i could jumper them to the DTR and RTS pins on an arduino mini pro to enable wireless programming? (kind of like a wireless replacement for the FTDI Breakout board)

Data sheets
Blutooth mate silver Bluetooth Modem - BlueSMiRF Silver - WRL-10269 - SparkFun Electronics
Bluetooh mate Schematic http://www.sparkfun.com/datasheets/RF/BlueSMiRF-Gold-ChipAnt-v1.pdf
RN 41/42 data sheet http://www.rovingnetworks.com/documents/RN-41.pdf

any advice would be appreciated.

Ok i figured it out, after a days worth of work and a lot of research.
Some thanks to Bill Welch and his info in this link, http://bvwelch.com/?p=186

Preparing the Bluetooth mate silver.
to program/change settings on the Bluetooth mate silver i used the FTDI basic board http://www.sparkfun.com/products/9716, and connected it up like this

**FTDI ** Mate silver.
Gnd -> Gnd
Vcc -> Vcc
RX -> TX
TX -> RX

You then have to set up the Bluetooth module. You can do it from this tutorial http://www.jhwarren.com/bluetooth-mate/ from the "Setting up Bluetooth" title
Remember the COM port that the pc has assigned to the Bluetooth module. There should be two that show up, but it is the lowest value we want.

To configure the RN-42 (Bluetooth module) you need a serial terminal software, I don’t think you can do it from the Arduino IDE serial window. You can use puTTY but I like to see what I’m typing into the serial screen so i used X -CTU http://www.digi.com/support/kbase/kbaseresultdetl.jsp?kb=125
It is used for Xbees, but you can still use the terminal.
Once its installed and opened, in the “Com Port Setup” box select the port that your FTDI board is on, mines usually one of the lower valued one. Once you have selected what you think it might be, go to the Baud dropdown tab and select 115200. This is the default baud rate for the Bluetooth module. Then select the terminal tab and type the following in the space below, it’s not case sensitive.

Note if the terminal comes up with an error then it is not the right com port or the device is not connected. Or if nothing happens when you type in $$$ then it’s the wrong com port, (or bud rate, but very unlikely if you have never used the BT module before)

Type the following

$$$ // enter command mode, you should see the red light flash more frequently on the BT module
SU,57.6 [-Press enter] // Changes the baud rate to 57600
S~,3 [-press enter] // sets the profile to DMD
--- [-press enter] // ends command mode

Additional commands
D - Display basic settings
SF,1 - factory reset.
For the entire list of commands see the link http://www.sparkfun.com/datasheets/Wireless/Bluetooth/rn-bluetooth-um.pdf

After altering the settings you need to reset the module, so just pull the power then repower it again.

Connecting to a Arduino mini pro
First off, an additional wire needs to be soldered onto the RN 42, pin 33 (remote DTR) see this datasheet for the location of pin 33
http://www.rovingnetworks.com/documents/RN-41.pdf - i know its the RN 41 but basically has the same pin out as the RN 42, look under "Pin description" for the location of pin 33 (4th from the left)

If you are having trouble with Arduino IDE being really slow when your Bluetooth is on, follow this thread http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1237179908/0

The Arduino mini pro needs to be connected to the Bluetooth mate in this configuration

Arduino Bluetooth mate
Gnd/ BLK -> Gnd
Gnd/CTS -> CTS - I
Vcc -> Vcc
RX -> TX
TX -> RX
GRN/DTR -> PIN 33 (remote RTS) – newly soldered wire. I used a 0.1uF cap between these connections because that is what is used when making a bread board Arduino for an auto reset using an FTDI.

Once connected, write your own sketch or use the one provided.

int ledPin = 13;
void setup() {
  Serial. begin(57600) ; 
  pinMode(ledPin, OUTPUT) ; 
}
void loop() {
  // Look for data coming in from the Bluetooth Mate
  if (Serial. available() > 0) {
    char data = Serial. read() ; // Read the character
    Serial. print(data) ;        
    
    // ' 1' turns on the LED, ' 0' turns it off
    if (data == '1' ) {
      digitalWrite(ledPin, HIGH) ;
    } else if (data == '0' ) {
      digitalWrite(ledPin, LOW) ;
    }
  }
  delay(10) ;
}

Make sure the correct board selected in the tools menu and the right COM port is selected, (the one I told you to remember earlier)

Press upload and hopefully success!

UPDATE I think you have to change the rxtxSerial.dll file in the arduino folder with one that can be downloaded from the thread mentioned above http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1237179908/0. I cant really test if the origional rxtxSerial.dll file works in uploading because the IDE becomes way to slow for me to try it (when my laptop's Bluetooth is on).

This is awesome!

I believe I followed your instructions, but it's not working for me. I have the RN-42 set to MDM mode, and I have connected the RST (RTS-0 on the Bluetooth Mate) to a .1uF cap, which is in turn connected to pin 33 on the RN-42.

Do I need to cut the original trace going to RTS-0 on the Bluetooth Mate board? Looking at the spec sheet I thought they were showing the chip upside down, so I actually soldered to pin 32 first, but I realized my mistake and fixed that. Still no love. Both times everything worked exactly as it always had, as if I hadn't done anything.

Thanks in advance for any ideas you may have. I have been wanting to get this to work for as long as I've had a bluetooth chip for my Arduino. :slight_smile:

hmm... the only other thing that i can think of that i did was, i was having trouble with the arduino IDE being really slow when my laptops Bluetooth was on so i followed this thread http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1237179908/0 and changed some of the software. i don't know if it does anything to help program wirelessly, but you can always try. Please let me know if it works or not because someone else emailed me with a similar problem but he hasn't emailed me back to let me know if the problem was solved or not. If it doesn't work then i will retry the tutorial myself with everything new.

great job!

I have a question, it is possible to do the same with btbee? I recently bought a http://garden.seeedstudio.com/Bluetooth_Bee in the forums someone said that is impossible to program atmel because you don't have control over the reset. My question is, there is a pin that connects directly to reset. Is there any chance to send a command to actuate this reset pin by soft? After looking to the diagram I saw that DTR (pin 17 bee socket) is connected directly to PC6 Reset to the atmel.

I'm using a arduino fio with bee socket. I get connected over bt and I changed the default bautrate to 57600 (default bautrate of atmel), I have stablished communication without any problem, my problem is that I would like to programm wireless with btbee.

Thank's for any advice!

umm... its a wild guess but its worth a shot, follow the thread in the post above yours, about changing one of the files in the arduino IDE. I personaly didn't write any IDE software , but i did change a file in the Arduino IDE because mine was running too slow when bluetooth was on. So the file i changed must have done something to make mine work. some people had trouble with a similar problem with the bluetooth mate. i told them to do the same thing but i haven't got any replies.

is there anyone that can help me to use two BlueSMiRF silver modules to make a connection between two arduinos?
thanks

I have been playing around with auto-reset for the Arduino-BT some years ago. For practical reasons auto-reset is not really what I wanted, because always resetting your sketch when you connect via Bluetooth is a pain and you need an option to turn it off.

For the BlueController board I have adapted the Arduino Bootloader and added the following features which are much more practical:

  1. enter the bootloader by calling a function from the currently running sketch
  2. enter the bootloader by pressing a switch on the board together with the reset switch
    In both cases the bootloader remains active for around 30 seconds (can be adjusted)

Normally I use the first variant and only when my sketch is totally screwed up I have to use the local switch as a last resort.

How it works? In your loop() you will normally process commands which arrive from the serial port. Just add one command to switch to the bootloader:

void loop(void)
{
int16_t ch;
while((ch = Serial.read()) >= 0)
{
switch(ch)
{
case 'y':
Serial.println("enter_bootloader()");
enter_bootloader();
break;

case 'x':
Serial.println("soft_reset()");
soft_reset();
break;
}
}
}

Before Downloading a new sketch, you have to open the Serial Monitor and enter "y" to start the bootloader, then press the download button.

The whole project can be found here.

Another project I'm working on is a ISP-programmer based on the BlueController board which speeds up the bluetooth download by factor 10. The programmer needs 7 seconds for the complete download (incl. verify) compared to 70 seconds using the bootloader without the optimization. Unfortunately the code is too large to fit in the bootloader.

Michael

maybe i'm not in the right topic so sorry, but please help me =(
i have two BlueSMiRF silver modules and i should get a bluetooth communication between my 2 arduinos, for example an arduino send a message to the other using bluetooth and after this one send a message to the other one. ok do you understand my project? (maybe my english is not perfect, sorry i'm italian)
i know that i should use TX and RX and the serial communication to control them using an arduino, but now my problem is that i can't understand what i have to do to set a module as master and the other one as slave :~
and how can i associate these modules between them?
thanks in advance!

Hi I have the bluetooch (JY-MCU V1.06), AND HE WANTED THE DATASHHET, and I found this. .. http://www.aliexpress.com/item-img/WHOLESALE-100X-JY-MCU-3-3V-V1-03-BT-BOARDS-Serial-4-pin-Bluetooth-RF-Transceiver/581598394.html
APPARENTLY ALSO HAVE TO RESET PIN, TO
DEBIT STRECK. SAY?, Plugged DIRECT?

I need something more?

ARDUINO BLUETOOCH
TX -----------> RX
RX -----------> TX
GND -----------> GND
VCC -----------> VCC
RST/GNR/RST -----------> RST

Omnimusha,
Thank you very much for the Schematic and the Image.
It helps..

Hi, great turorial! Everything is clear except the MDM mode: I'm using the RN42-XV Bluetooth module to wireless program an Fio board but I can't have the DTR or RTS signals working to drive the Reset pin. I pulled low BT pins UART_CTS, DCD (PIO3), DSR (PIO6) and CTS (PIO7). The only profile that seems to drive remote DTR & RTS is MDM SPP (the Roving networks datasheet states that profiles DUN should also drive them but I can't see that). But with the MDM SPP profile, the device is automatically recognized as a keyboard which prevents use of the terminal or the Arduino IDE. Does anybody have a clue ?

I'm sorry to help dig up an old thread, but I was wondering why my arduino is still getting sync errors. It is not resetting. I soldered 33(DTR) to a .1uf cap, then ran to an UNO's reset pin. Not working
I'm using a bluesmirf which is based on the RN-42

I literally just finished getting mine to work. I had to use Tera Term to open the serial connection over bluetooth. The arduino serial monitor would not do it. I have not yet been able to get into AT mode. I will update if I find a way to be successful.

It was an issue with firmware 6.11, latest firmware 6.15 solves it.