Yes it connected... wait. No it didn't

Hello!
I am using the HM10 bluetooth module with my Arduino Uno Rev 3. I did the circuit, and my sensor is connecting to my PC fine... for around 5 seconds. Then it just says disconnected.


I don't really have a sketch. My module is really close to my PC, but it still isn't working for me. Do you know how to fix this? (I have a Windows)
Thanks,
panda30

Do you power it with 3v3? Show your wiring diagram.

The HM10 is a BLE module.

What BLE app are you using on the PC? What service UUID are you trying to connect with?

Yes. I am. I'm using this diagram without the LEDs.
Ok... it's not uploading, so i guess I'll tell you.
VCC -> 3V3
GND -> GND
TX -> 4
RX -> 3

Well, I'm using the settings app on my PC. I don't really know what you mean with the second one.

Also, I am 90% sure this is a problem with my PC settings since I have a HC05, and it has the same problem. It literally works!!! But then it just doesn't. I've been trying to connect and reconnect for a while. (I'm powering my board with a 9V battery.)

I tried using 5V, but no use. :frowning:

I tried using this forum:

But I couldn't pinpoint the solution really. PLEASE HELP!

You have 3v3, 5v and 9v. Please, show the wiring diagram.

Hi! Welcome to the forum.

Some tips that may help you:

  1. The specs for the HM-10 tells it works from 3.6 to 6V. So, feeding it with 3.3V is not enough;

  2. 9V smoke alarm batteries are a poor choice for this kind of project, because they are drained quickly and can't provide enough current for more than an Arduino and a couple of sensors or LEDs.

  3. Common bluetooth modules (HC-05) and Low Energy Bluetooth modules (HM-10) are two complete different animals. They need different programs in your PC to work correctly. I would try first connecting the module to your cell phone.

PS: tips (1) and (2) are related to the schematics that @xfpd asked for. Tip (3) is related to @cattledog 's question. If you do not provide enough info of your complete setup, people can't help you or will end up misguiding you.

Link for video I used
The Circuit Diagram

Code I used:

#include <SoftwareSerial.h>
SoftwareSerial BT(3,4);
char val; //value to receieve data from the serial port
int ledpin1 = 9; //red LED
int ledpin2 = 10; // green LED

void setup() {
  pinMode(ledpin1, OUTPUT); // set LED pins as outputs
  pinMode(ledpin2, OUTPUT);
  BT.begin(9600); //begin serial communications at 9600 bits per second (baud)
}

void loop() {
  if( BT.available() ) // check if there is data to read
  {
    val = BT.read(); // read the data into our value variable
    BT.print("Reading new data: ");
    BT.println(val);
  }
  if (val == '1') // if 1 (high) is received
  {
  digitalWrite(ledpin1, HIGH); // Turn on the green light and off the red light
  digitalWrite(ledpin2, LOW);
  }
  else // 1 not received
  {
  digitalWrite(ledpin1, LOW); // Turn on the red light and off the green light
  digitalWrite(ledpin2, HIGH);
  }
  delay(100);
}

Sorry! I'm a middle schooler trying to use the forum for a school project. :pleading_face:

First, it is more simple to use a phone than a windows computer to connect with the BT or BLE modules. Can go that route with what you are trying to control?

I have a Win11 computer with Bluetooth, and I could get it to connect to an HC05, but I had to add a COM Port with the "more bluetooth settings". Then I could connect to the HC05 with the terminal program I use. (CoolTerm).

In the Video link I think the COM Port was automatically added.

But, in either case, I think you need the COM Port and a terminal program talking to the HC05 over that port.

EDIT:
I do find that you can get the IDE monitor window with the loaded sketch to change to the Bluetooth COM port set up in Windows and communicate with the HC05. You don't need the terminal program.

I do not have an HM10 to experiment with.

Without the necessary information, all we can do is guess. Please post your code and an annotated schematic so we can better understand your setup. At this point, resolving your issue before class might be challenging, but providing these details will increase your chances of finding a solution.

Ummm... I'm sorry but I thought I posted them above. The only change is that in the circuit diagram, I used an Uno. Respectfully, I don't really know what more you need.

The module needs to be powered with 5v.

A voltage divider on the Uno Tx to module Rx is advised to set the serial input voltage seen by the module to 3.3v, but I don't know if it's really possible to damage the module with 5v on the Serial.

Oh, I forgot to mention that. Sorry.

How did you add a COM port like that?

It should be through the "more bluetooth settings".

What version of windows are you running?