Help with App Inventor Problem with Max6675

Hi, my name is Klaus and I live in Germany, unfortunately I don't speak English and have to use a translator. I have a problem with the App Inventor and maybe you can help me. I have searched the internet but found nothing, also here in the forum I have read but also here without success. I also tried to get it to work myself but unfortunately I did not succeed. I use an esp32, connected is a Max6675 temperature sensor and a 2 pin fan which is connected to a Mosfet 520. I made an app that allows me to connect to the esp32 via bluetooth, which works. Now I want the Max6675 to send the temperature via the esp32 to this app and be displayed here. In addition, there should be two text fields where you can enter a variable value to control the fan. An example at 70 degrees off and at 50 degrees on. There should also be two buttons that can turn the fan on and off separately. I don't know if the sketch I'm using gives the right function. I did manage to add Bluetooth to the app, but unfortunately I can't manage to connect to the Max6675. I have however had data sent from the esp32 to the app, but that was not temperature data. My question, can you guys help me with my problem? I would be very happy if I could get positive news. Greetings Klaus

Sketch:

#include <BluetoothSerial.h>
#include <max6675.h>

#define LUEFTER_PIN 13
#define BUTTON_ON_PIN 14
#define BUTTON_OFF_PIN 27

BluetoothSerial SerialBT;
MAX6675 thermocouple(18, 19, 23);

int luefterStatus = 0;
float temperaturSchwelleAn = 0;
float temperaturSchwelleAus = 0;

void setup() {
  Serial.begin(115200);
  SerialBT.begin("Grillfan");  // Bluetooth-Name festlegen

  pinMode(LUEFTER_PIN, OUTPUT);
  pinMode(BUTTON_ON_PIN, INPUT_PULLUP);
  pinMode(BUTTON_OFF_PIN, INPUT_PULLUP);
}

void loop() {
  if (SerialBT.available()) {
    char receivedChar = SerialBT.read();
    if (receivedChar == 'A') {
      luefterStatus = 1;
    } else if (receivedChar == 'B') {
      luefterStatus = 0;
    }
  }

  if (digitalRead(BUTTON_ON_PIN) == LOW) {
    luefterStatus = 1;
  } else if (digitalRead(BUTTON_OFF_PIN) == LOW) {
    luefterStatus = 0;
  }

  float temperatur = thermocouple.readCelsius();

  if (temperatur >= temperaturSchwelleAn && luefterStatus == 0) {
    luefterStatus = 1;
  } else if (temperatur <= temperaturSchwelleAus && luefterStatus == 1) {
    luefterStatus = 0;
  }

  digitalWrite(LUEFTER_PIN, luefterStatus);

  if (SerialBT.connected()) {
    SerialBT.print("Temperatur: ");
    SerialBT.print(temperatur);
    SerialBT.print("°C\n");
    SerialBT.print("Lüfterstatus: ");
    SerialBT.println(luefterStatus);
  }
}

Translated with www.DeepL.com/Translator (free version)

It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

To get an image of your blocks, right click in the Blocks Editor and select "Download Blocks as Image". You might want to use an image editor to crop etc. if required. Then post it here in the community.

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

Hi, first of all, thank you for trying to help me. Almost everything works in this block. But turbo on and turbo off don't work. I want as described in my text that the Max6675 sends data with the app invertor.

This might not be your bug, but you should remove those 2 extra empty sockets from your text JOIN block in the lower right corner of your blocks image.

Oh yes, done

In your sketch, you use variable luefterstatus (0 or 1) to eventually control the turbo through a pin.

But that variable is affected by three separate processes:

  • incoming BT traffic (A/B)
  • BUTTON_ON_PIN and BUTTON_OFF_PIN
  • thermocouple bound checking.

So your data traffic effect has to run a gauntlet before it has a chance to affect anything.

I just started with this topic last week and had absolutely no idea until then. I have read a lot from morning until late at night and tried a lot of things on video. It is very difficult for a beginner to understand some things directly. The turbo buttons worked but the sketch was configured differently. I just can't get the buttons to work correctly. But more important is that the Max6675 can send data to the app, so as I described above.

may be unlikely to get one either with that attitude !

It is quite possible that no-one else who specialises in Appinventor, has sought to build an app that relies on bluetooth, an arduino e2sp32, a Mosfet520 and a Max6675. Perhaps you should also ask on the forums that specialise in those objects as well?

1 Like

danke für die schnelle Antwort

My last comment was really not okay, for that I would like to apologize to everyone here on the forum. I just started a few days ago and spent many hours learning about Arduino and the App Inventor. I read and tested late into the night to find a solution to my problem. Maybe it's my own disappointment with me that made me behave so stupidly. Once again, apologies to all, I hope you can forgive me.

2 Likes

No worries. Keep trying here, someone may be able to help.

1 Like

Your blocks, which are in German, are undecipherable by me. I'm looking at these blocks and I don't know what is what.

Hi, the blocks I first sent are no longer up to date. I can now control the date, time and a fan with an app I made with App Inventor and it all works without problems. I would like to send the temperature data from a Max6675 to this app. I would like to control the fan from the app via temperature. That is, one variable value to turn off and one to turn on, for example at 55 degrees on and at 70 degrees off. I need a working sketch and the right blocks for the app inventor. I have tried many variations with no success.

I forgot something important, all this should be sent via Bluetooth. The Max6675 is connected to an esp32 just like the fan. I have already managed that the Max sends the temperature to the Arduino monitor.

#include <BluetoothSerial.h>

#include <SPI.h>

#include <max6675.h>

#include <MAX6675.h>

// Pin für den Lüfter

const int fanPin = 13;

// Bluetooth-Objekt erstellen

BluetoothSerial SerialBT;

// MAX6675-Objekt erstellen

int thermoDO = 19;

int thermoCS = 23;

int thermoCLK = 18;

MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO);

void setup() {

  // Serielle Kommunikation starten

  Serial.begin(115200);

  // Bluetooth initialisieren

  SerialBT.begin("Grillfan"); // Name des Bluetooth-Geräts

  // Pin für den Lüfter als Ausgang festlegen

  pinMode(fanPin, OUTPUT);

  // MAX6675 initialisieren

    

}

void loop() {

  if (SerialBT.available()) {

    char command = SerialBT.read();

    // Überprüfen, ob der Befehl zum Einschalten des Lüfters gesendet wurde

    if (command == '1') {

      digitalWrite(fanPin, HIGH); // Lüfter einschalten

      SerialBT.println("Lüfter eingeschaltet");

    }

    // Überprüfen, ob der Befehl zum Ausschalten des Lüfters gesendet wurde

    if (command == '0') {

      digitalWrite(fanPin, LOW); // Lüfter ausschalten

      SerialBT.println("Lüfter ausgeschaltet");

    }

  }

  // Temperatur vom MAX6675 auslesen

  double temperature = thermocouple.readCelsius();

  // Temperatur über Bluetooth senden

  SerialBT.print("Temperatur: ");

  SerialBT.print(temperature);

  SerialBT.println(" °C");

  delay(1000); // Eine Sekunde warten, bevor die Temperatur erneut ausgelesen wird

}

This is my new sketch for Bluetooth the Max and the fan on off.

Before taking a screenshot of your relevant blocks you should change the Language to English, so everyone is able to read them...

See also

Taifun

1 Like

After thinking over your fan control problem, I remembered an old phrase, "No man can serve two masters".

Your fan code needs a way to tell it who is in charge,

  • local controls
  • remote commands
  • thermocouple

For example, my high end wall thermostats (designed for both heat and air conditioning) have slide switches with choices

  • heat
  • off
  • cool

and menu choices

  • manual
  • automatic

for timed versus manual control.

Having those settings simplifies the logic inside the thermostat and in the mind of the user.

Your sketch might benefit from this concept.

It would help me if the Max6675 would send the temperature data to the APP Inventor or to the app, I have not been able to do that yet. I just can't find the right blocks to do this. Everything I have read so far has not worked. Maybe the sketch is written wrong for this, I just don't know. I'm not an expert in this area either, but I just want to do it, so I won't giv

Hello Klaus,
My name is Andreas also from Germany. How can we come in contact.
Ich kann dir vielleicht helfen