Project #28 – Sensors – SparkFun IR Receiver TSOP85 – Mk08
——
#DonLucElectronics #DonLuc #Sensors #TMP102 #LineSensor #AlcoholGasSensor #MinIMU9 #Pololu #Adafruit #SparkFun #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
SparkFun IR Receiver – TSOP85
This is a very small infrared receiver based on the TSOP85 receiver from Vishay. This receiver has all the filtering and 38kHz demodulation built into the unit. Simply point a IR remote at the receiver, hit a button, and you’ll see a stream of 1s and 0s out of the data pin.
DL2309Mk02
1 x Adafruit METRO M0 Express
1 x DS3231 Precision RTC FeatherWing
1 x Pololu MinIMU-9 v5 Gyro, Accelerometer, and Compass
1 x Pololu Carrier for MQ Gas Sensors
1 x Alcohol Gas Sensor – MQ-3
1 x SparkFun Line Sensor – QRE1113
1 x SparkFun Digital Temperature Sensor – TMP102
1 x SparkFun IR Receiver – TSOP85
1 x LED Red
1 x ProtoScrewShield
1 x Rocker Switch – SPST
2 x Resistor 10K Ohm
1 x CR1220 3V Lithium Coin Cell Battery
1 x SparkFun Cerberus USB Cable
Adafruit METRO M0 Express
LED – LED_BUILTIN
SDA – Digital 20
SCL – Digital 21
IRR – Digital 11
LER – Digital 3
SW1 – Digital 2
MQ3 – Analog 0
LSB – Analog 1
ALE = Analog 3
VIN – +3.3V
VIN – +5V
GND – GND
——
DL2309Mk02p.ino
/****** Don Luc Electronics © ****** Software Version Information Project #28 - Sensors - SparkFun IR Receiver TSOP85 - Mk08 28-08 DL2309Mk02p.ino 1 x Adafruit METRO M0 Express 1 x DS3231 Precision RTC FeatherWing 1 x Pololu MinIMU-9 v5 Gyro, Accelerometer, and Compass 1 x Pololu Carrier for MQ Gas Sensors 1 x Alcohol Gas Sensor - MQ-3 1 x SparkFun Line Sensor - QRE1113 1 x SparkFun Digital Temperature Sensor - TMP102 1 x SparkFun IR Receiver - TSOP85 1 x LED Red 1 x ProtoScrewShield 1 x Rocker Switch - SPST 2 x Resistor 10K Ohm 1 x CR1220 3V Lithium Coin Cell Battery 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // DS3231 Precision RTC #include <RTClib.h> // Two Wire Interface (TWI/I2C) #include <Wire.h> // Keyboard #include <Keyboard.h> // Includes and variables for IMU integration // STMicroelectronics LSM6DS33 Gyroscope and Accelerometer #include <LSM6.h> // STMicroelectronics LIS3MDL Magnetometer #include <LIS3MDL.h> // SparkFun Digital Temperature Sensor TMP102 #include <SparkFunTMP102.h> // SparkFun IR Receiver - TSOP85 #include <IRremote.h> // Keyboard String sKeyboard = ""; // DS3231 Precision RTC RTC_DS3231 rtc; String dateRTC = ""; String timeRTC = ""; // Pololu 9DoF IMU // STMicroelectronics LSM6DS33 Gyroscope and Accelerometer LSM6 imu; // Accelerometer and Gyroscopes // Accelerometer int imuAX; int imuAY; int imuAZ; // Gyroscopes int imuGX; int imuGY; int imuGZ; // STMicroelectronics LIS3MDL Magnetometer LIS3MDL mag; // Magnetometer int magX; int magY; int magZ; // Gas Sensors MQ // Alcohol Gas Sensor - MQ-3 int iMQ3 = A0; int iMQ3Raw = 0; int iMQ3ppm = 0; // SparkFun Line Sensor - QRE1113 (Analog) int iLine = A1; int iLineSensor = 0; // SparkFun Digital Temperature Sensor TMP102 const int ALERT_PIN = A3; TMP102 sensor0; float temperature; boolean alertPinState; boolean alertRegisterState; // SparkFun IR Receiver - TSOP85 int RECV_PIN = 11; IRrecv irrecv(RECV_PIN); decode_results results; String IRValue = ""; int iLEDRed = 3; // The number of the Rocker Switch pin int iSwitch = 2; // Variable for reading the button status int SwitchState = 0; // Software Version Information String sver = "28-08"; void loop() { // Date and Time RTC isRTC (); // Pololu Accelerometer and Gyroscopes isIMU(); // Pololu Magnetometer isMag(); // Gas Sensors MQ isGasSensor(); // SparkFun Line Sensor isLineSensor(); // SparkFun Temperature TMP102 isTMP102(); // SparkFun IR Receiver - TSOP85 isIR(); // Read the state of the Switch value: SwitchState = digitalRead(iSwitch); // Check if the button is pressed. If it is, the SwitchState is HIGH: if (SwitchState == HIGH) { Keyboard.println(sKeyboard); } // Delay 1 Second delay(1000); }
getAccelGyro.ino
// Accelerometer and Gyroscopes // Setup IMU void setupIMU() { // Setup IMU imu.init(); // Default imu.enableDefault(); } // Accelerometer and Gyroscopes void isIMU() { // Accelerometer and Gyroscopes imu.read(); // Accelerometer x, y, z imuAX = imu.a.x; imuAY = imu.a.y; imuAZ = imu.a.z; // Gyroscopes x, y, z imuGX = imu.g.x; imuGY = imu.g.y; imuGZ = imu.g.z; // Keyboard sKeyboard = sKeyboard + String(imuAX) + "|" + String(imuAY) + "|" + String(imuAZ) + "|"; sKeyboard = sKeyboard + String(imuGX) + "|" + String(imuGY) + "|" + String(imuGZ) + "|"; }
getGasSensorMQ.ino
// Gas Sensors MQ // Gas Sensor void isGasSensor() { // Read in analog value from each gas sensors // Alcohol Gas Sensor - MQ-3 iMQ3ppm = isMQ3( iMQ3Raw ); // Keyboard sKeyboard = sKeyboard + String(iMQ3ppm) + "|"; } // Alcohol Gas Sensor - MQ-3 int isMQ3(double rawValue) { double RvRo = rawValue; // % BAC = breath mg/L * 0.21 double bac = RvRo * 0.21; return bac; }
getIMUMagnetometer.ino
// IMU Magnetometer // Setup Magnetometer void setupMag() { // Setup Magnetometer mag.init(); // Default mag.enableDefault(); } // Magnetometer void isMag() { // Magnetometer mag.read(); // Magnetometer x, y, z magX = mag.m.x; magY = mag.m.y; magZ = mag.m.z; // Keyboard sKeyboard = sKeyboard + String(magX) + "|" + String(magY) + "|" + String(magZ) + "|"; }
getIRRemote.ino
// SparkFun IR Receiver - TSOP85 // Setup void isSetupIR(){ // Initialize digital pin LED Red as an output pinMode(iLEDRed, OUTPUT); // Start the receiver irrecv.enableIRIn(); } // void isIR(){ if (irrecv.decode(&results)) { // LED Red HIGH digitalWrite(iLEDRed, HIGH); //Serial.print("IR RECV Code = 0x "); //Serial.println(results.value, HEX); IRValue = "0x "; IRValue = IRValue + String(results.value, HEX); // LED Red LOW digitalWrite(iLEDRed, LOW); // IR Resume irrecv.resume(); } else { IRValue = "0"; } // Keyboard sKeyboard = sKeyboard + String(IRValue) + "|*"; }
getLineSensor.ino
// Line Sensor // isLine Sensor void isLineSensor(){ // Line Sensor iLineSensor = analogRead(iLine); // Keyboard sKeyboard = sKeyboard + String(iLineSensor) + "|"; }
getRTC.ino
// Date & Time // DS3231 Precision RTC void setupRTC() { // DS3231 Precision RTC if (! rtc.begin()) { //Serial.println("Couldn't find RTC"); //Serial.flush(); while (1) delay(10); } if (rtc.lostPower()) { //Serial.println("RTC lost power, let's set the time!"); // When time needs to be set on a new device, or after a power loss, the // following line sets the RTC to the date & time this sketch was compiled rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); // This line sets the RTC with an explicit date & time, for example to set // January 21, 2014 at 3am you would call: //rtc.adjust(DateTime(2023, 8, 10, 11, 0, 0)); } } // Date and Time RTC void isRTC () { // Date and Time dateRTC = ""; timeRTC = ""; DateTime now = rtc.now(); // Date dateRTC = now.year(), DEC; dateRTC = dateRTC + "/"; dateRTC = dateRTC + now.month(), DEC; dateRTC = dateRTC + "/"; dateRTC = dateRTC + now.day(), DEC; // Time timeRTC = now.hour(), DEC; timeRTC = timeRTC + ":"; timeRTC = timeRTC + now.minute(), DEC; timeRTC = timeRTC + ":"; timeRTC = timeRTC + now.second(), DEC; // Keyboard sKeyboard = "SEN|" + sver + "|" + String(dateRTC) + "|" + String(timeRTC) + "|"; }
getTempTMP102.ino
// SparkFun Digital Temperature Sensor TMP102 // Setup TMP102 void isSetupTMP102(){ // Declare alertPin as an input pinMode(ALERT_PIN,INPUT); // Begin //It will return true on success or false on failure to communicate if(!sensor0.begin()) { while(1); } // set the Conversion Rate //0-3: 0:0.25Hz, 1:1Hz, 2:4Hz, 3:8Hz sensor0.setConversionRate(2); //set Extended Mode. //0:12-bit Temperature(-55C to +128C) 1:13-bit Temperature(-55C to +150C) sensor0.setExtendedMode(0); // Set T_HIGH, the upper limit to trigger the alert on // Set T_HIGH in C sensor0.setHighTempC(29.4); // Set T_LOW, the lower limit to shut turn off the alert // set T_LOW in C sensor0.setLowTempC(27.67); } // is TMP102 void isTMP102(){ // Turn sensor on to start temperature measurement. // Current consumtion typically ~10uA. sensor0.wakeup(); // read temperature data C temperature = sensor0.readTempC(); // Check for Alert // Read the Alert from pin alertPinState = digitalRead(ALERT_PIN); // Read the Alert from register alertRegisterState = sensor0.alert(); // Place sensor in sleep mode to save power. // Current consumtion typically <0.5uA. sensor0.sleep(); // Keyboard sKeyboard = sKeyboard + String(temperature) + "|" + String(alertPinState) + "|" + String(alertRegisterState) + "|"; }
setup.ino
// Setup void setup() { // Give display time to power on delay(100); // Wire - Inialize I2C Hardware Wire.begin(); // Give display time to power on delay(100); // Date & Time RTC // DS3231 Precision RTC setupRTC(); // Initialize control over the keyboard: Keyboard.begin(); // Pololu Setup IMU setupIMU(); // Pololu Setup Magnetometer setupMag(); // Setup TMP102 isSetupTMP102(); // SetupTSOP85 isSetupIR(); // Initialize the Switch pin as an input pinMode(iSwitch, INPUT); // Initialize digital pin LED_BUILTIN as an output pinMode(LED_BUILTIN, OUTPUT); // Turn the LED on HIGH digitalWrite(LED_BUILTIN, HIGH); // Delay 5 Second delay( 5000 ); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Programming Language
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
- Robotics
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Machine Learning
- RTOS
- Research & Development (R & D)
Instructor, E-Mentor, STEAM, and Arts-Based Training
- Programming Language
- IoT
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
Follow Us
Luc Paquin – Curriculum Vitae – 2023
https://www.donluc.com/luc/
Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Leave a Reply