PS1 PCB Review Fix


Purpose of the PCB
This PCB is a low-current monitoring and communications controller for a nominal 24 V wind-turbine system. It collects operating data, processes it with an ESP32, and sends the information to local or cloud systems.
It is not a turbine power controller and must not carry the turbine’s approximately 24 A output current.
What it does 1. Receives low-current system power
The board accepts a separately fused 12–36 VDC branch, normally about 24 V, from the turbine or battery system.
Onboard power circuitry:
  • Protects against input transients and voltage spikes
  • Converts the incoming voltage to regulated low-voltage rails
  • Generates 5 V and 3.3 V for the electronics
  • Provides local filtering and decoupling
Only enough current to operate the monitoring electronics should enter the PCB.
2. Reads the electrical measurements
A JSY-MK-229 energy meter measures electrical values in the external turbine power path, such as:
  • Voltage
  • Current
  • Power
  • Accumulated energy
  • Other values supported by its Modbus register set
The board communicates with that meter through RS485/Modbus. The high turbine current passes through an external shunt and appropriately sized wiring, not through this PCB.
An isolated RS485 interface helps separate the ESP32’s low-voltage logic domain from the field-wiring and measurement domain.
3. Measures turbine rotational speed
The board provides a Hall-effect sensor input for RPM measurement. A magnet or magnetic target on the turbine produces pulses as the shaft rotates.
The ESP32 counts these pulses and calculates RPM:
RPM=60×pulse frequencypulses per revolutionRPM=\frac{60 \times \text{pulse frequency}}{\text{pulses per revolution}}
The exact conversion depends on the number of magnets or pulses generated per revolution.
4. Processes the data
The ESP32-WROOM-32 is the main controller. Firmware can:
  • Poll the JSY-MK-229 over Modbus
  • Count Hall-sensor pulses
  • Calculate RPM and derived performance data
  • Detect abnormal or missing measurements
  • Timestamp and organize readings
  • Control indicators
  • Package the data for transmission
It can also compare electrical output with turbine speed to help identify low production, sensor faults, overspeed conditions, or changing operating performance.
5. Sends measurements remotely
The ESP32 provides Wi-Fi and Bluetooth capability. The intended cloud function is to publish measurements using MQTT to AWS IoT Core.
Possible reported values include:
  • Turbine voltage
  • Output current
  • Instantaneous power
  • Generated energy
  • Rotor RPM
  • Communications status
  • Device health and fault states
The design also includes LoRa-related connectivity for longer-range local telemetry where Wi-Fi is not practical, subject to the connected radio and firmware configuration.
6. Supports programming and servicing
The USB-C and CP2102N circuitry provide a computer interface for:
  • ESP32 firmware programming
  • Serial diagnostics
  • Configuration
  • Debug logging
  • Maintenance and commissioning
USB-C is a service/programming interface. It is not intended to carry turbine power.
Correct system arrangement
The turbine’s high-current path should remain entirely external:
Wind turbine → external fuse or breaker → external shunt/metering path → charge controller → battery/load
This path requires wiring, protection, terminals, and equipment rated for approximately 24 A or more, with suitable engineering margin.
The monitoring PCB receives only:
  1. A separately fused, low-current nominal 24 V power branch
  2. RS485 measurement data from the JSY-MK-229
  3. Hall-effect RPM pulses
  4. Any intended low-power sensor or communications connections
What it does not do
The PCB does not:
  • Carry the turbine’s approximately 24 A output
  • Replace the external fuse or breaker
  • Replace the external shunt
  • Replace the JSY-MK-229 meter
  • Regulate turbine charging
  • Replace the charge controller
  • Switch or interrupt the main turbine current
  • Act as a dump-load controller
  • Provide battery overcharge protection
  • Make high-current wiring safe
In short, it is the system’s measurement, processing, and communications layer, while the external charge controller, protection devices, shunt, and heavy wiring handle the actual turbine energy.

Firmware Starter — ESP32 Wind Turbine Monitor
PlatformIO Project

Ini


