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

Esra Ş.

esra.dev

@esra_s29 · Joined October 2025

Newcomer

Backend geliştirici · yazılım · sahada 8 yıl

Topics
3
Replies
26
Points
0
Newcomer10 points to Member

Forum Replies Created

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

Oğuz Bey doğru yerde. Bir su pompası istasyonunda birebir aynısını yaşamıştım, iki ayrı sebebi var.

1) Linux açılış mesajlarını ve login konsolunu seri porta veriyor, 115200’deki çöp o. cmdline.txt’ten console=serial0,115200 kısmını sil. Ya da raspi-config > Interface Options > Serial Port: login shell Hayır, donanım Evet. serial-getty servisinin de kapalı olduğunu kontrol et.

2) Asıl kalıcı çözüm DE/RE pini. Pi açılırken GPIO17 bir süre tanımsız kalıyor, MAX485 vericiyi açık bırakabiliyor, hatta gelen her şey sayaca gidiyor. DE/RE’den GND’ye 10k pull-down koy, pin sürülmediği sürece modül dinleme modunda kalsın.

Bir de Zero 2 W’de serial0 varsayılan olarak mini UART’a gidiyor, onun baud’u çekirdek saatine bağlı. Bluetooth’u kapatıp PL011’i al:

# config.txt
enable_uart=1
dtoverlay=disable-bt
# script
inst = minimalmodbus.Instrument("/dev/ttyAMA0", 1)
inst.serial.baudrate = 9600
inst.serial.timeout = 0.5
inst.clear_buffers_before_each_transaction = True

Sayaç kilitlendiğinde clear_buffers da işe yarıyor, yarım kalmış bir cevabı bir sonraki sorguya taşımıyor.

Kayıtta yoksa olmamıştır.
Accepted solution♥ 4

Çok mantıklı, uyguladım. PPK2 ile uyku 6,8 µA, uyanma döngüsü ortalama 1,4 s’de 88 mA çıktı. Cihaz artık her mesajda enerji.mAs ve pil.v gönderiyor, grafikte sum ile günlük toplamı görüyorum, günde 18 mAh civarı. 2×AA ile kabaca 4 ay ediyor, beklediğimden kısa, WiFi bağlanma süresini kısaltmaya çalışacağım. INA219’u da çekmeceye kaldırdım.

Kayıtta yoksa olmamıştır.
♥ 0

Pasif taramaya geçtim, 30 sensörün hepsi 10 saniye içinde görünüyor, hiç bağlantı hatası yok. Dakikada bir tek gw mesajı gidiyor. Sensörlerden 12’si şifreli yayını destekliyor, onlara bindkey tanımladık, kalanları değiştirme listesine koyduk.

Kayıtta yoksa olmamıştır.
♥ 1

Translated from Türkçe by AI ·

Widening the window increases the delay, you need to do the opposite. I went through the same thing once while working with drones.The source of the lag is the average itself: a 20-sample moving average comes in about 1 second late, and the error grows as the turn rate increases. The calibration deficiency Büşra Hanım mentioned also explains the difference between right and left.The solution is to combine it with the gyroscope. The gyroscope sees the rotation instantly but drifts slowly, the magnetometer is slow but does not drift. A complementary filter combines the two:

// dt = 0.1 s, gz = derece/s (z ekseni jiroskop)
float a = 0.98;
heading = a * (heading + gz * dt) + (1 - a) * magHeading;
// 0/360 geçişini düzelt
float fark = magHeading - heading;
if (fark > 180) heading += 360 * (1 - a);
if (fark < -180) heading -= 360 * (1 - a);
heading = fmod(heading + 360, 360);

If the board has no gyroscope, adding an MPU6050 is the cheapest way. First, turn the boat two full circles in the water and perform the hard/soft iron calibration.The 180 issue is separate: an angle cannot be averaged. The average of 359 and 1 comes out as 180. The weekly chart reads hourly aggregated values and the default function is average. On the heading chart, set the function to last, and for analysis send heading_sin and heading_cos alongside the heading; their average comes out correctly.

Kayıtta yoksa olmamıştır.
Accepted solution♥ 7

Translated from Türkçe by AI ·

Will you use the MAC as the device name or as a separate field? It won’t be very readable as a name.

Kayıtta yoksa olmamıştır.
♥ 0

Pi OS’ta netplan yok Hakan, ayarı NetworkManager’da yapmak lazım. Bizim sahadaki kutularda da aynısı vardı.

NetworkManager iki yerde rastgele MAC kullanabiliyor: tarama sırasında ve bağlantının kendisinde. İkisini de kapatın:

# /etc/NetworkManager/conf.d/99-sabit-mac.conf
[device]
wifi.scan-rand-mac-address=no

[connection]
wifi.cloned-mac-address=permanent
ethernet.cloned-mac-address=permanent

Ayrıca mevcut bağlantı profili kendi değerini taşıyorsa global ayarı ezer, onu da düzeltin:

