Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seeing odd values on sensor UART #59

Open
kieran opened this issue Oct 19, 2022 · 0 comments
Open

Seeing odd values on sensor UART #59

kieran opened this issue Oct 19, 2022 · 0 comments

Comments

@kieran
Copy link

kieran commented Oct 19, 2022

I'm getting really bizarre readings from the UART...

I've tried 2 different ESP8266s (d1 mini clones) and an ESP32 (a mini32) and see the same behaviour on each. The IKEA unit appears to work normally, and the LEDs on it light up as you would expect in different atmospheres.

Have also de/re-soldered the wires a few times, powered the ESP via either 5V pin or USB. Same deal each time.

Code modifications (for logging):

bool isValidHeader() {
  Serial.printf("Expected header: %02X %02X %02X\n", 0x16, 0x11, 0x0B);
  Serial.printf("Received header: %02X %02X %02X\n", serialRxBuf[0], serialRxBuf[1], serialRxBuf[2]);
  bool headerValid = serialRxBuf[0] == 0x16 && serialRxBuf[1] == 0x11 && serialRxBuf[2] == 0x0B;
  // ...
void handleUart(particleSensorState_t& state) {
  // ...
  Serial.print("Receiving: ");
  while (sensorSerial.available()) {
    serialRxBuf[rxBufIdx] = sensorSerial.read();
    Serial.printf("%02X ", serialRxBuf[rxBufIdx]);
    rxBufIdx++;
  // ...

Serial output

Receiving: F7 Done.
Expected header: 16 11 0B
Received header: F7 00 00
Received message with invalid header.

Receiving: FF Done.
Expected header: 16 11 0B
Received header: FF 00 00
Received message with invalid header.

Receiving: 7F FB Done.
Expected header: 16 11 0B
Received header: 7F FB 00
Received message with invalid header.

Receiving: EB FF FF Done.
Expected header: 16 11 0B
Received header: EB FF FF
Received message with invalid header.

Receiving: F7 FF FF Done.
Expected header: 16 11 0B
Received header: F7 FF FF
Received message with invalid header. 

I'm somewhat new to C++ / Arduino, would appreciate any tips re: where to look next!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant