The Alpha Geek – Geeking Out

Fritzing

Project #6: MicroView – RHT03 Sensor – Mk07

RHT03 Humidity and Temperature Sensor

The RHT03 (also known by DHT-22) is a low cost humidity and temperature sensor with a single wire digital interface. The sensor is calibrated and doesn’t require extra components so you can get right to measuring relative humidity and temperature.

Features

* 3.3-6V Input
* 1-1.5mA measuring current
* 40-50 uA standby current
* Humidity from 0-100% RH
* -40 – 80 degrees C temperature range
* +-2% RH accuracy
* +-0.5 degrees C

Technical Specification

Model: RHT03
Power supply: 3.3-6V DC
Output signal: Digital signal via MaxDetect 1-wire bus
Sensing element: Polymer humidity capacitor
Operating range: Humidity 0-100%RH; Temperature -40~80C
Accuracy: humidity +-2%RH(Max +-5%RH); Temperature +-0.5C
Resolution or sensitivity: Humidity 0.1%RH; Temperature 0.1C
Repeatability: Humidity +-1%RH; Temperature +-0.2C – Humidity hysteresis – +-0.3%RH
Long-term Stability: +-0.5%RH/year
Interchangeability: Fully interchangeable

DonLuc1805Mk06

1 x MicroView
1 x MicroView – USB Programmer
1 x RHT03
3 x Jumper Wires 3″ M/M
1 x Half-Size Breadboard

MicroView

RHT – PIN 11 – Digital 2
VIN – PIN 15 – +5V
GND – PIN 08 – GND

DonLuc1805Mk06a.ino

// ***** Don Luc *****
// Software Version Information
// 7.01
// DonLuc1804Mk07 7.01
// MicroView
// RHT03 Humidity and Temperature Sensor

// include the library code:
#include <MicroView.h>
#include <SparkFun_RHT03.h>

// RHT Humidity and Temperature Sensor
const int RHT03_DATA_PIN = 2;           // RHT03 data pin Digital 2
RHT03 rht;                              // This creates a RTH03 object, which we'll use to interact with the sensor

void loop() {

  // RHT03 Humidity and Temperature Sensor
  isRHT03();

  delay(1000);
  
  uView.clear(PAGE);  // Erase the memory buffer, the OLED will be cleared
  
}

getRHT.ino

// RHT03 Humidity and Temperature Sensor
void isRHT03(){

  // Call rht.update() to get new humidity and temperature values from the sensor.
  int updateRet = rht.update();
  
  // The humidity(), tempC(), and tempF() functions can be called -- after 
  // a successful update() -- to get the last humidity and temperature
  // value 
  float latestHumidity = rht.humidity();
  float latestTempC = rht.tempC();
  float latestTempF = rht.tempF();

  uView.setFontType(0);  // Set font type 0: Numbers and letters. 10 characters per line (6 lines)
  
  uView.setCursor(0,10); // Humidity
  uView.print( "H : " );
  uView.print( latestHumidity );

  uView.setCursor(0,20); // Temperature *C
  uView.print( "*C: " );
  uView.print( latestTempC );

  uView.setCursor(0,30); // "Temperature *F
  uView.print( "*F: " );
  uView.print( latestTempF );
     
  uView.display();       // Display
   
}

setup.ino

void setup() {

  uView.begin();           // Begin of MicroView
  uView.clear(ALL);        // Erase hardware memory inside the OLED controller
  uView.display();         // Display the content in the buffer memory, by default it is the MicroView logo
  
  delay(1000);
  
  uView.clear(PAGE);       // Erase the memory buffer, the OLED will be cleared.
   
  uView.setFontType(1);    // Set font type 1: Numbers and letters. 7 characters per line (3 lines)
  uView.setCursor(0,20);
  uView.print("Don Luc");  // Don Luc
  uView.display();         // Display
  
  delay(5000);

  uView.clear(PAGE);       // Erase the memory buffer, the OLED will be cleared.

  uView.setFontType(1);    // Set font type 1: Numbers and letters. 7 characters per line (3 lines)
  uView.setCursor(0,20);
  uView.print("RHT03");    // RHT03
  uView.display();         // Display 
  
  delay(5000);
  
  uView.clear(PAGE);       // Erase the memory buffer, the OLED will be cleared
 
  // RHT03 Humidity and Temperature Sensor
  // Call rht.begin() to initialize the sensor and our data pin
  rht.begin(RHT03_DATA_PIN);
    
}

