Project #16: Sound – Mozzi – Mk09

——

#donluc #sound #simplekeyboard #synthesizer #mozzi #programming #arduino #fritzing #electronics #microcontrollers #consultant #vlog

——

Mozzi

——

Mozzi

——

Mozzi

——

Mozzi

——

Mozzi

Currently your Arduino can only beep like a microwave oven. Mozzi brings your Arduino to life by allowing it to produce much more complex and interesting growls, sweeps and chorusing atmospherics. These sounds can be quickly and easily constructed from familiar synthesis units like oscillators, delays, filters and envelopes. You can use Mozzi to generate algorithmic music for an installation or performance, or make interactive sonifications of sensors, on a small, modular and super cheap Arduino, without the need for additional shields, message passing or external synths.

Wavepacket Synthesis Arduino

Wavepacket synthesis, with two overlapping streams of wave packets. Each packet is an enveloped grain of a sin (or cos) wave. The frequency of the wave, the width of the envelopes and the rate of release of envelopes are the parameters which can be changed. Potentiometer A0 Fundamental, the rate at which packets are produced. Potentiometer A1 Bandwidth, the width of each packet. A lower value allows more of the centre frequency to be audible, a rounder sound. A higher value produces narrower packets, a more buzzing sound. Potentiometer A2 Centrefreq, the oscillation frequency within each packet.

DL2011Mk03

1 x Arduino Uno
3 x Potentiometer
3 x Knob
1 x Audio Jack 3.5mm
1 x SparkFun Audio Jack Breakout
1 x Speaker
7 x Jumper Wires 3in M/M
6 x Jumper Wires 6in M/M
1 x Half-Size Breadboard
1 x SparkFun Cerberus USB Cable

Arduino Uno

SPK – Digital 9
PO0 – Analog A0
PO1 – Analog A1
PO2 – Analog A2
VIN – +5V
GND – GND

DL2011Mk03p.ino

// ***** Don Luc Electronics © *****
// Software Version Information
// Project #16: Sound - Mozzi - Mk09
// 11-03
// DL2011Mk03p.ino 16-09
// 1 x Arduino Uno
// 3 x Potentiometer
// 3 x Knob
// 1 x Audio Jack 3.5mm
// 1 x SparkFun Audio Jack Breakout
// 1 x Speaker
// 7 x Jumper Wires 3in M/M
// 6 x Jumper Wires 6in M/M
// 1 x Half-Size Breadboard
// 1 x SparkFun Cerberus USB Cable

// Include the Library Code
#include 
#include 
#include 
#include 

// Set the input for the potentiometer fundamental to analog pin 0
const int PotFun = A0;
// Set the input for the potentiometer for bandwidth to analog pin 1
const int PotBan = A1;
// Set the input for the potentiometer for centre_freq to analog pin 2
const int PotFre = A2;

// Min and Max values of synth parameters
// to map AutoRanged analog inputs to
// Fundamental
const int MIN_F = 20;
const int MAX_F = 150;
// Bandwidth
const int MIN_BW = 20;
const int MAX_BW = 150;
//Centre Frequency
const int MIN_CF = 20;
const int MAX_CF = 150;

// For smoothing the control signals
// RollingAverage  myThing
// Fundamental
RollingAverage  kAverageF;
// Bandwidth
RollingAverage  kAverageBw;
//Centre Frequency
RollingAverage  kAverageCf;

// Intmap is a pre-calculated faster version of Arduino's map
IntMap kMapF(0,1023,MIN_F,MAX_F);
// AutoMap adapts to range of input as it arrives
AutoMap kMapBw(0,1023,MIN_BW,MAX_BW);
AutoMap kMapCf(0,1023,MIN_CF,MAX_CF);

// DOUBLE selects 2 overlapping streams
WavePacket  wavey;

// Software Version Information
String sver = "16-09";

void loop() {

  // Audio Hook
  audioHook();

}

getMozzi.ino

