Steren
Steren
Project #22: Synthesizer – 4 Stages – Mk11
——
#DonLucElectronics #DonLuc #Synthesizer #Mozzi #Keyboard #ADSREnvelope #Arduino #SparkFunRedBoard #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
4 Stages of an ADSR Envelope
An ADSR envelope features these four stages.
- 1 Attack: The attack phase begins the moment a key is pressed. This phase determines how quickly a sound reaches full volume before entering the decay phase. On an analog synthesizer, this phase is typically instantaneous. Some modern synthesizers allow for the attack time to be delayed.
- 2 Decay: The decay phase determines the length of the drop from the peak level to the sustain level of a sound. The decay time can often be altered to change the overall sound. For instance, a short attack and a long decay will produce a sound that reaches maximum amplitude quickly and falls slowly to the sustain level.
- 3 Sustain: The sustain phase does not specify a length of time. Instead, it determines the volume of a sound for the entire hold time between the decay and release phases.
- 4 Release: The final phase determines the speed at which a sound ends from the moment you release the key. Depending on the desired sound, the release time can be short or long.
DL2208Mk04
1 x SparkFun RedBoard
7 x Momentary Button – Panel Mount (Blue)
5 x Momentary Button – Panel Mount (Black)
12 x 10K Ohm Resistor
5 x 10k Ohm Slide Linear Taper Pot – X-Large
5 x Slide Potentiometer Knob – X-Large
1 x Perfboard 13.5 cm x 11 cm
1 x SparkFun Solderable Breadboard
1 x Audio Jack 3.5mm
1 x SparkFun Audio Jack Breakout
1 x SparkFun ProtoShield
1 x Insignia Speakers
1 x SparkFun Cerberus USB Cable
SparkFun RedBoard
LP0 – Analog A0 – Blue
LP1 – Analog A1 – Green
LP2 – Analog A2 – Grey
LP3 – Analog A3 – Yellow
LP4 – Analog A4 – Purple
KY1 – 1
KY2 – 2
KY3 – 3
KY4 – 4
KY5 – 5
KY6 – 6
KY7 – 7
KY8 – 8
SPK – 9
KY10 – 10
KY11 – 11
KY12 – 12
KY13 – 13
VIN – +5V
GND – GND
DL2208Mk04p.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #22: Synthesizer - 4 Stages - Mk11 22-11 DL2208Mk04p.ino 1 x SparkFun RedBoard 7 x Momentary Button - Panel Mount (Blue) 5 x Momentary Button - Panel Mount (Black) 12 x 1K Ohm Resistor 5 x 10k Ohm Slide Linear Taper Pot - X-Large 5 x Slide Potentiometer Knob - X-Large 1 x Perfboard 13.5 cm x 11 cm 1 x SparkFun Solderable Breadboard 1 x Audio Jack 3.5mm 1 x SparkFun Audio Jack Breakout 1 x SparkFun ProtoShield 1 x Insignia Speakers 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // Pitches #include "pitches.h" // Mozzi #include <MozziGuts.h> // Oscillator #include <Oscil.h> // Sine Wave Table For Oscillator #include <tables/sin2048_int8.h> // ADSR envelope generator #include <ADSR.h> // Simple Keyboard // Minimum reading of the button that generates a note const int iKeyboard1 = 1; const int iKeyboard2 = 2; const int iKeyboard3 = 3; const int iKeyboard4 = 4; const int iKeyboard5 = 5; const int iKeyboard6 = 6; const int iKeyboard7 = 7; const int iKeyboard8 = 8; const int iKeyboard10 = 10; const int iKeyboard11 = 11; const int iKeyboard12 = 12; const int iKeyboard13 = 13; // Button is pressed int iB1 = 1; int iB2 = 1; int iB3 = 1; int iB4 = 1; int iB5 = 1; int iB6 = 1; int iB7 = 1; int iB8 = 1; int iB10 = 1; int iB11 = 1; int iB12 = 1; int iB13 = 1; // Set the input for the potentiometer for Frequency to analog pin 2 const int potFreq = A2; int iFreg = 1; int iNoteA = 0; int iNoteAS = 0; int iNoteB = 0; int iNoteC = 0; int iNoteCS = 0; int iNoteD = 0; int iNoteDS = 0; int iNoteE = 0; int iNoteF = 0; int iNoteFS = 0; int iNoteG = 0; int iNoteGS = 0; // Potentiometer int iPot3 = A3; int iPot4 = A4; //Oscillator Functions declared for output envelope 1 // Sine Wave Oscil <2048, AUDIO_RATE> aSin1(SIN2048_DATA); // ADSR declaration/definition // Comment out to use control rate of 128 #define CONTROL_RATE 128 ADSR <CONTROL_RATE, CONTROL_RATE> envelope1; // Set the input for the potentiometer Attack to analog pin 1 const int potAttack = A0; // Attack int attack_level = 0; int iAttack = 0; // Set the input for the potentiometer for Decay to analog pin 2 const int potDecay = A1; // Decay int decay_level = 0; int iDecay = 0; // Software Version Information String sver = "22-11"; void loop() { // Audio Hook audioHook(); }
getKeyboard.ino
// getKeyboard // setupKeyboard void setupKeyboard() { // Initialize the button pin as an input pinMode(iKeyboard1, INPUT_PULLUP); pinMode(iKeyboard2, INPUT_PULLUP); pinMode(iKeyboard3, INPUT_PULLUP); pinMode(iKeyboard4, INPUT_PULLUP); pinMode(iKeyboard5, INPUT_PULLUP); pinMode(iKeyboard6, INPUT_PULLUP); pinMode(iKeyboard7, INPUT_PULLUP); pinMode(iKeyboard8, INPUT_PULLUP); pinMode(iKeyboard10, INPUT_PULLUP); pinMode(iKeyboard11, INPUT_PULLUP); pinMode(iKeyboard12, INPUT_PULLUP); pinMode(iKeyboard13, INPUT_PULLUP); } // isKeyboard void isKeyboard() { // Choose envelope levels // attack_level iAttack = mozziAnalogRead( potAttack ); attack_level = map( iAttack, 0, 1023, 100, 400); // Attack Level envelope1.setAttackLevel( attack_level ); // decay_level iDecay = mozziAnalogRead( potDecay ); decay_level = map( iDecay, 0, 1023, 50, 255); // Decay Level envelope1.setDecayLevel( decay_level ); // Read the state of the button value 1 if ( digitalRead(iKeyboard1) == HIGH ) { // Button is pressed - pullup keeps pin high normally 1 iB1 = iB1 + 1; // ADSR declaration/definition envelope1.noteOn(); aSin1.setFreq(iNoteA); } else { iB1 = iB1 - 1; } // Read the state of the button value 2 if ( digitalRead(iKeyboard2) == HIGH ) { // Button is pressed - pullup keeps pin high normally 2 iB2 = iB2 + 1; // ADSR declaration/definition envelope1.noteOn(); aSin1.setFreq(iNoteAS); } else { iB2 = iB2 - 1; } // Read the state of the button value 3 if ( digitalRead(iKeyboard3) == HIGH ) { // Button is pressed - pullup keeps pin high normally 3 iB3 = iB3 + 1; // ADSR declaration/definition envelope1.noteOn(); aSin1.setFreq(iNoteB); } else { iB3 = iB3 - 1; } // Read the state of the button value 4 if ( digitalRead(iKeyboard4) == HIGH ) { // Button is pressed - pullup keeps pin high normally 4 iB4 = iB4 + 1; // ADSR declaration/definition envelope1.noteOn(); aSin1.setFreq(iNoteC); } else { iB4 = iB4 - 1; } // Read the state of the button value 5 if ( digitalRead(iKeyboard5) == HIGH ) { // Button is pressed - pullup keeps pin high normally 5 iB5 = iB5 + 1; // ADSR declaration/definition envelope1.noteOn(); aSin1.setFreq(iNoteCS); } else { iB5 = iB5 - 1; } // Read the state of the button value 6 if ( digitalRead(iKeyboard6) == HIGH ) { // Button is pressed - pullup keeps pin high normally 6 iB6 = iB6 + 1; // ADSR declaration/definition envelope1.noteOn(); aSin1.setFreq(iNoteD); } else { iB6 = iB6 - 1; } // Read the state of the button value 7 if ( digitalRead(iKeyboard7) == HIGH ) { // Button is pressed - pullup keeps pin high normally 7 iB7 = iB7 + 1; // ADSR declaration/definition envelope1.noteOn(); aSin1.setFreq(iNoteDS); } else { iB7 = iB7 - 1; } // Read the state of the button value 8 if ( digitalRead(iKeyboard8) == HIGH ) { // Button is pressed - pullup keeps pin high normally 8 iB8 = iB8 + 1; // ADSR declaration/definition envelope1.noteOn(); aSin1.setFreq(iNoteE); } else { iB8 = iB8 - 1; } // Read the state of the button value 10 if ( digitalRead(iKeyboard10) == HIGH ) { // Button is pressed - pullup keeps pin high normally 10 iB10 = iB10 + 1; // ADSR declaration/definition envelope1.noteOn(); aSin1.setFreq(iNoteF); } else { iB10 = iB10 - 1; } // Read the state of the button value 11 if ( digitalRead(iKeyboard11) == HIGH ) { // Button is pressed - pullup keeps pin high normally 11 iB11 = iB11 + 1; // ADSR declaration/definition envelope1.noteOn(); aSin1.setFreq(iNoteFS); } else { iB11 = iB11 - 1; } // Read the state of the button value 12 if ( digitalRead(iKeyboard12) == HIGH ) { // Button is pressed - pullup keeps pin high normally 12 iB12 = iB12 + 1; // ADSR declaration/definition envelope1.noteOn(); aSin1.setFreq(iNoteG); } else { iB12 = iB12 - 1; } // Read the state of the button value 13 if ( digitalRead(iKeyboard13) == HIGH ) { // Button is pressed - pullup keeps pin high normally 13 iB13 = iB13 + 1; // ADSR declaration/definition envelope1.noteOn(); aSin1.setFreq(iNoteGS); } else { iB13 = iB13 - 1; } }
getMozzi.ino
// Mozzi // Update Control void updateControl(){ // Frequency isPitches(); // Keyboard isKeyboard(); } // Update Audio int updateAudio() { // Update Audio // ADSR declaration/definition envelope1.update(); // >>8 for AUDIO_MODE STANDARD return (int) (envelope1.next() * aSin1.next())>>8; }
getPitches.ino
// Pitches // isPitches void isPitches(){ // Frequency // Value is 0-1023 iFreg = mozziAnalogRead(potFreq); iFreg = map(iFreg, 0, 1023, 2, 6); // Range Frequency Note Low => High switch ( iFreg ) { case 1: // NOTE A1 iNoteA = NOTE_A1; iNoteAS = NOTE_AS1; iNoteB = NOTE_B1; iNoteC = NOTE_C2; iNoteCS = NOTE_CS2; iNoteD = NOTE_D2; iNoteDS = NOTE_DS2; iNoteE = NOTE_E2; iNoteF = NOTE_F2; iNoteFS = NOTE_FS2; iNoteG = NOTE_G2; iNoteGS = NOTE_GS2; break; case 2: // NOTE A2 iNoteA = NOTE_A2; iNoteAS = NOTE_AS2; iNoteB = NOTE_B2; iNoteC = NOTE_C3; iNoteCS = NOTE_CS3; iNoteD = NOTE_D3; iNoteDS = NOTE_DS3; iNoteE = NOTE_E3; iNoteF = NOTE_F3; iNoteFS = NOTE_FS3; iNoteG = NOTE_G3; iNoteGS = NOTE_GS3; break; case 3: // NOTE A3 iNoteA = NOTE_A3; iNoteAS = NOTE_AS3; iNoteB = NOTE_B3; iNoteC = NOTE_C4; iNoteD = NOTE_D4; iNoteDS = NOTE_DS4; iNoteE = NOTE_E4; iNoteF = NOTE_F4; iNoteFS = NOTE_FS4; iNoteG = NOTE_G4; iNoteGS = NOTE_GS4; break; case 4: // NOTE A4 iNoteA = NOTE_A4; iNoteAS = NOTE_AS4; iNoteB = NOTE_B4; iNoteC = NOTE_C5; iNoteCS = NOTE_CS5; iNoteD = NOTE_D5; iNoteE = NOTE_E5; iNoteF = NOTE_F5; iNoteFS = NOTE_FS5; iNoteG = NOTE_G5; iNoteGS = NOTE_GS5; break; case 5: // NOTE A5 iNoteA = NOTE_A5; iNoteAS = NOTE_AS5; iNoteB = NOTE_B5; iNoteC = NOTE_C6; iNoteCS = NOTE_CS6; iNoteD = NOTE_D6; iNoteDS = NOTE_DS6; iNoteE = NOTE_E6; iNoteF = NOTE_F6; iNoteFS = NOTE_FS6; iNoteG = NOTE_G6; iNoteGS = NOTE_GS6; break; case 6: // NOTE A6 iNoteA = NOTE_A6; iNoteAS = NOTE_AS6; iNoteB = NOTE_B6; iNoteC = NOTE_C7; iNoteCS = NOTE_CS7; iNoteD = NOTE_D7; iNoteDS = NOTE_DS7; iNoteE = NOTE_E7; iNoteF = NOTE_F7; iNoteFS = NOTE_FS7; iNoteG = NOTE_G7; iNoteGS = NOTE_GS7; break; } }
pitches.h
/***************************************************************** * Pitches NOTE_B0 <=> NOTE_DS8 - NOTE_A4 is "A" measured at 440Hz *****************************************************************/ #define NOTE_B0 31 #define NOTE_C1 33 #define NOTE_CS1 35 #define NOTE_D1 37 #define NOTE_DS1 39 #define NOTE_E1 41 #define NOTE_F1 44 #define NOTE_FS1 46 #define NOTE_G1 49 #define NOTE_GS1 52 #define NOTE_A1 55 #define NOTE_AS1 58 #define NOTE_B1 62 #define NOTE_C2 65 #define NOTE_CS2 69 #define NOTE_D2 73 #define NOTE_DS2 78 #define NOTE_E2 82 #define NOTE_F2 87 #define NOTE_FS2 93 #define NOTE_G2 98 #define NOTE_GS2 104 #define NOTE_A2 110 #define NOTE_AS2 117 #define NOTE_B2 123 #define NOTE_C3 131 #define NOTE_CS3 139 #define NOTE_D3 147 #define NOTE_DS3 156 #define NOTE_E3 165 #define NOTE_F3 175 #define NOTE_FS3 185 #define NOTE_G3 196 #define NOTE_GS3 208 #define NOTE_A3 220 #define NOTE_AS3 233 #define NOTE_B3 247 #define NOTE_C4 262 #define NOTE_CS4 277 #define NOTE_D4 294 #define NOTE_DS4 311 #define NOTE_E4 330 #define NOTE_F4 349 #define NOTE_FS4 370 #define NOTE_G4 392 #define NOTE_GS4 415 #define NOTE_A4 440 #define NOTE_AS4 466 #define NOTE_B4 494 #define NOTE_C5 523 #define NOTE_CS5 554 #define NOTE_D5 587 #define NOTE_DS5 622 #define NOTE_E5 659 #define NOTE_F5 698 #define NOTE_FS5 740 #define NOTE_G5 784 #define NOTE_GS5 831 #define NOTE_A5 880 #define NOTE_AS5 932 #define NOTE_B5 988 #define NOTE_C6 1047 #define NOTE_CS6 1109 #define NOTE_D6 1175 #define NOTE_DS6 1245 #define NOTE_E6 1319 #define NOTE_F6 1397 #define NOTE_FS6 1480 #define NOTE_G6 1568 #define NOTE_GS6 1661 #define NOTE_A6 1760 #define NOTE_AS6 1865 #define NOTE_B6 1976 #define NOTE_C7 2093 #define NOTE_CS7 2217 #define NOTE_D7 2349 #define NOTE_DS7 2489 #define NOTE_E7 2637 #define NOTE_F7 2794 #define NOTE_FS7 2960 #define NOTE_G7 3136 #define NOTE_GS7 3322 #define NOTE_A7 3520 #define NOTE_AS7 3729 #define NOTE_B7 3951 #define NOTE_C8 4186 #define NOTE_CS8 4435 #define NOTE_D8 4699 #define NOTE_DS8 4978
setup.ino
// Setup void setup() { // Setup Keyboard setupKeyboard(); // Mozzi Start startMozzi( CONTROL_RATE ); // Sets Attack and Decay Levels; assumes Sustain, Decay, and Idle times envelope1.setADLevels(200,200); // Sets Decay time in milliseconds envelope1.setDecayTime(200); // Sustain Time setting for envelope1 envelope1.setSustainTime(52500); }
——
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 – ADSR Envelope – Mk10
——
#DonLucElectronics #DonLuc #Synthesizer #Mozzi #Keyboard #ADSREnvelope #Arduino #SparkFunRedBoard #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
What Is an Envelope in Music?
An envelope is a term used to describe the evolution of a sound in a piece of music. Envelopes are fed through an envelope generator, the component within an analog synthesizer that signals when and how a sound should change. The envelope defines the trajectory and modulation of a sound, while the envelope generator controls the behavior of the envelope.
What Is an ADSR Envelope?
An ADSR envelope is a type of envelope control mechanism commonly found in the synthesizer and samplers used in electronic music. ADSR stands for the envelope’s four stages of modulation: attack, decay, sustain, and release. These stages control the level of the sound from the moment you press a key or advance a music sequencer.
In sound design, ADSR envelopes are typically used to control the loudness of a sound. ADSR envelopes typically produce a sound that takes the shape of a waveform rising in the attack stage, slightly declining during the decay stage, plateauing during the sustain stage, and finally falling at the return stage.
DL2208Mk03
1 x SparkFun RedBoard
7 x Momentary Button – Panel Mount (Blue)
5 x Momentary Button – Panel Mount (Black)
12 x 10K Ohm Resistor
5 x 10k Ohm Slide Linear Taper Pot – X-Large
5 x Slide Potentiometer Knob – X-Large
1 x Perfboard 13.5 cm x 11 cm
1 x SparkFun Solderable Breadboard
1 x Audio Jack 3.5mm
1 x SparkFun Audio Jack Breakout
1 x SparkFun ProtoShield
1 x Insignia Speakers
1 x SparkFun Cerberus USB Cable
SparkFun RedBoard
LP0 – Analog A0 – Blue
LP1 – Analog A1 – Green
LP2 – Analog A2 – Grey
LP3 – Analog A3 – Yellow
LP4 – Analog A4 – Purple
KY1 – 1
KY2 – 2
KY3 – 3
KY4 – 4
KY5 – 5
KY6 – 6
KY7 – 7
KY8 – 8
SPK – 9
KY10 – 10
KY11 – 11
KY12 – 12
KY13 – 13
VIN – +5V
GND – GND
——
DL2208Mk03p.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #22: Synthesizer - ADSR Envelope - Mk10 22-10 DL2208Mk03p.ino 1 x SparkFun RedBoard 7 x Momentary Button - Panel Mount (Blue) 5 x Momentary Button - Panel Mount (Black) 12 x 1K Ohm Resistor 5 x 10k Ohm Slide Linear Taper Pot - X-Large 5 x Slide Potentiometer Knob - X-Large 1 x Perfboard 13.5 cm x 11 cm 1 x SparkFun Solderable Breadboard 1 x Audio Jack 3.5mm 1 x SparkFun Audio Jack Breakout 1 x SparkFun ProtoShield 1 x Insignia Speakers 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // Pitches #include "pitches.h" // Mozzi #include <MozziGuts.h> // Oscillator #include <Oscil.h> // Sine Wave Table For Oscillator #include <tables/sin2048_int8.h> // ADSR envelope generator #include <ADSR.h> // Simple Keyboard // Minimum reading of the button that generates a note const int iKeyboard1 = 1; const int iKeyboard2 = 2; const int iKeyboard3 = 3; const int iKeyboard4 = 4; const int iKeyboard5 = 5; const int iKeyboard6 = 6; const int iKeyboard7 = 7; const int iKeyboard8 = 8; const int iKeyboard10 = 10; const int iKeyboard11 = 11; const int iKeyboard12 = 12; const int iKeyboard13 = 13; // Button is pressed int iB1 = 1; int iB2 = 1; int iB3 = 1; int iB4 = 1; int iB5 = 1; int iB6 = 1; int iB7 = 1; int iB8 = 1; int iB10 = 1; int iB11 = 1; int iB12 = 1; int iB13 = 1; // Set the input for the potentiometer for Frequency to analog pin 3 //const int potFreq = A3; int iFreg = 1; int iNoteA = 0; int iNoteAS = 0; int iNoteB = 0; int iNoteC = 0; int iNoteCS = 0; int iNoteD = 0; int iNoteDS = 0; int iNoteE = 0; int iNoteF = 0; int iNoteFS = 0; int iNoteG = 0; int iNoteGS = 0; // Potentiometer int iPot2 = A2; int iPot3 = A3; int iPot4 = A4; //Oscillator Functions declared for output envelope 1 // Sine Wave Oscil <2048, AUDIO_RATE> aSin1(SIN2048_DATA); // ADSR declaration/definition // Comment out to use control rate of 128 #define CONTROL_RATE 128 ADSR <CONTROL_RATE, CONTROL_RATE> envelope1; // Set the input for the potentiometer Attack to analog pin 1 const int potAttack = A0; // Attack int attack_level = 0; int iAttack = 0; // Set the input for the potentiometer for Decay to analog pin 2 const int potDecay = A1; // Decay int decay_level = 0; int iDecay = 0; // Software Version Information String sver = "22-10"; void loop() { // Audio Hook audioHook(); }
getKeyboard.ino
// getKeyboard // setupKeyboard void setupKeyboard() { // Initialize the button pin as an input pinMode(iKeyboard1, INPUT_PULLUP); pinMode(iKeyboard2, INPUT_PULLUP); pinMode(iKeyboard3, INPUT_PULLUP); pinMode(iKeyboard4, INPUT_PULLUP); pinMode(iKeyboard5, INPUT_PULLUP); pinMode(iKeyboard6, INPUT_PULLUP); pinMode(iKeyboard7, INPUT_PULLUP); pinMode(iKeyboard8, INPUT_PULLUP); pinMode(iKeyboard10, INPUT_PULLUP); pinMode(iKeyboard11, INPUT_PULLUP); pinMode(iKeyboard12, INPUT_PULLUP); pinMode(iKeyboard13, INPUT_PULLUP); } // isKeyboard void isKeyboard() { // Choose envelope levels // attack_level iAttack = mozziAnalogRead( potAttack ); attack_level = map( iAttack, 0, 1023, 0, 255); // decay_level iDecay = mozziAnalogRead( potDecay ); decay_level = map( iDecay, 0, 1023, 0, 255); // set AD Levels envelope1.setADLevels(attack_level,decay_level); // Read the state of the button value 1 if ( digitalRead(iKeyboard1) == HIGH ) { // Button is pressed - pullup keeps pin high normally 1 iB1 = iB1 + 1; // ADSR declaration/definition envelope1.noteOn(); aSin1.setFreq(iNoteA); } else { iB1 = iB1 - 1; } // Read the state of the button value 2 if ( digitalRead(iKeyboard2) == HIGH ) { // Button is pressed - pullup keeps pin high normally 2 iB2 = iB2 + 1; // ADSR declaration/definition envelope1.noteOn(); aSin1.setFreq(iNoteAS); } else { iB2 = iB2 - 1; } // Read the state of the button value 3 if ( digitalRead(iKeyboard3) == HIGH ) { // Button is pressed - pullup keeps pin high normally 3 iB3 = iB3 + 1; // ADSR declaration/definition envelope1.noteOn(); aSin1.setFreq(iNoteB); } else { iB3 = iB3 - 1; } // Read the state of the button value 4 if ( digitalRead(iKeyboard4) == HIGH ) { // Button is pressed - pullup keeps pin high normally 4 iB4 = iB4 + 1; // ADSR declaration/definition envelope1.noteOn(); aSin1.setFreq(iNoteC); } else { iB4 = iB4 - 1; } // Read the state of the button value 5 if ( digitalRead(iKeyboard5) == HIGH ) { // Button is pressed - pullup keeps pin high normally 5 iB5 = iB5 + 1; // ADSR declaration/definition envelope1.noteOn(); aSin1.setFreq(iNoteCS); } else { iB5 = iB5 - 1; } // Read the state of the button value 6 if ( digitalRead(iKeyboard6) == HIGH ) { // Button is pressed - pullup keeps pin high normally 6 iB6 = iB6 + 1; // ADSR declaration/definition envelope1.noteOn(); aSin1.setFreq(iNoteD); } else { iB6 = iB6 - 1; } // Read the state of the button value 7 if ( digitalRead(iKeyboard7) == HIGH ) { // Button is pressed - pullup keeps pin high normally 7 iB7 = iB7 + 1; // ADSR declaration/definition envelope1.noteOn(); aSin1.setFreq(iNoteDS); } else { iB7 = iB7 - 1; } // Read the state of the button value 8 if ( digitalRead(iKeyboard8) == HIGH ) { // Button is pressed - pullup keeps pin high normally 8 iB8 = iB8 + 1; // ADSR declaration/definition envelope1.noteOn(); aSin1.setFreq(iNoteE); } else { iB8 = iB8 - 1; } // Read the state of the button value 10 if ( digitalRead(iKeyboard10) == HIGH ) { // Button is pressed - pullup keeps pin high normally 10 iB10 = iB10 + 1; // ADSR declaration/definition envelope1.noteOn(); aSin1.setFreq(iNoteF); } else { iB10 = iB10 - 1; } // Read the state of the button value 11 if ( digitalRead(iKeyboard11) == HIGH ) { // Button is pressed - pullup keeps pin high normally 11 iB11 = iB11 + 1; // ADSR declaration/definition envelope1.noteOn(); aSin1.setFreq(iNoteFS); } else { iB11 = iB11 - 1; } // Read the state of the button value 12 if ( digitalRead(iKeyboard12) == HIGH ) { // Button is pressed - pullup keeps pin high normally 12 iB12 = iB12 + 1; // ADSR declaration/definition envelope1.noteOn(); aSin1.setFreq(iNoteG); } else { iB12 = iB12 - 1; } // Read the state of the button value 13 if ( digitalRead(iKeyboard13) == HIGH ) { // Button is pressed - pullup keeps pin high normally 13 iB13 = iB13 + 1; // ADSR declaration/definition envelope1.noteOn(); aSin1.setFreq(iNoteGS); } else { iB13 = iB13 - 1; } }
getMozzi.ino
// Mozzi // Update Control void updateControl(){ // Frequency isPitches(); // Keyboard isKeyboard(); } // Update Audio int updateAudio() { // Update Audio // ADSR declaration/definition envelope1.update(); // >>8 for AUDIO_MODE STANDARD return (int) (envelope1.next() * aSin1.next())>>8; }
getPitches.ino
// Pitches // isPitches void isPitches(){ // Frequency // Value is 0-1023 //iFreg = mozziAnalogRead(potFreq); //iFreg = map(iFreg, 0, 1023, 3, 6); iFreg = 5; // Range Frequency Note Low => High switch ( iFreg ) { case 1: // NOTE A1 iNoteA = NOTE_A1; iNoteAS = NOTE_AS1; iNoteB = NOTE_B1; iNoteC = NOTE_C2; iNoteCS = NOTE_CS2; iNoteD = NOTE_D2; iNoteDS = NOTE_DS2; iNoteE = NOTE_E2; iNoteF = NOTE_F2; iNoteFS = NOTE_FS2; iNoteG = NOTE_G2; iNoteGS = NOTE_GS2; break; case 2: // NOTE A2 iNoteA = NOTE_A2; iNoteAS = NOTE_AS2; iNoteB = NOTE_B2; iNoteC = NOTE_C3; iNoteCS = NOTE_CS3; iNoteD = NOTE_D3; iNoteDS = NOTE_DS3; iNoteE = NOTE_E3; iNoteF = NOTE_F3; iNoteFS = NOTE_FS3; iNoteG = NOTE_G3; iNoteGS = NOTE_GS3; break; case 3: // NOTE A3 iNoteA = NOTE_A3; iNoteAS = NOTE_AS3; iNoteB = NOTE_B3; iNoteC = NOTE_C4; iNoteD = NOTE_D4; iNoteDS = NOTE_DS4; iNoteE = NOTE_E4; iNoteF = NOTE_F4; iNoteFS = NOTE_FS4; iNoteG = NOTE_G4; iNoteGS = NOTE_GS4; break; case 4: // NOTE A4 iNoteA = NOTE_A4; iNoteAS = NOTE_AS4; iNoteB = NOTE_B4; iNoteC = NOTE_C5; iNoteCS = NOTE_CS5; iNoteD = NOTE_D5; iNoteE = NOTE_E5; iNoteF = NOTE_F5; iNoteFS = NOTE_FS5; iNoteG = NOTE_G5; iNoteGS = NOTE_GS5; break; case 5: // NOTE A5 iNoteA = NOTE_A5; iNoteAS = NOTE_AS5; iNoteB = NOTE_B5; iNoteC = NOTE_C6; iNoteCS = NOTE_CS6; iNoteD = NOTE_D6; iNoteDS = NOTE_DS6; iNoteE = NOTE_E6; iNoteF = NOTE_F6; iNoteFS = NOTE_FS6; iNoteG = NOTE_G6; iNoteGS = NOTE_GS6; break; case 6: // NOTE A6 iNoteA = NOTE_A6; iNoteAS = NOTE_AS6; iNoteB = NOTE_B6; iNoteC = NOTE_C7; iNoteCS = NOTE_CS7; iNoteD = NOTE_D7; iNoteDS = NOTE_DS7; iNoteE = NOTE_E7; iNoteF = NOTE_F7; iNoteFS = NOTE_FS7; iNoteG = NOTE_G7; iNoteGS = NOTE_GS7; break; } }
pitches.h
/***************************************************************** * Pitches NOTE_B0 <=> NOTE_DS8 - NOTE_A4 is "A" measured at 440Hz *****************************************************************/ #define NOTE_B0 31 #define NOTE_C1 33 #define NOTE_CS1 35 #define NOTE_D1 37 #define NOTE_DS1 39 #define NOTE_E1 41 #define NOTE_F1 44 #define NOTE_FS1 46 #define NOTE_G1 49 #define NOTE_GS1 52 #define NOTE_A1 55 #define NOTE_AS1 58 #define NOTE_B1 62 #define NOTE_C2 65 #define NOTE_CS2 69 #define NOTE_D2 73 #define NOTE_DS2 78 #define NOTE_E2 82 #define NOTE_F2 87 #define NOTE_FS2 93 #define NOTE_G2 98 #define NOTE_GS2 104 #define NOTE_A2 110 #define NOTE_AS2 117 #define NOTE_B2 123 #define NOTE_C3 131 #define NOTE_CS3 139 #define NOTE_D3 147 #define NOTE_DS3 156 #define NOTE_E3 165 #define NOTE_F3 175 #define NOTE_FS3 185 #define NOTE_G3 196 #define NOTE_GS3 208 #define NOTE_A3 220 #define NOTE_AS3 233 #define NOTE_B3 247 #define NOTE_C4 262 #define NOTE_CS4 277 #define NOTE_D4 294 #define NOTE_DS4 311 #define NOTE_E4 330 #define NOTE_F4 349 #define NOTE_FS4 370 #define NOTE_G4 392 #define NOTE_GS4 415 #define NOTE_A4 440 #define NOTE_AS4 466 #define NOTE_B4 494 #define NOTE_C5 523 #define NOTE_CS5 554 #define NOTE_D5 587 #define NOTE_DS5 622 #define NOTE_E5 659 #define NOTE_F5 698 #define NOTE_FS5 740 #define NOTE_G5 784 #define NOTE_GS5 831 #define NOTE_A5 880 #define NOTE_AS5 932 #define NOTE_B5 988 #define NOTE_C6 1047 #define NOTE_CS6 1109 #define NOTE_D6 1175 #define NOTE_DS6 1245 #define NOTE_E6 1319 #define NOTE_F6 1397 #define NOTE_FS6 1480 #define NOTE_G6 1568 #define NOTE_GS6 1661 #define NOTE_A6 1760 #define NOTE_AS6 1865 #define NOTE_B6 1976 #define NOTE_C7 2093 #define NOTE_CS7 2217 #define NOTE_D7 2349 #define NOTE_DS7 2489 #define NOTE_E7 2637 #define NOTE_F7 2794 #define NOTE_FS7 2960 #define NOTE_G7 3136 #define NOTE_GS7 3322 #define NOTE_A7 3520 #define NOTE_AS7 3729 #define NOTE_B7 3951 #define NOTE_C8 4186 #define NOTE_CS8 4435 #define NOTE_D8 4699 #define NOTE_DS8 4978
setup.ino
// Setup void setup() { // Setup Keyboard setupKeyboard(); // Mozzi Start startMozzi( CONTROL_RATE ); // Sets Attack and Decay Levels; assumes Sustain, Decay, and Idle times envelope1.setADLevels(200,200); // Sets Decay time in milliseconds envelope1.setDecayTime(100); // Sustain Time setting for envelope1 envelope1.setSustainTime(32500); }
——
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 #12: Robotics – Pololu Wheel – Mk23
——
#DonLucElectronics #DonLuc #Robotics #Arduino #Fio #ArduinoProMini #XBee #DCMotor #MotorDriver #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
Pololu Wheel 90 mm × 10 mm – Black
These black plastic wheels have silicone tires and measure 90 mm (3.54 inches) in diameter, and they press-fit onto the 3mm D shafts on many of our motors, including our micro metal gearmotors and our mini plastic gearmotors. Additionally, this wheel is compatible with several of our universal mounting hubs, which can serve as adapters for motors with different shafts. Six mounting holes for #4 or M3 screws make it possible to use the wheel with any of our universal mounting hubs for those screw sizes, enabling these wheels to be used with our larger metal gearmotors and stepper motors. The included silicone tires, which feature horizontal treads for improved traction.
DL2202Mk03
1 x Fio v3 – ATmega32U4
1 x Arduino Pro Mini 328 – 5V/16MHz
1 x SparkFun FTDI Basic Breakout – 5V
1 x USB/DC Lithium Polymer Battery Charger
1 x Mountable Slide Switch
2 x XBee S1
1 x XBee Explorer Regulated
1 x Lithium Ion Battery – 850mAh
1 x Lithium Ion Battery – 2500mAh
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 Steren Model 155
2 x Adafruit Perma-Proto Quarter-Sized Breadboard
15 x Standoff – Metal – #4-40 – 3/8 inch
33 x Screw – #4-40 – 1/4 inch
3 x Nut – Nylon Locknut – #4-40
1 x Pololu Ball Caster – 1 Inch Plastic Ball
1 x HDPE – Black on White – 6 inches x 12 inches x 0.25 inch
2 x Pololu Wheel 90 mm × 10 mm – Black
4 x Screw – #4-40 – 3/8 inch
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
DL2202Mk03t.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #12: Robotics - Pololu Wheel - Mk23 02-03 Transmitter DL2202Mk03t.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-23t"; // 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
DL2202Mk03r.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #12: Robotics - Pololu Wheel - Mk23 02-03 Receiver DL2202Mk03r.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 USB/DC Lithium Polymer Battery Charger 1 x Mountable Slide Switch 1 x Lithium Ion Battery - 2500mAh 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 Steren Model 155 2 x Adafruit Perma-Proto Quarter-Sized Breadboard 15 x Standoff - Metal - #4-40 - 3/8 inch 33 x Screw - #4-40 - 1/4 inch 3 x Nut - Nylon Locknut - #4-40 1 x Pololu Ball Caster - 1 Inch Plastic Ball 1 x HDPE - Black on White - 6 inches x 12 inches x 0.25 inch 2 x Pololu Wheel 90 mm × 10 mm - Black 4 x Screw - #4-40 - 3/8 inch 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-23r"; // 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, 80, 200); // Vertical and Horizontal if ( mapVer == -512 ) { // Backward // NeoPixels Blue zz = 1; isNUMPIXELS(); iVer = 1; } else if ( mapVer == 512 ) { // Forward // 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_IN2, LOW); analogWrite(MOTOR2_IN1, 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_IN1, LOW); analogWrite(MOTOR2_IN2, iPower); delay(10); break; case 3: // Right // 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 4: // Left // 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 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 – 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 – Pololu Ball Caster – Mk22
——
#DonLucElectronics #DonLuc #Robotics #Arduino #Fio #ArduinoProMini #XBee #DCMotor #MotorDriver #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
Pololu Ball Caster with 1 Inch Plastic Ball and Ball Bearings
This ball caster uses a 1 inch diameter plastic ball and has an overall height of 1.1 inches (29 mm). The two-part housing snaps together to securely enclose the ball and three ball bearings that minimize friction between the ball and the ABS housing.
This ball caster kit includes a two-part black ABS housing, a 1 inch diameter POM plastic ball, three 3 mm × 7 mm × 3 mm ball bearings, and three dowel pins used to hold the ball bearings. When assembled, the ball caster is capable of rolling in any direction with low friction, making it suitable for use as a third contact point for wheeled, differential-drive robots weighing up to around ten pounds.
The base piece of the housing has holes for three mounting screws and slots for ball bearings. The second part of the housing snaps into the base piece to secure the ball and ball bearings. The assembled ball caster has an overall height of 1.1 inches (29 mm).
DL2202Mk02
1 x Fio v3 – ATmega32U4
1 x Arduino Pro Mini 328 – 5V/16MHz
1 x SparkFun FTDI Basic Breakout – 5V
1 x USB/DC Lithium Polymer Battery Charger
1 x Mountable Slide Switch
2 x XBee S1
1 x XBee Explorer Regulated
1 x Lithium Ion Battery – 850mAh
1 x Lithium Ion Battery – 2500mAh
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 Steren Model 155
2 x Adafruit Perma-Proto Quarter-Sized Breadboard
15 x Standoff – Metal – #4-40 – 3/8 inch
33 x Screw – #4-40 – 1/4 inch
3 x Nut – Nylon Locknut – #4-40
1 x Pololu Ball Caster – 1 Inch Plastic Ball
1 x HDPE – Black on White – 6 inches x 12 inches x 0.25 inch
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
——
DL2202Mk02t.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #12: Robotics - Pololu Ball Caster - Mk22 02-02 Transmitter DL2202Mk02t.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-22t"; // 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
DL2202Mk02r.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #12: Robotics - Pololu Ball Caster - Mk22 02-02 Receiver DL2202Mk02r.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 USB/DC Lithium Polymer Battery Charger 1 x Mountable Slide Switch 1 x Lithium Ion Battery - 2500mAh 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 Steren Model 155 2 x Adafruit Perma-Proto Quarter-Sized Breadboard 15 x Standoff - Metal - #4-40 - 3/8 inch 33 x Screw - #4-40 - 1/4 inch 3 x Nut - Nylon Locknut - #4-40 1 x Pololu Ball Caster - 1 Inch Plastic Ball 1 x HDPE - Black on White - 6 inches x 12 inches x 0.25 inch 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-22r"; // 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 – 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 – Steren 155 – Mk21
——
#DonLucElectronics #DonLuc #Robotics #Arduino #Fio #ArduinoProMini #XBee #DCMotor #MotorDriver #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
Perforated Phenolic Plate
So you finish your electronics projects, such as printed circuits. We know that designing a prototype or electronic project can be a complicated task if you do not have the necessary items to carry it out, so with us you it a phenolic plates of a face, two sided or perforated, ferric chloride, auto-adherable tracks, leaves thermal transfer or permanent ink markers so that your circuits are perfect.
Steren Model 155
Bakelite phenolic plate with copper, 4.5 cm x 4.5 cm, engraved and perforated with 164 orifices for components and 4 for fixing the plate. Ideal for projects or prototypes.
DL2202Mk01
1 x Fio v3 – ATmega32U4
1 x Arduino Pro Mini 328 – 5V/16MHz
1 x SparkFun FTDI Basic Breakout – 5V
1 x USB/DC Lithium Polymer Battery Charger
1 x Mountable Slide Switch
2 x XBee S1
1 x XBee Explorer Regulated
1 x Lithium Ion Battery – 850mAh
1 x Lithium Ion Battery – 2500mAh
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 Steren Model 155
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
DL2202Mk01t.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #12: Robotics - Steren 155 - Mk21 02-01 Transmitter DL2202Mk01t.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-21t"; // 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
DL2202Mk01r.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #12: Robotics - Steren 155 - Mk21 02-01 Receiver DL2202Mk01r.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 USB/DC Lithium Polymer Battery Charger 1 x Mountable Slide Switch 1 x Lithium Ion Battery - 2500mAh 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 Steren Model 155 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-21r"; // 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 – 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 – Transmitter and Receiver – Mk14
——
#DonLucElectronics #DonLuc #Robotics #Arduino #Fio #XBee #XBeeS1 #Transmitter #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
Serial
Used for communication between the Arduino board and a computer or other devices. All Arduino boards have at least one serial port, and some have several. Fio v3 ATmega32U4 board, Serial1 pins, 0(RX), 1(TX). On Fio v3 ATmega32U4, pins 0 and 1 are used for communication with the computer. Connecting anything to these pins can interfere with that communication, including causing failed uploads to the board. You can use the Arduino environment’s built-in serial monitor to communicate with an Arduino board. Click the serial monitor button in the toolbar and select the same baud rate used in the call to begin(). Serial communication on pins TX/RX uses TTL logic levels 3.3V . Don’t connect these pins directly to an RS232 serial port, they operate at +/- 12V and can damage your Arduino board.
DL2112Mk04
2 x Fio v3 – ATmega32U4
2 x XBee S1
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 LED Green
1 x Half-Size 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
DL2112Mk04t.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #12: Robotics - XBee S1 - Transmitter - Mk14 12-04 DL2112Mk04t.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 = 50; // 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-14t"; // 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); }
——
Fio v3 – ATmega32U4 – 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
LED – Digital 6
VIN – +3.3V
GND – GND
DL2112Mk04r.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #12: Robotics - Receiver - Mk14 12-04 DL2112Mk04r.ino 1 x Fio v3 - ATmega32U4 1 x XBee S1 1 x Lithium Ion Battery - 850mAh 1 x LED Green 1 x Half-Size 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> // LED Green int iLEDGreen = 6; // 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-14r"; // 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)); } }
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 ( Serial1.available() > 0 ) { // Read the incoming byte: incb = Serial1.read(); // Start the message when the '<' symbol is received if(incb == '<') { bStart = true; in = 0; msg = ""; // Done reading } // End the message when the '*' symbol is received else if(incb == '*') { bEnd = true; x = msg.length(); msg.remove( x , 1); // Done reading break; } // Read the message else { msg = msg + char(incb); in++; } } // Start - End if( bStart && bEnd) { digitalWrite(iLEDGreen, HIGH); in = 0; msg = ""; bStart = false; bEnd = false; } }
setup.ino
// Setup void setup() { // Open the serial port at 9600 bps: Serial1.begin( 9600 ); // Pause delay(5); // EEPROM Unit ID isUID(); // Pause delay(5); // LED Green pinMode(iLEDGreen, OUTPUT); digitalWrite(iLEDGreen, LOW); }
——
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 #1 – The AcceleroSynth – Mk9
Don Luc