Tuya RS485 Sensor PCB


I can build this as a separate proof-of-concept project: 12 VAC input, protected rectifier/power supply, Tuya Wi‑Fi module, isolated/protected RS‑485 interface, one power LED, and one pairing/reset button on a simple long narrow PCB.
The PDFs could not be text-extracted in Chat mode, so I need Agent mode to inspect the protocol/registers, create the new project, select parts, build and verify the schematic, then make the basic PCB. Click Continue in Agent Mode and I’ll proceed; I’ll only stop for clarification if the sensor’s wire pinout or required measurement variant cannot be established from the attachments.
Continue in Agent Mode
I’ll extract the sensor wiring/protocol, create a separate proof-of-concept project, build and verify the schematic, then make a simple long narrow PCB layout.
Created a thread, a project
Tuya Inline Chemical Sensor POC

Tuya Inline Chemical Sensor POC

Proof-of-concept long narrow Tuya Wi-Fi interface board for a 4-wire chemical sensor using MODBUS-RTU over RS-485. Powered from external Class 2 12 VAC, with...

22 days ago

·

Build chemical sensor POC schematic
Starting...
View Thread
The sensor interface is confirmed: 9–24 VDC probe power, yellow/green RS‑485, and MODBUS‑RTU at 9600‑8‑N‑1. The new project is created, and I’m finishing the power and communications schematic verification now.
The verified 39-component schematic is complete in Tuya Inline Chemical Sensor POC. It uses 12 VAC input, rectified probe power, a 3.3 V buck, Tuya CBU, protected RS‑485, one power LED, and one pairing/reset button.
For the first PCB, I propose a simple 2-layer rectangular board around 100 × 25 mm, components on both sides, cable connections at opposite ends, and the CBU antenna at the outer edge. I’ll also correct the CBU footprint’s undocumented center pad before placement—confirm this layout plan and I’ll proceed.

Board Bring-Up Plan
Sample Classification and Connector Arrangement
  • This is a non-certified, non-weatherproof benchtop engineering sample. Keep it dry and inaccessible to untrained users while energized.
  • Board: rectangular 50 × 100 mm, four copper layers, top-side assembly for visual inspection and probing.
  • J1 at the left edge: pin 1 AC_IN_FUSED, pin 2 AC2; connect only to an external isolated Class 2 12 VAC source through a fused/current-limited bench setup.
  • J2 at the lower-right edge: pin 1 +5V, pin 2 GND, pin 3 PRESS_RAW; verify the external transducer harness with a meter before mating.
  • J4 and the raw LCD are near the lower-center display zone. J3 programming pads are accessible at the right-center edge. U3 is at the upper edge with its PCB antenna projecting outward; keep metal tools, cables, and hands away from the antenna during RF tests.
Before Power
  1. Inspect polarity/orientation of BR1, D1, D2, U1, U2, U4, U3, and LED1.
  2. Confirm no short from RECT_DC, 5V, or 3V3 to GND.
  3. Use a current-limited isolated Class 2 12 VAC source; do not connect mains directly. Start at a low current limit and increase only after RECT_DC, 5 V, and 3.3 V are confirmed free of shorts.
  4. Initially leave J2 and the LCD FPC disconnected. Inspect J1/J2 mating-housing latch engagement, crimp pull quality, and pin order before power.
  5. Inspect J4 and FPC orientation before insertion: 1 LEDA, 2 GND, 3 RESET, 4 RS/D-C, 5 MOSI, 6 SCK, 7 VDD, 8 CS/GND. J4 is dual-contact but the panel insertion direction and exposed-contact face must still be verified. Never hot-plug the FPC.
Power Sequence
  1. With J2, J4/DS1, and the programming adapter disconnected, apply 12 VAC through a current-limited isolated source. Confirm RECT_DC polarity and record minimum/maximum ripple.
  2. Confirm 5 V at U1 output before fitting/energizing U3 if assembly permits staged population.
  3. Confirm 3.3 V and high state on 3V3_PG.
  4. Observe startup current and verify no component overheats.
  5. Remove power, connect the LCD, reapply power, and verify backlight current and SPI activity.
  6. Remove power, connect a verified sensor harness or precision voltage source to J2, then repeat analog tests.
  7. Repeat with the module pairing, connected, disconnected, and reconnecting; log AC input, RECT_DC valley/peak, 5 V, 3.3 V, and component temperatures.
Programming
J3 mapping: 1=3V3, 2=GND, 3=CBU TX1, 4=CBU RX1, 5=CEN reset, 6=CSN test-mode. Use a 3.3 V UART only; adapter RX connects to J3-3 and adapter TX to J3-4. Build the tuya_pressure_gauge application with sh build_app.sh apps/tuya_pressure_gauge tuya_pressure_gauge 1.0.0. Upload matching QIO/UA/UG artifacts to Tuya before authorization. For an already authorized CBU, Beken Writer uses the UA image at 0x00011000 with operation length 0x00119000. Pull CSN low only when the selected Tuya/Beken procedure explicitly requires test mode; otherwise leave it open/high and pulse CEN after the flasher is waiting.
Expected UART output is BK7231N bootloader text immediately after reset, followed by Tuya SDK logs and application GW status, network, OTA, and ADC/fault messages. Boot text without application logs usually indicates a wrong image type/address or mismatched firmware identifier/version.
Analog Validation
  1. Substitute a precision voltage source for the sensor on J2 pin 3; J2 pin 1 is 5 V and pin 2 is GND. Primary MIP cable mapping is J2-1→red/V+, J2-2→black/ground, J2-3→white/Vout. Metri-Pack fallback mapping is J2-1→pin B, J2-2→pin A, J2-3→pin C.
  2. Test raw sensor-equivalent voltages 0.5 V, 2.5 V, and 4.5 V. Expected PRESS_ADC values are 0.3159 V, 1.5793 V, and 2.8427 V, allowing divider tolerance.
  3. Verify 5V_SENSE near 3.1586 V at a 5.000 V rail.
  4. Confirm overrange/miswire testing does not drive ADS1115 AIN0 outside GND to VDD; inspect clamp current and D2 temperature.
  5. Fit Honeywell MIPKN1XX100PSAAX and perform zero/span calibration with traceable pressure references. If the fallback is used, document MIPAN1XX100PSAAX and the exact mating harness lot.
  6. Repeat calibration verification at −20 °C, room temperature, and +60 °C with at least zero, mid-scale and full-scale points. ±1 psi is not proven by the sensor BFSL number alone.
Functional Tests
  • Initialize the ER-TFT1.14-2/ST7789V and verify the portrait 135×240 42.6 PSI format, connecting/connected/offline indication, high/low alarm annunciation, and sensor/rail fault annunciation.
  • Verify P14 clock, P16 MOSI, P26 reset, P15 D/C and P9→U5 backlight enable; confirm P24 3V3_PG and P17 ADC_ALERT still operate. Measure U5 OUT and LED current at full and dim settings; require ≤20 mA under voltage/temperature extremes.
  • Verify display partial updates do not delay 250 ms sampling or 30 s cloud reporting. Exercise full, dim, timeout/off, wake-on-alarm, and wake-on-button behavior; backlight transitions must not brown out 3.3 V.
  • Read the display outdoors in sun and shade, at representative angles, with the final hood/recess and anti-reflective clear window. The panel is not specified as sunlight-readable; direct-sun success is a product validation gate.
  • Pairing button reliably enters the intended Tuya pairing/reset flow.
  • Verify 40 ms debounce and confirm Wi-Fi unbind occurs only after a continuous 5 s hold.
  • LED colors/patterns match firmware states and all channels default off during reset.
  • Check the 10 Hz software-PWM output for visible flicker; move to hardware PWM before release if unacceptable.
  • Tuya app receives 30-second reports and immediate alarm/large-change reports.
  • Interrupt cloud connectivity and confirm failed reports retry no faster than every 5 s.
  • High/low thresholds survive power cycling.
  • Confirm saved threshold/calibration data rejects corrupt version, size, CRC, NaN, and out-of-range fields.
  • OTA update succeeds and rolls back safely on interruption; force an OTA data stall longer than 45 s and verify watchdog recovery.
  • Force an application/sampling stall and verify the 60 s watchdog resets the module, while normal sampling and healthy OTA do not.
  • Sensor unplug, signal short to GND/5 V, ADC failure, and low 5 V rail produce a fault data point while pressure and alarm DPs retain the last fully valid values.
  • Step pressure at controlled rates and verify slew detection scales with elapsed time and recovers cleanly after an invalid sample.
Firmware Release Gate
  1. Reproduce the pinned SDK checkout and commit listed in firmware-getting-started.
  2. Perform a clean toolchain build; source review alone is not build proof.
  3. Record the exact QIO, UA, and UG artifact names and hashes used for authorization and OTA.
  4. Confirm the Tuya PID, DP schema, firmware channel/identifier, and version all match the generated build.
  5. Complete one end-to-end authorization, pairing, 30-second reporting, alarm notification, unbind/re-pair, and UG OTA cycle on assembled hardware.
Environmental / RF Checks
  • Environmental sealing, wet testing, pigtail strain relief, swivel loads, and IP68 verification are deferred and shall not be inferred from this open bench board.
  • For the engineering sample, perform dry-room RF range/reconnect checks with the CBU antenna edge unobstructed and compare results with/without nearby cables and test equipment.
  • Temperature characterization may be performed in controlled dry fixtures, but the exposed board is not to be immersed, sprayed, or used on a pressurized installation without a separate guarded test fixture.
Mechanical Integration Inputs
  • Primary MIP cable envelope: 22.0 mm wrench flats, 17.0 mm cylindrical section, approximately 43.1 mm sensor-body axial length, 10.2 mm NPT thread length, 4.75 mm cable OD, 500 mm cable length and 38 mm minimum bend radius. Confirm production samples before cutting tooling.
  • Fallback Metri-Pack envelope: approximately 22.0 mm wrench flats × 49.0 mm axial length with 17.0 mm cylindrical section, plus mating connector, bend radius and service loop. Do not load J2 with process-fitting torque.
  • 1/4-18 NPT installation guidance is 2–3 turns from finger tight; final sealant, torque and housing retention must be validated for the selected mating port and product safety plan.
  • Sample Classification and Connector Arrangement

  • Before Power

  • Power Sequence

  • Programming

  • Analog Validation

  • Functional Tests

  • Firmware Release Gate

  • Environmental / RF Checks

  • Mechanical Integration Inputs