Sound
Project #16: Sound – Music Shield – Mk25
——
#DonLucElectronics #DonLuc #ArduinoUno #Seeed #MusicShield #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
Seeed Studio: Music Shield V1.2
The Music Shield is a professional audio codec. It can work with Arduino, Seeeduino, Seeeduino Mega and Arduino Mega. It is based on VS1053b IC, and can play a variety of music formats stored on MicroSD cards with Seeed the provided Arduino Library. Recording is only supported on Seeeduino Mega and Arduino Mega for now.
- Arduino, Seeeduino, Arduino Mega, and Seeeduino Mega compatible
- 2 control-push buttons and 1 knob switch
- Plays music from micro SD cards Decodes: MP3, WAV, MIDI, Ogg Vorbis
- I2S interface for external DAC
- Headphone/Line Out for playback
- Line In for recording in OGG format
- Excellent sound quality with ±1 dB Frequency Response
- FCC verification
Insert the Micro SD card and the earphone. Plug the Music Shield onto the Arduino. Connect the board to PC using USB cable.
DL2407Mk01
1 x Arduino Uno – R3
1 x Seeed Music Shield V1.1
1 x MicroSD 2 GB
1 x Speakers
1 x SparkFun Cerberus USB Cable
Arduino Uno – R3
VOU – 3
RNS – 4
RP&S – 5
RPS – 6
VOD – 7
LED – 8
SPI – 10
MOSI – 11
MISO – 12
SCK – 13
RES – A0
VS1 – A1
VS2 – A2
VS3 – A3
VIN – +5V
GND – GND
DL2407Mk01p.ino
/****** Don Luc Electronics © ****** Software Version Information Project #16: Sound – Music Shield – Mk25 16-25 DL2407Mk01p.ino DL2407Mk01 1 x Arduino Uno - R3 1 x Seeed Music Shield V1.1 1 x MicroSD 2 GB 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // Fat 16 #include <Fat16.h> #include <Fat16Util.h> // New SPI #include <NewSPI.h> // Arduino #include <arduino.h> // Seeed Music Player #include "pins_config.h" #include "vs10xx.h" #include "newSDLib.h" #include "MusicPlayer.h" // Seeed Music Player MusicPlayer myplayer; // Software Version Information String sver = "16-25"; void loop() { // Seeed Music Player isMusicPlayer(); }
getMusicPlayer.ino
// Seeed Music Player // is Music Player void isMusicPlayer() { // Seeed Music Player // Set mode to play shuffle myplayer.setPlayMode(MODE_SHUFFLE); //Otherwise it will add the current song to the new playlist. //If the current playlist is empty,it will add all the songs // in the root directory to the playlist. myplayer.creatPlaylist(); // Play List myplayer.playList(); // While while(1); }
setup.ino
// Setup void setup() { // Give display time to power on delay(100); // Seeed Music Player // Will initialize the hardware and set default mode to be normal myplayer.begin(); // Delay 5 Second delay( 5000 ); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Teacher, Instructor, E-Mentor, R&D and Consulting
- Programming Language
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi, Arm, Silicon Labs, Espressif, Etc…)
- IoT
- Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
- Robotics
- Automation
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Machine Learning
- Artificial Intelligence (AI)
- RTOS
- Sensors, eHealth Sensors, Biosensor, and Biometric
- Research & Development (R & D)
- Consulting
Follow Us
Luc Paquin – Curriculum Vitae – 2024
https://www.donluc.com/luc/
Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
LinkedIn: https://www.linkedin.com/in/jlucpaquin/
Don Luc
Project #16: Sound – SparkFun ProtoShield Kit – Mk23
——
#DonLucElectronics #DonLuc #Sound #Arduino #MicroOLED #ProtoShield #SparkFunQwiicMP3 #SparkFunRedBoardQwiic #Project #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
SparkFun ProtoShield Kit
The SparkFun ProtoShield Kit lets you customize your own Arduino shield using whatever circuit you can come up with and then test it to make sure everything is working the way it should. The SparkFun ProtoShield Kit is based off the Arduino R3’s footprint that allows you to easily incorporate it with favorite Arduino-based device.
One of our favorite features with this version of the ProtoShield Kit is the solderable-like breadboard prototyping area. Half of this area was designed with a breadboard in mind. On the underside of the shield you will be able to see open jumper pads between each through hole to make a connection like a breadboard. Once you add a component, simply add a solder jumper between holes to make a connection. For those that prefer the standard prototyping pads.
DL2301Mk04
1 x SparkFun RedBoard Qwiic
1 x SparkFun ProtoShield Kit
1 x SparkFun Micro OLED Breakout (Qwiic)
1 x SparkFun Qwiic MP3 Trigger
1 x microSD Card – 2GB
1 x Panel Mount 10K potentiometer
1 x Knob
2 x Rocker Switch – SPST (Round)
1 x Qwiic Cable – 50mm
1 x Qwiic Cable – 100mm
1 x Dayton Audio Reference 3″ Full-Range Drive
1 x SparkFun Cerberus USB Cable
——
SparkFun RedBoard Qwiic
PO1 – Analog A0
SDA – Analog A4
SCL – Analog A5
SW0 – Digital 8
SW1 – Digital 7
VIN – +5V
VIN – +3.3V
GND – GND
——
DL2301Mk04p.ino
/* ***** Don Luc Electronics © ***** Software Version Information #16 - Sound - SparkFun ProtoShield Kit - Mk23 16-04 DL2301Mk04p.ino 1 x SparkFun RedBoard Qwiic 1 x SparkFun ProtoShield Kit 1 x SparkFun Micro OLED Breakout (Qwiic) 1 x SparkFun Qwiic MP3 Trigger 1 x microSD Card - 2GB 1 x Panel Mount 10K potentiometer 1 x Knob 2 x Rocker Switch - SPST (Round) 1 x Qwiic Cable - 50mm 1 x Qwiic Cable - 100mm 1 x Dayton Audio Reference 3" Full-Range Drive 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // Wire communicate with I2C / TWI devices #include <Wire.h> // SparkFun MP3 Trigger #include "SparkFun_Qwiic_MP3_Trigger_Arduino_Library.h" // SparkFun Micro OLED #include <SFE_MicroOLED.h> // SparkFun MP3 Trigger MP3TRIGGER mp3; int iSongCount = 0; int x = 0; // Volume int iVolume = A0; int iVolumeLevel = 0; // EQ Setting Normal byte bEQSetting = 0; // Play Next const int iPlayNext = 8; // Variable for reading the iPlayNext status int iPlayNextState = 0; // Play Previous const int iPlayPrevious = 7; // Variable for reading the iPlayPrevious status int iPlayPreviousState = 0; // SparkFun Micro OLED #define PIN_RESET 9 #define DC_JUMPER 1 // I2C declaration MicroOLED oled(PIN_RESET, DC_JUMPER); // iLED ProtoShield int iLED = 13; // Software Version Information String sver = "16-23"; void loop() { // SparkFun MP3 Trigger if (mp3.isPlaying() == false) { if ( x > iSongCount ) { x = 0; } else { x = x + 1; } // Play Track mp3.playTrack( x ); } else { // Volume isVolume(); // Play Next isPlayNext(); // Play Previous isPlayPrevious(); } // Micro OLED isMicroOLED(); }
getMP3.ino
// MP3 // Setup MP3 void isSetupMP3(){ // Check to see if Qwiic MP3 is present on the bus if (mp3.begin() == false) { // Qwiic MP3 failed to respond. Please check wiring and possibly the I2C address. Freezing... while (1); } if (mp3.hasCard() == false) { // Qwiic MP3 is missing its SD card. Freezing... while (1); } // Song Count iSongCount = mp3.getSongCount(); // EQ Setting // 0 Normal // 1 Pop // 2 Rock // 3 Jazz // 4 Classic // 5 Bass bEQSetting = 5; bEQSetting = mp3.getEQ(); // Initialize the iPlayNext pinMode( iPlayNext, INPUT); // Initialize the iPlayPrevious pinMode( iPlayPrevious, INPUT); } // Volume void isVolume() { // Volume iVolumeLevel = analogRead( iVolume ); // (0-1023 for 10 bits or 0-4095 for 12 bits) iVolumeLevel = map(iVolumeLevel, 0, 1023, 0, 10); // Volume can be 0 (off) to 31 (max) // Volume can be 0 (off) to 10 (Breakfast) mp3.setVolume( iVolumeLevel ); } // Play Next void isPlayNext() { // Read the state of the iPlayNext value iPlayNextState = digitalRead( iPlayNext ); if ( iPlayNextState == HIGH ) { mp3.stop(); if ( x > iSongCount ) { x = 0; } else { x = x + 1; } // Play Track mp3.playTrack( x ); } } // Play Previous void isPlayPrevious() { // Read the state of the iPlayPrevious value iPlayPreviousState = digitalRead( iPlayPrevious ); if ( iPlayPreviousState == HIGH ) { mp3.stop(); if ( x > iSongCount ) { x = 0; } else { x = x - 1; } // Play Track mp3.playTrack( x ); } }
getMicroOLED.ino
// SparkFun Micro OLED // Setup Micro OLED void isSetupMicroOLED() { // 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 FreeIMU // Clear the display oled.clear(PAGE); // Set cursor to top-left oled.setCursor(0, 0); // Set font to type 0 oled.setFontType(0); // Song oled.print("Song"); // Song Name oled.setCursor(0, 13); String songName = mp3.getSongName(); oled.print( songName ); // Song Count oled.setCursor(0, 24); oled.print("Song Count"); // Song Count oled.setCursor(0, 37); iSongCount = mp3.getSongCount(); oled.print( iSongCount ); oled.display(); }
setup.ino
// Setup void setup() { // Initialize digital pin iLED ProtoShield as an output pinMode(iLED, OUTPUT); // Turn the LED on (HIGH is the voltage level) digitalWrite(iLED, HIGH); // Wire communicate with I2C / TWI devices Wire.begin(); // SparkFun MP3 Trigger Setup isSetupMP3(); // Setup Micro OLED isSetupMicroOLED(); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Programming Language
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
- Robotics
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Machine Learning
- RTOS
- Research & Development (R & D)
Instructor, E-Mentor, STEAM, and Arts-Based Training
- Programming Language
- IoT
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
Follow Us
Luc Paquin – Curriculum Vitae – 2023
https://www.donluc.com/luc/
Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #16: Sound – Metronome – Mk22
——
#DonLucElectronics #DonLuc #Sound #Metronome #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
Metronome
A metronome is a device that produces an audible click or other sound at a regular interval that can be set by the user, typically in Beats Per Minute (BPM). Metronomes may include synchronized visual motion. Musicians use the device to practise playing to a regular pulse. In the 20th century, electronic metronomes and software metronomes were invented.
Musicians practise with metronomes to improve their timing, especially the ability to stick to a regular tempo. Metronome practice helps internalize a clear sense of timing and tempo. Composers and conductors often use a metronome as a standard tempo reference, and may play, sing, or conduct to the metronome. The metronome is used by composers to derive beats per minute if they want to indicate that in a composition. Conductors use a metronome to note their preferred tempo in each section.
SparkFun Metro-Gnome
The SparkFun Metro-Gnome is a basic digital metronome used to keep time during music practice. This is a basic kit that goes together in 15-20 minutes for people learning to solder, and 5-10 minutes for those with a bit of experience.
DL2301Mk03
-1 x Metro-Gnome PCB
-1 x ATmega168
-2 x 7-Segment Red LED
-1 x 10uF Capacitor
-1 X 0.1uf Capacitor
-1 x 10k Resistor
-1 x 1N4148 Diode
-1 x Piezo Speaker
-1 x Mini Power Switch
-2 x Push Button Reset Switches
-1 x Battery Holder Pack
-4 x AA Alkaline Battery
ATmega168
Metro-Gnome
VIN – +6V
GND – GND
——
Metrognomev03
Metrognomev03.c
// Metronome-v03 #define F_CPU 1024000 // Adjust this to get the clock more precise #include <avr/io.h> #include <util/delay.h> #include <avr/interrupt.h> #define BUZZER1 1 #define BUZZER1_PORT PORTB #define BUZZER2 2 #define BUZZER2_PORT PORTB #define sbi(port_name, pin_number) (port_name |= 1<<pin_number) #define cbi(port_name, pin_number) ((port_name) &= (uint8_t)~(1 << pin_number)) uint16_t countUp = F_CPU/1024; // Dividing clock by 1024 uint16_t speed = 60; // Program initially runs at 60 BPM uint8_t leftDisplay = 6; // Initialize output to show 60 BPM uint8_t rightDisplay = 0; void ioinit(); void display(int digit, int number); // Interrupt Timer 1 makes the buzzer tick at proper intervals ISR(TIMER1_COMPA_vect) { int buzzPeriod = 100; uint32_t buzzLength = 1000; while(1) { //Subtract the buzzPeriod from the overall length if(buzzPeriod > buzzLength) break; buzzLength -= buzzPeriod; if(buzzPeriod > buzzLength) break; buzzLength -= buzzPeriod; //Toggle the buzzer at various speeds PINB = 0b00000010; _delay_us(buzzPeriod); PINB = 0b00000100; _delay_us(buzzPeriod); } } // Interrupt Timer 2 checks for button presses ISR(TIMER0_COMPA_vect) { // Check down button if( (PINB & (1<<4)) == 0) { if (speed == 1) // If speed = 1 go up to 299 { speed = 299; rightDisplay = 9; leftDisplay = 9; } else if ((rightDisplay == 0) && (leftDisplay == 0)) { rightDisplay = 9; leftDisplay = 9; speed--; } else if (rightDisplay == 0) { rightDisplay = 9; leftDisplay--; speed--; } else { rightDisplay--; speed--; } // Reset counter and adjust compare register TCNT1 = 0x00; OCR1A = (countUp*60)/speed; } // Check up button if((PINB & (1<<5)) == 0) { if (speed == 299) { speed = 1; rightDisplay = 1; leftDisplay = 0; } else if ((rightDisplay == 9) && (leftDisplay == 9)) { rightDisplay = 0; leftDisplay = 0; speed++; } else if (rightDisplay == 9) { rightDisplay = 0; leftDisplay++; speed++; } else { rightDisplay++; speed++; } // Reset counter and adjust compare register TCNT1 = 0x00; OCR1A = (countUp*60)/speed; } } int main() { int flag = 0; ioinit(); while(1) // Main loop PWM's the two displays at 1kHz { if (flag == 0) { cbi(PORTC, 1); // Turn right display off display(0, leftDisplay); // Output to left display flag = 1; } else { cbi(PORTC, 0); // Turn left display off display(1, rightDisplay); // Output to right display flag = 0; } _delay_us(10); PORTD = 0xFF; cbi(PORTC, 0); cbi(PORTC, 1); _delay_us(30); } return 0; } void ioinit() { // set PORTB for Buzzer and buttons DDRB = DDRB | 0b00110110; PORTB = PORTB | 0b00110000; // set PORTC for DIGI select DDRC = 0b0000011; PINC = 0b0000011; // set PORTD for display DDRD = 0b11111111; // Set 16-bit Timer 1 for clicking TCCR1A = 0x00; TCCR1B = (_BV(WGM12) | _BV(CS12) | _BV(CS10)); // Divide clock by 1024, CTC mode OCR1A = (countUp*60)/speed; // Set top of counter TIMSK1 = _BV(OCIE1A); // Enable OCR1A interrupt // Set Timer 0 to check button press TCCR0A = _BV(WGM01); TCCR0B = _BV(CS00) | _BV(CS02); OCR0A = 100; // OCCR0A can be adjusted to change the button debounce time TIMSK0 = _BV(OCIE0A); sei(); // Enable interrupts } // This will output the corresponding // 'number' to digit 0 (left) or 1 (right) void display(int digit, int number) { //cbi(PORTC, digit); // Ties display to ground if (digit == 0) sbi(PORTC, 0); // Ties display to ground else if (digit == 1) sbi(PORTC, 1); switch(number) // Set PIND, display pins, to correct output { case 0: PORTD = 0b11000000; break; case 1: PORTD = 0b11111001; break; case 2: PORTD = 0b10100100; break; case 3: PORTD = 0b10110000; break; case 4: PORTD = 0b10011001; break; case 5: PORTD = 0b10010010; break; case 6: PORTD = 0b10000010; break; case 7: PORTD = 0b11111000; break; case 8: PORTD = 0b10000000; break; case 9: PORTD = 0b10010000; break; } // Turn decimal point on if above 100 & 200 if ((digit == 0) && (speed >= 200)) cbi(PORTD, 7); if ((digit == 1) && (speed >= 100)) cbi(PORTD, 7); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Programming Language
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
- Robotics
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Machine Learning
- RTOS
- Research & Development (R & D)
Instructor, E-Mentor, STEAM, and Arts-Based Training
- Programming Language
- IoT
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
Follow Us
Luc Paquin – Curriculum Vitae – 2023
https://www.donluc.com/luc/
Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #16: Sound – Bluetooth – Mk21
——
#DonLucElectronics #DonLuc #ESP32 #Bluetooth #ThumbJoystick #Keyboard #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
Bluetooth
Bluetooth is a short-range wireless technology standard that is used for exchanging data between fixed and mobile devices over short distances and building personal area networks. It employs UHF radio waves in the ISM bands, from 2.402 GHz to 2.48 GHz. It is mainly used as an alternative to wire connections, to exchange files between nearby portable devices, computer and connect cell phones and music players with wireless headphones. In the most widely used mode, transmission power is limited to 2.5 milliwatts, giving it a very short range of up to 10 metres.
DL2210Mk01
1 x Adafruit HUZZAH32 – ESP32 Feather
1 x Lithium Ion Battery – 2500mAh
1 x Thumb Joystick
1 x SparkFun Thumb Joystick Breakout
1 x SparkFun Cerberus USB Cable
ESP32 Feather
JY0 – Analog A0
JY1 – Analog A5
SE0 – Digital 13
VIN – +3.3V
GND – GND
——
DL2210Mk01p.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #16: Sound - Bluetooth - Mk21 16-21 DL2210Mk01p.ino 1 x Adafruit HUZZAH32 – ESP32 Feather 1 x Lithium Ion Battery - 2500mAh 1 x Thumb Joystick 1 x SparkFun Thumb Joystick Breakout 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // ESP32 BLE Keyboard #include <BleKeyboard.h> // ESP32 BLE Keyboard BleKeyboard bleKeyboard; // Connections to joystick // Vertical const int VERT = A0; // Horizontal const int HORIZ = A5; // Pushbutton const int SEL = 13; // Initialize variables for analog and digital values int vertical; int horizontal; int selec; // Software Version Information String sver = "16-21"; void loop() { // ESP32 BLE Keyboard if(bleKeyboard.isConnected()) { // Thumb Joystick isThumbJoystick(); } // Delay delay( 1000 ); }
getThumbJoystick.ino
// Thumb Joystick void isThumbJoystick() { // Read all values from the joystick // Joystick was sitting around 2047 for the vertical and horizontal values // Will be 0-4095 // Vertical vertical = analogRead(VERT); if (vertical == 4095) { // Volume Up bleKeyboard.write(KEY_MEDIA_VOLUME_UP); } else if (vertical == 0) { // Volume Down bleKeyboard.write(KEY_MEDIA_VOLUME_DOWN); } // Horizontal // Will be 0-4095 horizontal = analogRead(HORIZ); if (horizontal == 4095) { // Previous Track bleKeyboard.write(KEY_MEDIA_PREVIOUS_TRACK); } else if (horizontal == 0) { // Next Track bleKeyboard.write(KEY_MEDIA_NEXT_TRACK); } // Will be HIGH (1) if not pressed, and LOW (0) if pressed selec = digitalRead(SEL); if (selec == 0) { // Play/Pause media key bleKeyboard.write(KEY_MEDIA_PLAY_PAUSE); } }
setup.ino
// Setup void setup() { // Make the SEL line an input pinMode(SEL, INPUT_PULLUP); // ESP32 BLE Keyboard bleKeyboard.begin(); }
——
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 #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 #20: CircuitPython – Audio Out WAV – Mk02
——
#DonLucElectronics #DonLuc #METROM0Express #CircuitPython #Sound #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
Play a Wave File
You can use any supported wave file you like. CircuitPython supports mono or stereo, at 22 KHz sample rate, or less, and 16-bit WAV format. The METRO M0 Express boards support only mono. The reason for mono is that there’s only one analog output on those boards. The 22 KHz or less because the CircuitPython can’t handle more data than that, and also it will not sound much better, and the DAC output is 10-bit so anything over 16-bit will just take up room without better quality. Since the WAV file must fit on the CircuitPython file system, it must be under 2 MB.
HamletUMk01.wav -> 1316 KB
We’re going to play the wave file for 10 seconds, pause it, wait for a button to be pressed, and then resume the file to play through to the end. Then it loops back to the beginning and starts again. First we create the button object, assign it to pin A1, and set it as an input with a pull-up.
Now we will ask the audio playback system to load the wave data from the file HamletUMk01.wav and finally request that the audio is played through the A0 analog output pin. The audio file is now ready to go, and can be played at any time with play. Inside our loop, we start by playing the file.
DL2112Mk02
1 x Adafruit METRO M0 Express
1 x SparkFun Audio Jack Breakout
1 x Audio Jack 3.5mm
1 x Hamburger Mini Speaker
1 x Tactile Button
1 x 10K potentiometer
1 x Knob
1 x 100uF 16V Electrolytic Capacitors
1 x SparkFun Cerberus USB Cable
Adafruit METRO M0 Express
AUD – Analog A0
BUT – Analog A1
VIN – +3.3V
VIN – +5V
GND – GND
code.py
""" ***** Don Luc Electronics © ***** Software Version Information Project #20: CircuitPython – Audio Out WAV – Mk02 12-02 DL2112Mk02 code.py 1 x Adafruit METRO M0 Express 1 x SparkFun Audio Jack Breakout 1 x Audio Jack 3.5mm 1 x Hamburger Mini Speaker 1 x Tactile Button 1 x 10K potentiometer 1 x Knob 1 x 100uF 16V Electrolytic Capacitors 1 x SparkFun Cerberus USB Cable """ # Module import time import board import digitalio # audiocore -> WaveFile from audiocore import WaveFile try: from audioio import AudioOut except ImportError: try: from audiopwmio import PWMAudioOut as AudioOut except ImportError: # Not always supported by every board. pass # Button A1 button = digitalio.DigitalInOut(board.A1) button.switch_to_input(pull=digitalio.Pull.UP) # William Shakespeare - Hamlet wave_file = open("HamletUMk01.wav", "rb") wave = WaveFile(wave_file) # audio -> A0 audio = AudioOut(board.A0) while True: # Play audio.play(wave) # This allows you to do other things while the audio plays. t = time.monotonic() # -> 10 second while time.monotonic() - t < 10: pass audio.pause() print("Waiting for button press to continue.") while button.value: pass # Resume audio.resume() while audio.playing: pass # Done print("Done")
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 #16: Sound – Dayton Audio RS75T-8 – Mk20
——
#DonLucElectronics #DonLuc #Sound #Arduino #ESP32 #SparkFunThingPlusESP32WROOM #SparkFunQwiicMP3 #DaytonAudioRS75T #Project #Programming #Electronics #Microcontrollers #Consultant #VideoBlog
——
——
——
——
——
Dayton Audio RS75T-8 3″ Reference Full-Range Driver Truncated Frame
The Dayton Audio Reference Series sets a new standard of value in high-performance loudspeaker drivers. Incorporating a low-distortion motor system with a copper ring, a copper cap, and an aluminum phase plug, the RS75T-8 can outperform “boutique” drivers that cost several times the price. The driver’s truncated frame makes it ideal for line arrays and ultra-compact MTM designs requiring minimal driver-to-driver spacing. Its low-distortion characteristics and smooth response provide exceptional clarity, detail, and dynamics. Features a black anodized cone, heavy-duty 4-hole cast frame, low-loss rubber surround, and gold terminals.
DL2107Mk02
1 x SparkFun Thing Plus – ESP32 WROOM
1 x SparkFun Qwiic MP3 Trigger
1 x microSD Card – 2GB
1 x Panel Mount 10K potentiometer
1 x Knob
1 x Slide Switch
2 x Rocker Switch – SPST (Round)
1 x Qwiic Cable – 50mm
1 x Dayton Audio Reference 3″ Full-Range Drive
1 x Lithium Ion Battery – 850mAh
1 x JST Jumper 2 Wire Assembly
2 x Screw Terminals 5mm Pitch (2-Pin)
1 x Acrylic Blue 5.75in x 3.75in x 1/8in
1 x Acrylic Purple 5.75in x 3.75in x 1/8in
24 x Screw – 4-40
4 x Nut – Nylon Locknut 4-40
6 x Standoff – Metal 4-40 – 3/8″
8 x Standoff – Metal 4-40 – 1″
18 x Wire Solid Core – 22 AWG
1 x Adafruit Perma-Prote Half-Size Breadboard
1 x SparkFun Cerberus USB Cable
SparkFun Thing Plus – ESP32 WROOM
PO1 – Analog A0
SW0 – Digital 21
SW1 – Digital 17
VIN – +3.3V
GND – GND
DL2107Mk02p.ino
/* ***** Don Luc Electronics © ***** Software Version Information #16 - Sound - Dayton Audio RS75T-8 - Mk20 07-02 DL2107Mk02p.ino 1 x SparkFun Thing Plus - ESP32 WROOM 1 x SparkFun Qwiic MP3 Trigger 1 x microSD Card - 2GB 1 x Panel Mount 10K potentiometer 1 x Knob 1 x Slide Switch 2 x Rocker Switch - SPST (Round) 1 x Qwiic Cable - 50mm 1 x Dayton Audio Reference 3" Full-Range Drive 1 x Lithium Ion Battery - 850mAh 1 x JST Jumper 2 Wire Assembly 2 x Screw Terminals 5mm Pitch (2-Pin) 1 x Acrylic Blue 5.75in x 3.75in x 1/8in 1 x Acrylic Purple 5.75in x 3.75in x 1/8in 24 x Screw - 4-40 4 x Nut - Nylon Locknut 4-40 6 x Standoff - Metal 4-40 - 3/8" 8 x Standoff - Metal 4-40 - 1" 18 x Wire Solid Core - 22 AWG 1 x Adafruit Perma-Prote Half-Size Breadboard 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // Wire communicate with I2C / TWI devices #include <Wire.h> // SparkFun MP3 Trigger #include "SparkFun_Qwiic_MP3_Trigger_Arduino_Library.h" // SparkFun MP3 Trigger MP3TRIGGER mp3; int iSongCount = 0; int x = 0; // Volume int iVolume = A0; int iVolumeLevel = 0; // EQ Setting Normal byte bEQSetting = 0; // Play Next const int iPlayNext = 21; // Variable for reading the iPlayNext status int iPlayNextState = 0; // Play Previous const int iPlayPrevious = 17; // Variable for reading the iPlayPrevious status int iPlayPreviousState = 0; // Software Version Information String sver = "16-20"; void loop() { if (mp3.isPlaying() == false) { if ( x > iSongCount ) { x = 0; } else { x = x + 1; } // Play Track mp3.playTrack( x ); } else { // Volume isVolume(); // Play Next isPlayNext(); // Play Previous isPlayPrevious(); } }
getMP3.ino
// MP3 // Setup MP3 void isSetupMP3(){ // Check to see if Qwiic MP3 is present on the bus if (mp3.begin() == false) { // Qwiic MP3 failed to respond. Please check wiring and possibly the I2C address. Freezing... while (1); } if (mp3.hasCard() == false) { // Qwiic MP3 is missing its SD card. Freezing... while (1); } // Song Count iSongCount = mp3.getSongCount(); // EQ Setting Classic bEQSetting = mp3.getEQ(); // Initialize the iPlayNext pinMode( iPlayNext, INPUT); // Initialize the iPlayPrevious pinMode( iPlayPrevious, INPUT); } // Volume void isVolume() { // Volume iVolumeLevel = analogRead( iVolume ); // (0-1023 for 10 bits or 0-4095 for 12 bits) iVolumeLevel = map(iVolumeLevel, 0, 4095, 0, 31); // Volume can be 0 (off) to 31 (max) mp3.setVolume( iVolumeLevel ); } // Play Next void isPlayNext() { // Read the state of the iPlayNext value iPlayNextState = digitalRead( iPlayNext ); if ( iPlayNextState == HIGH ) { mp3.stop(); if ( x > iSongCount ) { x = 0; } else { x = x + 1; } // Play Track mp3.playTrack( x ); } } // Play Previous void isPlayPrevious() { // Read the state of the iPlayPrevious value iPlayPreviousState = digitalRead( iPlayPrevious ); if ( iPlayPreviousState == HIGH ) { mp3.stop(); if ( x > iSongCount ) { x = 0; } else { x = x - 1; } // Play Track mp3.playTrack( x ); } }
setup.ino
// Setup void setup() { // Wire communicate with I2C / TWI devices Wire.begin(); // SparkFun MP3 Trigger Setup isSetupMP3(); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- Robotics
- 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
- 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/CV/LucPaquinCVEngMk2021c.pdf
https://www.jlpconsultants.com/CV/LucPaquinCVEspMk2021c.pdf
Web: https://www.donluc.com/
Web: http://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 #16: Sound – SparkFun Thing Plus ESP32 WROOM – Mk19
——
#DonLucElectronics #DonLuc #Sound #Arduino #ESP32 #SparkFunThingPlusESP32WROOM #SparkFunQwiicMP3 #Project #Programming #Electronics #Microcontrollers #Consultant #VideoBlog
——
——
——
——
——-
SparkFun Thing Plus – ESP32 WROOM
The SparkFun ESP32 Thing Plus is the next step to get started with Espressif IoT ideations while still enjoying all the amenities of the original ESP32 Thing. Espressif’s ESP32 WROOM is a powerful WiFi and Bluetooth MCU module that targets a wide variety of applications. At the core of this module is the ESP32-D0WDQ6 chip which is designed to be both scalable and adaptive. To make the Thing Plus even easier to use, we’ve moved a few pins around to make the board Feather compatible and it utilizes our handy Qwiic Connect System which means no soldering or shields are required to connect it to the rest of your system. A JST connector to plug in a LiPo battery.
SparkFun Qwiic MP3 Trigger
Sometimes you just need an MP3 to play. The SparkFun Qwiic MP3 Trigger takes care of all the necessary requirements, all you need to do is send a simple I2C command and listen to whatever is on your micro SD card. The contents of the microSD card appears as a jump drive. Simply plug in the Qwiic MP3 Trigger and you’ll be transferring MP3s, no need for drivers and no need for WAV or Vorbis conversion. Your supplied speaker is boosted by a Class-D mono amplifier capable of outputting up to 1.4W making it capable of being incredibly loud. Volume is software selectable between 32 levels.
DL2107Mk01
1 x SparkFun Thing Plus – ESP32 WROOM
1 x SparkFun Qwiic MP3 Trigger
1 x microSD Card – 2GB
1 x Panel Mount 1K potentiometer
1 x Knob
1 x Qwiic Cable – 100mm
1 x Dayton Audio Reference 3″ Full-Range Drive
2 x Wire Stranded Core – 18 AWG
7 x Wire Solid Core – 22 AWG
1 x Full-Size Breadboard
1 x SparkFun Cerberus USB Cable
SparkFun Thing Plus – ESP32 WROOM
PO1 – Analog A0
SW0 – Digital 21
SW1 – Digital 17
VIN – +3.3V
GND – GND
DL2107Mk01p.ino
// ***** Don Luc Electronics © ***** // Software Version Information // #16 - Sound - SparkFun Thing Plus ESP32 WROOM - Mk19 // 07-01 // DL2107Mk01p.ino // 1 x SparkFun RedBoard Qwiic // 1 x SparkFun Qwiic MP3 Trigger // 1 x microSD Card - 2GB // 1 x Panel Mount 1K potentiometer // 1 x Knob // 1 x Qwiic Cable - 100mm // 1 x Dayton Audio Reference 3" Full-Range Drive // 2 x Wire Stranded Core - 18 AWG // 7 x Wire Solid Core - 22 AWG // 1 x Full-Size Breadboard // 1 x SparkFun Cerberus USB Cable // Include the Library Code // Wire communicate with I2C / TWI devices #include <Wire.h> // SparkFun MP3 Trigger #include "SparkFun_Qwiic_MP3_Trigger_Arduino_Library.h" // SparkFun MP3 Trigger MP3TRIGGER mp3; int iSongCount = 0; int x = 0; // Volume int iVolume = A0; int iVolumeLevel = 0; // EQ Setting Normal byte bEQSetting = 0; // Play Next const int iPlayNext = 21; // Variable for reading the iPlayNext status int iPlayNextState = 0; // Play Previous const int iPlayPrevious = 17; // Variable for reading the iPlayPrevious status int iPlayPreviousState = 0; // Software Version Information String sver = "16-19"; void loop() { if (mp3.isPlaying() == false) { if ( x > iSongCount ) { x = 0; } else { x = x + 1; } // Play Track mp3.playTrack( x ); } else { // Volume isVolume(); // Play Next isPlayNext(); // Play Previous isPlayPrevious(); } }
getMP3.ino
// MP3 // Setup MP3 void isSetupMP3(){ // Check to see if Qwiic MP3 is present on the bus if (mp3.begin() == false) { // Qwiic MP3 failed to respond. Please check wiring and possibly the I2C address. Freezing... while (1); } if (mp3.hasCard() == false) { // Qwiic MP3 is missing its SD card. Freezing... while (1); } // Song Count iSongCount = mp3.getSongCount(); // EQ Setting Classic bEQSetting = mp3.getEQ(); // Initialize the iPlayNext pinMode( iPlayNext, INPUT); // Initialize the iPlayPrevious pinMode( iPlayPrevious, INPUT); } // Volume void isVolume() { // Volume iVolumeLevel = analogRead( iVolume ); // (0-1023 for 10 bits or 0-4095 for 12 bits) iVolumeLevel = map(iVolumeLevel, 0, 4095, 0, 31); // Volume can be 0 (off) to 31 (max) mp3.setVolume( iVolumeLevel ); } // Play Next void isPlayNext() { // Read the state of the iPlayNext value iPlayNextState = digitalRead( iPlayNext ); if ( iPlayNextState == HIGH ) { mp3.stop(); if ( x > iSongCount ) { x = 0; } else { x = x + 1; } // Play Track mp3.playTrack( x ); } } // Play Previous void isPlayPrevious() { // Read the state of the iPlayPrevious value iPlayPreviousState = digitalRead( iPlayPrevious ); if ( iPlayPreviousState == HIGH ) { mp3.stop(); if ( x > iSongCount ) { x = 0; } else { x = x - 1; } // Play Track mp3.playTrack( x ); } }
setup.ino
// Setup void setup() { // Wire communicate with I2C / TWI devices Wire.begin(); // SparkFun MP3 Trigger Setup isSetupMP3(); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- Robotics
- 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
- 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/CV/LucPaquinCVEngMk2021c.pdf
https://www.jlpconsultants.com/CV/LucPaquinCVEspMk2021c.pdf
Web: https://www.donluc.com/
Web: http://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 #16: Sound – Music Acoustics – Mk18
——
#DonLucElectronics #DonLuc #Sound #WhiteNoise #Mozzi #WavePacket #Arduino #Project #Programming #Electronics #Microcontrollers #Consultant #VideoBlog
——
——
——
——
——
Music Acoustics
Music acoustics is a multidisciplinary field that combines knowledge from physics, psychophysics, physiology, and signal processing among other disciplines. As a branch of acoustics, it is concerned with researching and describing the physics of music, how sounds are employed to make music. Examples of areas of study are the function human voice (the physics of speech), computer analysis, and in the clinical.
DL2106Mk05
1 x Arduino Pro Mini 328 – 5V/16MHz
2 x Mountable Slide Switch
1 x 10K Ohm
2 x LED Green
2 x 270 Ohm
3 x Rotary Potentiometer – 10k Ohm
3 x Knob
1 x Audio Jack 3.5mm
1 x SparkFun Audio Jack Breakout
2 x Battery Holder – 2 x AAA
4 x Alkaline Battery – AAA
1 x JST Jumper 2 Wire Assembly
19 x Wire Solid Core – 22 AWG
8 x Screw, 1/4 inches, 4-40
8 x Nut, Nylon Locknut, 4-40
3 x Standoff, Metal 4-40, 3/8 inches
1 x Adafruit Perma-Proto Quarter-sized Breadboard PCB
1 x Bakelite Perfboard
1 x Hamburger Mini Speaker
1 x ABS Plastic Multi-Purpose Enclosures
1 x SparkFun Cerberus USB Cable
1 x SparkFun FTDI Basic Breakout – 5V
Arduino Pro Mini 328 – 5V/16MHz
PO1 – Analog A0
PO2 – Analog A1
PO3 – Analog A2
SPK – Digital 9
LD1 – Digital 6
LD2 – Digital 7
SW1 – Digital 4
VIN – +5V
GND – GND
DL2106Mk05p.ino
// ***** Don Luc Electronics © ***** // Software Version Information // Project #16: Sound - Music Acoustics - Mk18 // 06-05 // DL2106Mk05.ino 16-18 // 1 x Arduino Pro Mini 328 - 5V/16MHz // 2 x Mountable Slide Switch // 1 x 10K Ohm // 2 x LED Green // 2 x 270 Ohm // 3 x Rotary Potentiometer - 10k Ohm // 3 x Knob // 1 x Audio Jack 3.5mm // 1 x SparkFun Audio Jack Breakout // 2 x Battery Holder - 2 x AAA // 4 x Alkaline Battery - AAA // 1 x JST Jumper 2 Wire Assembly // 19 x Wire Solid Core - 22 AWG // 8 x Screw, 1/4 inches, 4-40 // 8 x Nut, Nylon Locknut, 4-40 // 3 x Standoff, Metal 4-40, 3/8 inches // 1 x Adafruit Perma-Proto Quarter-sized Breadboard PCB // 1 x Bakelite Perfboard // 1 x Hamburger Mini Speaker // 1 x ABS Plastic Multi-Purpose Enclosures // 1 x SparkFun Cerberus USB Cable // 1 x SparkFun FTDI Basic Breakout - 5V // Include the Library Code // Mozzi #include <MozziGuts.h> // Mozzi Random #include <mozzi_rand.h> // Oscillator template #include <Oscil.h> // Mozzi Analog #include <mozzi_analog.h> // WavePacket Sample #include <WavePacket.h> // Rolling Average #include <RollingAverage.h> // Sine table for oscillator whitenoise #include <tables/whitenoise8192_int8.h> // Set the input for the knob #define FUNDAMENTAL_PIN A0 #define BANDWIDTH_PIN A1 #define CENTREFREQ_PIN A2 // for smoothing the control signals // Rolling Average RollingAverage <int, 32> kAverageF; RollingAverage <int, 32> kAverageBw; RollingAverage <int, 32> kAverageCf; // SINGLE selects 1 non-overlapping stream WavePacket <SINGLE> wavey; // Oscil <table_size, update_rate> oscilName (wavetable) Oscil <WHITENOISE8192_NUM_CELLS, AUDIO_RATE> aSin(WHITENOISE8192_DATA); // Mini Speaker int SPK = 9; // Mountable Slide Switch int iSS1 = 4; // State int iSS1State = 0; // LED Green int iLEDG1 = 6; int iLEDG2 = 7; // Set the input for the volume // Volume level from updateControl() to updateAudio() byte vol; // Software Version Information String sver = "16-18"; void loop() { // Slide Switch // Read the state of the iSS1 value iSS1State = digitalRead(iSS1); // Audio Hook audioHook(); }
getMozzi.ino
// Mozzi // Update Control void updateControl(){ // If it is the Slide Switch State is HIGH if (iSS1State == HIGH) { // White Noise vol = 255; } else { // Wavey Set wavey.set(kAverageF.next(mozziAnalogRead(FUNDAMENTAL_PIN))+1, kAverageBw.next(mozziAnalogRead(BANDWIDTH_PIN)), kAverageCf.next(2*mozziAnalogRead(CENTREFREQ_PIN))); } } // Update Audio int updateAudio() { // If it is the Slide Switch State is HIGH if (iSS1State == HIGH) { // LED Green digitalWrite(iLEDG1, HIGH); digitalWrite(iLEDG2, LOW); // White Noise char whitenoise = rand((byte)255) - 128; return (((whitenoise * aSin.next())) * vol)>>8; } else { // LED Green digitalWrite(iLEDG1, LOW); digitalWrite(iLEDG2, HIGH); // AUDIO_MODE STANDARD // Wavey Next return wavey.next()>>8; } }
setup.ino
// Setup void setup() { // Slide Switch pinMode(iSS1, INPUT); // LED Green pinMode(iLEDG1, OUTPUT); pinMode(iLEDG2, OUTPUT); // Mozzi Start startMozzi(); // Set the frequency aSin.setFreq(0.05f); }
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- Robotics
- 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
- 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/CV/LucPaquinCVEngMk2021c.pdf
https://www.jlpconsultants.com/CV/LucPaquinCVEspMk2021c.pdf
Web: https://www.donluc.com/
Web: http://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 #16: Sound – White Noise or Wave Packet – Mk17
——
#donluc #sound #whitenoise #mozzi #WavePacket #arduino #sparkfun #project #programming #electronics #microcontrollers #consultant #zoom #patreon #videoblog
——
——
——
——
White Noise
White Noise can be used by all audiences in a variety of ways throughout our daily lives. Whether you’re trying to work, study, relax, or even sleep. Offices can be either too quiet or too noisy. White noise makes it impossible to concentrate. Sound affects many areas of the brain and has an undeniable effect on the body. A good way to test if a particular sound is relaxing to you is to check your pulse, if it slows down, then you have found the sound that is calming you. Keep listening to it and you will relax, reaching a state of increased calmness and reducing your levels of anxiety, stress, or anger.
Wave Packet
In physics, a wave packet is a short burst of localized wave action that travels as a unit. A wave packet can be analyzed into, or can be synthesized from, an infinite set of component sinusoidal waves of different wavenumbers, with phases and amplitudes such that they interfere constructively only over a small region of space, and destructively elsewhere.Each component wave function, and hence the wave packet, are solutions of a wave equation. Depending on the wave equation, the wave packet’s profile may remain constant or it may change while propagating.
DL2104Mk02
1 x Arduino Pro Mini 328 – 5V/16MHz
1 x Mountable Slide Switch
1 x 10K Ohm
2 x LED Green
2 x 270 Ohm
3 x Rotary Potentiometer – 10k Ohm
3 x Knob
1 x Audio Jack 3.5mm
1 x SparkFun Audio Jack Breakout
1 x Hamburger Mini Speaker
12 x Wire Solid Core – 22 AWG
7 x Jumper Wires 3 inches M/M
2 x Jumper Wires 6 inches M/M
1 x Full-Size Breadboard
1 x SparkFun Cerberus USB Cable
1 x SparkFun FTDI Basic Breakout – 5V
Arduino Pro Mini 328 – 5V/16MHz
PO1 – Analog A0
PO2 – Analog A1
PO3 – Analog A2
SPK – Digital 9
LD1 – Digital 6
LD2 – Digital 7
SW1 – Digital 4
VIN – +5V
GND – GND
DL2104Mk02p.ino
// ***** Don Luc Electronics © ***** // Software Version Information // Project #16: Sound - White Noise - Mk17 // 04-02 // DL2104Mk02p.ino 16-17 // 1 x Arduino Pro Mini 328 - 5V/16MHz // 1 x Mountable Slide Switch // 1 x 10K Ohm // 2 x LED Green // 2 x 270 Ohm // 3 x Rotary Potentiometer - 10k Ohm // 3 x Knob // 1 x Audio Jack 3.5mm // 1 x SparkFun Audio Jack Breakout // 1 x Hamburger Mini Speaker // 12 x Wire Solid Core - 22 AWG // 7 x Jumper Wires 3 inches M/M // 2 x Jumper Wires 6 inches M/M // 1 x Full-Size Breadboard // 1 x SparkFun Cerberus USB Cable // 1 x SparkFun FTDI Basic Breakout - 5V // Include the Library Code // Mozzi #include <MozziGuts.h> // Mozzi Random #include <mozzi_rand.h> // Oscillator template #include <Oscil.h> // Mozzi Analog #include <mozzi_analog.h> // WavePacket Sample //#include <WavePacketSample.h> #include <WavePacket.h> // Rolling Average #include <RollingAverage.h> // Sine table for oscillator whitenoise #include <tables/whitenoise8192_int8.h> // Set the input for the knob #define FUNDAMENTAL_PIN A0 #define BANDWIDTH_PIN A1 #define CENTREFREQ_PIN A2 // for smoothing the control signals // Rolling Average RollingAverage <int, 32> kAverageF; RollingAverage <int, 32> kAverageBw; RollingAverage <int, 32> kAverageCf; // SINGLE selects 1 non-overlapping stream WavePacket <SINGLE> wavey; // Oscil <table_size, update_rate> oscilName (wavetable) Oscil <WHITENOISE8192_NUM_CELLS, AUDIO_RATE> aSin(WHITENOISE8192_DATA); // Mini Speaker int SPK = 9; // Mountable Slide Switch int iSS1 = 4; // State int iSS1State = 0; // LED Green int iLEDG1 = 6; int iLEDG2 = 7; // Set the input for the volume // Volume level from updateControl() to updateAudio() byte vol; // Software Version Information String sver = "16-17"; void loop() { // Slide Switch // Read the state of the iSS1 value iSS1State = digitalRead(iSS1); // Audio Hook audioHook(); }
getMozzi.ino
// Mozzi // Update Control void updateControl(){ // If it is the Slide Switch State is HIGH if (iSS1State == HIGH) { // White Noise vol = 255; } else { // Wavey Set wavey.set(kAverageF.next(mozziAnalogRead(FUNDAMENTAL_PIN))+1, kAverageBw.next(mozziAnalogRead(BANDWIDTH_PIN)), kAverageCf.next(2*mozziAnalogRead(CENTREFREQ_PIN))); } } // Update Audio int updateAudio() { // If it is the Slide Switch State is HIGH if (iSS1State == HIGH) { // LED Green digitalWrite(iLEDG1, HIGH); digitalWrite(iLEDG2, LOW); // White Noise char whitenoise = rand((byte)255) - 128; return (((whitenoise * aSin.next())) * vol)>>8; } else { // LED Green digitalWrite(iLEDG1, LOW); digitalWrite(iLEDG2, HIGH); // AUDIO_MODE STANDARD // Wavey Next return wavey.next()>>8; } }
setup.ino
// Setup void setup() { // Slide Switch pinMode(iSS1, INPUT); // LED Green pinMode(iLEDG1, OUTPUT); pinMode(iLEDG2, OUTPUT); // Mozzi Start startMozzi(); // Set the frequency aSin.setFreq(0.05f); }
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- Robotics
- 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
- 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
https://www.donluc.com/DLE/LucPaquinCVEngMk2021a.pdf
Web: https://www.donluc.com/
Web: http://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