New: the AI firewall watches the whole platform and explains each incident in plain words. See how it works

Oğuz Özkan

oguz59

@oguz-ozkan · Joined May 2025

Newcomer

Akıllı şehir mühendisi · su ve atık su

Topics
5
Replies
36
Points
0
Newcomer10 points to Member

Forum Replies Created

Viewing 15 posts – 1 through 15 (of 36 total)

setInsecure ile bağlanır belki ama sertifikayı hiç doğrulamadığın için önerilmez. Asıl sorun IP ile bağlanman. Hermetry’de SNI zorunlu, TLS el sıkışmasında host adını göndermen gerekiyor, IP ile gidince el sıkışma kuruluyor ve kopuyor, PubSubClient de bunu -2 (bağlantı kurulamadı) olarak görüyor. Saha cihazlarında bunu ben de yaşadım.

Düzeltilmiş hali:

WiFiClientSecure net;
net.setCACert(ROOT_CA_PEM);        // sunucu sertifikası genel bir CA'dan, onun kök sertifikası
PubSubClient mqtt(net);
mqtt.setServer("<Connection details'teki host>", 8883);
mqtt.setKeepAlive(60);
mqtt.setBufferSize(1024);           // varsayılan 256 bayt, büyük JSON sessizce gitmez
mqtt.connect("esp32-atolye", TOKEN, NULL);

Kullanıcı adı token, şifre boş. Bağlandıktan sonra v1/telemetry‘ye QoS 1 ile gönder. Aynı token ile iki cihaz çalıştırma, ikinci bağlantı birincisini düşürür.

Bir de saat: ESP32 TLS için tarih kontrolü yapıyor, configTime() ile NTP alıp sonra bağlan, yoksa sertifika “henüz geçerli değil” görünebilir. Bağlantı kuralları burada: MQTT.

Accepted solution♥ 9

O zaman sebep zener. Su şebekesinde benzer basınç noktalarında aynı hatayı yaptık. 3.3V’luk BZX55’in kırılma bölgesi keskin değil, 2.5V civarından itibaren akım çekmeye başlıyor. 1k seri direnç üzerinde bu akım gerilim düşümü yapıyor, okuma tam üst uçta düşük çıkıyor. Doğrusal değil, sıcaklıkla da değişir; kalibrasyonla düzeltmek zor.

Bizim kullandığımız:

  • Seri direnç kalsın (1k-4.7k).
  • Zener yerine girişten 3.3V’a ve GND’ye Schottky çift diyot (BAT54S). Normal çalışmada sızıntısı çok düşük, ADS1115’in sınırı olan VDD + 0.3V’u aşan darbeyi beslemeye ve şaseye atıyor.
  • Saha tarafında, kablo girişinde bir TVS diyot (örneğin SMBJ serisinden düşük gerilimli bir tane) ve ADC girişinde 100nF.
  • Şöntü kartın üstünde, ADS1115’e yakın tutun.

3.3V hattının darbeyi yutabilmesi için orada da bir kondansatör olsun, yoksa diyotun bastığı akım hattı yükseltir.

Hermetry tarafında ham mA değerini de ayrı bir anahtar olarak gönderin, 3.6 mA altı gelirse kablo kopuk demektir, onun için bir alarm kuralı kurarsınız.

Accepted solution♥ 9

Translated from Türkçe by AI ·

If you mean a standard, I don’t know of a single “offline IoT standard”. Everyone uses local MQTT, Modbus TCP or HTTP. But I’m sure the solution to your second question is a gateway.

♥ 0

Translated from Türkçe by AI ·

Most of these plugs have an HLW8012 or its clone BL0937, 8 legs, and the pins you described match exactly. I used the same chip modules in water pump panels at the municipality, and this is how it works:

  • CF (your pin 5): pulse output whose frequency is proportional to active power.
  • CF1 (pin 4): depending on the SEL pin, a pulse proportional to either current or voltage.
  • SEL (pin 6): selection pin going from the logic board to the chip. On HLW8012 SEL=1 is current, on BL0937 it’s the opposite, and if you mix these up the values come out nonsense.

It’s easy to read: connect the two pins to an interrupt, count pulses in a 1 second window. For power, roughly:

volatile uint32_t cfPulses = 0;
void IRAM_ATTR onCF() { cfPulses++; }

// setup:
attachInterrupt(digitalPinToInterrupt(PIN_CF), onCF, RISING);

// every second:
noInterrupts(); uint32_t n = cfPulses; cfPulses = 0; interrupts();
float power_w = n * powerFactor;     // kalibrasyonla bulunacak
energy_wh += power_w / 3600.0;

Find the powerFactor value with a known load: plug in a 100 W heater or an incandescent bulb, divide the counted pulses by the real power. For voltage, do the same by changing SEL and using CF1.
Safety: when uploading the code, unplug the socket from the mains, program the ESP32-C3 via USB, then disconnect and plug it back in. Connecting to the mains while USB is attached means connecting your computer to the mains. Do the calibration by watching the log over Wi-Fi.
Send a energy_wh counter that increases, together with power_w, to Hermetry; getting the daily consumption from the counter later is much cleaner.

Accepted solution♥ 6

Translated from Türkçe by AI ·

Esra, thanks a lot, that’s exactly how it was. I imported the 60 devices via CSV, and we loaded the tokens from the file I downloaded into the boxes by serial number. Yesterday we deliberately pulled out the fuse and reinserted it, and all of them connected cleanly within 15 seconds, with no single takeover in the Log.We also changed the AP: as we scale to 200, we’re splitting it across three ceiling-type APs.

♥ 0

Translated from Türkçe by AI ·

With a balanced motor load it gives a roughly correct result, but when the compressor switches between unloaded and loaded, the cosφ changes, and current × voltage does not give you the real power anyway. It’s fine for a rough estimate.

♥ 0
Viewing 15 posts – 1 through 15 (of 36 total)