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
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.)
The specs for the HM-10 tells it works from 3.6 to 6V. So, feeding it with 3.3V is not enough;
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.
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.
#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);
}
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.
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.
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.