Fritzing
Project #7: RGB LCD Shield – PIR Motion Sensor – Mk03
PIR Motion Sensor
This is a simple to use motion sensor. Power it up and wait 1-2 seconds for the sensor to get a snapshot of the still room. If anything moves after that period, the ‘alarm’ pin will go low.
This unit works great from 5 to 12V (datasheet shows 12V). You can also install a jumper wire past the 5V regulator on board to make this unit work at 3.3V. Sensor uses 1.6mA@3.3V.
The alarm pin is an open collector meaning you will need a pull up resistor on the alarm pin. The open drain setup allows multiple motion sensors to be connected on a single input pin. If any of the motion sensors go off, the input pin will be pulled low.
We’ve finally updated the connector! Gone is the old “odd” connector, now you will find a common 3-pin JST! This makes the PIR Sensor much more accessible for whatever your project may need. Red = Power, White = Ground, and Black = Alarm.
Buzzer
This is a small 12mm round speaker that operates around the audible 2kHz range. You can use these speakers to create simple music or user interfaces.
This is not a true piezoelectric speaker but behaves similarly. Instead of a piezoelectric crystal that vibrates with an electric current, this tiny speaker uses an electromagnet to drive a thin metal sheet. That means you need to use some form of alternating current to get sound. The good news is that this speaker is tuned to respond best with a square wave (e.g. from a microcontroller).
LED
LED Yellow
LED Green
DonLuc1805Mk07
1 x RGB LCD Shield 16×2 Character Display
1 x Arduino UNO – R3
1 x ProtoScrewShield
1 x PIR Motion Sensor
1 x Buzzer
1 x LED Yellow
1 x LED Green
2 x Jumper Wires 2″ M/F
4 x Jumper Wires 3″ M/M
5 x Jumper Wires 6″ M/M
1 x Half-Size Breadboard
Arduino UNO
JST – Digital 6
BUZ – Digital 2
LEY – Digital 1
LEG – Digital 0
VIN – +5V
GND – GND
DonLuc1805Mk07a.ino
// ***** Don Luc ***** // Software Version Information // Project #7: RGB LCD Shield – PIR Motion Sensor - Mk03 // 5-3.01 // DonLuc1804Mk07 5-3.01 // RGB LCD Shield // PIR Motion Sensor (JST} // include the library code: #include <Adafruit_MCP23017.h> #include <Adafruit_RGBLCDShield.h> Adafruit_RGBLCDShield RGBLCDShield = Adafruit_RGBLCDShield(); #define GREEN 0x2 // PIR Motion Sensor (JST} const int buz = 6; // Buzzer const int MOTION_PIN = 2; // Pin connected to motion detector const int LED_Yellow = 1; // LED Yellow const int LED_Green = 0; // LED Green void loop() { // PIR Motion Sensor (JST} isJST(); delay(1000); // Clear RGBLCDShield.clear(); }
getJST.ino
void isJST(){ int proximity = digitalRead(MOTION_PIN); // PIR Motion Sensor if (proximity == LOW) // If the sensor's output goes low, motion is detected { // Motion Detected digitalWrite(buz, HIGH); // Buzzer High digitalWrite(LED_Yellow, HIGH); // LED Yellow High digitalWrite(LED_Green, LOW); // LED Green Low // Display // Set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); RGBLCDShield.print("Motion Detected!"); // Motion Detected! // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); RGBLCDShield.print("Buzzer On - Yel"); // Buzzer On } else { // Motion Off digitalWrite(buz, LOW); // Buzzer Low digitalWrite(LED_Yellow, LOW); // LED Yellow Low digitalWrite(LED_Green, HIGH); // LED Green High // Display // Set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); RGBLCDShield.print("Motion Off!"); // Motion Off! // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); RGBLCDShield.print("Buzzer Off - Gr"); // "Buzzer Off } }
setup.ino
void setup() { // set up the LCD's number of columns and rows: RGBLCDShield.begin(16, 2); RGBLCDShield.setBacklight(GREEN); // Display // Set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); RGBLCDShield.print("Don Luc"); // Don luc // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); RGBLCDShield.print("Motion Sensor"); // Motion Sensor delay(5000); // Clear RGBLCDShield.clear(); // PIR Motion Sensor (JST} pinMode(buz, OUTPUT); // Buzzer pinMode(MOTION_PIN, INPUT_PULLUP); // PIR Motion Sensor pinMode(LED_Yellow, OUTPUT); // LED Yellow pinMode(LED_Green, OUTPUT); // LED Green }
Don Luc
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