// Mozzi
// Update Control
void updateControl(){

  // Fundamental
  int fundamental = mozziAnalogRead( PotFun )+1;
  fundamental = kMapF(fundamental);
  
  // Bandwidth
  int bandwidth = mozziAnalogRead( PotBan );
  bandwidth = kMapBw(bandwidth);

  //Centre Frequency
  int centre_freq = mozziAnalogRead( PotFre );
  centre_freq = kMapCf(centre_freq);
  
  // Wavey
  wavey.set(fundamental, bandwidth, centre_freq);
  
}
// Update Audio 
int updateAudio(){

  // >>8 for AUDIO_MODE STANDARD
  return wavey.next()>>8;
  
}

setup.ino

// Setup
void setup() {

  // Wait before starting Mozzi to receive analog reads,
  // so AutoRange will not get 0
  delay(200);
  startMozzi();
  
}

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

  • Arduino
  • Raspberry Pi
  • Espressif
  • Robotics
  • DOS, Windows, OSX, Linux, iOS, Android, Multi-OS
  • Linux-Apache-PHP-MySQL

Follow Us

J. Luc Paquin – Curriculum Vitae
http://www.donluc.com/DLHackster/LucPaquinCVEngMk2020a.pdf

Web: http://www.donluc.com/
Web: http://www.jlpconsultants.com/
Web: http://www.donluc.com/DLHackster/
Web: https://www.hackster.io/neosteam-labs
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/luc.paquin/

Don Luc

Project #7: RGB LCD Shield – Bi-Color LED – Mk09

Bi-Color LED

Bi-color LEDs contain two different LED emitters in one case. There are two types of these. One type consists of two dies connected to the same two leads antiparallel to each other. Current flow in one direction emits one color, and current in the opposite direction emits the other color. The other type consists of two dies with separate leads for both dies and another lead for common anode or cathode so that they can be controlled independently. The most common bi-color combination is red/traditional green, however, other available combinations include amber/traditional green, red/pure green, red/blue, and blue/pure green.

Super Bright BiPolar LEDs

Package of 12 super bright Red/Green jumbo T1 3/4 5mm LEDs. These have a diffused frosted lens and 3 long leads. Prime 100% perfect and bright. CODE 7: 100% Prime Parts. Stock # GP55

DonLuc1808Mk02

1 x RGB LCD Shield 16×2 Character Display
1 x Arduino UNO – R3
1 x ProtoScrewShield
3 x Bi-Color LED GP55
3 x 270 Ohm Resistance
3 x 330 Ohm Resistance
3 x Jumper Wires 3″ M/M
7 x Jumper Wires 6″ M/M
1 x Size Breadboard
1 x USB Cable A to B

Arduino UNO

LG3 – Digital 5
LR3 – Digital 4
LG2 – Digital 3
LR2 – Digital 2
LG1 – Digital 1
LR1 – Digital 0
GND – GND

DonLuc1808Mk02p.ino

// ***** Don Luc *****
// Software Version Information
// Project #7: RGB LCD Shield – Bi-Color LED  – Mk09
// 8-02
// DonLuc1808Mk02p 8-02
// RGB LCD Shield
// Bi-Color LED

// Include Library Code
#include <Adafruit_MCP23017.h>
#include <Adafruit_RGBLCDShield.h>

// RGB LCD Shield
Adafruit_RGBLCDShield RGBLCDShield = Adafruit_RGBLCDShield();
#define GREEN 0x2

// Bi-Color LED
int iLR1 = 0;      // LED Red 1
int iLG1 = 1;      // LED Green 1
int iLR2 = 2;      // LED Red 2
int iLG2 = 3;      // LED Green 2
int iLR3 = 4;      // LED Red 3
int iLG3 = 5;      // LED Green 3

void loop() 
{

  // Bi-Color LED
  isBiColor();

  delay(1000);
  
  // Clear
  RGBLCDShield.clear();
  
}

getBiColor.ino