Don Luc

Project #6: MicroView – Accelerometer ADXL335 – Mk06

Accelerometer

An accelerometer is a device that measures proper acceleration. Proper acceleration, being the acceleration (or rate of change of velocity) of a body in its own instantaneous rest frame, is not the same as coordinate acceleration, being the acceleration in a fixed coordinate system. For example, an accelerometer at rest on the surface of the Earth will measure an acceleration due to Earth’s gravity, straight upwards (by definition) of g = 9.81 m/s2. By contrast, accelerometers in free fall (falling toward the center of the Earth at a rate of about 9.81 m/s2) will measure zero.

Triple Axis Accelerometer Breakout – ADXL335

Breakout board for the 3 axis ADXL335 from Analog Devices. This is the latest in a long, proven line of analog sensors – the holy grail of accelerometers. The ADXL335 is a triple axis MEMS accelerometer with extremely low noise and power consumption – only 320uA! The sensor has a full sensing range of +/-3g. There is no on-board regulation, provided power should be between 1.8 and 3.6VDC. Board comes fully assembled and tested with external components installed. The included 0.1uF capacitors set the bandwidth of each axis to 50Hz.

DonLuc1805Mk05

1 x MicroView
1 x MicroView – USB Programmer
1 x Accelerometer ADXL335
5 x Jumper Wires 3″ M/M
1 x Half-Size Breadboard

MicroView

Z-Axis – PIN 07 – Analog A0
Y-Axis – PIN 06 – Analog A1
X-Axis – PIN 05 – Analog A2
VIN – PIN 16 – 3.3V
GND – PIN 08 – GND

DonLuc1805Mk05a.ino

// ***** Don Luc *****
// Software Version Information
// 6.01
// DonLuc1804Mk06 6.01
// MicroView
// Accelerometer ADXL335

// include the library code:
#include <MicroView.h>
#include <ADXL335.h>

// Accelerometer ADXL335
const int pin_x = A0;     // X-Axis
const int pin_y = A1;     // Y-Axis
const int pin_z = A2;     // Z-Axis
const int vin = 16;       // 3.3V
const int gnd = 8;        // GND

ADXL335 accel(pin_x, pin_y, pin_z, vin);

void loop() {

  // Accelerometer ADXL335
  isADXL335();

  delay(500);
  
  uView.clear(PAGE);  // Erase the memory buffer, the OLED will be cleared
  
}

getADXL335.ino

// Accelerometer ADXL335
void isADXL335(){

  // This is required to update the values
  accel.update();

  float rho;
  float phi;
  float theta;  
  
  rho = accel.getRho();
  phi = accel.getPhi();
  theta = accel.getTheta();

  uView.setFontType(0);  // Set font type 0: Numbers and letters. 10 characters per line (6 lines)
  
  uView.setCursor(0,10); // X-Axis
  uView.print( "X: " );
  uView.print( rho );

  uView.setCursor(0,20); // Y-Axis
  uView.print( "Y: " );
  uView.print( phi );

  uView.setCursor(0,30); // Z-Axis
  uView.print( "Z: " );
  uView.print( theta );
     
  uView.display();       // Display
  
}

setup.ino

void setup() {

  uView.begin();           // Begin of MicroView
  uView.clear(ALL);        // Erase hardware memory inside the OLED controller
  uView.display();         // Display the content in the buffer memory, by default it is the MicroView logo
  
  delay(1000);
  
  uView.clear(PAGE);       // Erase the memory buffer, the OLED will be cleared.
   
  uView.setFontType(1);    // Set font type 1: Numbers and letters. 7 characters per line (3 lines)
  uView.setCursor(0,20);
  uView.print("Don Luc");  // Don Luc
  uView.display();         // Display
  
  delay(5000);

  uView.clear(PAGE);       // Erase the memory buffer, the OLED will be cleared.

  uView.setFontType(1);    // Set font type 1: Numbers and letters. 7 characters per line (3 lines)
  uView.setCursor(0,20);
  uView.print("ADXL335");  // ADXL335
  uView.display();         // Display
  
  delay(5000);
  
  uView.clear(PAGE);       // Erase the memory buffer, the OLED will be cleared
 
  // Accelerometer ADXL335
  pinMode(gnd, OUTPUT);    // GND
  pinMode(vin, OUTPUT);    // 3.3V
  digitalWrite(gnd, LOW);
  digitalWrite(vin, HIGH);
  
}

Don Luc

Categories
Archives