nmcli -f 802-11-wireless.cloned-mac-address con show "saha-wifi"
sudo nmcli con modify "saha-wifi" 802-11-wireless.cloned-mac-address permanent
sudo systemctl restart NetworkManager

stable değeri de var, her ağ için sabit ama gerçek olmayan bir MAC verir. Sizin rezervasyon gerçek MAC’e yapıldığı için permanent doğru seçenek. Yeniden başlatıp ip link show wlan0 çıktısında link/ether ile permaddr aynı mı bakın.

Kayıtta yoksa olmamıştır.
Accepted solution♥ 9

Translated from Türkçe by AI ·

İlgaz is right about the AP, but the takeover in the log is saying something else, and the main cause is the last sentence you wrote.In Hermetry, each device gets a single session. When a second connection from the same device arrives, it closes the first one and takes over. When 60 boxes connect with the same token, Hermetry sees them as one device: each new connection drops the previous one, the dropped one reconnects, and it loops endlessly. A device that keeps doing this from two networks is held back for a while, and that is the “takeover fight” notification. Normally the connections are spread out so you wouldn’t have noticed, but when power came back and all 60 went down and up at the same time, it blew up.What to do:1. Give each box its own credentials. Instead of adding 200 devices one by one, you can do a bulk CSV import from the Imports page (up to 1,000 rows per file). It shows a dry run first, and the tokens for new devices come in a file that can be downloaded only once. Alternatively, you can use a provisioning key in the profile so each device gets its own token on first boot.2. Add a random delay before reconnecting. If CONNACK 3 comes back, wait and retry, but don’t let them all retry in the same second:

uint32_t backoff = 2000 + (esp_random() % 8000);   // 2-10 sn
if (!mqtt.connected()) { delay(backoff); mqtt.connect(id, token, ""); }

3. Keepalive between 30 and 300 seconds. 60 is good.4. Don’t rely on a single home-type AP for 200 boxes; split them across 2-3 enterprise APs.Session and CONNACK details are on the MQTT page.

Kayıtta yoksa olmamıştır.
Accepted solution♥ 5

Translated from Türkçe by AI ·

It’s not the baud rate, it’s the voltage. If you measured -9 V, the answer is already there.An RS-232 signal swings roughly ±3 to ±15 V and its logic is inverted: idle is negative, “1” is negative, “0” is positive. The Pi’s UART, on the other hand, is 3.3 V TTL, 0 to 3.3 V, with normal logic. Connecting them directly gets both the level and the polarity wrong, and that garbage in the output is exactly what you’d expect. On top of that, applying a negative voltage and around 9 V to GPIO15 can kill the pin. Disconnect it right away; it’s luck if the Pi is still intact.I’ve done the same job in two places and used two approaches:1. MAX3232 module (MAX3232, not MAX232; it runs at 3.3 V). Feed VCC from the Pi’s 3.3 V, TTL side to GPIO14/15, RS-232 side to the DB9. 2. The cleaner option: a USB-RS232 adapter (PL2303 or FTDI chip). It shows up as /dev/ttyUSB0 and you don’t have to deal with GPIO at all.About the login screen issue: the Pi’s serial console is open on /dev/serial0. In raspi-config > Interface > Serial Port, answer No to “login shell over serial” and Yes to “serial port hardware”.And about TX/RX crossing: we don’t know whether the scale is DCE or DTE. If no data arrives, swap pins 2 and 3.Sending the data to Hermetry after that part is simple: using paho with an access token, you publish to v1/telemetry:

import re, json, serial
import paho.mqtt.client as mqtt

c = mqtt.Client(client_id="kantar-1")
c.username_pw_set(TOKEN, "")
c.tls_set()
c.connect(BROKER_HOST, 8883, keepalive=60)
c.loop_start()

s = serial.Serial('/dev/ttyUSB0', 9600, timeout=2)
while True:
    line = s.readline().decode('ascii', 'ignore')
    m = re.search(r'(-?d+.d+)s*kg', line)
    if m:
        c.publish("v1/telemetry", json.dumps({"weight_kg": float(m.group(1))}), qos=1)
Kayıtta yoksa olmamıştır.
Accepted solution♥ 8

Translated from Türkçe by AI ·

Hakan, check the documentation, there is nothing like that. Hermetry has no scheduled or e-mailed ready-made report, it is stated clearly. But the approach that works today is this, we did exactly that at a textile factory:Measurement: for 38A, get an SCT-013-050 (1V output), connect it to the ESP32’s ADC with a 1.65V bias, and do the EmonLib-like RMS calculation on the device. Have the device send current_a every 30 seconds. If you want real kWh, you will need an energy analyzer with Modbus on a DIN rail. Accept a 10% error margin with clamp-on meter + estimated cosφ.Power and energy: in the root flow, put a Calculate block before Save telemetry and derive power_kw. Details are on the derived values page.

expr:   round(1.732 * 400 * msg.payload.current_a * 0.85 / 1000, 2)
target: msg.payload.power_kw

