How to Make an Arduino MIDI Footswitch

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey everybody aaron here i hope everybody's doing well miss this whole coronavirus thing um and i hope everybody's families are staying safe and you're staying healthy um as you know everybody's staying inside for the shelter in place warning i wanted to do a project at home i usually go over to my friend's place to use his garage because all of our tools are located over there but i'm taking the shelter in place warning very seriously so i don't want to go over there and risk getting anybody over there infected or myself infected as we should to you know contain this coronavirus outbreak so like i said i'm going to do a project at home as many of you might not know i actually play a lot of guitar in my free time and i've been playing quite a bit more just because i'm stuck inside what i do on the guitar is i usually set up loops and jam along with them and my wife sings over the top of them because she's a singer so i wanted a way to basically connect something to my computer where i can control those loops and i recently purchased this aluminum enclosure it's kind of like a project box and it's pretty large as you can see here uh and i want to basically connect some buttons to this enclosure so that i can trigger those loops uh this is called it will be using a midi interface so it's called a midi foot controller you can buy these online for about 150 bucks but if you just buy the parts and make it yourself it's much cheaper more on the order of 50 instead of 150. and i'm going to be using something new that i haven't used in the past it's called the teensy uh 4.0 controller this is great because it has all the midi interfacing stuff built right in so you can just kind of plug it straight into your computer and with some basic code get the midi controller working so i'm going to be using tools that i have at home mainly just a cordless drill and some clamps to do the drilling into this enclosure so hopefully everything goes well but i'll make do with what i have and let's get started in addition to the teensy in the housing you'll need some momentary push buttons some project wires with both a male and female header a pcb project board a usb printer style cable and some pcb headers okay so the first step here is just laying out all of our buttons so everything's in the place that it should be when we have the holes drilled and i'm going to do this to kind of eyeball some of the measurements and then i'm going to go back and do some math to figure out where exactly these things should be drilled basically i want one of these buttons to start the recording on the loop and then one to stop the loop and i want to have these buttons on the side here to do sort of like utility functions that i may want to assign to those buttons like switching pages or maybe switching between different phrases in the the loop so i think this layout works good for me but you could do whatever you want for your button as well the first thing i did was measure the length of the housing which was 11.75 inches there are six buttons so i divided by seven for the spaces see it's 1.678 inches i also measured the depth which was 7 inches and then divided by 3 for the spacing between the the two buttons which was 2.33 inches and i also divided by four for the buttons on the right hand side so i got spacing of 1.25 inches there i then made some markings for each of the buttons starting at the end i made markings for the spacing intervals and these are going to be the spots where we end up drilling our holes later on for this i just use a simple straight edge and i connected all of those markings with a line so that the markings ended up in points which i would use to drill my holes later i then took the housing outside and used a drill bit to make some impressions on those crosses this just prevents the drill bit from wandering when you start drilling into the casing because the drill bit likes to wander on smooth surfaces since this is metal you want to make sure you start drilling really slowly the drill bit can actually heat up quite a bit when you're drilling metal and it would be best if you actually had some lubricating oil um to prevent that from happening but i didn't have any at my place so i just took it really slowly and made sure that my drill bit wasn't getting too hot as you can see there's a lot of metal shavings that come off of this so you want to make sure you don't accidentally prick your hand with one of those and i recommend using a garbage bag to just kind of dust those shavings off into i also needed to make a hole in the side of the housing for our usb connector so i just eyeballed this hole and took my half inch drill bit to make it hole and this was actually a little too small for my usb connector so i used a file to file down the edges a little bit so that it was wide enough for that connector and you can see what i'm doing here i also used another drill bit to mark holes where the screws for that usb connector is going to go and i use the same method to draw on there and here you can see what the housing looks like after i've drilled all of those holes from here i just started taking the buttons and screwing them into the housing i didn't have a socket set where the socket was big enough to fit the button so i just kind of screwed it in with my hands and made sure to tighten it as much as i could this doesn't need to be perfect because there's a piece on the bottom of the button that kind of holds it in place and if it ever becomes loose you know you can always screw it back in next i started soldering all of my jumper wires to the buttons i used one black wire and one white wire per button you want to make sure that you add some solder to the buttons before you start soldering wires to them because it's a large contact and it's very difficult to wire a button to that contact without any solder on it since the wires already had male headers on them i just took the male headers and wired them directly to the buttons you could probably strip the wires too but i just thought it was easier to wire them directly to the buttons when you're wiring these up you want to make sure that your wires flow in the same direction because it'll be much easier to attach it to the pcb board later on speaking of the pcb board the next step was soldering everything to our project board so that it was in one contained unit so i took my teensy and we're going to use some of those headers to basically make it easier for us to connect our jumper wires to the buttons so i started off by just soldering on the tnt to the pcb board and you want to start by just soldering the two pins in the corners first so that you make sure that the board stays in place and then you can end up just soldering all those pins onto the board after you do that makes it much easier because again the board doesn't move around while you're trying to solder it next we're going to take those headers and wire them onto the board and we'll wire each pin to the adjacent pin on the pcb board and i also used a couple jumper wires just to make sure the spacing between the board and the headers was good and then i as i mentioned i just took a soldering iron and soldered each adjacent pin and you don't you want to make sure that the header pins aren't accidentally connected so i just took a multimeter and and uh tested each pin to make sure that it wasn't connected to the wrong pin next i took another header and just soldered it on another part of the board this is where we're going to connect all of our ground pins for our buttons and you can just solder all of these pins together because there will be one shared ground for every button so when one of the momentary buttons is pressed a ground will be connected to a pin on the teensy board and we'll read that value in the software to register our midi events here i'm just taking a wire stripping the end off and i'm going to solder one end to the ground strip that i just created and i'm gonna attach the other end to the ground on the teensy board with that female header this way we don't have to connect an external ground we can just use the usb as both our power source and our ground davis made a nice 3d printed standoff for me and i'm just using this so that the exposed contacts on the bottom of the pcb board don't touch the metal surface on the housing and accidentally short out if you want the file for this 3d printed standoff you can check our patreon page which has all 3d printed files for all of our projects here's a schematic of what the circuit looks like for three buttons it's pretty simple i'm just taking the black wires connecting them to that shared header and then taking each of the white wires and connecting them to a gpio pin on the teensy board and i'm using some of my favorite 3m outdoor mounting tape to make sure that the pcb board stays in place inside of that housing the housing has a couple of slots which you can use to align the top to the bottom of the housing and then there are just a couple sides that screw on with some small screws next i took my usb printer cable and plugged it right into my computer so that i could start programming all right i'm on my computer now and i'm going to show you how to program your pedal so that you can connect to any software instrument as a midi device so the first thing you want to do is download some special arduino programming software for the teensy and to do that i'm just going to go to teensy.com or i guess it's it's pijrc.com uh and then on here there will be a teensy arduino program that you can download and let's see to download this you just go to this main link here and download the installer for your operating system okay so i already have this installed so i just opened the tnc arduino program up and to make sure that your device is connected you're going to want to go into tools board and make sure that your your particular teensy board is selected so for my case i'm using the 4.0 i just want to make sure that is selected here and then the other thing i want to do is make sure that i enable midi because we're going to be using this as a midi controller so if i go down here to usb type i can go down and select midi as well all right so now i have the program open for the midi controller and i just want to say that this code is not very modular you'll notice that there are a bunch of copied statements that are repeated quite a bit down here and normally what you want to do is make this more modular by creating some sort of object that holds all this information and then iterating through uh over each uh item and doing this you know all the the steps that you need to do for those items uh but for this tutorial i think i'm going to keep it like this so that it's you know for the sake of clarity but the gist of this is that we have 15 buttons they're labeled button 5 through 20 um based on the pins so starting at pin 5 and going up to pin 20 and all of these um buttons have a bounce object which basically controls debouncing of the switch so what happens when you press a switch down is there are two contacts that touch together when you when you press the switch down so when that happens because um it's you know the world is not perfect um there might be you know when you press it down you might not press it down fully and those contacts can bounce um against each other which when your software reads that button press it could read multiple presses instead of just one single press because those contacts are again bouncing together so this object basically debounces the switch by having a window where it looks for all the the up and down events and then compresses them into one single event so that window in our case is 50 milliseconds and we pass that into our bounce object when we configure our button here so bounce is part of a system library if you don't have this library you might need to install it by going into the uh the manage libraries tool right here which you would just search for bounce in here um but i already have installed so if i go down in the code here you'll see that after i configure these button objects i need to set up the pins and to do that i just call pin mode on the pin number so for pin five this is how i set it up i say pin five i want to be an input pull up and that means that i'm going to use an internal pull up resistor on the teensy board and connect this pin to a ground pin when i want it to be on so with our wiring schematic we want these as pull up input resistors and so i do that for every pin in the setup function and then on our main loop we're updating the buttons because you need to use do that with the bounce library in your main loop and then after we update the buttons we check for both falling and rising edges and send events for the corresponding note for that button so in this case for button 5 we have the note c4 so if there's a falling edge then we want to turn the note on and this seems a little backwards because we're connecting it to a ground so when there's a falling edge it actually means it's on so then we send note c4 which is the midi id 60 here and then you can see a corresponding rising edge event for button five so if there's a rising edge then you send note off or c4 so we do that for every single button and you'll see that you know this is just copy pasted over and over so to program this you just need to make sure that your pedal is plugged in you go up to verify here and then this will compile the sketch to make sure there are no errors and for me there are no errors and it brings up this little interface right here this automatically programs the teensy so there's two modes for the teensy there's a programming mode and then a run mode so by default it's in its run mode but you have to switch it over to the program mode in order to actually program it so you can turn off the auto mode to manually switch between those if you want but if the auto mode is on it will automatically just program the tnc when you click upload right here so i'm going to do that now so all i have to do is just hit upload oh and i need to make sure that my port is actually the right port here so if i go to the port menu and then just select my port and hit upload it will upload that to the device now i'm in ableton which is a daw interface and dodge just basically stands for a digital audio workstation it's a software way of interfacing with a midi device and playing sounds when you press buttons on your midi device so i'm going to show you how to use this to test your your pedal if you don't have this you could also use like something like garageband or you know anything that interfaces with a midi pedal so i have a midi track right here and before i do this i just want to make sure that my midi device is connected so if i go into preferences and link midi i can see my teensy midi right here so all i have to do is just make sure it's on and remote is on as well and i can close that um and then we're going to go over to our midi track make sure it's armed and put some sort of software instrument in there so i'm using this funky organ so if i press buttons you can hear it's playing notes on those mini devices so uh this is on ice configured mine so it's on channel 2 but you can use any channel that you want so if you have multiple media devices you want to make sure they're on different channels but i'm using channel 2 and then you can map these buttons to different features in your pro your daw interface so if i wanted to i can make one button you know disarm the track or something like that so if i just press that button you can see how it's um disarming the track there so yeah you can map these to whatever buttons you want and for me i map them to a couple buttons that helps with my loops again you can do whatever you want and it's pretty useful because it's very customizable for your particular setup all right so i've finished my midi pedal and i've been using this thing for about a week now maybe a little bit longer than a week and i i have to say it's pretty good actually i haven't noticed any issues with the pedal like restarting or the buttons not working or anything like that the buttons are actually pretty good there are only a couple things i would probably change if i were to do this project again one is that i put way too many buttons on here uh i think if i were to do it again i would probably put one less row of buttons and then just space them out a little bit more because when you're pressing on the pedal with your foot it's pretty hard to hit one of these pedals and not press another one so i would definitely do that the other thing is i think i probably could have cleaned up this little area right here where i put the usb connector it's kind of tilted to one side here uh so i would have probably tried to measure that and like tap the hole a little better and then there's like this opening for the usb connector is a little messed up so i would have spent more time kind of like filing that to make it more even but it does the trick so i'm not complaining build quality of this is like definitely really good so if i were to make another pedal i would probably use a housing similar to this i really like this housing to demo this i'm just going to play my guitar and set up some loops uh using this thing it's just going to be a quick little demo but if you're interested i also have another channel where i do music theory and i will also have a video that shows you exactly how i integrate this with my live looping setup so go check that out if out if you're interested the link will be linked down in the description all right that's it for this video i hope you guys enjoyed i know it's not the ideal setup because i'm just drilling stuff out my patio and kind of like building stuff on my home desk but hopefully we'll get through this coronavirus thing and things will go back to normal afterwards but if you've enjoyed this video please consider subscribing so that you keep up to date with all of our latest content but until then i'll see you next time [Music] [Music] you [Music] [Applause] [Music] um
Info
Channel: Hacker Shack
Views: 65,844
Rating: undefined out of 5
Keywords: how to make, midi footswitch, arduino, looper, looping, music, pedal, teensy, hacker shack, midi pedal, midi controller
Id: M25I58I7BtI
Channel Id: undefined
Length: 24min 5sec (1445 seconds)
Published: Thu Jun 04 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.