Teensy 3.2, DHT22, Ciseco XRF

Teensy 3.2, DHT22 and XRF

The teensy 3.2 USB development board runs a

MK20DX256 32 bit ARM Cortex-M4 72 MHz (96 Mhz overclockable)
has
262144 Flash memory
65536 Ram Memory
2048 EEPROM
34 I/O Pins, runs on 3.3 V and is 5 Volt tolerant
21 Analogue Ins, 12 PWM’s, 3 UARTS, 2 I2C and 1 SPI input.

It comes with it’s own loader, compiler and Arduino Software Tools integration.

teensy 3.2
teensy 3.2
teensy dht22 wiring
teensy 3.2 (3.1) dht22 wiring to Digital 11

Connecting our DHT22 test application after Teensyduino installation  is extremely easy and the Adafruit DHT22 library just works.
In Arduino just adjust your settings.

Arduino Settings for Teensy 3.2
Arduino Settings for Teensy 3.2

Verify your sketch the teensy app will pop up.

Press the button on the USB connected teensy3.2 and the teensy app on Auto will upload the sketch very, very quickly automatically. No minutes of waiting on the cloud…

teensy app
teensy app

Adding an XRF is also relatively easy.

Teensy 3.2, DHT22, Ciseco XRF
Teensy 3.2, DHT22, Ciseco XRF

Hiccups are, that there are several serial RX, TX (UARTS) on the board and that serial has several variants.  Just look at the teensy pinout and connect XRF TX to RX1 and XRF RX to TX1.

Teensy 3.2 Front Pin out
Teensy 3.2 Front Pin out

Serial is for the USB out.
Serial1 is for RX1, TX1 on the teensy in below sketch.

#include <DHT.h>

#define DEVICEID "DA"	// this is the LLAP device ID

#define DHTPIN 11
// what I/O the DHT-22 data pin is connected to
#define DHTTYPE DHT22   // DHT 22  (AM2302)

// Connect pin 1 (on the left) of the sensor to +5V
// Connect pin 2 of the sensor to whatever your DHTPIN is
// Connect pin 4 (on the right) of the sensor to GROUND
// Connect a 10K resistor from pin 2 (data) to pin 1 (power) of the sensor

DHT dht(DHTPIN, DHTTYPE);
int localKey = 0;
String keyString = "";
String hummi = "";
String temmi = "";

void setup() {
  Serial.begin(115200);
  delay(1000);				
  Serial1.begin(115200);
  delay(1000);  
  dht.begin();
  Serial.println("Alive");
  Serial1.println("Alive");

  delay(2500);
}
void loop() {
  static unsigned long lastTime = millis();
  if (millis() - lastTime >= 10000)
  {
    Serial.println("Reading");
    Serial1.println("Reading");
    lastTime = millis();
    float h = dht.readHumidity();
    float t = dht.readTemperature();
    Serial.println(t);
    Serial.println(h);
    Serial1.println(t);
    Serial1.println(h);
  }
}

Reading the DHT22 is standard. Sadly the LLAPSerial from Ciseco has not been done with an ARM processor in mind, so this include will fail. Nevertheless we can still send messages, or even fake LLAP messages over the XRF.

You can look at Andrew’s github LLAP Serial, or tinkerman‘s Github to see if this helps you. I have not tried this yet.

Tinkerman got rid of the power management code, which fails in teensyduino, so this might be a good starting point.

Overall I like the teensy, like Ciseco’s  rfu328 . A fast development board with head room for your own learning curve. Easy accessible in the beginning but possibilities to crawl into the hardware as your skill improves.

Real value for not that much money.