Analyzing non-standard signals

dev board Arduino UNO
chip DHT11
tool Saleae Logic Analyser
sensor temperature
features I2C logic analyser

Before starting

Dependancies

Ensure the following dependancies are downloaded and available:

Code

Download code logic-analyzer-signal.ino
#include "DHT.h"

#define DHTPIN 7
#define DHTTYPE DHT11

DHT dht(DHTPIN, DHTTYPE);

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);

  Serial.begin(9600);
  Serial.println("Start DHT11");

  dht.begin();
}

void loop() {
  float t = dht.readTemperature();

  if (isnan(t)) {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }

  digitalWrite(LED_BUILTIN, HIGH);
  delay(1000);

  digitalWrite(LED_BUILTIN, LOW);
  delay(1000);

  Serial.println(t);
}

Makefile

BOARD?=arduino:avr:uno
PORT?=/dev/cu.usbmodem14*

.PHONY: default lint all flash clean

default: lint all flash clean

lint:
	cpplint --extensions=ino --filter=-legal/copyright *.ino

all:
	arduino-cli compile --fqbn $(BOARD) ./

flash:
	arduino-cli upload -p $(PORT) --fqbn $(BOARD)

clean:
	rm -rf build

Prototype

A photo of the actual setup.

Analyzing non-standard signals prototype

Schematic

Wire up the hardware accordingly

Analyzing non-standard signals schematic

Serial console

Serial output from the firmware.

Analyzing non-standard signals serial console

Description

View the decoded non-standard signal from the graph produced by Saleae to read temperature from a DHT11 sensor.

Capture the signal in Saleae:

Manually decoding the signal gives us:

0010 0110 0000 0000 0001 1100 0000 0000 0100 0010
RH MSB    RH LSB    T MSB     T LSB     Checksum

Take the temperature MSB which is 0001 1100 in binary and 28 in decimal, which is the same as what is shown i the serial monitor.

References

Watch