Video Blog
Project #22: Synthesizer – UltrasonicSynth – Mk03
——
#DonLucElectronics #DonLuc #Synthesizer #UltrasonicSynth #Arduino #ArduinoProMini #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
UltrasonicSynth Mozzi
Oscil
Oscil plays a wavetable, cycling through the table to generate an audio or control signal. The frequency of the signal can be set or changed, and the output of an Oscil can be produced with for a simple cycling oscillator, or for a particular sample in the table.
Soundtables
Look-up-tables and python scripts to generate tables or convert sounds. Includes ready-to-use wave tables and a few example samples. Also check out the other scripts in the python folder for templates to use if you want to do your own thing.
Smooth
A simple infinite impulse response low pass filter for smoothing control or audio signals. Smoothness sets how much smoothing the filter will apply to its input. Use a float in the range 0 – 1, where 0 is not very smooth and 0.99 is very smooth.
AutoMap
Automatically map an input value to an output range without knowing the precise range of inputs beforehand.
DL2204Mk01
1 x Arduino Pro Mini 328 – 5V/16MHz
2 x HC-SR04 Ultrasonic Sensor
1 x 1M Ohm Potentiometer
1 x Knob
1 x Audio Jack 3.5mm
1 x SparkFun Audio Jack Breakout
1 x Insignia Speakers
1 x Full-Size Breadboard
1 x Half-Size Breadboard
1 x SparkFun FTDI Basic Breakout – 5V
1 x SparkFun Cerberus USB Cable
Arduino Pro Mini 328 – 5V/16MHz
Ech – Digital 13
Tri – Digital 12
EcR – Digital 11
TrR – Digital 10
SPK – Digital 9
CAP – Analog A0
VIN – +5V
GND – GND
——
DL2206Mk01p.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #22: Synthesizer - UltrasonicSynth - Mk03 22-03 DL2206Mk01p.ino 1 x Arduino Pro Mini 328 - 5V/16MHz 2 x HC-SR04 Ultrasonic Sensor 1 x 1M Ohm Potentiometer 1 x Knob 1 x Audio Jack 3.5mm 1 x SparkFun Audio Jack Breakout 1 x Insignia Speakers 1 x Full-Size Breadboard 1 x Half-Size Breadboard 1 x SparkFun FTDI Basic Breakout - 5V 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // Mozzi #include <MozziGuts.h> // Oscillator #include <Oscil.h> // Table for Oscils to play #include <tables/cos2048_int8.h> // Smoothing Control #include <Smooth.h> // Maps unpredictable inputs to a range #include <AutoMap.h> // Desired carrier frequency max and min, for AutoMap const int MIN_CARRIER_FREQ = 22; const int MAX_CARRIER_FREQ = 440; // Desired intensity max and min, for AutoMap, note they're inverted for reverse dynamics const int MIN_INTENSITY = 450; const int MAX_INTENSITY = 50; // Desired mod speed max and min, for AutoMap, note they're inverted for reverse dynamics const int MIN_MOD_SPEED = 450; const int MAX_MOD_SPEED = 50; // Maps unpredictable inputs to a range AutoMap kMapCarrierFreq(0,1023,MIN_CARRIER_FREQ,MAX_CARRIER_FREQ); AutoMap kMapIntensity(0,1023,MIN_INTENSITY,MAX_INTENSITY); AutoMap kMapModSpeed(0,1023,MIN_MOD_SPEED,MAX_MOD_SPEED); // Set the input for the knob to analog pin 0 const int KNOB_PIN = A0; // Set the analog input for fm_intensity int LDR1_PIN; // Set the analog input for mod rate int LDR2_PIN; // Table for Oscils to play Oscil<COS2048_NUM_CELLS, AUDIO_RATE> aCarrier(COS2048_DATA); Oscil<COS2048_NUM_CELLS, AUDIO_RATE> aModulator(COS2048_DATA); Oscil<COS2048_NUM_CELLS, CONTROL_RATE> kIntensityMod(COS2048_DATA); // Brightness (harmonics) int mod_ratio = 5; // Carries control info from updateControl to updateAudio long fm_intensity; // Smoothing for intensity to remove clicks on transitions float smoothness = 0.95f; Smooth <long> aSmoothIntensity(smoothness); // Trigger pin 12 to pitch distance sensor const int iTrigPitch = 12; // Echo Receive pin 13 to pitch distance sensor const int iEchoPitch = 13; // Define the useable range of the pitch sensor const int pitchLowThreshold = 450; const int pitchHighThreshold = 50; // Stores the distance measured by the distance sensor float distance = 0; // Trigger pin 10 to rate distance sensor const int iTrigRate = 10; // Echo Receive pin 13 to pitch distance sensor const int iEchoRate = 11; // Define the useable range of the pitch sensor const int rateLowThreshold = 450; const int rateHighThreshold = 50; // Stores the distance measured by the distance sensor float rate = 0; // Mini Speaker int SPK = 9; // Software Version Information String sver = "22-03"; void loop() { // Audio Hook audioHook(); }
getHC-SR04.ino
// HC-SR04 Ultrasonic Sensor // Setup HC-SR04 void setupHCSR04() { // The trigger iTrig Pitch will output pulses of electricity pinMode(iTrigPitch, OUTPUT); // The echo iEcho will measure the duration of pulses coming back from the distance sensor pinMode(iEchoPitch, INPUT); // The trigger iTrig Rate will output pulses of electricity pinMode(iTrigRate, OUTPUT); // The echo iEcho will measure the duration of pulses coming back from the distance sensor pinMode(iEchoRate, INPUT); } // Distance float isDistance() { // Variable to store the time it takes for a ping to bounce off an object float echoTime; // Variable to store the distance calculated from the echo time float calculatedDistance; // Send out an ultrasonic pulse that's 10ms long digitalWrite(iTrigPitch, HIGH); delayMicroseconds(10); digitalWrite(iTrigPitch, LOW); // Use the pulseIn command to see how long it takes for the // pulse to bounce back to the sensor echoTime = pulseIn(iEchoPitch, HIGH); // Calculate the distance of the object that reflected the pulse // (half the bounce time multiplied by the speed of sound) // cm = 58.0 calculatedDistance = echoTime / 58.0; // Send back the distance that was calculated return calculatedDistance; } // Rate float isRate() { // Variable to store the time it takes for a ping to bounce off an object float echoTime; // Variable to store the distance calculated from the echo time float calculatedDistance; // Send out an ultrasonic pulse that's 10ms long digitalWrite(iTrigRate, HIGH); delayMicroseconds(10); digitalWrite(iTrigRate, LOW); // Use the pulseIn command to see how long it takes for the // pulse to bounce back to the sensor echoTime = pulseIn(iEchoRate, HIGH); // Calculate the distance of the object that reflected the pulse // (half the bounce time multiplied by the speed of sound) // cm = 58.0 calculatedDistance = echoTime / 58.0; // Send back the distance that was calculated return calculatedDistance; }
getMozzi.ino
// Mozzi // Update Control void updateControl(){ // Variable to store the distance measured by the sensor distance = isDistance(); // Low Threshold if ( distance >= pitchLowThreshold) { // pitchLowThreshold distance = pitchLowThreshold; } // High Threshold if ( distance < pitchHighThreshold){ // pitchHighThreshold distance = pitchHighThreshold; } // Variable to store the distance measured by the sensor rate = isRate(); // Low Threshold if ( rate >= rateLowThreshold) { // rateLowThreshold rate = rateLowThreshold; } // High Threshold if ( rate < rateHighThreshold){ // rateHighThreshold rate = rateHighThreshold; } // Read the knob // Value is 0-1023 int knob_value = mozziAnalogRead(KNOB_PIN); // Map the knob to carrier frequency int carrier_freq = kMapCarrierFreq(knob_value); // Calculate the modulation frequency to stay in ratio int mod_freq = carrier_freq * mod_ratio; // Set the FM oscillator frequencies aCarrier.setFreq(carrier_freq); aModulator.setFreq(mod_freq); // Read the light dependent resistor on the width LDR1_PIN = distance; int LDR1_value = LDR1_PIN; int LDR1_calibrated = kMapIntensity(LDR1_value); // Calculate the fm_intensity // Shift back to range after 8 bit multiply fm_intensity = ((long)LDR1_calibrated * (kIntensityMod.next()+128))>>8; // Read the light dependent resistor on the speed LDR2_PIN = rate; int LDR2_value= LDR2_PIN; // Use a float here for low frequencies float mod_speed = (float)kMapModSpeed(LDR2_value)/1000; kIntensityMod.setFreq(mod_speed); } // Update Audio int updateAudio() { // Update Audio long modulation = aSmoothIntensity.next(fm_intensity) * aModulator.next(); return aCarrier.phMod(modulation); }
setup.ino
// Setup void setup() { // Setup HC-SR04 setupHCSR04(); // Delay delay( 200 ); // Mozzi Start startMozzi(); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Robotics
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Research & Development (R & D)
Instructor and E-Mentor
- IoT
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
Follow Us
J. Luc Paquin – Curriculum Vitae – 2022 English & Español
https://www.jlpconsultants.com/luc/
Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #23: E-Textiles – Coin Cell Battery – Mk08
——
#DonLucElectronics #DonLuc #ETextiles #Wearable #FLORA #BME280 #CCS811 #CoinCell #RTC #SD #Arduino #Project #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
Coin Cell Battery Holder – 2 x CR2032 (Enclosed)
This is a simple coin cell battery holder that can enclose two CR2032 batteries inside itself, and safely kept closed via two phillips head screws. Each battery holder will run batteries in series, output up to 6V, and is equipped with an On/Off slide switch and two 6″ power wires (one positive and one negative) on the back.
DL2205Mk03
1 x FLORA – Version 1.0a
1 x SparkFun Environmental Combo CCS811/BME280
1 x DS3231 Precision RTC FeatherWing
1 x MicroSD card breakout board+
1 x MicroSD card 8 Gb
1 x CR1220 Coin Cell Battery
1 x LED Red
1 x 220 Ohm
1 x Coin Cell Battery Holder – 2 x CR2032
2 x CR2032 Coin Cell Battery
1 x SparkFun Cerberus USB Cable
FLORA – Version 1.0a
CLK – ICSP 3
DO – ICSP 1
DI – ICSP 4
CS – Digital 10
LER – Digital 6
SCL – Digital 3
SDA – Digital 2
VIN – +5V
VIN – +3.3V
GND – GND
——
DL2205Mk03p.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #23: E-Textiles - Coin Cell Battery - Mk08 23-08 DL2205Mk03p.ino 1 x FLORA - Version 1.0a 1 x SparkFun Environmental Combo CCS811/BME280 1 x DS3231 Precision RTC FeatherWing 1 x MicroSD card breakout board+ 1 x MicroSD card 8 Gb 1 x CR1220 Coin Cell Battery 1 x LED Red 1 x 220 Ohm 1 x Coin Cell Battery Holder - 2 x CR2032 2 x CR2032 Coin Cell Battery 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // Wire #include <Wire.h> // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure #include <SparkFunBME280.h> // SparkFun CCS811 - eCO2 & tVOC #include <SparkFunCCS811.h> // Date and time DS3231 RTC #include <RTClib.h> // Serial Peripheral Interface (SPI) #include <SPI.h> // Secure Digital (SD Card) #include <SD.h> // SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure BME280 myBME280; // Temperature Celsius float BMEtempC = 0; // Humidity float BMEhumid = 0; // Altitude Meters float BMEaltitudeM = 0; // Barometric Pressure float BMEpressure = 0; // SparkFun CCS811 - eCO2 & tVOC // Default I2C Address #define CCS811_ADDR 0x5B CCS811 myCCS811(CCS811_ADDR); // eCO2 float CCS811CO2 = 0; // TVOC float CCS811TVOC = 0; // Date and time functions using a DS3231 RTC RTC_DS3231 RTC; String sDate; String sTime; // Secure Digital (SD Card) const int chipSelect = 10; String zzzzzz = ""; // LED Red const int iLEDR = 6; // Software Version Information String sver = "23-08"; void loop() { // SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure isBME280(); // SparkFun CCS811 - eCO2 & tVOC isCCS811(); // Dates and Time timeRTC(); // MicroSD Card isSD(); // 1 Seconds delay( 1000 ); }
getBME280.ino
// SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure // isBME280 - Temperature, Humidity, Altitude and Barometric Pressure void isBME280(){ // Temperature Celsius BMEtempC = myBME280.readTempC(); // Humidity BMEhumid = myBME280.readFloatHumidity() ; // Altitude Meters BMEaltitudeM = myBME280.readFloatAltitudeMeters(); // Barometric Pressure BMEpressure = myBME280.readFloatPressure(); }
getCCS811.ino
// CCS811 - eCO2 & tVOC // isCCS811 - eCO2 & tVOC void isCCS811(){ // This sends the temperature & humidity data to the CCS811 myCCS811.setEnvironmentalData(BMEhumid, BMEtempC); // Calling this function updates the global tVOC and eCO2 variables myCCS811.readAlgorithmResults(); // eCO2 Concentration CCS811CO2 = myCCS811.getCO2(); // tVOC Concentration CCS811TVOC = myCCS811.getTVOC(); }
getRTCDS3231.ino
// DS3231 Precision RTC // Setup RTC void setupRTC() { // DS3231 Precision RTC RTC.begin(); if (! RTC.begin()) { while (1); } DateTime now = RTC.now(); if (RTC.lostPower()) { // 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 // August 2, 2021 at 13:53:0 you would call: // RTC.adjust(DateTime(2022, 4, 26, 11, 39, 0)); } } // timeRTC void timeRTC() { // DS3231 Precision RTC sDate = ""; sTime = ""; // Date Time DateTime now = RTC.now(); // sData sDate += String(now.year(), DEC); sDate += "/"; sDate += String(now.month(), DEC); sDate += "/"; sDate += String(now.day(), DEC); // sTime sTime += String(now.hour(), DEC); sTime += ":"; sTime += String(now.minute(), DEC); sTime += ":"; sTime += String(now.second(), DEC); }
getSD.ino
// MicroSD Card // MicroSD Setup void setupSD() { // MicroSD Card // See if the card is present and can be initialized: if (!SD.begin(chipSelect)) { // Don't do anything more: while (1); } } // MicroSD Card void isSD() { zzzzzz = ""; // Version|Date|Time|Temperature Celsius|Humidity|Altitude Meters|Barometric Pressure //|eCO2 Concentration|tVOC Concentration| zzzzzz = sver + "|" + sDate + "|" + sTime + "|" + BMEtempC + "|" + BMEhumid + "|" + BMEaltitudeM + "|" + BMEpressure + "|" + CCS811CO2 + "|" + CCS811TVOC + "|"; // Open the file. Note that only one file can be open at a time, // so you have to close this one before opening another. File dataFile = SD.open("DLE22Log.txt", FILE_WRITE); // If the file is available, write to it: if (dataFile) { // Write dataFile.println( zzzzzz ); dataFile.close(); } }
setup.ino
// Setup void setup() { // Delay delay( 100 ); // Set up I2C bus Wire.begin(); // Delay delay( 50 ); // SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure myBME280.begin(); // CCS811 - eCO2 & tVOC myCCS811.begin(); // Setup RTC setupRTC(); //MicroSD Card setupSD(); // LED Red pinMode( iLEDR , OUTPUT); // Turn the LED Red on HIGH digitalWrite( iLEDR , HIGH); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Robotics
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Research & Development (R & D)
Instructor and E-Mentor
- IoT
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
Follow Us
J. Luc Paquin – Curriculum Vitae – 2022 English & Español
https://www.jlpconsultants.com/luc/
Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #23: E-Textiles – MicroSD Card – Mk07
——
#DonLucElectronics #DonLuc #ETextiles #Wearable #FLORA #BME280 #CCS811 #RTC #SD #Arduino #Project #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
MicroSD Card Breakout Board+
Not just a simple breakout board, this microSD adapter goes the extra mile designed for ease of use.
- Onboard 5 Volt – 3 Volt regulator provides 150mA for power-hungry cards.
- 3 Volt level shifting means you can use this with ease on either 3 Volt or 5 Volt systems.
- Uses a proper level shifting chip, not resistors, less problems, and faster read/write access.
- Use 3 or 4 digital pins to read and write 8 Gb of storage.
- Activity LED lights up when the SD card is being read or written.
- Push-push socket with card slightly over the edge of the PCB so its easy to insert and remove.
- Comes with 0.1″ header, unattached, so you can get it on a breadboard or use wires your choice.
To use with an Arduino, connect GND to ground, 5 Volt – 3 Volt to 5 Volt – 3 Volt, CLK to pin 13, DO to pin 12, DI to pin 11, and CS to pin 10. Then you can use the Arduino IDE’s SD library which supports FAT and FAT32 SD cards.
DL2205Mk01
1 x FLORA – Version 1.0a
1 x SparkFun Environmental Combo CCS811/BME280
1 x DS3231 Precision RTC FeatherWing
1 x MicroSD card breakout board+
1 x MicroSD card 8 Gb
1 x CR1220 Coin Cell Battery
1 x LED Red
1 x 220 Ohm
1 x SparkFun Cerberus USB Cable
FLORA – Version 1.0a
CLK – ICSP 3
DO – ICSP 1
DI – ICSP 4
CS – Digital 10
LER – Digital 6
SCL – Digital 3
SDA – Digital 2
VIN – +5V
VIN – +3.3V
GND – GND
——
DL2205Mk01p.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #23: E-Textiles - MicroSD Card - Mk07 23-07 DL2205Mk01p.ino 1 x FLORA - Version 1.0a 1 x SparkFun Environmental Combo CCS811/BME280 1 x DS3231 Precision RTC FeatherWing 1 x MicroSD card breakout board+ 1 x MicroSD card 8 Gb 1 x CR1220 Coin Cell Battery 1 x LED Red 1 x 220 Ohm 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // Wire #include <Wire.h> // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure #include <SparkFunBME280.h> // SparkFun CCS811 - eCO2 & tVOC #include <SparkFunCCS811.h> // Date and time DS3231 RTC #include <RTClib.h> // Serial Peripheral Interface (SPI) #include <SPI.h> // Secure Digital (SD Card) #include <SD.h> // SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure BME280 myBME280; // Temperature Celsius float BMEtempC = 0; // Humidity float BMEhumid = 0; // Altitude Meters float BMEaltitudeM = 0; // Barometric Pressure float BMEpressure = 0; // SparkFun CCS811 - eCO2 & tVOC // Default I2C Address #define CCS811_ADDR 0x5B CCS811 myCCS811(CCS811_ADDR); // eCO2 float CCS811CO2 = 0; // TVOC float CCS811TVOC = 0; // Date and time functions using a DS3231 RTC RTC_DS3231 RTC; String sDate; String sTime; // Secure Digital (SD Card) const int chipSelect = 10; String zzzzzz = ""; // LED Red const int iLEDR = 6; // Software Version Information String sver = "23-07"; void loop() { // SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure isBME280(); // SparkFun CCS811 - eCO2 & tVOC isCCS811(); // Dates and Time timeRTC(); // MicroSD Card isSD(); // 1 Seconds delay( 1000 ); }
getBME280.ino
// SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure // isBME280 - Temperature, Humidity, Altitude and Barometric Pressure void isBME280(){ // Temperature Celsius BMEtempC = myBME280.readTempC(); // Humidity BMEhumid = myBME280.readFloatHumidity() ; // Altitude Meters BMEaltitudeM = myBME280.readFloatAltitudeMeters(); // Barometric Pressure BMEpressure = myBME280.readFloatPressure(); }
getCCS811.ino
// CCS811 - eCO2 & tVOC // isCCS811 - eCO2 & tVOC void isCCS811(){ // This sends the temperature & humidity data to the CCS811 myCCS811.setEnvironmentalData(BMEhumid, BMEtempC); // Calling this function updates the global tVOC and eCO2 variables myCCS811.readAlgorithmResults(); // eCO2 Concentration CCS811CO2 = myCCS811.getCO2(); // tVOC Concentration CCS811TVOC = myCCS811.getTVOC(); }
getRTCDS3231.ino
// DS3231 Precision RTC // Setup RTC void setupRTC() { // DS3231 Precision RTC RTC.begin(); if (! RTC.begin()) { while (1); } DateTime now = RTC.now(); if (RTC.lostPower()) { // 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 // August 2, 2021 at 13:53:0 you would call: // RTC.adjust(DateTime(2022, 4, 26, 11, 39, 0)); } } // timeRTC void timeRTC() { // DS3231 Precision RTC sDate = ""; sTime = ""; // Date Time DateTime now = RTC.now(); // sData sDate += String(now.year(), DEC); sDate += "/"; sDate += String(now.month(), DEC); sDate += "/"; sDate += String(now.day(), DEC); // sTime sTime += String(now.hour(), DEC); sTime += ":"; sTime += String(now.minute(), DEC); sTime += ":"; sTime += String(now.second(), DEC); }
getSD.ino
// MicroSD Card // MicroSD Setup void setupSD() { // MicroSD Card // See if the card is present and can be initialized: if (!SD.begin(chipSelect)) { // Don't do anything more: while (1); } } // MicroSD Card void isSD() { zzzzzz = ""; // Version|Date|Time|Temperature Celsius|Humidity|Altitude Meters|Barometric Pressure //|eCO2 Concentration|tVOC Concentration| zzzzzz = sver + "|" + sDate + "|" + sTime + "|" + BMEtempC + "|" + BMEhumid + "|" + BMEaltitudeM + "|" + BMEpressure + "|" + CCS811CO2 + "|" + CCS811TVOC + "|"; // Open the file. Note that only one file can be open at a time, // so you have to close this one before opening another. File dataFile = SD.open("DLE22Log.txt", FILE_WRITE); // If the file is available, write to it: if (dataFile) { // Write dataFile.println( zzzzzz ); dataFile.close(); } }
setup.ino
// Setup void setup() { // Delay delay( 100 ); // Set up I2C bus Wire.begin(); // Delay delay( 50 ); // SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure myBME280.begin(); // CCS811 - eCO2 & tVOC myCCS811.begin(); // Setup RTC setupRTC(); //MicroSD Card setupSD(); // LED Red pinMode( iLEDR , OUTPUT); // Turn the LED Red on HIGH digitalWrite( iLEDR , HIGH); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Robotics
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Research & Development (R & D)
Instructor and E-Mentor
- IoT
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
Follow Us
J. Luc Paquin – Curriculum Vitae – 2022 English & Español
https://www.jlpconsultants.com/luc/
Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #23: E-Textiles – DS3231 Precision RTC – Mk06
——
#DonLucElectronics #DonLuc #ETextiles #Wearable #FLORA #MicroOLED #BME280 #CCS811 #RTC #Arduino #Project #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
DS3231 Precision RTC FeatherWing
A Feather board without ambition is a Feather board without FeatherWings. This is the DS3231 Precision RTC FeatherWing it adds an extremely accurate I2C-integrated Real Time Clock (RTC) with a Temperature Compensated Crystal Oscillator (TCXO). This RTC is the most precise you can get in a small, low power package.
Most RTCs use an external 32kHz timing crystal that is used to keep time with low current draw. And that’s all well and good, but those crystals have slight drift, particularly when the temperature changes, the temperature changes the oscillation frequency very very very slightly but it does add up. This RTC is in a beefy package because the crystal is inside the chip, and right next to the integrated crystal is a temperature sensor. That sensor compensates for the frequency changes by adding or removing clock ticks so that the timekeeping stays on schedule.
With a CR1220 12mm coin cell plugged into the top of the FeatherWing, you can get years of precision time keeping, even when main power is lost. Great for datalogging and clocks or anything where you need to really know the time.
DL2204Mk06
1 x FLORA – Version 1.0a
1 x SparkFun Micro OLED
1 x SparkFun Environmental Combo CCS811/BME280
1 x DS3231 Precision RTC FeatherWing
1 x CR1220 Coin Cell Battery
1 x RGB Smart NeoPixel
1 x Half-Size Breadboard
1 x SparkFun Cerberus USB Cable
FLORA – Version 1.0a
SDA – Digital 2
SCL – Digital 3
NEO – Digital 6
VIN – +5V
GND – GND
——
DL2204Mk06p.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #23: E-Textiles - DS3231 Precision RTC - Mk06 23-06 DL2204Mk06p.ino 1 x FLORA - Version 1.0a 1 x SparkFun Micro OLED 1 x SparkFun Environmental Combo CCS811/BME280 1 x DS3231 Precision RTC FeatherWing 1 x CR1220 Coin Cell Battery 1 x RGB Smart NeoPixel 1 x Half-Size Breadboard 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // Wire #include <Wire.h> // NeoPixels #include <Adafruit_NeoPixel.h> // SparkFun Micro OLED #include <SFE_MicroOLED.h> // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure #include <SparkFunBME280.h> // SparkFun CCS811 - eCO2 & tVOC #include <SparkFunCCS811.h> // Date and time DS3231 RTC #include <RTClib.h> // NeoPixels // On digital pin 6 #define PIN 6 // NeoPixels NUMPIXELS = 1 #define NUMPIXELS 1 // Pixels Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800); // Red int red = 0; // Green int green = 0; // Blue int blue = 0; // Neopix int iNeo = 0; // Value int zz = 0; // SparkFun Micro OLED #define PIN_RESET 9 #define DC_JUMPER 1 // I2C declaration MicroOLED oled(PIN_RESET, DC_JUMPER); // SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure BME280 myBME280; // Temperature Celsius float BMEtempC = 0; // Humidity float BMEhumid = 0; // Altitude Meters float BMEaltitudeM = 0; // Barometric Pressure float BMEpressure = 0; // SparkFun CCS811 - eCO2 & tVOC // Default I2C Address #define CCS811_ADDR 0x5B CCS811 myCCS811(CCS811_ADDR); // eCO2 float CCS811CO2 = 0; // TVOC float CCS811TVOC = 0; // Date and time functions using a DS3231 RTC RTC_DS3231 RTC; String sDate; String sTime; // Software Version Information String sver = "23-06"; void loop() { // SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure isBME280(); // SparkFun CCS811 - eCO2 & tVOC isCCS811(); // FLORA isFLORA(); // Dates and Time timeRTC(); // Micro OLED isMicroOLED(); }
getBME280.ino
// SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure // isBME280 - Temperature, Humidity, Altitude and Barometric Pressure void isBME280(){ // Temperature Celsius BMEtempC = myBME280.readTempC(); // Humidity BMEhumid = myBME280.readFloatHumidity() ; // Altitude Meters BMEaltitudeM = myBME280.readFloatAltitudeMeters(); // Barometric Pressure BMEpressure = myBME280.readFloatPressure(); }
getCCS811.ino
// CCS811 - eCO2 & tVOC // isCCS811 - eCO2 & tVOC void isCCS811(){ // This sends the temperature & humidity data to the CCS811 myCCS811.setEnvironmentalData(BMEhumid, BMEtempC); // Calling this function updates the global tVOC and eCO2 variables myCCS811.readAlgorithmResults(); // eCO2 Concentration CCS811CO2 = myCCS811.getCO2(); // tVOC Concentration CCS811TVOC = myCCS811.getTVOC(); }
getFLORA.ino
// FLORA // isFLORA void isFLORA() { // FLORA = Temperature Celsius // BMEtempC // FLORA = Temperature Celsius if ( BMEtempC >= 50 ) { // 40 <= Temperature Celsius < 50~~~ zz = 2; isNUMPIXELS(); } else if ( BMEtempC >= 40 ) { // 30 <= Temperature Celsius < 40 zz = 3; isNUMPIXELS(); } else if ( BMEtempC >= 30 ) { // 20 <= Temperature Celsius < 30 zz = 4; isNUMPIXELS(); } else if ( BMEtempC >= 20 ) { // 10 <= Temperature Celsius < 20 zz = 0; isNUMPIXELS(); } else if ( BMEtempC >= 10 ) { // ~~~0 <= Temperature Celsius < 10 zz = 1; isNUMPIXELS(); } }
getMicroOLED.ino
// SparkFun Micro OLED // Setup Micro OLED void setupMicroOLED() { // Initialize the OLED oled.begin(); // Clear the display's internal memory oled.clear(ALL); // Display what's in the buffer (splashscreen) oled.display(); // Delay 1000 ms delay(1000); // Clear the buffer. oled.clear(PAGE); } // Micro OLED void isMicroOLED() { // Text Display BME280 // Clear the display oled.clear(PAGE); // Set cursor to top-left oled.setCursor(0, 0); // Set font to type 0 oled.setFontType(0); // Temperature Celsius oled.print("T: "); oled.print(BMEtempC, 2); oled.setCursor(0, 10); // Humidity oled.print("H: "); oled.print(BMEhumid, 0); oled.setCursor(0, 20); // Altitude Meters oled.print("A: "); oled.print(BMEaltitudeM, 1); oled.setCursor(0, 30); // Barometric Pressure oled.print("P: "); oled.print(BMEpressure, 0); oled.display(); // Delay delay( 2000 ); // Text Display CCS811 // Clear the display oled.clear(PAGE); // Set cursor to top-left oled.setCursor(0, 0); // Set font to type 0 oled.setFontType(0); // Date oled.setCursor(0, 0); oled.print(sDate); // Time oled.setCursor(0, 10); oled.print(sTime); // eCO2 Concentration oled.setCursor(0, 20); oled.print("C: "); oled.print(CCS811CO2, 0); // tVOC Concentration oled.setCursor(0, 30); oled.print("V: "); oled.print(CCS811TVOC, 0); oled.display(); // Delay delay( 2000 ); }
getNeopix.ino
// NeoPixels // Neopix void isNeopix() { // Pixels pixels.setBrightness( 150 ); // Pixels color takes RGB values, from 0,0,0 up to 255,255,255 pixels.setPixelColor( iNeo, pixels.Color(red,green,blue) ); // This sends the updated pixel color to the hardware pixels.show(); // Delay for a period of time (in milliseconds) delay(50); } // isNUMPIXELS void isNUMPIXELS() { // Neopix Value switch ( zz ) { case 0: // NeoPixels Green // Red red = 0; // Green green = 255; // Blue blue = 0; // Neopix iNeo = 0; isNeopix(); break; case 1: // NeoPixels Blue // Red red = 0; // Green green = 0; // Blue blue = 255; // Neopix iNeo = 0; isNeopix(); break; case 2: // NeoPixels Red // Red red = 255; // Green green = 0; // Blue blue = 0; // Neopix iNeo = 0; isNeopix(); break; case 3: // NeoPixels Yellow // Red red = 255; // Green green = 255; // Blue blue = 0; // Neopix iNeo = 0; isNeopix(); break; case 4: // NeoPixels Magenta // Red red = 255; // Green green = 0; // Blue blue = 255; // Neopix iNeo = 0; isNeopix(); break; case 5: // NeoPixels Cyan // Red red = 0; // Green green = 255; // Blue blue = 255; // Neopix iNeo = 0; isNeopix(); break; case 6: // NeoPixels White // Red red = 255; // Green green = 255; // Blue blue = 255; // Neopix iNeo = 0; isNeopix(); break; } } // isNUMPIXELSoff void isNUMPIXELSoff() { // Black Off // NeoPixels // Red red = 0; // Green green = 0; // Blue blue = 0; isNeopix(); }
getRTCDS3231.ino
// DS3231 Precision RTC // Setup RTC void setupRTC() { // DS3231 Precision RTC RTC.begin(); if (! RTC.begin()) { while (1); } DateTime now = RTC.now(); if (RTC.lostPower()) { // 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 // August 2, 2021 at 13:53:0 you would call: // RTC.adjust(DateTime(2022, 4, 26, 11, 39, 0)); } } // timeRTC void timeRTC() { // DS3231 Precision RTC sDate = ""; sTime = ""; // Date Time DateTime now = RTC.now(); // sData sDate += String(now.year(), DEC); sDate += "/"; sDate += String(now.month(), DEC); sDate += "/"; sDate += String(now.day(), DEC); // sTime sTime += String(now.hour(), DEC); sTime += ":"; sTime += String(now.minute(), DEC); sTime += ":"; sTime += String(now.second(), DEC); }
setup.ino
// Setup void setup() { // NeoPixels // This initializes the NeoPixel library pixels.begin(); // Delay for a period of time (in milliseconds) delay(50); // isNUMPIXELS Off isNUMPIXELSoff(); // Set up I2C bus Wire.begin(); // Delay for a period of time (in milliseconds) delay(50); // SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure myBME280.begin(); // CCS811 - eCO2 & tVOC myCCS811.begin(); // Setup RTC setupRTC(); // Setup Micro OLED setupMicroOLED(); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Robotics
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Research & Development (R & D)
- Desktop Applications (Windows, OSX, Linux, Multi-OS, Multi-Tier, etc…)
- Mobile Applications (Android, iOS, Blackberry, Windows Mobile, Windows CE, etc…)
- Web Applications (LAMP, Scripting, Java, ASP, ASP.NET, RoR, Wakanda, etc…)
- Social Media Programming & Integration (Facebook, Twitter, YouTube, Pinterest, etc…)
- Content Management Systems (WordPress, Drupal, Joomla, Moodle, etc…)
- Bulletin Boards (phpBB, SMF, Vanilla, jobberBase, etc…)
- eCommerce (WooCommerce, OSCommerce, ZenCart, PayPal Shopping Cart, etc…)
Instructor and E-Mentor
- IoT
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
- DOS, Windows, OSX, Linux, iOS, Android, Multi-OS
- Linux-Apache-PHP-MySQL
Follow Us
J. Luc Paquin – Curriculum Vitae – 2022 English & Español
https://www.jlpconsultants.com/luc/
Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #22: Synthesizer – Theremin – Mk02
——
#DonLucElectronics #DonLuc #Synthesizer #Theremin #Arduino #ArduinoProMini #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
Theremin
The theremin was invented in 1920 by a Russian physicist named Lev Termen. Today, this marvelous instrument is once again in the musical spotlight. Besides looking like no other instrument, the theremin is unique in that it is played without being touched.
Two antennas protrude from the theremin, one controlling pitch, and the other controlling volume. As a hand approaches the vertical antenna, the pitch gets higher. Approaching the horizontal antenna makes the volume softer. Because there is no physical contact with the instrument, playing the theremin in a precise melodic way requires practiced skill and keen attention to pitch. The electric signals from the theremin are amplified and sent to a loudspeaker.
In the late 1920’s, RCA produced approximately 500 theremins, manufactured by General Electric and Westinghouse. Today, it is estimated that only half of these still exist. The spooky sound of the theremin was used in several movie soundtracks during the 1950’s and 1960’s. Electronic music pioneer Robert Moog built theremins long before he built synthesizers. In the 1960’s, he produced such models as the wedge-shaped Vanguard theremin and the shoebox shaped Moog Melodia theremin. It provided background mood music for such sci-fi classics. During the 60’s and 70’s, bands such as Lothar and the Hand People, the Bonzo Doo Dah Dog Band, and Led Zeppelin brought the theremin into the public eye for a short time.
Theremin + Arduino Pro Mini + Ultrasonic Sensor + Mozzi
Arduino Pro Mini does not come with connectors populated so that you can solder in any connector or wire with any orientation you need. This is the ultrasonic distance sensor. This economical sensor provides 2cm to 400cm of non-contact measurement functionality. The ultrasonic range detectors replace the antenna of the traditional Theremin. Control the frequency (pitch) of the output. Operation of the sensor is straightforward. The Arduino sends a digital pulse to the TRIG pin of the sensor causing it to emit a burst of high frequency audio. If an echo is detected the sensor toggles the ECHO pin which is monitored by the Arduino. By measuring the time delay between the outgoing pulse and returning echo we can calculate the distance. As sound takes 29 microseconds to travel one cm, and must travel out and back, we can divide the time to the echo by 5.8 to get the distance in mm. The project uses the Mozzi audio library to generate a sine table for oscillator which is sent to the output.
DL2203Mk01
1 x Arduino Pro Mini 328 – 5V/16MHz
1 x SparkFun FTDI Basic Breakout – 5V
1 x HC-SR04 Ultrasonic Sensor
1 x Audio Jack 3.5mm
1 x SparkFun Audio Jack Breakout
1 x Hamburger Mini Speaker
1 x Full-Size Breadboard
1 x SparkFun Cerberus USB Cable
Arduino Pro Mini 328 – 5V/16MHz – Receiver
Ech – Digital 13
Tri – Digital 12
SPK – Digital 9
VIN – +5V
GND – GND
DL2203Mk01p.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #22: Synthesizer - Theremin - Mk02 22-02 DL2203Mk01p.ino 1 x Arduino Pro Mini 328 - 5V/16MHz 1 x SparkFun FTDI Basic Breakout - 5V 1 x HC-SR04 Ultrasonic Sensor 1 x Audio Jack 3.5mm 1 x SparkFun Audio Jack Breakout 1 x Hamburger Mini Speaker 1 x Full-Size Breadboard 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // Mozzi #include <MozziGuts.h> // Oscillator template #include <Oscil.h> // Sine table for oscillator #include <tables/sin2048_int8.h> // Rolling Average #include <RollingAverage.h> // Control Delay #include <ControlDelay.h> // Control Rate #define CONTROL_RATE 64 // Echo Cells unsigned int echo_cells_1 = 32; unsigned int echo_cells_2 = 60; unsigned int echo_cells_3 = 127; // Contro lDelay = 2 seconds ControlDelay <128, int> kDelay; // Oscils to compare bumpy to averaged control input Oscil <SIN2048_NUM_CELLS, AUDIO_RATE> aSin0(SIN2048_DATA); Oscil <SIN2048_NUM_CELLS, AUDIO_RATE> aSin1(SIN2048_DATA); Oscil <SIN2048_NUM_CELLS, AUDIO_RATE> aSin2(SIN2048_DATA); Oscil <SIN2048_NUM_CELLS, AUDIO_RATE> aSin3(SIN2048_DATA); // RollingAverage <number_type, how_many_to_average> myThing // How many to average has to be power of 2 RollingAverage <int, 32> kAverage; int averaged; // Trigger pin 12 to pitch distance sensor const int iTrigPitch = 12; // Echo Receive pin 13 to pitch distance sensor const int iEchoPitch = 13; // Stores the distance measured by the distance sensor float distance = 0; // Mini Speaker int SPK = 9; // Set the input for the volume // Volume level from updateControl() to updateAudio() byte vol; // Software Version Information String sver = "22-02"; void loop() { // Audio Hook audioHook(); }
getHC-SR04.ino
// HC-SR04 Ultrasonic Sensor // Setup HC-SR04 void setupHCSR04() { // The trigger iTrig will output pulses of electricity pinMode(iTrigPitch, OUTPUT); // The echo iEcho will measure the duration of pulses coming back from the distance sensor pinMode(iEchoPitch, INPUT); } // Distance float isDistance() { // Variable to store the time it takes for a ping to bounce off an object float echoTime; // Variable to store the distance calculated from the echo time float calculatedDistance; // Send out an ultrasonic pulse that's 10ms long digitalWrite(iTrigPitch, HIGH); delayMicroseconds(10); digitalWrite(iTrigPitch, LOW); // Use the pulseIn command to see how long it takes for the // pulse to bounce back to the sensor echoTime = pulseIn(iEchoPitch, HIGH); // Calculate the distance of the object that reflected the pulse // (half the bounce time multiplied by the speed of sound) // cm = 58.0 calculatedDistance = echoTime / 58.0; // Send back the distance that was calculated return calculatedDistance; }
getMozzi.ino
// Mozzi // Update Control void updateControl(){ // Volume vol = 255; // Variable to store the distance measured by the sensor distance = isDistance(); int bumpy_input = distance; // Averaged averaged = kAverage.next(bumpy_input); aSin0.setFreq(averaged); aSin1.setFreq(kDelay.next(averaged)); aSin2.setFreq(kDelay.read(echo_cells_2)); aSin3.setFreq(kDelay.read(echo_cells_3)); } // Update Audio int updateAudio() { // Update Audio return 3*((int)aSin0.next()+aSin1.next()+(aSin2.next()>>1) +(aSin3.next()>>2)) >>3; }
setup.ino
// Setup void setup() { // Setup HC-SR04 setupHCSR04(); // Echo Cells 1 kDelay.set(echo_cells_1); // Mozzi Start startMozzi(); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Robotics
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Research & Development (R & D)
- Desktop Applications (Windows, OSX, Linux, Multi-OS, Multi-Tier, etc…)
- Mobile Applications (Android, iOS, Blackberry, Windows Mobile, Windows CE, etc…)
- Web Applications (LAMP, Scripting, Java, ASP, ASP.NET, RoR, Wakanda, etc…)
- Social Media Programming & Integration (Facebook, Twitter, YouTube, Pinterest, etc…)
- Content Management Systems (WordPress, Drupal, Joomla, Moodle, etc…)
- Bulletin Boards (phpBB, SMF, Vanilla, jobberBase, etc…)
- eCommerce (WooCommerce, OSCommerce, ZenCart, PayPal Shopping Cart, etc…)
Instructor and E-Mentor
- IoT
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
- DOS, Windows, OSX, Linux, iOS, Android, Multi-OS
- Linux-Apache-PHP-MySQL
Follow Us
J. Luc Paquin – Curriculum Vitae – 2022 English & Español
https://www.jlpconsultants.com/luc/
Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #12: Robotics – LiPower Boost Converter – Mk19
——
#DonLucElectronics #DonLuc #Robotics #Arduino #Fio #ArduinoProMini #XBee #DCMotor #MotorDriver #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
LiPower Boost Converter
The LiPower board is based on the incredibly versatile TPS61200 boost converter. The board is configured to be used with a LiPo battery, has solder jumper selectable 5V and 3.3V output, and an under voltage protection of 2.6V. However, the board can also be used as a general purpose buck and boost regulator with an input voltage as low as 0.3V. With such a low input voltage and quiescent current, the board also works well in energy harvesting applications that use low input voltages.
XBee Explorer Regulated
The XBee Explorer Regulated takes care of the 3.3V regulation, signal conditioning, and basic activity indicators. It translates the 5V serial signals to 3.3V so that you can connect a 5V system to any XBee module. The board was conveniently designed to mate directly with Arduino Pro boards for wireless bootloading and USB based configuration. This unit works with all XBee modules including the Series 1 and Series 2.5, standard and Pro versions. Plug an XBee into this breakout and you will have direct access to the serial and programming pins on the XBee unit and will be able to power the XBee with 5V.
DL2201Mk03
1 x Fio v3 – ATmega32U4
1 x Arduino Pro Mini 328 – 5V/16MHz
1 x SparkFun FTDI Basic Breakout – 5V
1 x LiPower Boost Converter
2 x XBee S1
1 x XBee Explorer Regulated
2 x Lithium Ion Battery – 850mAh
1 x Thumb Joystick
1 x SparkFun Thumb Joystick Breakout
1 x Slide Pot (Small)
1 x Slide Potentiometer Knob
1 x RGB Smart NeoPixel
2 x DRV8835 Dual Motor Driver Carrier
2 x Solarbotics RM2
2 x Pololu Universal Aluminum Mounting Hub 3mm Shaft, #4-40 Holes
2 x Pololu Mini Plastic Gearmotor Bracket Pair – Wide
1 x Half-Size Breadboard
2 x Adafruit Perma-Proto Quarter-Sized Breadboard
1 x SparkFun Cerberus USB Cable
Fio v3 – ATmega32U4 – Transmitter
XBee S1: Transmitter
CH Channel: C
PAN Id: 3333
SH Serial Number: 13A200
SL Serial Number: 40717A1F
CE Coordinator: Coordinator
BD: 9600
RX0 – Digital 0
TX0 – Digital 1
PO0 – Analog A0
JY0 – Analog A1
JY1 – Analog A2
SE0 – Digital 16
VIN – +3.3V
GND – GND
——
DL2201Mk03t.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #12: Robotics - LiPower Boost Converter - Mk19 01-03 DL2201Mk03t.ino 1 x Fio v3 - ATmega32U4 1 x XBee S1 1 x Lithium Ion Battery - 850mAh 1 x Thumb Joystick 1 x SparkFun Thumb Joystick Breakout 1 x Slide Pot (Small) 1 x Slide Potentiometer Knob 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // EEPROM library to read and write EEPROM with unique ID for unit #include <EEPROM.h> // Communication unsigned long dTime = 200; // Slide Pot (Small) // Select the input pin for the slide pot // Power const int iSP1 = A0; // Power to store the value int iPower = 0; // Connections to joystick // Vertical const int VERT = A1; // Horizontal const int HORIZ = A2; // Pushbutton const int SEL = 16; // Initialize variables for analog and digital values int vertical; int horizontal; int select; // Software Version Information // Version String sver = "12-19t"; // Unit ID Information // UID String uid = ""; void loop() { // Thumb Joystick isThumbJoystick(); // Process Message isProcessMessage(); delay( dTime ); }
getEEPROM.ino
// EEPROM // is UID void isUID() { // Is Unit ID // UID uid = ""; for (int x = 0; x < 5; x++) { uid = uid + char(EEPROM.read(x)); } }
getProcessMessage.ino
// Process Message // isProcessMessage void isProcessMessage() { // Loop through serial buffer // Print = "<" + vertical + "|" + horizontal + "|" + select + "|" + iValue + "|" + sver + "|" + uid + "*" Serial1.print( '<' ); Serial1.print( vertical ); Serial1.print( '|' ); Serial1.print( horizontal ); Serial1.print( '|' ); Serial1.print( select ); Serial1.print( '|' ); Serial1.print( iPower ); Serial1.print( '|' ); Serial1.print( sver ); Serial1.print( '|' ); Serial1.print( uid ); Serial1.println( '*' ); }
getThumbJoystick.ino
// Thumb Joystick void isThumbJoystick() { // Read all values from the joystick // Joystick was sitting around 520 for the vertical and horizontal values // Will be 0-1023 vertical = analogRead(VERT); // Will be 0-1023 horizontal = analogRead(HORIZ); // Will be HIGH (1) if not pressed, and LOW (0) if pressed select = digitalRead(SEL); // Read the value // Power be 0-1023 iPower = analogRead( iSP1 ); }
setup.ino
// Setup void setup() { // EEPROM Unit ID isUID(); // Pause delay(5); // Make the SEL line an input pinMode(SEL, INPUT_PULLUP); // Open Serial1 port at 9600 baud Serial1.begin( 9600 ); // Pause delay(5); }
——
Arduino Pro Mini 328 – 5V/16MHz – Receiver
XBee S1: Receiver
CH Channel: C
PAN Id: 3333
SH Serial Number: 13A200
SL Serial Number: 4076E2C5
CE Coordinator: End Device
BD: 9600
RX0 – Digital 0
TX0 – Digital 1
M11 – Digital 2
M12 – Digital 3
M21 – Digital 4
M22 – Digital 5
NEO – Digital 6
VIN – +5V
GND – GND
——
DL2201Mk03r.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #12: Robotics - LiPower Boost Converter - Mk19 01-03 DL2201Mk03r.ino 1 x Arduino Pro Mini 328 - 5V/16MHz 1 x SparkFun FTDI Basic Breakout - 5V 1 x XBee S1 1 x XBee Explorer Regulated 1 x LiPower Boost Converter 1 x Lithium Ion Battery - 850mAh 1 x RGB Smart NeoPixel 2 x DRV8835 Dual Motor Driver Carrier 2 x Solarbotics RM2 2 x Pololu Universal Aluminum Mounting Hub 3mm Shaft, #4-40 Holes 2 x Pololu Mini Plastic Gearmotor Bracket Pair - Wide 1 x Half-Size Breadboard 2 x Adafruit Perma-Proto Quarter-Sized Breadboard 1 x SparkFun Cerberus USB Cable */ // Include the library code: // EEPROM library to read and write EEPROM with unique ID for unit #include <EEPROM.h> // NeoPixels #include <Adafruit_NeoPixel.h> // Solarbotics RM2 -> 1 #define MOTOR1_IN1 2 #define MOTOR1_IN2 3 // Solarbotics RM2 -> 2 #define MOTOR2_IN1 4 #define MOTOR2_IN2 5 // Power be 0-1023 int iPower = 0; String POW = ""; // Joystick was sitting around 520 for the vertical and horizontal values // Will be 0-1023 // Vertical int vertical; String VER = ""; // Horizontal // Will be 0-1023 int horizontal; String HOR = ""; // Select // Will be HIGH (1) if not pressed, and LOW (0) if pressed int select1 = 0; String SEL = ""; int firstClosingBracket = 0; // Map Vertical and Horizontal int mapVer = 0; int mapHor = 0; int iVer = 1; int iHor = 0; // NeoPixels // On digital pin 6 #define PIN 6 // NeoPixels NUMPIXELS = 1 #define NUMPIXELS 1 // Pixels Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800); // Red int red = 0; // Green int green = 0; // Blue int blue = 0; // Neopix int iNeo = 0; // Value int zz = 0; // Process Message // Start bool bStart = false; // End bool bEnd = false; // Variable to store the incoming byte int incb = 0; // Message String msg = ""; // Index byte in = 0; int x = 0; // Software Version Information String sver = "12-19r"; // Unit ID information String uid = ""; void loop() { // Check for serial messages isProcessMessage(); }
getEEPROM.ino
// EEPROM // isUID void isUID() { // Is Unit ID uid = ""; for (int x = 0; x < 5; x++) { uid = uid + char(EEPROM.read(x)); } }
getNeopix.ino
// NeoPixels // Neopix void isNeopix() { // Pixels pixels.setBrightness( 130 ); // Pixels color takes RGB values, from 0,0,0 up to 255,255,255 pixels.setPixelColor( iNeo, pixels.Color(red,green,blue) ); // This sends the updated pixel color to the hardware pixels.show(); // Delay for a period of time (in milliseconds) delay(50); } // isNUMPIXELS void isNUMPIXELS() { // Neopix Value switch ( zz ) { case 0: // NeoPixels Green // Red red = 0; // Green green = 255; // Blue blue = 0; // Neopix iNeo = 0; isNeopix(); break; case 1: // NeoPixels Blue // Red red = 0; // Green green = 0; // Blue blue = 255; // Neopix iNeo = 0; isNeopix(); break; case 2: // NeoPixels Red // Red red = 255; // Green green = 0; // Blue blue = 0; // Neopix iNeo = 0; isNeopix(); break; case 3: // NeoPixels Yellow // Red red = 255; // Green green = 255; // Blue blue = 0; // Neopix iNeo = 0; isNeopix(); break; case 4: // NeoPixels Magenta // Red red = 255; // Green green = 0; // Blue blue = 255; // Neopix iNeo = 0; isNeopix(); break; case 5: // NeoPixels Cyan // Red red = 0; // Green green = 255; // Blue blue = 255; // Neopix iNeo = 0; isNeopix(); break; case 6: // NeoPixels White // Red red = 255; // Green green = 255; // Blue blue = 255; // Neopix iNeo = 0; isNeopix(); break; } } // isNUMPIXELSoff void isNUMPIXELSoff() { // Black Off // NeoPixels // Red red = 0; // Green green = 0; // Blue blue = 0; isNeopix(); }
getProcessMessage.ino
// ProcessMessage // isProcessMessage void isProcessMessage() { // Loop through serial buffer one byte at a time until you reach * which will be end of message while ( Serial.available() > 0 ) { // Read the incoming byte: incb = Serial.read(); // Start the message when the '<' symbol is received if(incb == '<') { // Start bStart = true; in = 0; msg = ""; } // End the message when the '*' symbol is received else if(incb == '*') { // End bEnd = true; x = msg.length(); msg.remove( x , 1); // Done reading break; } // Read the message else { // Message msg = msg + char(incb); in++; } } // Start - End if( bStart && bEnd) { // isRM2Motor => Message isRM2Motor(); // Start - End in = 0; msg = ""; bStart = false; bEnd = false; vertical; horizontal; iPower; } }
getRM2Motor.ino
// RM2 Motor // Setup RM2 Motor void isSetupRM2Motor() { // Solarbotics RM2 -> 1 pinMode(MOTOR1_IN1, OUTPUT); pinMode(MOTOR1_IN2, OUTPUT); // Solarbotics RM2 -> 2 pinMode(MOTOR2_IN1, OUTPUT); pinMode(MOTOR2_IN2, OUTPUT); } // isRM2Motor void isRM2Motor() { // msg = vertical + "|" + horizontal + "|" + select + "|" + iValue + "|" + sver + "|" + uid firstClosingBracket = 0; // Vertical firstClosingBracket = msg.indexOf('|'); VER = msg; VER.remove(firstClosingBracket); vertical = VER.toInt(); // Horizontal firstClosingBracket = firstClosingBracket + 1; msg.remove(0, firstClosingBracket ); firstClosingBracket = msg.indexOf('|'); HOR = msg; HOR.remove(firstClosingBracket); horizontal = HOR.toInt(); // Select firstClosingBracket = firstClosingBracket + 1; msg.remove(0, firstClosingBracket ); firstClosingBracket = msg.indexOf('|'); SEL = msg; SEL.remove(firstClosingBracket); select1 = SEL.toInt(); // Power firstClosingBracket = firstClosingBracket + 1; msg.remove(0, firstClosingBracket ); firstClosingBracket = msg.indexOf('|'); POW = msg; POW.remove(firstClosingBracket); iPower = POW.toInt(); // Set the direction // Joystick was sitting around 520 for the vertical and horizontal values // Will be 0-1023 mapVer = map(vertical, 0, 1023, -512, 512); mapHor = map(horizontal, 0, 1023, -512, 512); // Power iPower = map(iPower, 0, 1023, 30, 200); // Vertical and Horizontal if ( mapVer == -512 ) { // Down // NeoPixels Blue zz = 1; isNUMPIXELS(); iVer = 1; } else if ( mapVer == 512 ) { // Up // NeoPixels Green zz = 0; isNUMPIXELS(); iVer = 2; } else if ( mapHor == -512 ) { // Left // NeoPixels Yellow zz = 3; isNUMPIXELS(); iVer = 3; } else if ( mapHor == 512 ) { // Right // NeoPixels Magenta zz = 4; isNUMPIXELS(); iVer = 4; } else { // Stop // NeoPixels Red zz = 2; isNUMPIXELS(); iVer = 5; } // XBee Car switch ( iVer ) { case 1: // Solarbotics RM2 -> 1 Forward digitalWrite(MOTOR1_IN1, LOW); analogWrite(MOTOR1_IN2, iPower); delay(10); // Solarbotics RM2 -> 2 Forward digitalWrite(MOTOR2_IN1, LOW); analogWrite(MOTOR2_IN2, iPower); delay(10); break; case 2: // Solarbotics RM2 -> 1 Backward digitalWrite(MOTOR1_IN2, LOW); analogWrite(MOTOR1_IN1, iPower); delay(10); // Solarbotics RM2 -> 2 Backward digitalWrite(MOTOR2_IN2, LOW); analogWrite(MOTOR2_IN1, iPower); delay(10); break; case 3: // Right // Solarbotics RM2 -> 1 Forward digitalWrite(MOTOR1_IN1, LOW); analogWrite(MOTOR1_IN2, iPower); delay(10); // Solarbotics RM2 -> 2 Backward digitalWrite(MOTOR2_IN2, LOW); analogWrite(MOTOR2_IN1, iPower); delay(10); break; case 4: // Left // Solarbotics RM2 -> 1 Backward digitalWrite(MOTOR1_IN2, LOW); analogWrite(MOTOR1_IN1, iPower); delay(10); // Solarbotics RM2 -> 2 Forward digitalWrite(MOTOR2_IN1, LOW); analogWrite(MOTOR2_IN2, iPower); delay(10); break; case 5: // Stop // NeoPixels Red //zz = 2; //isNUMPIXELS(); // Solarbotics RM2 -> 1 digitalWrite(MOTOR1_IN1, LOW); analogWrite(MOTOR1_IN2, 0); delay(10); // Solarbotics RM2 -> 2 digitalWrite(MOTOR2_IN1, LOW); analogWrite(MOTOR2_IN2, 0); delay(10); break; } }
setup.ino
// Setup void setup() { // Open the serial port at 9600 bps: Serial.begin( 9600 ); // Pause delay(5); // EEPROM Unit ID isUID(); // Pause delay(5); // Setup Solarbotics RM2 Motor isSetupRM2Motor(); // Pause delay(5); // NeoPixels // This initializes the NeoPixel library pixels.begin(); // Delay for a period of time (in milliseconds) delay(50); // isNUMPIXELS Off isNUMPIXELSoff(); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Robotics
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Research & Development (R & D)
- Desktop Applications (Windows, OSX, Linux, Multi-OS, Multi-Tier, etc…)
- Mobile Applications (Android, iOS, Blackberry, Windows Mobile, Windows CE, etc…)
- Web Applications (LAMP, Scripting, Java, ASP, ASP.NET, RoR, Wakanda, etc…)
- Social Media Programming & Integration (Facebook, Twitter, YouTube, Pinterest, etc…)
- Content Management Systems (WordPress, Drupal, Joomla, Moodle, etc…)
- Bulletin Boards (phpBB, SMF, Vanilla, jobberBase, etc…)
- eCommerce (WooCommerce, OSCommerce, ZenCart, PayPal Shopping Cart, etc…)
Instructor and E-Mentor
- IoT
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
- DOS, Windows, OSX, Linux, iOS, Android, Multi-OS
- Linux-Apache-PHP-MySQL
Follow Us
J. Luc Paquin – Curriculum Vitae – 2021 English & Español
https://www.jlpconsultants.com/luc/
Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #15: Environment – ChronoDot – Mk16
——
#DonLucElectronics #DonLuc #Environment #MQ #PIR #RHT03 #RTC #ArduinoUNO #Arduino #AdafruitPowerBoost #Project #Programming #Electronics #Microcontrollers #Consultant #VideoBlog
——
——
——
——
——
ChronoDot – Ultra-Precise Real Time Clock – v2.1
The ChronoDot RTC is an extremely accurate real time clock module, based on the DS3231 temperature compensated RTC. It includes a CR1632 battery, which should last at least 8 years if the I2C interface is only used while the device has 5V power available. No external crystal or tuning capacitors are required.
The top side of the Chronodot now features a battery holder for 16mm 3V lithium coin cells. It pairs particularly well with CR1632 batteries. The DS3231 has an internal crystal and a switched bank of tuning capacitors. The temperature of the crystal is continously monitored, and the capacitors are adjusted to maintain a stable frequency. Other RTC solutions may drift minutes per month, especially in extreme temperature ranges…the ChronoDot will drift less than a minute per year. This makes the ChronoDot very well suited for time critical applications that cannot be regularly synchronized to an external clock.
DL2110Mk03
1 x Arduino UNO – R3
1 x ProtoScrewShield
1 x RGB LCD Shield 16×2 Character Negative Display
1 x ChronoDot – Ultra-Precise Real Time Clock – v2.1
1 x Adafruit PowerBoost 500 Shield
1 x Lithium Ion Battery – 3.7v 2000mAh
4 x Pololu Carrier for MQ Gas Sensors
1 x SparkFun Hydrogen Gas Sensor – MQ-8
1 x 4.7K Ohm
1 x Pololu Carbon Monoxide & Flammable Gas Sensor – MQ-9
1 x 22k Ohm
1 x SparkFun Carbon Monoxide Gas Sensor – MQ-7
1 x 10K Ohm
1 x SparkFun Alcohol Gas Sensor – MQ-3
1 x 220k Ohm
1 x Temperature and Humidity Sensor- RHT03
1 x PIR Motion Sensor (JST)
1 x SparkFun Solderable Half-Breadboard
1 x Half-Breadboard
1 x SparkFun Cerberus USB Cable
Arduino UNO – R3
RHT – Digital 5
PIR – Digital 7
MQ8 – Analog 0
MQ9 – Analog 1
MQ7 – Analog 2
MQ3 – Analog 3
SDA – Analog 4
SCL – Analog 5
VIN – +5V
GND – GND
——
DL2110Mk03p.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #15: Environment – ChronoDot – Mk16 10-03 DL2110Mk03p.ino 1 x Arduino UNO - R3 1 x ProtoScrewShield 1 x RGB LCD Shield 16x2 Character Negative Display 1 x ChronoDot - Ultra-Precise Real Time Clock - v2.1 1 x Adafruit PowerBoost 500 Shield 1 x Lithium Ion Battery - 3.7v 2000mAh 4 x Pololu Carrier for MQ Gas Sensors 1 x SparkFun Hydrogen Gas Sensor - MQ-8 1 x 4.7K Ohm 1 x Pololu Carbon Monoxide & Flammable Gas Sensor - MQ-9 1 x 22k Ohm 1 x SparkFun Carbon Monoxide Gas Sensor - MQ-7 1 x 10K Ohm 1 x SparkFun Alcohol Gas Sensor - MQ-3 1 x 220k Ohm 1 x Temperature and Humidity Sensor - RHT03 1 x PIR Motion Sensor (JST) 1 x SparkFun Solderable Half-Breadboard 1 x Half-Breadboard 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // EEPROM Library to Read and Write EEPROM with Unique ID for Unit #include <EEPROM.h> // RHT Temperature and Humidity Sensor #include <SparkFun_RHT03.h> // Adafruit RGB LCD Shield 16x2 #include <Adafruit_RGBLCDShield.h> // Wire #include <Wire.h> // DS3231 RTC Date and Time #include <RTClib.h> // RHT Temperature and Humidity Sensor // RHT03 data pin Digital 5 const int RHT03_DATA_PIN = 5; // This creates a RTH03 object, which we'll use to interact with the sensor RHT03 rht; float latestHumidity; float latestTempC; // Gas Sensors MQ // Hydrogen Gas Sensor - MQ-8 int iMQ8 = A0; int iMQ8Raw = 0; int iMQ8ppm = 0; // Two points are taken from the curve in datasheet. // With these two points, a line is formed which is // "approximately equivalent" to the original curve. float H2Curve[3] = {2.3, 0.93,-1.44}; // Carbon Monoxide & Flammable Gas Sensor - MQ-9 int iMQ9 = A1; int iMQ9Raw = 0; int iMQ9ppm = 0; // Carbon Monoxide Gas Sensor - MQ-7 int iMQ7 = A2; int iMQ7Raw = 0; int iMQ7ppm = 0; // Alcohol Gas Sensor - MQ-3 int iMQ3 = A3; int iMQ3Raw = 0; int iMQ3ppm = 0; // PIR Motion // Motion detector const int iMotion = 7; // Proximity int proximity = LOW; String Det = ""; // Adafruit RGB LCD Shield Adafruit_RGBLCDShield RGBLCDShield = Adafruit_RGBLCDShield(); // These #defines make it easy to set the backlight color #define OFF 0x0 #define RED 0x1 #define YELLOW 0x3 #define GREEN 0x2 #define TEAL 0x6 #define BLUE 0x4 #define VIOLET 0x5 #define WHITE 0x7 // Momentary Button int yy = 0; uint8_t momentaryButton = 0; // DS3231 RTC Date and Time RTC_DS3231 rtc; String sDate; String sTime; // Software Version Information String uid = ""; // Version String sver = "15-16"; void loop() { // Adafruit RGB LCD Shield // Clear RGBLCDShield.clear(); // RHT Temperature and Humidity Sensor isRHT03(); // Gas Sensors MQ isGasSensor(); // isPIR Motion isPIR(); // DS3231 RTC Date and Time isRTC(); // Adafruit RGB LCD Shield // Display isDisplay(); // Delay // Turn the LED on HIGH is the voltage level digitalWrite(LED_BUILTIN, HIGH); // Wait for a 0.5 second delay( 500 ); // Turn the LED off by making the voltage LOW digitalWrite(LED_BUILTIN, LOW); // Wait for a 0.5 second delay( 500 ); }
getEEPROM.ino
// EEPROM // isUID EEPROM Unique ID void isUID() { // Is Unit ID uid = ""; for (int x = 0; x < 5; x++) { uid = uid + char(EEPROM.read(x)); } }
getGasSensorMQ.ino
// Gas Sensors MQ // Gas Sensor void isGasSensor() { // Read in analog value from each gas sensors // Hydrogen Gas Sensor - MQ-8 iMQ8Raw = analogRead( iMQ8 ); // Carbon Monoxide & Flammable Gas Sensor - MQ-9 iMQ9Raw = analogRead( iMQ9 ); // Carbon Monoxide Gas Sensor - MQ-7 iMQ7Raw = analogRead( iMQ7 ); // Alcohol Gas Sensor - MQ-3 iMQ3Raw = analogRead( iMQ3 ); // Caclulate the PPM of each gas sensors // Hydrogen Gas Sensor - MQ-8 iMQ8ppm = isMQ8( iMQ8Raw ); // Carbon Monoxide & Flammable Gas Sensor - MQ-9 iMQ9ppm = isMQ9( iMQ9Raw ); // Carbon Monoxide Gas Sensor - MQ-7 iMQ7ppm = isMQ7( iMQ7Raw ); // Alcohol Gas Sensor - MQ-3 iMQ3ppm = isMQ3( iMQ3Raw ); } // Hydrogen Gas Sensor - MQ-8 - PPM int isMQ8(double rawValue) { // RvRo double RvRo = rawValue * (3.3 / 1023); return (pow(4.7,( ((log(RvRo)-H2Curve[1])/H2Curve[2]) + H2Curve[0]))); } // Carbon Monoxide & Flammable Gas Sensor - MQ-9 int isMQ9(double rawValue) { double RvRo = rawValue * 3.3 / 4095; double ppm = 3.027*exp(1.0698*( RvRo )); return ppm; } // Carbon Monoxide Gas Sensor - MQ-7 int isMQ7(double rawValue) { double RvRo = rawValue * 3.3 / 4095; double ppm = 3.027*exp(1.0698*( RvRo )); return ppm; } // Alcohol Gas Sensor - MQ-3 int isMQ3(double rawValue) { double RvRo = rawValue * 3.3 / 4095; double bac = RvRo * 0.21; return bac; }
getPIR.ino
// PIR Motion // Setup PIR void setupPIR() { // Setup PIR Montion pinMode(iMotion, INPUT_PULLUP); } // isPIR Motion void isPIR() { // Proximity proximity = digitalRead(iMotion); if (proximity == LOW) { // PIR Motion Sensor's LOW, Motion is detected Det = "Motion Yes"; } else { // PIR Motion Sensor's HIGH Det = "No"; } }
getRGBLCDShield.ino
// Adafruit RGB LCD Shield // Setup RGB LCD Shield void isSetupRGBLCDShield() { // Adafruit RGB LCD Shield // Set up the LCD's number of columns and rows: RGBLCDShield.begin(16, 2); // Set the cursor to column 0, line 0 RGBLCDShield.setBacklight(RED); // Don luc RGBLCDShield.setCursor(0,0); RGBLCDShield.print("Don Luc"); // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); // Electronics RGBLCDShield.print("Electronics"); // Delay delay(5000); // Clear RGBLCDShield.clear(); // Set the cursor to column 0, line 0 RGBLCDShield.setBacklight(TEAL); // Version RGBLCDShield.setCursor(0,0); RGBLCDShield.print("Version: " + sver); // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); // Unit ID RGBLCDShield.print("Unit ID: " + uid); // Delay delay(5000); // Clear RGBLCDShield.clear(); } // isDisplay void isDisplay() { // Momentary Button momentaryButton = RGBLCDShield.readButtons(); switch ( yy ) { case 1: // RHT Temperature and Humidity Sensor // Set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); // Temperature C RGBLCDShield.print( "Temp C: " ); RGBLCDShield.print( latestTempC ); // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); // Humidity RGBLCDShield.print( "Humidity: " ); RGBLCDShield.print( latestHumidity ); break; case 2: // PIR Motion Sensor // Set the cursor to column 0, line 0 // PIR Motion Sensor RGBLCDShield.setCursor(0,0); RGBLCDShield.print( "PIR Motion" ); // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); // Det RGBLCDShield.print( Det ); break; case 3: // Gas Sensors 1 // Set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); // Hydrogen Gas Sensor - MQ-8 RGBLCDShield.print( "MQ-8: " ); RGBLCDShield.print( iMQ8ppm ); // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); // Carbon Monoxide & Flammable Gas Sensor - MQ-9 RGBLCDShield.print( "MQ-9: " ); RGBLCDShield.print( iMQ9ppm ); break; case 4: // Gas Sensors 2 // Set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); // Carbon Monoxide Gas Sensor - MQ-7 RGBLCDShield.print( "MQ-7: " ); RGBLCDShield.print( iMQ7ppm ); // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); // Alcohol Gas Sensor - MQ-3 RGBLCDShield.print( "MQ-3: " ); RGBLCDShield.print( iMQ3ppm ); break; case 5: // DS3231 RTC Date and Time // Date and Time DateTime now = rtc.now(); // Set the cursor to column 0, line 0 // Date RGBLCDShield.setCursor(0,0); RGBLCDShield.print( sDate ); // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); // Time RGBLCDShield.print( sTime ); break; default: // Don luc Electronics yy = 5; RGBLCDShield.setBacklight(RED); // Set the cursor to column 0, line 0 // Don luc RGBLCDShield.setCursor(0,0); RGBLCDShield.print("Don Luc"); // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); // Electronics RGBLCDShield.print("Electronics"); } if ( momentaryButton ) { if ( momentaryButton & BUTTON_UP ) { yy = 1; // RHT Temperature and Humidity Sensor RGBLCDShield.setBacklight(GREEN); } if ( momentaryButton & BUTTON_DOWN ) { yy = 2; // PIR Motion Sensor RGBLCDShield.setBacklight(VIOLET); } if ( momentaryButton & BUTTON_LEFT ) { yy = 3; // Gas Sensors 1 RGBLCDShield.setBacklight(TEAL); } if ( momentaryButton & BUTTON_RIGHT ) { yy = 4; // Gas Sensors 2 RGBLCDShield.setBacklight(YELLOW); } if ( momentaryButton & BUTTON_SELECT ) { yy = 5; // DS3231 RTC Date and Time RGBLCDShield.setBacklight(WHITE); } } }
getRHT.ino
// RHT Temperature and Humidity Sensor // setup RHT Temperature and Humidity Sensor void setupRTH03() { // RHT Temperature and Humidity Sensor // Call rht.begin() to initialize the sensor and our data pin rht.begin(RHT03_DATA_PIN); } // RHT Temperature and Humidity 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 latestHumidity = rht.humidity(); latestTempC = rht.tempC(); }
getRTC.ino
// DS3231 RTC Date and Time // Setup DS3231 RTC void isSetupRTC() { if (! rtc.begin()) { while (1); } if (rtc.lostPower()) { // 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(2014, 1, 21, 3, 0, 0)); } } // DS3231 RTC Date and Time void isRTC(){ // Date and Time sDate = ""; sTime = ""; // Date Time DateTime now = rtc.now(); // sData sDate += String(now.year(), DEC); sDate += "/"; sDate += String(now.month(), DEC); sDate += "/"; sDate += String(now.day(), DEC); // sTime sTime += String(now.hour(), DEC); sTime += ":"; sTime += String(now.minute(), DEC); sTime += ":"; sTime += String(now.second(), DEC); }
setup.ino
// Setup void setup() { // EEPROM Unique ID isUID(); // RHT Temperature and Humidity Sensor // Setup RTH03 Temperature and Humidity Sensor setupRTH03(); // PIR Motion // Setup PIR setupPIR(); // Setup DS3231 RTC isSetupRTC(); // Initialize digital pin LED_BUILTIN as an output. pinMode(LED_BUILTIN, OUTPUT); // Adafruit RGB LCD Shield isSetupRGBLCDShield(); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Robotics
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Research & Development (R & D)
- Desktop Applications (Windows, OSX, Linux, Multi-OS, Multi-Tier, etc…)
- Mobile Applications (Android, iOS, Blackberry, Windows Mobile, Windows CE, etc…)
- Web Applications (LAMP, Scripting, Java, ASP, ASP.NET, RoR, Wakanda, etc…)
- Social Media Programming & Integration (Facebook, Twitter, YouTube, Pinterest, etc…)
- Content Management Systems (WordPress, Drupal, Joomla, Moodle, etc…)
- Bulletin Boards (phpBB, SMF, Vanilla, jobberBase, etc…)
- eCommerce (WooCommerce, OSCommerce, ZenCart, PayPal Shopping Cart, etc…)
Instructor and E-Mentor
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
- DOS, Windows, OSX, Linux, iOS, Android, Multi-OS
- Linux-Apache-PHP-MySQL
Follow Us
J. Luc Paquin – Curriculum Vitae – 2021 English & Español
https://www.jlpconsultants.com/luc/
Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Web: https://www.donluc.com/DLE/
Web: https://www.donluc.com/DLHackster/
Web: https://www.hackster.io/neosteam-labs
Web: https://zoom.us/
Patreon: https://www.patreon.com/DonLucElectronics
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #15: Environment – RGB LCD Shield 16×2 Character Display – Mk15
——
#DonLucElectronics #DonLuc #Environment #MQ #PIR #RHT03 #ArduinoUNO #Arduino #AdafruitPowerBoost #Project #Programming #Electronics #Microcontrollers #Consultant #VideoBlog
——
——
——
——
——
RGB LCD Shield 16×2 Character Negative Display
With this in mind, we wanted to make it easier for people to get these LCD into their projects so we devised a shield that lets you control a 16×2 Character LCD, up to 3 backlight pins AND 5 keypad pins using only the two I2C pins on the Arduino. The shield is designed for Arduinos Uno. It uses the I2C pins at Analog 4 and Analog 5.
At this time, the library and shield can control the RGB backlight of our character LCDs by turning each LED on or off. This means you can display the following colors: Red, Yellow, Green, Teal, Blue, Violet, White and all off. This shield is perfect for when you want to build a stand-alone project with its own user interface. The 4 directional buttons plus select button allows basic control without having to attach a bulky computer.
Adjusting Contrast
The shield uses a character LCD with an external contrast potentiometer. The first time you use it, adjust the potentiometer in the bottom right until you see the text clearly.
DL2110Mk02
1 x Arduino UNO – R3
1 x ProtoScrewShield
1 x RGB LCD Shield 16×2 Character Negative Display
1 x Adafruit PowerBoost 500 Shield
1 x Lithium Ion Battery – 3.7v 2000mAh
4 x Pololu Carrier for MQ Gas Sensors
1 x SparkFun Hydrogen Gas Sensor – MQ-8
1 x 4.7K Ohm
1 x Pololu Carbon Monoxide & Flammable Gas Sensor – MQ-9
1 x 22k Ohm
1 x SparkFun Carbon Monoxide Gas Sensor – MQ-7
1 x 10K Ohm
1 x SparkFun Alcohol Gas Sensor – MQ-3
1 x 220k Ohm
1 x Temperature and Humidity Sensor- RHT03
1 x PIR Motion Sensor (JST)
1 x SparkFun Solderable Half-Breadboard
1 x SparkFun Cerberus USB Cable
Arduino UNO – R3
RHT – Digital 5
PIR – Digital 7
MQ8 – Analog 0
MQ9 – Analog 1
MQ7 – Analog 2
MQ3 – Analog 3
SDA – Analog 4
SCL – Analog 5
VIN – +5V
GND – GND
DL2110Mk02p.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #15: Environment – RGB LCD Shield 16x2 Character Display – Mk15 10-02 DL2110Mk02p.ino 1 x Arduino UNO - R3 1 x ProtoScrewShield 1 x RGB LCD Shield 16x2 Character Negative Display 1 x Adafruit PowerBoost 500 Shield 1 x Lithium Ion Battery - 3.7v 2000mAh 4 x Pololu Carrier for MQ Gas Sensors 1 x SparkFun Hydrogen Gas Sensor - MQ-8 1 x 4.7K Ohm 1 x Pololu Carbon Monoxide & Flammable Gas Sensor - MQ-9 1 x 22k Ohm 1 x SparkFun Carbon Monoxide Gas Sensor - MQ-7 1 x 10K Ohm 1 x SparkFun Alcohol Gas Sensor - MQ-3 1 x 220k Ohm 1 x Temperature and Humidity Sensor - RHT03 1 x PIR Motion Sensor (JST) 1 x SparkFun Solderable Half-Breadboard 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // EEPROM Library to Read and Write EEPROM with Unique ID for Unit #include <EEPROM.h> // RHT Temperature and Humidity Sensor #include <SparkFun_RHT03.h> // Adafruit RGB LCD Shield 16x2 #include <Adafruit_RGBLCDShield.h> // RHT Temperature and Humidity Sensor // RHT03 data pin Digital 5 const int RHT03_DATA_PIN = 5; // This creates a RTH03 object, which we'll use to interact with the sensor RHT03 rht; float latestHumidity; float latestTempC; // Gas Sensors MQ // Hydrogen Gas Sensor - MQ-8 int iMQ8 = A0; int iMQ8Raw = 0; int iMQ8ppm = 0; // Two points are taken from the curve in datasheet. // With these two points, a line is formed which is // "approximately equivalent" to the original curve. float H2Curve[3] = {2.3, 0.93,-1.44}; // Carbon Monoxide & Flammable Gas Sensor - MQ-9 int iMQ9 = A1; int iMQ9Raw = 0; int iMQ9ppm = 0; // Carbon Monoxide Gas Sensor - MQ-7 int iMQ7 = A2; int iMQ7Raw = 0; int iMQ7ppm = 0; // Alcohol Gas Sensor - MQ-3 int iMQ3 = A3; int iMQ3Raw = 0; int iMQ3ppm = 0; // PIR Motion // Motion detector const int iMotion = 7; // Proximity int proximity = LOW; String Det = ""; // Adafruit RGB LCD Shield Adafruit_RGBLCDShield RGBLCDShield = Adafruit_RGBLCDShield(); // These #defines make it easy to set the backlight color #define OFF 0x0 #define RED 0x1 #define YELLOW 0x3 #define GREEN 0x2 #define TEAL 0x6 #define BLUE 0x4 #define VIOLET 0x5 #define WHITE 0x7 // Momentary Button int yy = 0; uint8_t momentaryButton = 0; // Software Version Information String uid = ""; // Version String sver = "15-15"; void loop() { // Adafruit RGB LCD Shield // Clear RGBLCDShield.clear(); // RHT Temperature and Humidity Sensor isRHT03(); // Gas Sensors MQ isGasSensor(); // isPIR Motion isPIR(); // Adafruit RGB LCD Shield // Display isDisplay(); // Delay // Turn the LED on HIGH is the voltage level digitalWrite(LED_BUILTIN, HIGH); // Wait for a 0.5 second delay( 500 ); // Turn the LED off by making the voltage LOW digitalWrite(LED_BUILTIN, LOW); // Wait for a 0.5 second delay( 500 ); }
getEEPROM.ino
// EEPROM // isUID EEPROM Unique ID void isUID() { // Is Unit ID uid = ""; for (int x = 0; x < 5; x++) { uid = uid + char(EEPROM.read(x)); } }
getGasSensorMQ.ino
// Gas Sensors MQ // Gas Sensor void isGasSensor() { // Read in analog value from each gas sensors // Hydrogen Gas Sensor - MQ-8 iMQ8Raw = analogRead( iMQ8 ); // Carbon Monoxide & Flammable Gas Sensor - MQ-9 iMQ9Raw = analogRead( iMQ9 ); // Carbon Monoxide Gas Sensor - MQ-7 iMQ7Raw = analogRead( iMQ7 ); // Alcohol Gas Sensor - MQ-3 iMQ3Raw = analogRead( iMQ3 ); // Caclulate the PPM of each gas sensors // Hydrogen Gas Sensor - MQ-8 iMQ8ppm = isMQ8( iMQ8Raw ); // Carbon Monoxide & Flammable Gas Sensor - MQ-9 iMQ9ppm = isMQ9( iMQ9Raw ); // Carbon Monoxide Gas Sensor - MQ-7 iMQ7ppm = isMQ7( iMQ7Raw ); // Alcohol Gas Sensor - MQ-3 iMQ3ppm = isMQ3( iMQ3Raw ); } // Hydrogen Gas Sensor - MQ-8 - PPM int isMQ8(double rawValue) { // RvRo double RvRo = rawValue * (3.3 / 1023); return (pow(4.7,( ((log(RvRo)-H2Curve[1])/H2Curve[2]) + H2Curve[0]))); } // Carbon Monoxide & Flammable Gas Sensor - MQ-9 int isMQ9(double rawValue) { double RvRo = rawValue * 3.3 / 4095; double ppm = 3.027*exp(1.0698*( RvRo )); return ppm; } // Carbon Monoxide Gas Sensor - MQ-7 int isMQ7(double rawValue) { double RvRo = rawValue * 3.3 / 4095; double ppm = 3.027*exp(1.0698*( RvRo )); return ppm; } // Alcohol Gas Sensor - MQ-3 int isMQ3(double rawValue) { double RvRo = rawValue * 3.3 / 4095; double bac = RvRo * 0.21; return bac; }
getPIR.ino
// PIR Motion // Setup PIR void setupPIR() { // Setup PIR Montion pinMode(iMotion, INPUT_PULLUP); } // isPIR Motion void isPIR() { // Proximity proximity = digitalRead(iMotion); if (proximity == LOW) { // PIR Motion Sensor's LOW, Motion is detected Det = "Motion Yes"; } else { // PIR Motion Sensor's HIGH Det = "No"; } }
getRGBLCDShield.ino
// Adafruit RGB LCD Shield // Setup RGB LCD Shield void isSetupRGBLCDShield() { // Adafruit RGB LCD Shield // Set up the LCD's number of columns and rows: RGBLCDShield.begin(16, 2); // Set the cursor to column 0, line 0 RGBLCDShield.setBacklight(RED); // Don luc RGBLCDShield.setCursor(0,0); RGBLCDShield.print("Don Luc"); // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); // Electronics RGBLCDShield.print("Electronics"); // Delay delay(5000); // Clear RGBLCDShield.clear(); // Set the cursor to column 0, line 0 RGBLCDShield.setBacklight(TEAL); // Version RGBLCDShield.setCursor(0,0); RGBLCDShield.print("Version: " + sver); // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); // Unit ID RGBLCDShield.print("Unit ID: " + uid); // Delay delay(5000); // Clear RGBLCDShield.clear(); } // isDisplay void isDisplay() { // Momentary Button momentaryButton = RGBLCDShield.readButtons(); switch ( yy ) { case 1: // RHT Temperature and Humidity Sensor // Set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); // Temperature C RGBLCDShield.print( "Temp C: " ); RGBLCDShield.print( latestTempC ); // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); // Humidity RGBLCDShield.print( "Humidity: " ); RGBLCDShield.print( latestHumidity ); break; case 2: // PIR Motion Sensor // Set the cursor to column 0, line 0 // PIR Motion Sensor RGBLCDShield.setCursor(0,0); RGBLCDShield.print( "PIR Motion" ); // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); // Det RGBLCDShield.print( Det ); break; case 3: // Gas Sensors 1 // Set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); // Hydrogen Gas Sensor - MQ-8 RGBLCDShield.print( "MQ-8: " ); RGBLCDShield.print( iMQ8ppm ); // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); // Carbon Monoxide & Flammable Gas Sensor - MQ-9 RGBLCDShield.print( "MQ-9: " ); RGBLCDShield.print( iMQ9ppm ); break; case 4: // Gas Sensors 2 // Set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); // Carbon Monoxide Gas Sensor - MQ-7 RGBLCDShield.print( "MQ-7: " ); RGBLCDShield.print( iMQ7ppm ); // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); // Alcohol Gas Sensor - MQ-3 RGBLCDShield.print( "MQ-3: " ); RGBLCDShield.print( iMQ3ppm ); break; case 5: // Don luc Electronics // Set the cursor to column 0, line 0 // Don luc RGBLCDShield.setCursor(0,0); RGBLCDShield.print("Don Luc"); // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); // Electronics RGBLCDShield.print("Electronics"); break; default: // Don luc Electronics yy = 5; RGBLCDShield.setBacklight(RED); // Set the cursor to column 0, line 0 // Don luc RGBLCDShield.setCursor(0,0); RGBLCDShield.print("Don Luc"); // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); // Electronics RGBLCDShield.print("Electronics"); } if ( momentaryButton ) { if ( momentaryButton & BUTTON_UP ) { yy = 1; // RHT Temperature and Humidity Sensor RGBLCDShield.setBacklight(GREEN); } if ( momentaryButton & BUTTON_DOWN ) { yy = 2; // PIR Motion Sensor RGBLCDShield.setBacklight(VIOLET); } if ( momentaryButton & BUTTON_LEFT ) { yy = 3; // Gas Sensors 1 RGBLCDShield.setBacklight(TEAL); } if ( momentaryButton & BUTTON_RIGHT ) { yy = 4; // Gas Sensors 2 RGBLCDShield.setBacklight(YELLOW); } if ( momentaryButton & BUTTON_SELECT ) { yy = 5; // Don luc Electronics RGBLCDShield.setBacklight(RED); } } }
getRHT.ino
// RHT Temperature and Humidity Sensor // setup RHT Temperature and Humidity Sensor void setupRTH03() { // RHT Temperature and Humidity Sensor // Call rht.begin() to initialize the sensor and our data pin rht.begin(RHT03_DATA_PIN); } // RHT Temperature and Humidity 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 latestHumidity = rht.humidity(); latestTempC = rht.tempC(); }
setup.ino
// Setup void setup() { // EEPROM Unique ID isUID(); // RHT Temperature and Humidity Sensor // Setup RTH03 Temperature and Humidity Sensor setupRTH03(); // PIR Motion // Setup PIR setupPIR(); // Initialize digital pin LED_BUILTIN as an output. pinMode(LED_BUILTIN, OUTPUT); // Adafruit RGB LCD Shield isSetupRGBLCDShield(); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Robotics
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Research & Development (R & D)
- Desktop Applications (Windows, OSX, Linux, Multi-OS, Multi-Tier, etc…)
- Mobile Applications (Android, iOS, Blackberry, Windows Mobile, Windows CE, etc…)
- Web Applications (LAMP, Scripting, Java, ASP, ASP.NET, RoR, Wakanda, etc…)
- Social Media Programming & Integration (Facebook, Twitter, YouTube, Pinterest, etc…)
- Content Management Systems (WordPress, Drupal, Joomla, Moodle, etc…)
- Bulletin Boards (phpBB, SMF, Vanilla, jobberBase, etc…)
- eCommerce (WooCommerce, OSCommerce, ZenCart, PayPal Shopping Cart, etc…)
Instructor and E-Mentor
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
- DOS, Windows, OSX, Linux, iOS, Android, Multi-OS
- Linux-Apache-PHP-MySQL
Follow Us
J. Luc Paquin – Curriculum Vitae – 2021 English & Español
https://www.jlpconsultants.com/luc/
Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Web: https://www.donluc.com/DLE/
Web: https://www.donluc.com/DLHackster/
Web: https://www.hackster.io/neosteam-labs
Web: https://zoom.us/
Patreon: https://www.patreon.com/DonLucElectronics
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #15: Environment – Adafruit PowerBoost – Mk14
——
#DonLucElectronics #DonLuc #Environment #MQ #PIR #RHT03 #ArduinoUNO #Arduino #AdafruitPowerBoost #Project #Programming #Electronics #Microcontrollers #Consultant #VideoBlog
——
——
——
——
——
Adafruit PowerBoost 500 Shield – Rechargeable 5V Power Shield
What’s a project if it’s trapped on your desk? Now you can take your Arduino anywhere you wish with the PowerBoost shield. This stackable shield goes onto your Arduino and provides a slim rechargeable power pack, with a built in battery charger as well as DC/DC booster.
Compatible with Arduino Uno basically any Arduino-pinout-shaped Arduino as only the GND and 5V pins are used. You can stack shields on top, or stack the PowerBoost on top. The PowerBoost shield can run off of any Lithium Ion or Lithium Polymer battery but we suggest our 2000mAh capacity batteries, both of which fits very nicely in the empty space of the shield. Plug in the battery and recharge it via the microUSB jack. When you’re ready to go, just unplug the Arduino from USB or the wall adapter and it will automatically switch over to shield power. Use only Lipoly batteries with protection circuitry.
The onboard boost converter can provide at least 500mA current, and can peak at 1A. There’s an onboard fuse to protect against higher current draws which could damage the boost converter or battery. The boost converter can be damaged by high current spikes and is not recommended for driving motors or robots where the stall current can cause high current spikes. It will let you turn the shield and Arduino power on/off.
Lithium Ion Battery – 3.7v 2000mAh
Lithium ion polymer batteries are thin, light and powerful. The output ranges from 4.2V when completely charged to 3.7V. This battery has a capacity of 2000mAh. If you need a larger battery. The batteries come pre-attached with a genuine 2-pin JST-PH connector as shown and include the necessary protection circuitry. Because they have a genuine JST connector, not a knock-off, the cable wont snag or get stuck in a matching JST jack, they click in and out smoothly.
DL2110Mk01
1 x Arduino UNO – R3
1 x ProtoScrewShield
1 x Adafruit PowerBoost 500 Shield
1 x Lithium Ion Battery – 3.7v 2000mAh
4 x Pololu Carrier for MQ Gas Sensors
1 x SparkFun Hydrogen Gas Sensor – MQ-8
1 x 4.7K Ohm
1 x Pololu Carbon Monoxide & Flammable Gas Sensor – MQ-9
1 x 22k Ohm
1 x SparkFun Carbon Monoxide Gas Sensor – MQ-7
1 x 10K Ohm
1 x SparkFun Alcohol Gas Sensor – MQ-3
1 x 220k Ohm
1 x Temperature and Humidity Sensor- RHT03
1 x PIR Motion Sensor (JST)
1 x SparkFun Solderable Half-Breadboard
1 x SparkFun Cerberus USB Cable
Arduino UNO – R3
RHT – Digital 5
PIR – Digital 7
MQ8 – Analog 0
MQ9 – Analog 1
MQ7 – Analog 2
MQ3 – Analog 3
VIN – +5V
GND – GND
DL2110Mk01p.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #15: Environment – Adafruit PowerBoost – Mk14 10-01 DL2110Mk01p.ino 1 x Arduino UNO - R3 1 x ProtoScrewShield 1 x Adafruit PowerBoost 500 Shield 1 x Lithium Ion Battery - 3.7v 2000mAh 4 x Pololu Carrier for MQ Gas Sensors 1 x SparkFun Hydrogen Gas Sensor - MQ-8 1 x 4.7K Ohm 1 x Pololu Carbon Monoxide & Flammable Gas Sensor - MQ-9 1 x 22k Ohm 1 x SparkFun Carbon Monoxide Gas Sensor - MQ-7 1 x 10K Ohm 1 x SparkFun Alcohol Gas Sensor - MQ-3 1 x 220k Ohm 1 x Temperature and Humidity Sensor - RHT03 1 x PIR Motion Sensor (JST) 1 x SparkFun Solderable Half-Breadboard 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // EEPROM Library to Read and Write EEPROM with Unique ID for Unit #include <EEPROM.h> // RHT Temperature and Humidity Sensor #include <SparkFun_RHT03.h> // RHT Temperature and Humidity Sensor // RHT03 data pin Digital 5 const int RHT03_DATA_PIN = 5; // This creates a RTH03 object, which we'll use to interact with the sensor RHT03 rht; float latestHumidity; float latestTempC; float latestTempF; // Gas Sensors MQ // Hydrogen Gas Sensor - MQ-8 int iMQ8 = A0; int iMQ8Raw = 0; int iMQ8ppm = 0; // Two points are taken from the curve in datasheet. // With these two points, a line is formed which is // "approximately equivalent" to the original curve. float H2Curve[3] = {2.3, 0.93,-1.44}; // Carbon Monoxide & Flammable Gas Sensor - MQ-9 int iMQ9 = A1; int iMQ9Raw = 0; int iMQ9ppm = 0; // Carbon Monoxide Gas Sensor - MQ-7 int iMQ7 = A2; int iMQ7Raw = 0; int iMQ7ppm = 0; // Alcohol Gas Sensor - MQ-3 int iMQ3 = A3; int iMQ3Raw = 0; int iMQ3ppm = 0; // PIR Motion // Motion detector const int iMotion = 7; // Proximity int proximity = LOW; String Det = ""; // Software Version Information String uid = ""; // Version String sver = "15-14"; void loop() { // RHT Temperature and Humidity Sensor isRHT03(); // Gas Sensors MQ isGasSensor(); // isPIR Motion isPIR(); // Delay // Turn the LED on HIGH is the voltage level digitalWrite(LED_BUILTIN, HIGH); // Wait for a 0.5 second delay( 500 ); // Turn the LED off by making the voltage LOW digitalWrite(LED_BUILTIN, LOW); // Wait for a 0.5 second delay( 500 ); }
getEEPROM.ino
// EEPROM // isUID EEPROM Unique ID void isUID() { // Is Unit ID uid = ""; for (int x = 0; x < 5; x++) { uid = uid + char(EEPROM.read(x)); } }
getGasSensorMQ.ino
// Gas Sensors MQ // Gas Sensor void isGasSensor() { // Read in analog value from each gas sensors // Hydrogen Gas Sensor - MQ-8 iMQ8Raw = analogRead( iMQ8 ); // Carbon Monoxide & Flammable Gas Sensor - MQ-9 iMQ9Raw = analogRead( iMQ9 ); // Carbon Monoxide Gas Sensor - MQ-7 iMQ7Raw = analogRead( iMQ7 ); // Alcohol Gas Sensor - MQ-3 iMQ3Raw = analogRead( iMQ3 ); // Caclulate the PPM of each gas sensors // Hydrogen Gas Sensor - MQ-8 iMQ8ppm = isMQ8( iMQ8Raw ); // Carbon Monoxide & Flammable Gas Sensor - MQ-9 iMQ9ppm = isMQ9( iMQ9Raw ); // Carbon Monoxide Gas Sensor - MQ-7 iMQ7ppm = isMQ7( iMQ7Raw ); // Alcohol Gas Sensor - MQ-3 iMQ3ppm = isMQ3( iMQ3Raw ); // Serial // Hydrogen Gas Sensor - MQ-8 Serial.print( "MQ-8: " ); Serial.println( iMQ8ppm ); // Carbon Monoxide & Flammable Gas Sensor - MQ-9 Serial.print( "MQ-9: " ); Serial.println( iMQ9ppm ); // Carbon Monoxide Gas Sensor - MQ-7 Serial.print( "MQ-7: " ); Serial.println( iMQ7ppm ); // Alcohol Gas Sensor - MQ-3 Serial.print( "MQ-3: " ); Serial.println( iMQ3ppm ); } // Hydrogen Gas Sensor - MQ-8 - PPM int isMQ8(double rawValue) { // RvRo double RvRo = rawValue * (3.3 / 1023); return (pow(4.7,( ((log(RvRo)-H2Curve[1])/H2Curve[2]) + H2Curve[0]))); } // Carbon Monoxide & Flammable Gas Sensor - MQ-9 int isMQ9(double rawValue) { double RvRo = rawValue * 3.3 / 4095; double ppm = 3.027*exp(1.0698*( RvRo )); return ppm; } // Carbon Monoxide Gas Sensor - MQ-7 int isMQ7(double rawValue) { double RvRo = rawValue * 3.3 / 4095; double ppm = 3.027*exp(1.0698*( RvRo )); return ppm; } // Alcohol Gas Sensor - MQ-3 int isMQ3(double rawValue) { double RvRo = rawValue * 3.3 / 4095; double bac = RvRo * 0.21; return bac; }
getPIR.ino
// PIR Motion // Setup PIR void setupPIR() { // Setup PIR Montion pinMode(iMotion, INPUT_PULLUP); } // isPIR Motion void isPIR() { // Proximity proximity = digitalRead(iMotion); if (proximity == LOW) { // PIR Motion Sensor's LOW, Motion is detected Det = "Motion Yes"; // Serial Serial.println( Det ); } else { // PIR Motion Sensor's HIGH Det = "No"; // Serial Serial.println( Det ); } }
getRHT.ino
// RHT Temperature and Humidity Sensor // setup RHT Temperature and Humidity Sensor void setupRTH03() { // RHT Temperature and Humidity Sensor // Call rht.begin() to initialize the sensor and our data pin rht.begin(RHT03_DATA_PIN); } // RHT Temperature and Humidity 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 latestHumidity = rht.humidity(); latestTempC = rht.tempC(); latestTempF = rht.tempF(); // Serial // RHT Temperature and Humidity Sensor // Temperature F Serial.print( "Temp F: " ); Serial.println( latestTempF ); // Temperature C Serial.print( "Temp C: " ); Serial.println( latestTempC ); // Humidity Serial.print( "Humidity: " ); Serial.println( latestHumidity ); }
setup.ino
// Setup void setup() { // EEPROM Unique ID isUID(); // Serial Serial.begin( 9600 ); // RHT Temperature and Humidity Sensor // setup RTH03 Humidity and Temperature Sensor setupRTH03(); // PIR Motion // Setup PIR setupPIR(); // Initialize digital pin LED_BUILTIN as an output. pinMode(LED_BUILTIN, OUTPUT); // Don Luc Electronics Serial.println( "Don Luc Electronics" ); // Version Serial.println( sver ); // Is Unit ID Serial.println( uid ); delay( 5000 ); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Robotics
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Research & Development (R & D)
- Desktop Applications (Windows, OSX, Linux, Multi-OS, Multi-Tier, etc…)
- Mobile Applications (Android, iOS, Blackberry, Windows Mobile, Windows CE, etc…)
- Web Applications (LAMP, Scripting, Java, ASP, ASP.NET, RoR, Wakanda, etc…)
- Social Media Programming & Integration (Facebook, Twitter, YouTube, Pinterest, etc…)
- Content Management Systems (WordPress, Drupal, Joomla, Moodle, etc…)
- Bulletin Boards (phpBB, SMF, Vanilla, jobberBase, etc…)
- eCommerce (WooCommerce, OSCommerce, ZenCart, PayPal Shopping Cart, etc…)
Instructor and E-Mentor
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
- DOS, Windows, OSX, Linux, iOS, Android, Multi-OS
- Linux-Apache-PHP-MySQL
Follow Us
J. Luc Paquin – Curriculum Vitae – 2021 English & Español
https://www.jlpconsultants.com/luc/
Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Web: https://www.donluc.com/DLE/
Web: https://www.donluc.com/DLHackster/
Web: https://www.hackster.io/neosteam-labs
Web: https://zoom.us/
Patreon: https://www.patreon.com/DonLucElectronics
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #15: Environment – ProtoScrewShield – Mk13
——
#DonLucElectronics #DonLuc #Environment #MQ #PIR #RHT03 #ArduinoUNO #Arduino #Project #Programming #Electronics #Microcontrollers #Consultant #VideoBlog
——
——
——
——
——
ProtoScrewShield
The ScrewShield extends all pins of the Arduino out to 3.5 mm pitch screw terminals. It also has a lot of the utility provided by Arduino Protoshield, including: a large prototyping space of both connected and unconnected 0.1 inch spaced through-holes, a couple 5V and GND busses, a reset button, general use push button, and a 5 mm yellow LED. This product includes all the parts shown and comes in kit form and must be soldered together by the end user.
DL2109Mk03
1 x Arduino UNO – R3
1 x ProtoScrewShield
4 x Pololu Carrier for MQ Gas Sensors
1 x SparkFun Hydrogen Gas Sensor – MQ-8
1 x 4.7K Ohm
1 x Pololu Carbon Monoxide & Flammable Gas Sensor – MQ-9
1 x 22k Ohm
1 x SparkFun Carbon Monoxide Gas Sensor – MQ-7
1 x 10K Ohm
1 x SparkFun Alcohol Gas Sensor – MQ-3
1 x 220k Ohm
1 x Temperature and Humidity Sensor- RHT03
1 x PIR Motion Sensor (JST)
1 x SparkFun Solderable Half-Breadboard
1 x SparkFun Cerberus USB Cable
Arduino UNO – R3
RHT – Digital 5
PIR – Digital 7
MQ8 – Analog 0
MQ9 – Analog 1
MQ7 – Analog 2
MQ3 – Analog 3
VIN – +5V
GND – GND
DL2109Mk03p.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #15: Environment – ProtoScrewShield – Mk13 09-03 DL2109Mk03p.ino 1 x Arduino UNO - R3 1 x ProtoScrewShield 4 x Pololu Carrier for MQ Gas Sensors 1 x SparkFun Hydrogen Gas Sensor - MQ-8 1 x 4.7K Ohm 1 x Pololu Carbon Monoxide & Flammable Gas Sensor - MQ-9 1 x 22k Ohm 1 x SparkFun Carbon Monoxide Gas Sensor - MQ-7 1 x 10K Ohm 1 x SparkFun Alcohol Gas Sensor - MQ-3 1 x 220k Ohm 1 x Temperature and Humidity Sensor - RHT03 1 x PIR Motion Sensor (JST) 1 x SparkFun Solderable Half-Breadboard 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // EEPROM Library to Read and Write EEPROM with Unique ID for Unit #include <EEPROM.h> // RHT Temperature and Humidity Sensor #include <SparkFun_RHT03.h> // RHT Temperature and Humidity Sensor // RHT03 data pin Digital 5 const int RHT03_DATA_PIN = 5; // This creates a RTH03 object, which we'll use to interact with the sensor RHT03 rht; float latestHumidity; float latestTempC; float latestTempF; // Gas Sensors MQ // Hydrogen Gas Sensor - MQ-8 int iMQ8 = A0; int iMQ8Raw = 0; int iMQ8ppm = 0; // Two points are taken from the curve in datasheet. // With these two points, a line is formed which is // "approximately equivalent" to the original curve. float H2Curve[3] = {2.3, 0.93,-1.44}; // Carbon Monoxide & Flammable Gas Sensor - MQ-9 int iMQ9 = A1; int iMQ9Raw = 0; int iMQ9ppm = 0; // Carbon Monoxide Gas Sensor - MQ-7 int iMQ7 = A2; int iMQ7Raw = 0; int iMQ7ppm = 0; // Alcohol Gas Sensor - MQ-3 int iMQ3 = A3; int iMQ3Raw = 0; int iMQ3ppm = 0; // PIR Motion // Motion detector const int iMotion = 7; // Proximity int proximity = LOW; String Det = ""; // Software Version Information String uid = ""; // Version String sver = "15-13"; void loop() { // RHT Temperature and Humidity Sensor isRHT03(); // Gas Sensors MQ isGasSensor(); // isPIR Motion isPIR(); // Delay // Turn the LED on HIGH is the voltage level digitalWrite(LED_BUILTIN, HIGH); // Wait for a 0.5 second delay( 500 ); // Turn the LED off by making the voltage LOW digitalWrite(LED_BUILTIN, LOW); // Wait for a 0.5 second delay( 500 ); }
getEEPROM.ino
// EEPROM // isUID EEPROM Unique ID void isUID() { // Is Unit ID uid = ""; for (int x = 0; x < 5; x++) { uid = uid + char(EEPROM.read(x)); } }
getGasSensorMQ.ino
// Gas Sensors MQ // Gas Sensor void isGasSensor() { // Read in analog value from each gas sensors // Hydrogen Gas Sensor - MQ-8 iMQ8Raw = analogRead( iMQ8 ); // Carbon Monoxide & Flammable Gas Sensor - MQ-9 iMQ9Raw = analogRead( iMQ9 ); // Carbon Monoxide Gas Sensor - MQ-7 iMQ7Raw = analogRead( iMQ7 ); // Alcohol Gas Sensor - MQ-3 iMQ3Raw = analogRead( iMQ3 ); // Caclulate the PPM of each gas sensors // Hydrogen Gas Sensor - MQ-8 iMQ8ppm = isMQ8( iMQ8Raw ); // Carbon Monoxide & Flammable Gas Sensor - MQ-9 iMQ9ppm = isMQ9( iMQ9Raw ); // Carbon Monoxide Gas Sensor - MQ-7 iMQ7ppm = isMQ7( iMQ7Raw ); // Alcohol Gas Sensor - MQ-3 iMQ3ppm = isMQ3( iMQ3Raw ); // Serial // Hydrogen Gas Sensor - MQ-8 Serial.print( "MQ-8: " ); Serial.println( iMQ8ppm ); // Carbon Monoxide & Flammable Gas Sensor - MQ-9 Serial.print( "MQ-9: " ); Serial.println( iMQ9ppm ); // Carbon Monoxide Gas Sensor - MQ-7 Serial.print( "MQ-7: " ); Serial.println( iMQ7ppm ); // Alcohol Gas Sensor - MQ-3 Serial.print( "MQ-3: " ); Serial.println( iMQ3ppm ); } // Hydrogen Gas Sensor - MQ-8 - PPM int isMQ8(double rawValue) { // RvRo double RvRo = rawValue * (3.3 / 1023); return (pow(4.7,( ((log(RvRo)-H2Curve[1])/H2Curve[2]) + H2Curve[0]))); } // Carbon Monoxide & Flammable Gas Sensor - MQ-9 int isMQ9(double rawValue) { double RvRo = rawValue * 3.3 / 4095; double ppm = 3.027*exp(1.0698*( RvRo )); return ppm; } // Carbon Monoxide Gas Sensor - MQ-7 int isMQ7(double rawValue) { double RvRo = rawValue * 3.3 / 4095; double ppm = 3.027*exp(1.0698*( RvRo )); return ppm; } // Alcohol Gas Sensor - MQ-3 int isMQ3(double rawValue) { double RvRo = rawValue * 3.3 / 4095; double bac = RvRo * 0.21; return bac; }
getPIR.ino
// PIR Motion // Setup PIR void setupPIR() { // Setup PIR Montion pinMode(iMotion, INPUT_PULLUP); } // isPIR Motion void isPIR() { // Proximity proximity = digitalRead(iMotion); if (proximity == LOW) { // PIR Motion Sensor's LOW, Motion is detected Det = "Motion Yes"; // Serial Serial.println( Det ); } else { // PIR Motion Sensor's HIGH Det = "No"; // Serial Serial.println( Det ); } }
getRHT.ino
// RHT Temperature and Humidity Sensor // setup RHT Temperature and Humidity Sensor void setupRTH03() { // RHT Temperature and Humidity Sensor // Call rht.begin() to initialize the sensor and our data pin rht.begin(RHT03_DATA_PIN); } // RHT Temperature and Humidity 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 latestHumidity = rht.humidity(); latestTempC = rht.tempC(); latestTempF = rht.tempF(); // Serial // RHT Temperature and Humidity Sensor // Temperature F Serial.print( "Temp F: " ); Serial.println( latestTempF ); // Temperature C Serial.print( "Temp C: " ); Serial.println( latestTempC ); // Humidity Serial.print( "Humidity: " ); Serial.println( latestHumidity ); }
setup.ino
// Setup void setup() { // EEPROM Unique ID isUID(); // Serial Serial.begin( 9600 ); // RHT Temperature and Humidity Sensor // setup RTH03 Humidity and Temperature Sensor setupRTH03(); // PIR Motion // Setup PIR setupPIR(); // Initialize digital pin LED_BUILTIN as an output. pinMode(LED_BUILTIN, OUTPUT); // Don Luc Electronics Serial.println( "Don Luc Electronics" ); // Version Serial.println( sver ); // Is Unit ID Serial.println( uid ); delay( 5000 ); }
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Robotics
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Research & Development (R & D)
- Desktop Applications (Windows, OSX, Linux, Multi-OS, Multi-Tier, etc…)
- Mobile Applications (Android, iOS, Blackberry, Windows Mobile, Windows CE, etc…)
- Web Applications (LAMP, Scripting, Java, ASP, ASP.NET, RoR, Wakanda, etc…)
- Social Media Programming & Integration (Facebook, Twitter, YouTube, Pinterest, etc…)
- Content Management Systems (WordPress, Drupal, Joomla, Moodle, etc…)
- Bulletin Boards (phpBB, SMF, Vanilla, jobberBase, etc…)
- eCommerce (WooCommerce, OSCommerce, ZenCart, PayPal Shopping Cart, etc…)
Instructor and E-Mentor
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
- DOS, Windows, OSX, Linux, iOS, Android, Multi-OS
- Linux-Apache-PHP-MySQL
Follow Us
J. Luc Paquin – Curriculum Vitae – 2021 English & Español
https://www.jlpconsultants.com/luc/
Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Web: https://www.donluc.com/DLE/
Web: https://www.donluc.com/DLHackster/
Web: https://www.hackster.io/neosteam-labs
Web: https://zoom.us/
Patreon: https://www.patreon.com/DonLucElectronics
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc