HM-10

hello,

my project includes temperature sensor, sensor's reading are displayed on serial monitor. i use the HM-10 module to communicate with my iphone. how can i see the sensor's reading on my iphone? my question is about the code in arduino.

thank you!

my question is about the code in arduino.

The code you didn't post? What pins is the HM10 connected to? Your code would tell us that.

PaulS:
The code you didn't post? What pins is the HM10 connected to? Your code would tell us that.

this is exactly the problem, I'm not sure how to write the code for my purpose

You say readings are currently displayed on serial monitor. It takes code to do that. Where is it?

Then you can change it from writing stuff to serial monitor to writing the same stuff to bluetooth via the HM10. There are many examples available showing how to use the HM-10.

Steve

slipstick:
You say readings are currently displayed on serial monitor. It takes code to do that. Where is it?

Then you can change it from writing stuff to serial monitor to writing the same stuff to bluetooth via the HM10. There are many examples available showing how to use the HM-10.

Steve

here is my code:

#define PIN_SENSOR1 A1
#define PIN_SENSOR2 A2
#define PIN_SENSOR3 A3
#define PIN_SENSOR4 A4
#define PIN_SENSOR5 A5

#define PIN_HEATER1 11
#define PIN_HEATER2 10
#define PIN_HEATER3 9
#define PIN_HEATER4 6
#define PIN_HEATER5 5

float target = 30;

void setup()
{
pinMode(PIN_SENSOR1, INPUT);
pinMode(PIN_SENSOR2, INPUT);
pinMode(PIN_SENSOR3, INPUT);
pinMode(PIN_SENSOR4, INPUT);
pinMode(PIN_SENSOR5, INPUT);

pinMode(PIN_HEATER1, OUTPUT);
pinMode(PIN_HEATER2, OUTPUT);
pinMode(PIN_HEATER3, OUTPUT);
pinMode(PIN_HEATER4, OUTPUT);
pinMode(PIN_HEATER5, OUTPUT);

Serial.begin(9600);
}

float getTemperature1() {
float data = analogRead(PIN_SENSOR1);
return (5.0 * data * 100.0) / 1024.0;
}
float getTemperature2() {
float data = analogRead(PIN_SENSOR2);
return (5.0 * data * 100.0) / 1024.0;
}
float getTemperature3() {
float data = analogRead(PIN_SENSOR3);
return (5.0 * data * 100.0) / 1024.0;
}
float getTemperature4() {
float data = analogRead(PIN_SENSOR4);
return (5.0 * data * 100.0) / 1024.0;
}
float getTemperature5() {
float data = analogRead(PIN_SENSOR5);
return (5.0 * data * 100.0) / 1024.0;
}

void loop()
{

float c1 = getTemperature1();
Serial.print("Temperature 1 : ");
Serial.println(c1);

if (c1 < target)
{
analogWrite(PIN_HEATER1, 30);
Serial.print("\Heater 1 on");
}else {
digitalWrite(PIN_HEATER1, LOW);
Serial.print("\Heater 1 O-F-F");

}
delay (1000);

float c2 = getTemperature2();
Serial.print("Temperature 2 : ");
Serial.println(c2);

if (c2 < target)
{
analogWrite(PIN_HEATER2, 30);
Serial.print("\Heater 2 on");
}else {
digitalWrite(PIN_HEATER2, LOW);
Serial.print("\Heater 2 O-F-F");

}
delay (1000);

float c3 = getTemperature3();
Serial.print("Temperature 3 : ");
Serial.println(c3);

if (c3 < target)
{
analogWrite(PIN_HEATER3, 30);
Serial.print("\Heater 3 on");
}else {
digitalWrite(PIN_HEATER3, LOW);
Serial.print("\Heater 3 O-F-F");

}
delay (1000);

float c4 = getTemperature4();
Serial.print("Temperature 4 : ");
Serial.println(c4);

if (c4 < target)
{
analogWrite(PIN_HEATER4, 30);
Serial.print("\Heater 4 on");
}else {
digitalWrite(PIN_HEATER4, LOW);
Serial.print("\Heater 4 O-F-F");

}
delay (1000);

float c5 = getTemperature5();
Serial.print("Temperature 5 : ");
Serial.println(c5);

if (c5 < target)
{
analogWrite(PIN_HEATER5, 30);
Serial.print("\Heater 5 on");
}else {
digitalWrite(PIN_HEATER5, LOW);
Serial.print("\Heater 5 O-F-F");

}
delay (1000);

}

now, how can i connect the HM-10 and to see the reading in the application?
thank you very much

now, how can i connect the HM-10

If google completely fails you, duct tape.

and to see the reading in the application?

What reading? You are reading from 5 pins. You need to use XXX.print() to send data to the HM10.

What XXX is depends on exactly how you end up connecting the HM10 after consulting with Mr. Google.

