Project #16: Sound – Thumb Joystick – Mk10

——

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

——

Thumb Joystick

——

Thumb Joystick

——

Thumb Joystick

——

Thumb Joystick

——

Thumb Joystick

This is a joystick very similar to the analog joysticks on PS2 controllers. Directional movements are simply two potentiometers, one for each axis. Pots are 10k Ohm each. This joystick also has a select button that is actuated when the joystick is pressed down. This is the breakout board for the thumb joystick. Pins are broken out to a 0.1″ header and includes 4 mounting holes in the corners.

Mozzi

Mozzi synthesis wave packet double, selects 2 overlapping streams. In a wave packet is a short burst of localized wave action that travels as a unit. A wave packet 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. Synthesizer and used a capacitor to store and slowly release voltage produced. He refined the design to remove the need to push a separate button one to produce the control voltage determining pitch and the other to trigger the envelope generator. The envelope generator became a standard feature of synthesizers.

Arduino

Joystick vertical potentiometer a fundamental, joystick horizontal potentiometer a bandwidth, potentiometer centre frequency and a select button that is actuated when the joystick is pressed down a random number.

DL2011Mk04

1 x Arduino Uno
1 x Thumb Joystick
1 x SparkFun Thumb Joystick Breakout
1 x Potentiometer
1 x Knob
1 x Audio Jack 3.5mm
1 x SparkFun Audio Jack Breakout
1 x Speaker
5 x Wire Solid Core – 22 AWG
3 x Jumper Wires 3in M/M
4 x Jumper Wires 6in M/M
1 x Half-Size Breadboard
1 x SparkFun Cerberus USB Cable

Arduino Uno

SPK – Digital 9
JSV – Analog A0
JSH – Analog A1
PO2 – Analog A2
SEL – Digital 13
VIN – +5V
GND – GND

DL2011Mk04p.ino

// ***** Don Luc Electronics © *****
// Software Version Information
// Project #16: Sound - Thumb Joystick - Mk10
// 11-04
// DL2011Mk04p.ino 16-10
// 1 x Arduino Uno
// 1 x Thumb Joystick
// 1 x SparkFun Thumb Joystick Breakout
// 1 x Potentiometer
// 1 x Knob
// 1 x Audio Jack 3.5mm
// 1 x SparkFun Audio Jack Breakout
// 1 x Speaker
// 5 x Wire Solid Core - 22 AWG
// 3 x Jumper Wires 3in M/M
// 4 x Jumper Wires 6in M/M
// 1 x Half-Size Breadboard
// 1 x SparkFun Cerberus USB Cable

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

// Store the Arduino pin associated with each axis X of the joystick input
// FUNDAMENTAL
const int JoystickVert = A0;
// Store the Arduino pin associated with each axis Y of the joystick input
// BANDWIDTH
const int JoystickHorz = A1;
// Set the input for the potentiometer for volume to analog pin 2
// CENTREFREQ
const char PotCENTREFREQ = A2;
// Select button is triggered when joystick is pressed
const int SEL = 13;
// Variables for reading the pushbutton status
int selState  = 0; 

// for smoothing the control signals
// use: RollingAverage  myThing
// FUNDAMENTAL
RollingAverage  kAverageF;
// BANDWIDTH
RollingAverage  kAverageBw;
// CENTREFREQ
RollingAverage  kAverageCf;

// Min and max values of synth parameters to map AutoRanged analog inputs to
// FUNDAMENTAL
const int MIN_F = 10;
const int MAX_F = 200;
// BANDWIDTH
const int MIN_BW = 10;
const int MAX_BW = 1000;
// CENTREFREQ
const int MIN_CF = 60;
const int MAX_CF = 2000;

// Auto Map
// FUNDAMENTAL
AutoMap kMapF(0,1023,MIN_F,MAX_F);
// BANDWIDTH
AutoMap kMapBw(0,1023,MIN_BW,MAX_BW);
// CENTREFREQ
AutoMap kMapCf(0,1023,MIN_CF,MAX_CF);

// Wave Packet
// DOUBLE selects 2 overlapping streams
WavePacket  wavey;

// Random Number
long randNumber;

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

void loop() {

  // Audio Hook
  audioHook();

}

getMozzi.ino

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

  // Wavey
  // Fundamental
  int fundamental = mozziAnalogRead( JoystickVert )+1;
  fundamental = kMapF(fundamental);
  
  // Bandwidth
  int bandwidth = mozziAnalogRead( JoystickHorz );
  // Select button is triggered when joystick is pressed
  bandwidth = kMapBw(bandwidth);

  //Centre Frequency
  int centre_freq = mozziAnalogRead( PotCENTREFREQ );
  selState = digitalRead( SEL ); 
  if (selState == HIGH)
  {
    
    randNumber = random(300);
    centre_freq = randNumber;

  }
  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() {

  // Select button is triggered when joystick is pressed
  pinMode(SEL, INPUT_PULLUP);
  // Start Mozzi
  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

Leave a Comment