1
\$\begingroup\$

I've recently bought a HC05 Bluetooth module, of which I hoped to use the general purpose input-output pins. The HC05 has loads of them, but I haven't found anywhere a single description on how to use them, except when in AT mode, which, as far as I understand (I may be wrong) can only be used when the device is not bluetooth paired (i.e. it's just wired to the PC).

So, if they can't be queried or changed remotely, what are they for? How else could I broadcast the value of a pin through bluetooth without a whole Arduino?

\$\endgroup\$
5
  • \$\begingroup\$ By taking the KEY pin to Vcc you can enter AT mode at any time. \$\endgroup\$
    – JimmyB
    Commented Jul 1, 2016 at 15:25
  • \$\begingroup\$ "How else could I broadcast the value of a pin through bluetooth" - Not possible with a bare HC-05. You'll need some external controller. \$\endgroup\$
    – JimmyB
    Commented Jul 1, 2016 at 15:27
  • 1
    \$\begingroup\$ Those HM-10 modules seem to be configurable for a "remote control mode" which looks like what you want. \$\endgroup\$
    – JimmyB
    Commented Jul 1, 2016 at 15:32
  • \$\begingroup\$ Damn, I bought the wrong ones, it seems... \$\endgroup\$
    – Martino
    Commented Jul 1, 2016 at 16:35
  • \$\begingroup\$ @JimmyB maybe, but I can't use AT commands for reading and writing gpio via bluetooth right? So those gpio seem pretty useless to me... \$\endgroup\$
    – Martino
    Commented Jul 1, 2016 at 16:36

2 Answers 2

3
\$\begingroup\$

The HC-05 is a poorly documented module with firmware designed to just be a bluetooth to ttl serial uart interface, to be seamlessly dropped in. The extra features of the radio chip are ignored with the default firmwares. You could try writing a firmware from scratch, as I have not seen the code for the existing firmware available.

the other options is to use any number of bare microcontroller as a middleman. A whole Arduino uno is costly and wasteful, but you could use a 1 dollar msp430 or attiny or atmega, program it and use that.

Otherwise look for a module that offers gpio access over bluetooth.

\$\endgroup\$
2
  • \$\begingroup\$ Thanks. @JimmyB suggests HM10 could be the module that allows gpio control. Can you confirm? \$\endgroup\$
    – Martino
    Commented Jul 3, 2016 at 14:34
  • \$\begingroup\$ With at mode 2 I think. \$\endgroup\$
    – Passerby
    Commented Jul 3, 2016 at 15:04
4
\$\begingroup\$

Remember that the BT module is essentially just a radio with protocol. It needs to be connected to something to be of any use. A module with power attached sitting by itself will really do nothing.

On to the bigger question. Let's assume you're connected to an Arduino or some other MCU. You can send it AT commands all day long as long as the KEY pin is held high. In whatever software you write to use the BT as a radio link, include a command that, when received and processed, will send the MCU off to a function that will toggle an output pin connected to KEY. The only reason you would need to be physically next to the module and pull KEY high on power-up would be to put it at a 'factory default' baud rate 38400. If you allow in your software complete access to all AT commands, it is possible that you can change the baud rate remotely so that it no longer communicates with the MPU. At this time a physical reset is necessary. Better if you program a parser for the BT module so you can filter which commands are okay.

I use an HC05 for my remote relays and a simple Bluetooth Terminal app on my Samsung to send command line instructions to switch relays on and off or to change the alarm times. With the Arduino I use Softwareserial at what ever buad rate I choose. These are hard coded in the Arduino and cannot be changed.

Good luck. I hope I've given you something to think about.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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