Go Down

Topic: Arduino 1.6.9 Bluetooth Programming (Read 1 time) previous topic - next topic

codedsteele

Hi,

Is it still possible to use Bluetooth Programming in version 1.6.9 of the Arduino IDE? I am trying to use the HC-05 following instructions according to this tutorial http://makezine.com/projects/diy-arduino-bluetooth-programming-shield/ 

codedsteele

I am seeing the board reset, and sometimes the code appears to upload to the board. I am using a 14.7K (series 10K+4.7K) ohm impedance to ground and have a 77nF capacitor as measured with my meter. Does it need to be closer to 100nF or is this close enough?

DrAzzy

#2
Aug 01, 2016, 08:44 am Last Edit: Aug 01, 2016, 08:44 am by DrAzzy
I'm surprised it ever worked reliably (I suspect it never did) - their reset circuit is mondo bogus.
ATTinyCore for x4/x5/x61/x7/x8/x41/1634/828/x313 megaTinyCore for the megaavr ATtinies - Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts, mosfets, awesome prototyping board in my store http://tindie.com/stores/DrAzzy

codedsteele

So then it is hopeless to use the HC-05 for Bluetooth Programming?

dmjlambert

You need a 0.1uF capacitor.   What Arduino are you connecting the HC-05 to? 

codedsteele

A 100nF Cap is a 0.1uF Cap. Pin 32 is connected to Cap than connected to reset of the Arduino Uno. 15K resistance is in parallel with 100nF Cap.

dmjlambert

#6
Aug 02, 2016, 06:25 am Last Edit: Aug 02, 2016, 06:36 am by dmjlambert Reason: corrected schematic
15K resistor goes from the reset of the Uno to ground, not parallel with the cap.   This is to hold the reset signal barely in the tolerance for high signal, so the cap can toggle it low.  It forms a voltage divider with the 10K pull up resistor that is already on the Uno.  You can omit the 15K resistor if you cut the reset-en trace on the Uno, which temporarily removes the other 0.1uF capacitor that is connected from the ATmega16U2 or CH340G DTR.  When you have 2 capacitors connected to 2 serial devices (the one built into the Uno and the HC-05) connected at the same time, they interfere with each other.    I don't really know what some of those resistors are intended for in the Make article.   This is my schematic.



This is assuming you got through the programming of the HC-05 successfully.   As in the Make article, you connect the HC-05 differently while you are doing the one-time programming of it to set the baud rate and the state pin behavior with the polar command.  



codedsteele

I meant to say I had it connected to ground. From what I see there isn't anything I am doing differently than you with the exception of the voltage divider/level shifter you use. I'm stumped.  :smiley-confuse:

dmjlambert

You will need to do troubleshooting, and break down the problem into parts.

Part 1 - check that your Uno is working fine and uploads new sketches via the USB port.  Check that at beginning of upload the pin 13 LED (L LED) blinks.   That means the bootloader is working.   The pin 13 LED should also blink when you open Serial Monitor.  If the Uno does not work normally with USB, fix the Uno before proceeding.

Part 2 - you can check if it is reliably doing the auto reset with the bluetooth module connected if you select the bluetooth device port in the IDE and then open the serial monitor.   Every time you open the serial monitor, the Uno should reset.  You will observe it resets by the blinks the pin 13 LED gives you upon reset.  If it resets fine every time, stop looking at the auto reset part of the circuit.   If it does not auto reset reliably, double check that you have programmed the HC-05 properly with the AT+POLAR=1,0 command as described in the Make article.  Check with a multimeter that when Serial Monitor is open on the Bluetooth port, you get 0 volts on the State pin and when Serial Monitor is closed you get 3.3V.  If behavior of the State pin is OK, cut the RESET-EN trace on the Uno and just use the 0.1uF cap between the state pin of the HC-05 and the RESET pin of the Uno.  Re-test.  You can always put a solder blob across the RESET-EN trace to re-enable USB port auto reset in the future, if you like.  

Part 3 - Double check that you have done the AT+UART=115200,0,0 command to program the HC-05.   The Uno accepts uploads at 115200 baud, that is the rate of the Optiboot bootloader.   Load a sketch on the Uno using the USB cable, and make it a sketch that accepts some input from Serial Monitor and does something, such as repeat the characters back out to the Serial Monitor.  The sketch should start the serial port at 115200 baud rate, i.e. Serial.begin(115200);    Check that this works when you have the USB cable connected and the port of the USB selected in Serial Monitor, and select the 115200 baud rate in Serial Monitor.   If everything is ok, switch to the Bluetooth module connected as shown in my schematic, and repeat the test with the Bluetooth port selected.   It should work properly at the 115200 baud rate.  

Part 4 - If still not working make sure the HC-05 module is in good condition and the markings on the board for RX and TX are not reversed or in some other way messed up, and that the board has a 3.3V voltage regulator on it like the board shown in the Make article.  

Part 5 - You should be supplying 5V to the module on the 5V supply pin, and when you connect the Uno's TX pin to the Bluetooth module's RX pin, use a voltage divider like I have shown, because the Uno outputs 5V on the TX pin and the Bluetooth module RX pin is not 5V tolerant, it needs 3.3V.   The Bluetooth module outputs 3.3V on its TX pin, and that is usually high enough to be read by the Uno's RX pin.   I have seen cases where it is not enough, and you may need to make the wire going to the Uno's RX pin very short, and use a nice thick wire such as a 22 gauge wire, or run double wires, or ideally use a bi-directional logic level converter, which is a cheap module that has some transistors on it to convert between 5V and 3.3V logic levels.   They are available at Sparkfun's website (with good tutorials) and knock-offs are on eBay.   You may also try cutting the RX and TX traces that go between the USB chip on the Uno and the ATmega328P, or switch to trying Bluetooth programming of a Pro Mini, which does not have the USB port built-in and therefore won't interfere with your Bluetooth programming.   http://www.instructables.com/id/Bluetooth-Serial-Adapter-for-Pro-Mini/

Part 6 - Use a multimeter to make sure the board is receiving good voltage, 3.3V on pin 12 of the postage stamp shaped board.   Make sure you have connected grounds in all places that require ground.  Actually, that advice should probably be the first thing to check.   Usually when something unexplainable or bizarre is happening, and you just can't get something to work, it's failure to connect grounds that causes problems for people in Arduinoland (and in other electronic wonderlands).  And finally, order a different HC-05 module, there are several different ones available, and they are very inexpensive, so don't drive yourself crazy trying to get a $3 or $4 board going, it could be you have a bad one.   I recommend ordering one with a 6-pin header, and with the onboard 3.3V regulator and button between the postage stamp shaped board and the header pins, and with the State pin available on the header.  

Note:
Most HC-05 modules have a State pin broken out to the 6-pin headers.  If yours doesn't, the pin 32 of the postage-stamp-shaped board on the module is the State signal.   The Make article shows soldering a flying lead to pin 32 because they bought a module that does not have the State pin broken out.  

Damn, that was a long-winded post.  I don't guarantee all of it, apparently I just went on and on and on, probably put you to sleep.   Whew.   

Go Up