// Bi-Color LED
void isBiColor()
{
   
  // Display
  // Set the cursor to column 0, line 0  
  RGBLCDShield.setCursor(0,0);
  RGBLCDShield.print("Bi-Color LED");         // Bi-Color LED

  // Bi-Color LED
   
  // Set the cursor to column 0, line 1
  RGBLCDShield.setCursor(0, 1); 
  RGBLCDShield.print("L1x- L2x- L3x-");      // Bi-Color LED Red

  digitalWrite(iLR1, HIGH);                  // LED Red 1
  digitalWrite(iLG1, LOW);                   // LED Green 1
  digitalWrite(iLR2, HIGH);                  // LED Red 2
  digitalWrite(iLG2, LOW);                   // LED Green 2
  digitalWrite(iLR3, HIGH);                  // LED Red 3
  digitalWrite(iLG3, LOW);                   // LED Green 3

  delay( 2000 );

  // Set the cursor to column 0, line 1
  RGBLCDShield.setCursor(0, 1); 
  RGBLCDShield.print("L1-x L2-x L3-x");      // Bi-Color LED Green

  digitalWrite(iLR1, LOW);                   // LED Red 1
  digitalWrite(iLG1, HIGH);                  // LED Green 1
  digitalWrite(iLR2, LOW);                   // LED Red 2
  digitalWrite(iLG2, HIGH);                  // LED Green 2  
  digitalWrite(iLR3, LOW);                   // LED Red 3
  digitalWrite(iLG3, HIGH);                  // LED Green 3

  delay( 2000 );

  // Set the cursor to column 0, line 1
  RGBLCDShield.setCursor(0, 1); 
  RGBLCDShield.print("L1xx L2xx L3xx");      // Bi-Color LED Red-Green

  digitalWrite(iLR1, HIGH);                  // LED Red 1
  digitalWrite(iLG1, HIGH);                  // LED Green 1
  digitalWrite(iLR2, HIGH);                  // LED Red 2
  digitalWrite(iLG2, HIGH);                  // LED Green 2  
  digitalWrite(iLR3, HIGH);                  // LED Red 3
  digitalWrite(iLG3, HIGH);                  // LED Green 3

  delay( 2000 ); 
  
}

setup.ino

// Setup
void setup() 
{

  // set up the LCD's number of columns and rows: 
  RGBLCDShield.begin(16, 2);
  RGBLCDShield.setBacklight(GREEN);
  
  // Display
  // Set the cursor to column 0, line 0  
  RGBLCDShield.setCursor(0,0);  
  RGBLCDShield.print("Don Luc");           // Don luc
  // Set the cursor to column 0, line 1
  RGBLCDShield.setCursor(0, 1);
  RGBLCDShield.print("Bi-Color LED");      // Bi-Color LED
  delay(5000);

  // Clear
  RGBLCDShield.clear();

  // Bi-Color LED
  pinMode(iLR1, OUTPUT);                   // LED Red 1
  pinMode(iLG1, OUTPUT);                   // LED Green 1
  pinMode(iLR2, OUTPUT);                   // LED Red 2
  pinMode(iLG2, OUTPUT);                   // LED Green 2
  pinMode(iLR3, OUTPUT);                   // LED Red 3
  pinMode(iLG3, OUTPUT);                   // LED Green 3
  
}

Don Luc

LED – Infrared 950nm

Infrared LEDs are used for remote controls and ‘night-vision’ cameras, and these little blue guys are high powered ones. They are 950nm wavelength, which is what nearly all devices listen to.

The IR LED (or infrared light-emitting diode) Bit sends out light with longer wavelengths than visible light, similar to the light in your remote control. It’s invisible to the eye, but many digital cameras can see it. Try using it to activate the light sensor or remote trigger.

In short, LEDs are like tiny lightbulbs. However, LEDs require a lot less power to light up by comparison. They’re also more energy efficient, so they don’t tend to get hot like conventional lightbulbs do (unless you’re really pumping power into them). This makes them ideal for mobile devices and other low-power applications.

Technical Details

* 5mm LED
* 950nm wavelength (most common)
* 20 degree beam width

LED – Infrared 950nm

5 x Powerful IR LEDs GP54
5 x 30 Ohm
1 x Battery Holder 2xAAA with Cover and Switch
2 x Battery AAA
1 x Half-Size Breadboard
5 x Jumper Wires 3″ M/M

Don Luc