Report: put a chart card on the dashboard, set grouping to day, and in the card settings tick Download data (CSV). At month end, set the window to This month and download the Excel file. If you want it automated, a small script can pull the daily values from the history API with agg=sum, or with increase if you are sending a counter, and you send the e-mail yourself.

Kayıtta yoksa olmamıştır.
Accepted solution♥ 8

Bunal Bey’in dediğine katılıyorum, eğik girişi Mx/My ile görmek güzel ama pahalı. Çoğu atölyede tek eksenli yük hücresi + strok ölçümü (bir lineer potansiyometre ya da enkoder) ile kuvvet-yol eğrisi alınıyor, eğik giriş zaten eğrinin şeklinden belli oluyor.

Forge kısmı: dokümanlarda Forge’un kendi sayfasını bulamadım, o yüzden parça bazlı kaydı nasıl yaptığını söyleyemem, neyi kapsadığını satış tarafına sormak lazım. Bu iş için şart da değil.

Normal IoT eklentisiyle şöyle yapabilirsiniz, biz bir müşteride böyle kurduk:

Presin yanında küçük bir kontrolcü (ESP32 + HX711 ya da endüstriyel bir yük hücresi amplifikatörü) her geçmede eğriyi yerelde örnekliyor, geçme bitince tek bir kayıt gönderiyor:

{"part_no": "RY-24117", "f_peak_kn": 12.8, "stroke_mm": 18.4, "ok": 1}

part_no metin olarak son değer görünüyor, sayılar grafikte, her kayıt geçmişte duruyor ve dışa aktarılabiliyor. Profilde f_peak_kn için üst/alt sınırlı bir alarm kuralı, ok == 0 için ayrı bir kural. Günlük adet için bir pano kartında ok anahtarının toplamı yeterli. Ham eğrinin tamamını göndermeyin, kontrolcünün SD kartında tutun, gerekirse müşteri istediğinde çıkarırsınız. CSV için: Verileri dışa aktarma.

Kayıtta yoksa olmamıştır.
Accepted solution♥ 7

Bu cihazı geçen yıl bir müşteride okudum, üç tane tuzağı var, büyük ihtimalle üçüne birden takıldınız 🙂

1. Baud: SDM120 fabrikadan 2400 baud geliyor, 9600 değil. Menüden değiştirmediyseniz 2400 kullanın, 8N1.

2. Fonksiyon kodu: ölçümler input register’larda, holding’de değil. Yani FC04, readInputRegisters. Gerilim 30001 yani adres 0x0000, akım 0x0006, aktif güç 0x000C, toplam aktif enerji 0x0156.

3. Veri tipi: her değer iki register’lık 32 bit float, büyük sonlu (yüksek word önce).

float regsToFloat(uint16_t hi, uint16_t lo) {
  uint32_t v = ((uint32_t)hi << 16) | lo;
  float f; memcpy(&f, &v, 4); return f;
}

if (node.readInputRegisters(0x0000, 2) == node.ku8MBSuccess) {
  float volts = regsToFloat(node.getResponseBuffer(0), node.getResponseBuffer(1));
}

Bir de istekler arasında en az 100-200 ms bekleyin, ucuz analizörler peş peşe sorguya kızıyor. Hermetry’ye gönderirken enerjiyi kümülatif kWh olarak gönderin, günlük tüketimi orada “increase” ile alırsınız.

Kayıtta yoksa olmamıştır.
Accepted solution♥ 6

Translated from Türkçe by AI ·

It doesn’t, Ilgaz. This is also where I went wrong on my first project. Hermetry does not calculate zones from position or from BLE beacons, and there is no geofence polygon. The tag, or the gateway that hears it, decides the room itself and sends the zone name. The ready-made staff tracking solution is built exactly this way: the zone key is either a zone name or outside.For your scale, my suggestion is BLE. UWB is for sub-metre accuracy; at room level it doesn’t pay off. The setup works like this:

  1. One fixed BLE receiver per room (an ESP32 is enough, plugged into a socket). All of them send the RSSI of the tags to a local server or a Pi.
  2. For each tag, the Pi picks the room that heard it strongest in the last 10-15 seconds, and adds hysteresis (don’t switch to a new room unless it is at least 6 dB stronger), otherwise the chair at the door will jump between two rooms.
  3. The Pi connects as a gateway and reports each tag as a child device:
v1/gw/telemetry
{
  "pompa-07":   {"values": {"zone": "A-3-314", "zone_id": 3314, "battery": 81}},
  "sandalye-12": {"values": {"zone": "A-2-208", "zone_id": 2208, "battery": 64}}
}

I added zone_id on purpose: zone is text, and text keys don’t keep a chart history, only the last value is shown. For the question “where was the pump yesterday” you need a numeric code.On the Sites & Assets side, create the rooms with kind Room or with your own ZONE type, and keep their codes the same as the names the gateway sends. For the tree dashboard and lists, the matching is again done by the gateway.The ready-made solution’s page describes the model very well, you can adapt from there: Personel takibi.

Kayıtta yoksa olmamıştır.
Accepted solution♥ 1
Viewing 15 posts – 1 through 15 (of 26 total)