[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed = 115200
lib_deps =
  knolleary/PubSubClient
  emelianov/modbus-esp8266
  bblanchon/ArduinoJson
Pin Definitions

Cpp


#define PIN_RS485_RX      16
#define PIN_RS485_TX      17
#define PIN_RS485_DE_RE    4
#define PIN_HALL_RPM      27
#define PIN_BOOT           0

#define MODBUS_BAUD     9600
#define MQTT_PORT       8883
Starter Code

Cpp


#include <Arduino.h>
#include <WiFi.h>
#include <WiFiClientSecure.h>
#include <PubSubClient.h>
#include <ArduinoJson.h>

#define PIN_RS485_RX      16
#define PIN_RS485_TX      17
#define PIN_RS485_DE_RE    4
#define PIN_HALL_RPM      27
#define MODBUS_BAUD     9600

const char* WIFI_SSID = "YOUR_WIFI";
const char* WIFI_PASS = "YOUR_PASSWORD";
const char* AWS_ENDPOINT = "your-endpoint-ats.iot.us-east-1.amazonaws.com";
const char* MQTT_TOPIC = "turbine/telemetry";

WiFiClientSecure net;
PubSubClient mqtt(net);
HardwareSerial RS485(2);

volatile uint32_t hallPulses = 0;
uint32_t lastSampleMs = 0;
float rotorRpm = 0;

void IRAM_ATTR onHallPulse() {
  hallPulses++;
}

void rs485TransmitMode(bool enable) {
  digitalWrite(PIN_RS485_DE_RE, enable ? HIGH : LOW);
  delayMicroseconds(20);
}

void connectWiFi() {
  WiFi.mode(WIFI_STA);
  WiFi.begin(WIFI_SSID, WIFI_PASS);
  while (WiFi.status() != WL_CONNECTED) delay(500);
}

void connectMQTT() {
  net.setInsecure(); // Replace with AWS root CA + device certificate for production.
  mqtt.setServer(AWS_ENDPOINT, 8883);
  while (!mqtt.connected()) {
    mqtt.connect("esp32-wind-turbine-monitor");
    delay(500);
  }
}

float readModbusPlaceholder(uint8_t slaveId, uint16_t reg) {
  // TODO: replace with real Modbus RTU request/CRC/register parsing for each sensor.
  (void)slaveId;
  (void)reg;
  return 0.0f;
}

void publishTelemetry() {
  StaticJsonDocument<384> doc;
  doc["wind_speed"] = readModbusPlaceholder(1, 0x0000);
  doc["wind_direction"] = readModbusPlaceholder(2, 0x0000);
  doc["dc_voltage"] = readModbusPlaceholder(3, 0x0000);
  doc["dc_current"] = readModbusPlaceholder(3, 0x0001);
  doc["dc_power"] = readModbusPlaceholder(3, 0x0002);
  doc["energy_kwh"] = readModbusPlaceholder(3, 0x0003);
  doc["rotor_rpm"] = rotorRpm;

  char payload[384];
  serializeJson(doc, payload);
  mqtt.publish(MQTT_TOPIC, payload);
}

void setup() {
  pinMode(PIN_RS485_DE_RE, OUTPUT);
  rs485TransmitMode(false);
  pinMode(PIN_HALL_RPM, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(PIN_HALL_RPM), onHallPulse, FALLING);

  Serial.begin(115200);
  RS485.begin(MODBUS_BAUD, SERIAL_8N1, PIN_RS485_RX, PIN_RS485_TX);

  connectWiFi();
  connectMQTT();
}

void loop() {
  if (!mqtt.connected()) connectMQTT();
  mqtt.loop();

  uint32_t now = millis();
  if (now - lastSampleMs >= 1000) {
    noInterrupts();
    uint32_t pulses = hallPulses;
    hallPulses = 0;
    interrupts();

    // Assumes 1 pulse/revolution; change if the rotor magnet count differs.
    rotorRpm = pulses * 60.0f;
    publishTelemetry();
    lastSampleMs = now;
  }
}
Bring-Up Notes
  1. Program over USB-C / CP2102N at 115200 baud.
  2. Verify 3.3 V rail before inserting/programming firmware.
  3. Confirm RS485 sensor slave IDs and register maps for the exact wind and JSY-MK-229 devices.
  4. Replace net.setInsecure() with AWS IoT root CA, device certificate, and private key before deployment.
  • PlatformIO Project

  • Pin Definitions

  • Starter Code

  • Bring-Up Notes