Hi,

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Thanks.. Tom... :slight_smile:

TomGeorge:
Hi,

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Thanks… Tom… :slight_smile:

#define PIN_SENSOR1 A1
#define PIN_SENSOR2 A2
#define PIN_SENSOR3 A3
#define PIN_SENSOR4 A4
#define PIN_SENSOR5 A5

#define PIN_HEATER1 11
#define PIN_HEATER2 10
#define PIN_HEATER3 9
#define PIN_HEATER4 6
#define PIN_HEATER5 5
 
float target = 30;
 
void setup()
{
  pinMode(PIN_SENSOR1, INPUT);
  pinMode(PIN_SENSOR2, INPUT);
  pinMode(PIN_SENSOR3, INPUT);
  pinMode(PIN_SENSOR4, INPUT);
  pinMode(PIN_SENSOR5, INPUT);
  
  pinMode(PIN_HEATER1, OUTPUT);
  pinMode(PIN_HEATER2, OUTPUT);
  pinMode(PIN_HEATER3, OUTPUT);
  pinMode(PIN_HEATER4, OUTPUT);
  pinMode(PIN_HEATER5, OUTPUT);

  Serial.begin(9600);
}
 
float getTemperature1() {
  float data = analogRead(PIN_SENSOR1);
  return (5.0 * data * 100.0) / 1024.0; 
}
float getTemperature2() {
  float data = analogRead(PIN_SENSOR2);
  return (5.0 * data * 100.0) / 1024.0; 
}
float getTemperature3() {
  float data = analogRead(PIN_SENSOR3);
  return (5.0 * data * 100.0) / 1024.0; 
}
float getTemperature4() {
  float data = analogRead(PIN_SENSOR4);
  return (5.0 * data * 100.0) / 1024.0; 
}
float getTemperature5() {
  float data = analogRead(PIN_SENSOR5);
  return (5.0 * data * 100.0) / 1024.0; 
}

 
void loop()
{

  float c1 = getTemperature1();
  Serial.print("Temperature 1 : ");
  Serial.println(c1);

  if (c1 < target)
  {
    analogWrite(PIN_HEATER1, 30);
    Serial.print("\Heater 1 on");
  }else {
        digitalWrite(PIN_HEATER1, LOW);
    Serial.print("\Heater 1 O-F-F");
    
  }
  delay (1000);

  float c2 = getTemperature2();
  Serial.print("Temperature 2 : ");
  Serial.println(c2);

  if (c2 < target)
  {
    analogWrite(PIN_HEATER2, 30);
    Serial.print("\Heater 2 on");
  }else {
        digitalWrite(PIN_HEATER2, LOW);
    Serial.print("\Heater 2 O-F-F");
    
  }
  delay (1000);


  float c3 = getTemperature3();
  Serial.print("Temperature 3 : ");
  Serial.println(c3);

  if (c3 < target)
  {
    analogWrite(PIN_HEATER3, 30);
    Serial.print("\Heater 3 on");
  }else {
        digitalWrite(PIN_HEATER3, LOW);
    Serial.print("\Heater 3 O-F-F");
    
  }
  delay (1000);


  float c4 = getTemperature4();
  Serial.print("Temperature 4 : ");
  Serial.println(c4);

  if (c4 < target)
  {
    analogWrite(PIN_HEATER4, 30);
    Serial.print("\Heater 4 on");
  }else {
        digitalWrite(PIN_HEATER4, LOW);
    Serial.print("\Heater 4 O-F-F");
    
  }
  delay (1000);

  float c5 = getTemperature5();
  Serial.print("Temperature 5 : ");
  Serial.println(c5);

  if (c5 < target)
  {
    analogWrite(PIN_HEATER5, 30);
    Serial.print("\Heater 5 on");
  }else {
        digitalWrite(PIN_HEATER5, LOW);
    Serial.print("\Heater 5 O-F-F");
    
  }
  delay (1000);
  
}

I tried to find a basic code to connect the HM10 in order to see the serial monitor on the screen of my iPhone, i mean i tried to see the temperature’s readings of my sensor on my iPhone screen

thank you!

Hi,
Have you googled arduino hm-10 iphone

Get comms between Arduino and iPhone first.
Do you have an app to read what you send the iphone?

Tom... :slight_smile:

TomGeorge:
Hi,
Have you googled arduino hm-10 iphone

Get comms between Arduino and iPhone first.
Do you have an app to read what you send the iphone?

Tom... :slight_smile:

Yes of course, I searched and I also have an app. I still do not get along well with the connections and the code. Would appreciate help

I still do not get along well with the connections and the code. Would appreciate help

You need to see a psychiatrist for your anti-social tendencies.

We can't help you, since you won't provide links to the hardware, a schematic, or any code that actually talks to the HM-10.