Go Down

Topic: Upload program to Mega via BT using HC-05 (Read 1 time) previous topic - next topic



Just ran a couple of tests using SoftwareSerial on pins 10/11 on the Mega, and couldn't get remote upload to work at all.  So now I'm wondering about the tutorials where 'it just happens' using SoftwareSerial.  Maybe they missed the step where they moved the HC-05 connection from the SoftwareSerial pins to the Tx/Rx0 pins?  There wasn't any mention of a custom bootloader either.

Just sayin ;=)




In an effort to help others who are interested in using the HC-05 for remote program upload to an Arduino-compatible microcontroller, and maybe save them from some of the frustration I experienced, I created what I hope is a comprehensive tutorial on my blog site (link).  I would very much appreciate comments, especially if you see something that I got wrong or missed.

Special thanks to dmjlambert for all your help; you didn't provide the 'magic sauce', but you helped me eliminate everything else! ;-).




Here is a fun fact you don't need.   You can program the HC-05 using the UNO or Mega RX and TX pins with the blink sketch loaded on the Arduino.   The MCU on the Arduino won't be doing anything with the RX and TX pins with the blink sketch running, so you can just hook up TX on Arduino to TX on HC-05, and RX on Arduino to RX on HC-05.  And of course GND to GND and 5V to VCC.  Scenario 1 diagram in post #6 earlier in the thread.  Your HC-05 will be communicating with the USB-to-serial chip, and the computer.    Program the HC-05 using the serial monitor set to 38400 baud.   After the HC-05 is programmed and you are ready to use the HC-05 with Arduino sketches or for upload, swap the wiring to connect RX on Arduino to TX on HC-05, and TX on Arduino to RX on HC-05.    Scenario 2 diagram in post #6 earlier in the thread.

The magic sauce was me trying to get to you to upload a program on the Arduino that communicates back and forth over the USB, then, without changing the sketch, go ahead and connect the HC-05 and communicate with the sketch.   That would have required you to use RX0/TX0.     You said you were using Scenario 2 hookup, but you were not, because you were not connected to the same RX/TX wires that go between the USB-to-serial chip and the ATmega2560.   RX/TX on the ATmega16u2 or CH340G is connected to TX0/RX0 on the ATmega2560, the path that the bootloader uses.   That's ok, we all learn this stuff in different ways, and you found the best way (your way). 

Go Up