7

I followed a tutorial on how to setup arduino and bluetooth so it can be programmed without usb cables. I didn't use capacitors or resistors asthere doesn't seem to be a need for them. I have the serial output appearing on arduino serial console via bluetooth (no usb cable connected). Since the is a working connection that means it is working to a point. However when trying to upload I get "avrdude: stk500_getsync(): not in sync: resp=0x4c" error.

I didn't connect pin 32 of hc-05 to arduino reset pin yet, could that be the issue? I don't actually need arduino to be reset since I can just kill the power to it manually at least for now. I also used 9600 as baud rate instead of 115200 as in the tutorial, because my arduino code used 9600 but maybe I misunderstood this and it actually needs to be 115200 regardless or my baud rate in arduino code?

What else could be the cause?

Edit 1:

From the answer by @sachleen I changed the baud rate as per the tutorial and soldered pin 32 of the hc-05 module to rst pin of arduino.

After baud rate change opening arduino serial console no longer outputs anything. Why did this happen? I was getting serial output before when baud rate of hc-05 was 9600.

After soldering the rst pin arduino also seems to reset after serial console is opened. I did not add the capacitor, is it required and if so why? I also excluded resistors since it seems they are only for voltage reduction from 5v to 3V (my arduino is 3.3V version).

  • have you fixed it? – emj365 Apr 7 '15 at 11:13
  • @emj365 I have but unfortunately it was so long ago I just don't remember. I should have added the answer before I forgot but I forgot to do that too :) Will add the answer if I come across this issue again. I do remember it was a simple issue. – DominicM Apr 7 '15 at 21:28
  • @emj365 Still don't remember for sure. What Arduino model are you using and what baudrate? – DominicM Apr 10 '15 at 11:33
  • Thanks for tried. I used a fake Uno and changed ESP8266(new and very cheap) baud rate to 115200. – emj365 Apr 10 '15 at 17:01
  • @emj365 Well, I used a Bluetooth module so it may be a different issue but then again it may be the exact same issue. Try 57600 baudrate as that's what I have in my old Arduino sketch. Also what is the baudrate for the ESP8266 module? – DominicM Apr 11 '15 at 11:44
3

I wrote the tutorial you were following so maybe I can help. When I was building the circuit initially I used some of the other tutorials out there on Arduino Bluetooth programming which don't have a lot of the extra resistors and capacitor. However, I couldn't get any of those to work reliably. Using a circuit simulator and some trial and error, I ended up with the circuit shown in the tutorial which worked for me.

While there "doesn't seem to be a need for" some of the extra passives, if your circuit doesn't work without them, perhaps there is a need for them after all? ;-) Now, I have heard from other people that they were able to leave out certain bits so it seems that there is some variability in the hardware. But we're talking four passives to ensure reliable operation, so why leave them out?

Anyway, a couple of points:

  1. Pin 32 on the HC-05 becomes active upon Bluetooth connection. We configure the pin to be active low so we can use it to auto-reset the Arduino upon serial connection to emulate what happens with the normal USB connection. You can leave out the connection to pin 32 only if you want to have to manually reset the Arduino to program it.

  2. The 115200 baud rate is the rate for programming the Arduino and is set by the Arduino bootloader. It is possible to re-flash the bootloader with a different configuration if you needed to for some reason.

    So, the programming baud rate is fixed in the bootloader, but the communication baud rate is configurable in software using Serial.begin(). However, the HC-05's baud rate has to be the same as the Arduino's, so you need to stick with the same baud rate for both programming and communication (115200 by default).

  3. There are two resistors involved with the reset, R3 and R2. I believe R2 is only necessary for 5V Arduinos to act as a voltage divider with R3. However, R3 should be included for any voltage Arduino. See this Atmel design note - "The reset line has an internal pull-up resistor, but if the environment is noisy it can be insufficient and reset can therefore occur sporadically ... This pull-up resistor makes sure that reset does not go low unintended." R3 should be 4.7k or greater; most designs stick with 10k.

  4. The capacitor C1 is necessary because Pin 32 stays low the entire time Bluetooth is connected. If you connect RST to Pin 32 directly, the Arduino will just stay reset until the Bluetooth connection drops and nothing will work just as if you held down the reset button and never let go.

    With C1 in place, when Pin 32 goes low it will momentarily discharge C1, pulling RST low and resetting the Arduino. C1 will immediately begin charging through R3 back up to VCC which will restore RST to high, bringing the Arduino out of reset. The values of R3 and C1 affect the timing of the reset and must be chosen appropriately.

  5. Don't forget R1. I can't remember the reason it is helpful, but it has something to do with the Arduino/Atmel UART. I found the recommendation for adding it one day on an Atmel discussion board and it has solved a non-working circuit for me many times.

