# HC-05 bluetooth module

**URL:** <https://forum.arduino.cc/t/hc-05-bluetooth-module/1269236>\
**Category:** Programming\
**Created:** [June 7, 2024, 3:50pm UTC](https://forum.arduino.cc/t/hc-05-bluetooth-module/1269236 "2024-06-07T15:50:12Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![asskob06](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/asskob06/32/1064779_2.png) [@asskob06](https://forum.arduino.cc/u/asskob06)\
**Post date:** [June 7, 2024, 3:50pm UTC](https://forum.arduino.cc/t/hc-05-bluetooth-module/1269236/1 "2024-06-07T15:50:12Z")

</div>

hello everyone,  
for a project i am using a HC-05 module but it does not receive any data when i send data by apps like arduino bluetooth control. when i use remote xy it does receive data and switches a relay, but when it has to switch multiple relays at one time it open all of them when i need for example only 3 to switch. someone who knows what the problem could be?? thank you to the one who can really help me.

```arduino
/*
   -- gip bluetooth --
   
   This source code of graphical user interface 
   has been generated automatically by RemoteXY editor.
   To compile this code using RemoteXY library 3.1.13 or later version 
   download by link http://remotexy.com/en/library/
   To connect using RemoteXY mobile app by link http://remotexy.com/en/download/                   
     - for ANDROID 4.13.13 or later version;
     - for iOS 1.10.3 or later version;
    
   This source code is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2.1 of the License, or (at your option) any later version.    
*/

//////////////////////////////////////////////
// RemoteXY include library //
//////////////////////////////////////////////

// you can enable debug logging to Serial at 115200
//#define REMOTEXY__DEBUGLOG    

// RemoteXY select connection mode and include library 
#define REMOTEXY_MODE__SOFTSERIAL

#include <SoftwareSerial.h>

// RemoteXY connection settings 
#define REMOTEXY_SERIAL_RX 2
#define REMOTEXY_SERIAL_TX 3
#define REMOTEXY_SERIAL_SPEED 9600

#include <RemoteXY.h>

// RemoteXY GUI configuration  
#pragma pack(push, 1)  
uint8_t RemoteXY_CONF[] = // 138 bytes
  { 255,7,0,0,0,131,0,17,0,0,0,31,1,106,200,1,1,7,0,2,
  3,8,44,22,0,2,26,16,16,79,78,0,79,70,70,0,2,56,9,44,
  22,0,2,26,31,31,79,78,0,79,70,70,0,2,5,45,44,22,0,2,
  26,31,31,79,78,0,79,70,70,0,2,56,46,44,22,0,2,26,31,31,
  79,78,0,79,70,70,0,2,6,84,44,22,0,2,26,31,31,79,78,0,
  79,70,70,0,2,57,84,44,22,0,2,26,31,31,79,78,0,79,70,70,
  0,2,30,124,44,22,0,2,26,31,31,79,78,0,79,70,70,0 };
  
// this structure defines all the variables and events of your control interface 
struct {

    // input variables
  uint8_t switch_01; // =1 if switch ON and =0 if OFF
  uint8_t switch_02; // =1 if switch ON and =0 if OFF
  uint8_t switch_03; // =1 if switch ON and =0 if OFF
  uint8_t switch_04; // =1 if switch ON and =0 if OFF
  uint8_t switch_05; // =1 if switch ON and =0 if OFF
  uint8_t switch_06; // =1 if switch ON and =0 if OFF
  uint8_t switch_07; // =1 if switch ON and =0 if OFF

    // other variable
  uint8_t connect_flag; // =1 if wire connected, else =0

} RemoteXY;   
#pragma pack(pop)
 
/////////////////////////////////////////////
// END RemoteXY include //
/////////////////////////////////////////////

#define PIN_SWITCH_01 4
#define PIN_SWITCH_02 5
#define PIN_SWITCH_03 6
#define PIN_SWITCH_04 7
#define PIN_SWITCH_05 8
#define PIN_SWITCH_06 9
#define PIN_SWITCH_07 10

void setup() 
{
  RemoteXY_Init (); 
  
  pinMode (PIN_SWITCH_01, OUTPUT);
  pinMode (PIN_SWITCH_02, OUTPUT);
  pinMode (PIN_SWITCH_03, OUTPUT);
  pinMode (PIN_SWITCH_04, OUTPUT);
  pinMode (PIN_SWITCH_05, OUTPUT);
  pinMode (PIN_SWITCH_06, OUTPUT);
  pinMode (PIN_SWITCH_07, OUTPUT);
  
  // TODO you setup code
  
}

void loop() 
{ 
  RemoteXY_Handler ();
  
  digitalWrite(PIN_SWITCH_01, (RemoteXY.switch_01==0)?LOW:HIGH);
  digitalWrite(PIN_SWITCH_02, (RemoteXY.switch_02==0)?LOW:HIGH);
  digitalWrite(PIN_SWITCH_03, (RemoteXY.switch_03==0)?LOW:HIGH);
  digitalWrite(PIN_SWITCH_04, (RemoteXY.switch_04==0)?LOW:HIGH);
  digitalWrite(PIN_SWITCH_05, (RemoteXY.switch_05==0)?LOW:HIGH);
  digitalWrite(PIN_SWITCH_06, (RemoteXY.switch_06==0)?LOW:HIGH);
  digitalWrite(PIN_SWITCH_07, (RemoteXY.switch_07==0)?LOW:HIGH);
  
  // TODO you loop code
  // use the RemoteXY structure for data transfer
  // do not call delay(), use instead RemoteXY_delay() 

}

```

---

<div class="post-metadata">

**Author:** ![StefanL38](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/stefanl38/32/713548_2.png) [@StefanL38](https://forum.arduino.cc/u/StefanL38)\
**Post date:** [June 7, 2024, 8:00pm UTC](https://forum.arduino.cc/t/hc-05-bluetooth-module/1269236/2 "2024-06-07T20:00:25Z")

</div>

If somebody shall be able to help you have to provide more information

How does the smartphone interface look like?  
post a screenshot

From just looking at the code I would say  
whenever you press a button the related OUTPUT switches LOW:HIGH  
and only that one particular output that is connected to that oneparticular button that you tap on in the remoteXY-interface is switched LOW:HIGH

You will have to describe in much more details  
like this:

If I tap on button 4 in my remoteXY-user-interface on the smartphone  
the following OUTPOUTs change state from ...... to state .......

When using hardware like multiple relays this could be a hardware-problem  
how do you power the relays?  
did you connect ground of what exact type of microcontroller to ground of the relays?  
Is this a relay-board or simgular relays?  
post a datasheet of the relay-board?

---

<div class="post-metadata">

**Author:** ![asskob06](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/asskob06/32/1064779_2.png) [@asskob06](https://forum.arduino.cc/u/asskob06)\
**Post date:** [June 8, 2024, 9:02am UTC](https://forum.arduino.cc/t/hc-05-bluetooth-module/1269236/3 "2024-06-08T09:02:59Z")

</div>

in the schematics i use a wemos but as for now it is an Uno R3 with HC-05 module.  
pin 0 = not in use  
pin 1 = not in use  
pin 2 = rx pin HC-05  
pin 3 = tx pin HC-05  
pin 4 = relay 1  
pin 5 = relay 2  
pin 6 = relay 3  
pin 7 = relay 4  
pin 8 = relay 5  
pin 9 = relay 6  
pin 10 = relay 7  
pin 11 = relay 8  
pin 12 = relay 9

the sensor's in the schematics are not in use but will be later at the analog pins

[gip\_schema\_kobeasselberghs\_2023\_2024.pdf](https://forum.arduino.cc/uploads/short-url/db5fUsJ6ve8ckRUIED9ghKOvoys.pdf) (136,9 KB)

 ![Schermopname (37)](https://europe1.discourse-cdn.com/arduino/original/4X/b/0/e/b0e058716ef5b5f70d974f1f06b3d80affcf505d.png)

---

<div class="post-metadata">

**Author:** ![asskob06](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/asskob06/32/1064779_2.png) [@asskob06](https://forum.arduino.cc/u/asskob06)\
**Post date:** [June 8, 2024, 9:03am UTC](https://forum.arduino.cc/t/hc-05-bluetooth-module/1269236/4 "2024-06-08T09:03:28Z")

</div>

posted e-plan scematics and the interface of the app

---

<div class="post-metadata">

**Author:** ![asskob06](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/asskob06/32/1064779_2.png) [@asskob06](https://forum.arduino.cc/u/asskob06)\
**Post date:** [June 8, 2024, 9:56am UTC](https://forum.arduino.cc/t/hc-05-bluetooth-module/1269236/5 "2024-06-08T09:56:22Z")

</div>

> [@StefanL38](#):
>
> From just looking at the code I would say  
> whenever you press a button the related OUTPUT switches LOW:HIGH  
> and only that one particular output that is connected to that oneparticular button that you tap on in the remoteXY-interface is switched LOW:HIGH
> 
> You will have to describe in much more details  
> like this:
> 
> If I tap on button 4 in my remoteXY-user-interface on the smartphone  
> the following OUTPOUTs change state from ...... to state .......

could you maybe make a small example??

---

<div class="post-metadata">

**Author:** ![StefanL38](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/stefanl38/32/713548_2.png) [@StefanL38](https://forum.arduino.cc/u/StefanL38)\
**Post date:** [June 9, 2024, 11:51am UTC](https://forum.arduino.cc/t/hc-05-bluetooth-module/1269236/7 "2024-06-09T11:51:29Z")

</div>

> [@asskob06](#):
>
> could you maybe make a small example??

You seem to have not understand what I was asking **you**.

I am asking **you** that **you** shall describe what behaviour of **your** current code do **you** observe.

I have numbered the slide-switches on the screenshot of your remoteXY-App

 ![image](https://europe1.discourse-cdn.com/arduino/original/4X/3/b/2/3b22e05db8278aabc0c4df59c505fac6a7d159de.png)

Assuming App-slide-switch 1 changes relay 1  
Assuming App-slide-switch 2 changes relay 2  
...  
Assuming App-slide-switch 7 changes relay 7

This means user @asskob06 posts an answer similar to this

> [@asskob06](#):
>
> small example

Situation at powering up my Arduino-Uno R3 with bluetooth-module  
all relays are switched ON

If I change the slide-switch 1 from on-position to off-position

I observe this behaviour of the relays:

relay 1.....  
relay2....  
etc.

---

<div class="post-metadata">

**Author:** ![asskob06](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/asskob06/32/1064779_2.png) [@asskob06](https://forum.arduino.cc/u/asskob06)\
**Post date:** [June 9, 2024, 12:40pm UTC](https://forum.arduino.cc/t/hc-05-bluetooth-module/1269236/8 "2024-06-09T12:40:55Z")

</div>

yeah this is how it works

---

<div class="post-metadata">

**Author:** ![StefanL38](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/stefanl38/32/713548_2.png) [@StefanL38](https://forum.arduino.cc/u/StefanL38)\
**Post date:** [June 9, 2024, 12:42pm UTC](https://forum.arduino.cc/t/hc-05-bluetooth-module/1269236/9 "2024-06-09T12:42:24Z")

</div>

> [@asskob06](#):
>
> yeah this is how it works

So does this mean the problem is solved?

---

<div class="post-metadata">

**Author:** ![asskob06](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/asskob06/32/1064779_2.png) [@asskob06](https://forum.arduino.cc/u/asskob06)\
**Post date:** [June 9, 2024, 12:49pm UTC](https://forum.arduino.cc/t/hc-05-bluetooth-module/1269236/10 "2024-06-09T12:49:38Z")

</div>

no because when i use 1 slide button 1 relay switches but when i use 2 slide button's all the relay's switch

---

<div class="post-metadata">

**Author:** ![StefanL38](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/stefanl38/32/713548_2.png) [@StefanL38](https://forum.arduino.cc/u/StefanL38)\
**Post date:** [June 9, 2024, 12:58pm UTC](https://forum.arduino.cc/t/hc-05-bluetooth-module/1269236/11 "2024-06-09T12:58:59Z")

</div>

You seem to think the arduino-Forum is similar to WhatsApp or SnapChat.  
Well if yiou want to take 100 posts until your problem is solved go on with such short postings.

If you want the problem solved within less than 10 posts  
write down a very detailed posting that describes very detailed what you observe

I insist on this detailed description.

a last example:  
I use this code

```arduino
your real actual code that does compile

```

On powerup of the arduino Uno R3 with HC05-bluetooh module connected  
all relays are switched ............

If I move slideswitch 2 from ....-position to .......-position  
relay1 does.........  
relay2 does.........  
relay3 does .........  
relay4 does .........  
relay5 does .........  
relay6 does .........  
relay7 does .........

If you think your hands will ache to much after writing so many letters  
wait for somebody else to answer

---

<div class="post-metadata">

**Author:** ![asskob06](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/asskob06/32/1064779_2.png) [@asskob06](https://forum.arduino.cc/u/asskob06)\
**Post date:** [June 9, 2024, 1:05pm UTC](https://forum.arduino.cc/t/hc-05-bluetooth-module/1269236/12 "2024-06-09T13:05:08Z")

</div>

sorry i am just new to this, i'll do my best to provide you with the info you need but i also don't really know anything about using the bluetooth module, i just want it so that when i switch button 1 relay 1 goes on and not all the relay's at the same time.

> [@StefanL38](#):
>
> `your real actual code that does compile`

this code does compile but it does not what i ask from it, i just want an answer from someone who can friendly and easy explain to me what can be wrong. or someone who can give me and example of an app that does what i ask from it

---

<div class="post-metadata">

**Author:** ![anon85221860](https://avatars.discourse-cdn.com/v4/letter/a/59ef9b/32.png) [@anon85221860](https://forum.arduino.cc/u/anon85221860)\
**Post date:** [June 9, 2024, 1:36pm UTC](https://forum.arduino.cc/t/hc-05-bluetooth-module/1269236/13 "2024-06-09T13:36:09Z")

</div>

The trouble with some libraries (_e.g._ RemoteXY.h) can be trying to find someone who knows such a thing well enough to be able to have a conversation about it.

There are BT serial terminal apps that present simple buttons that can result a text stream (that the user determines).

---

<div class="post-metadata">

**Author:** ![asskob06](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/asskob06/32/1064779_2.png) [@asskob06](https://forum.arduino.cc/u/asskob06)\
**Post date:** [June 9, 2024, 1:38pm UTC](https://forum.arduino.cc/t/hc-05-bluetooth-module/1269236/14 "2024-06-09T13:38:05Z")

</div>

example of some apps?? i have already tried using apps like arduino bluetooth controller but that just does nothing at all

---

<div class="post-metadata">

**Author:** ![anon85221860](https://avatars.discourse-cdn.com/v4/letter/a/59ef9b/32.png) [@anon85221860](https://forum.arduino.cc/u/anon85221860)\
**Post date:** [June 9, 2024, 1:43pm UTC](https://forum.arduino.cc/t/hc-05-bluetooth-module/1269236/15 "2024-06-09T13:43:24Z")

</div>

Look for the bluetooth serial terminal by Kai Morich.  
It's not going to work with your RemoteXY.h sketch.  
For example, you'd set up a button on it to send "R1o".  
Your Arduino would take that in and decode it as _relay No.1 off_.  
("R2O" → _relay No.2 on_)  
("R1O" → _relay No.1 on_)

Taking this approach will involve good knowledge of C-strings or Arduino Strings.

---

<div class="post-metadata">

**Author:** ![StefanL38](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/stefanl38/32/713548_2.png) [@StefanL38](https://forum.arduino.cc/u/StefanL38)\
**Post date:** [June 9, 2024, 2:11pm UTC](https://forum.arduino.cc/t/hc-05-bluetooth-module/1269236/16 "2024-06-09T14:11:15Z")

</div>

> [@runaway\_pancake](#):
>
> Look for the bluetooth serial terminal by Kai Morich.

> **[bluetooth serial terminal - Android Apps on Google Play](https://play.google.com/store/search?q=bluetooth%20serial%20terminal&c=apps&hl=en)**
>
> Enjoy millions of the latest Android apps, games, music, movies, TV, books, magazines & more. Anytime, anywhere, across your devices.

You can configure the buttons of this bluetooth-app to send character-sequences.  
Like @runaway\_pancake suggested.

The advantage of this approach is that almost all users will be able to help you because receiving serial character-sequences is a standard-thing that is done all the time.  
remoteXY is one of a dozen smartphone-apps only a few users know well.

You haven't described what you want to switch on/off in the end.  
Depending on factors like

- switch with a single or multiple devices (multiple smartphones / tablets)
- local WiFi is present where you want to switch the relays
- distance between sender and receiver

it might well be that a different technolgy is much better suited

---

<div class="post-metadata">

**Author:** ![asskob06](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/asskob06/32/1064779_2.png) [@asskob06](https://forum.arduino.cc/u/asskob06)\
**Post date:** [June 9, 2024, 5:44pm UTC](https://forum.arduino.cc/t/hc-05-bluetooth-module/1269236/17 "2024-06-09T17:44:52Z")

</div>

> [@StefanL38](#):
>
> You haven't described what you want to switch on/off in the end.  
> Depending on factors like
> 
> - switch with a single or multiple devices (multiple smartphones / tablets)
> - local WiFi is present where you want to switch the relays
> - distance between sender and receiver

I want to use valve's for water distrubution. The valve's will be controlled by the NO contact of the relay, there is only one valve wich has a motor to let it go left or right. Works by HC-05 module but it has to work in a little bit of time on wifi at home. They will be used by only 1 device at a time. There will be a wifi amplifier placed next to the whole project. Then i should be able to manage it from wherever i am.

---

<div class="post-metadata">

**Author:** ![anon85221860](https://avatars.discourse-cdn.com/v4/letter/a/59ef9b/32.png) [@anon85221860](https://forum.arduino.cc/u/anon85221860)\
**Post date:** [June 9, 2024, 7:23pm UTC](https://forum.arduino.cc/t/hc-05-bluetooth-module/1269236/18 "2024-06-09T19:23:22Z")

</div>

> [@Relay does not want to switch](https://forum.arduino.cc/t/relay-does-not-want-to-switch/1268575):
>
> hello everyone, i want to get relays to switch by sending characters into a bluetooth module HC-05. when i sent characters to the module nothing happens. someone who can help me with it?? im fairly new to using arduino so it could be that i made some stupid mistakes #include \<SoftwareSerial.h\> //Bluetooth Tx pin to Arduino 1 //Bluetooth Rx pin to Arduino 0 #define rxPin 2 #define txPin 3 SoftwareSerial Bluetooth(rxPin,txPin); #define RELAY\_1 4 #define RELAY\_2 5 #define RELAY\_3 6 #define RELA…

---

<div class="post-metadata">

**Author:** ![asskob06](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/asskob06/32/1064779_2.png) [@asskob06](https://forum.arduino.cc/u/asskob06)\
**Post date:** [June 10, 2024, 3:33pm UTC](https://forum.arduino.cc/t/hc-05-bluetooth-module/1269236/19 "2024-06-10T15:33:30Z")

</div>

would this code work with the app you recommended??

---

<div class="post-metadata">

**Author:** ![anon85221860](https://avatars.discourse-cdn.com/v4/letter/a/59ef9b/32.png) [@anon85221860](https://forum.arduino.cc/u/anon85221860)\
**Post date:** [June 10, 2024, 3:39pm UTC](https://forum.arduino.cc/t/hc-05-bluetooth-module/1269236/20 "2024-06-10T15:39:31Z")

</div>

> [@asskob06](#):
>
> would this code work

What code ?

---

<div class="post-metadata">

**Author:** ![asskob06](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/asskob06/32/1064779_2.png) [@asskob06](https://forum.arduino.cc/u/asskob06)\
**Post date:** [June 10, 2024, 3:46pm UTC](https://forum.arduino.cc/t/hc-05-bluetooth-module/1269236/21 "2024-06-10T15:46:48Z")

</div>

You tagged another forum of mine so i thought you would mean the code that i put in there?

[Next page](https://forum.arduino.cc/t/hc-05-bluetooth-module/1269236.md?page=2)