Hope that helps!

  • Thanks for taking your time to explain though I don't understand why at least some of this info wasn't in the original tutorial. There was barely any text there at all :) You are also wrong on some points and far too vague on others. First of all 115200 baud rate is one reason why it didn't work for me. Arduino Pro Micro uses 57600 baud rate. I also did not need to use any resistors and I used a 450 nf capacitor and probably almost any value would have worked. R1 and R3 may be useful but I never had issues without them. – DominicM May 30 '14 at 16:11
  • There's also a serious limitation that was not mentioned with the tutorial as it will reset when pairing or opening serial console. There is a way to fix this and I will share it when I get it to work properly. – DominicM May 30 '14 at 16:11
1

Both of those things will cause issues.

It needs to reset when its downloading a new sketch. You can manually reset it at just the right moment, but if you don't get the timing right, you'll get that issue.

The baud rate you set in your code for serial communication becomes irrelevant when you're loading a new sketch as that's set in the bootloader. Keep it at 115200 like the tutorial suggests.

  • Ok, I changed the baud rate but now I am not getting any output from serial console at all. Why? Will try to solder the pin to the module now. – DominicM May 21 '14 at 19:35
  • I connected the arduino reset pin to pin 32 of hc-05 module but still unable to program it. It also seems to reset or seizes executing code for a while when serial console is opened but still no output. I did connect the rst pin directly, I am not sure what to make of the diagram showing capacitor and resistors relating to rst pin. My arduino is the 3.3V version so I dont need a voltage divider. – DominicM May 21 '14 at 19:58
1

Have you got the TX from the Bluetooth module linked to the RX pin of the Arduino?

If you have you need to unhook it whilst uploading. A better solution is not to use the TX RX pins of the Arduino and use serial software instead.

Here's a simple tut but it spreads over a few pages:

http://ianlangelectronic.webeden.co.uk/#/arduino-bluetooth/4583456314

A Bluetooth baud rate bigger than 9600 is not recommended. The Arduino struggles to keep up if it's much faster than this.

  • Whilst you link may answer the question, it would be preferable to include the essential parts of the linked here, and provide the link for citation. Can you please edit your answer? Thanks! – Anonymous Penguin May 26 '14 at 18:04
  • I am using rx/tx, yes. Why would this cause problems exactly? I changed baud rate to 57600 of the bt module and was able to program OTA. It has to be specific baud rate as each arduino has it's own baud rate requirement for programming. Will try your link later. – DominicM May 26 '14 at 18:39
  • The tutorial you linked to will only allow serial communication, but not for the Arduino to be programmed, via Bluetooth. 9600 baud is a good recommendation for a safe upper limit when using SoftwareSerial but doesn't apply when using the UART. – imjosh May 29 '14 at 16:16
1

The baud rate depends on model of arduino you are using. For Pro-Micro; Pro-Mini and Nano that I use I had to change to 57600 baud as that is what the dll (downlineloader) avrdude forces this baud rate:

avrdude: Version 5.11, compiled on Sep  2 2011 at 19:38:36
     Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
     Copyright (c) 2007-2009 Joerg Wunsch

     System wide configuration file is "C:\Program Files (x86)\Arduino\hardware/tools/avr/etc/avrdude.conf"

     Using Port                    : \\.\COM40
     Using Programmer              : arduino
     Overriding Baud Rate          : 57600

For Mega the overriding Baud Rate is 115200.

0

The easiest way to program your arduino via bluetooth (HC-05) is the following steps

1: change the baud rate of the bluetooth module to 57600 using software seriel, and that is all you need to do with your bluetooth, and when you use the software seriel sketch you do not need a ftdi converter, this is how you do it ( https://www.youtube.com/watch?v=zoJUAjW3vQ0 )

2: next step is to make a very simple and small circuit for the reset pin of your bluetooth module like the one in this youtube link ( the circuit I am talking about is a circuit made of a NPN transistor, a 0,01 capacitor and a 10 k resistor. the circuit is like a signal inverter or something. (https://www.youtube.com/watch?v=xXUKfTNHkKE). you will find the circuit in the middle of the video.

I have done it and it works,

thanks for reading Arman

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.