-
Notifications
You must be signed in to change notification settings - Fork 192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Relay Drum Kit #154
base: moppy-advanced
Are you sure you want to change the base?
Relay Drum Kit #154
Conversation
Changes to allow drum track to be played with relays using shift register
Changes to all drum track to be played on relays using shift register
I am interested in your idea for implementing the relay drum kit with an additional Arduino, instead of using a shift register. I am also not a programmer by trade, I am an electro-mechanical engineering student, so I admire your resolve in delving into Java. In the meantime, I will take a look at your code to see if I can come up with anything myself! |
Thanks for your interest.
I'm also not a programer (Electrician) but I did get it working perfectly. The shift register worked out really well and freed up a lot of outputs on the Arduino. I suggest not giving up on it too soon.
I don't recall if I ever uploaded my current code. Let me know if you have any questions and I can go back and look at my final effort.
Stephen
…________________________________
From: TeslaXC <[email protected]>
Sent: November 12, 2017 4:06 PM
To: SammyIAm/Moppy
Cc: sparklini; Author
Subject: Re: [SammyIAm/Moppy] Relay Drum Kit (#154)
I am interested in your idea for implementing the relay drum kit with an additional Arduino, instead of using a shift register. I am also not a programmer by trade, I am an electro-mechanical engineering student, so I admire your resolve in delving into Java. In the meantime, I will take a look at your code to see if I can come up with anything myself!
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<Sammy1Am/Moppy2#154 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AQi1YKdUxNFjuZe95C2HN8F7eYbVRlUvks5s113FgaJpZM4L9yGg>.
|
Hey! I got it working (sort of). I only have a one-channel relay on hand, so I can only listen to one drum part at a time. I have LED's to flash representing the other drum parts. I've used a separate UNO on a second USB input so I may use 8 drives on my original UNO. Have you run into this problem? Sometimes the drum parts move by too quickly so that the indicator LED on the relay briefly lights, but the armature doesn't engage. Is there a solution for this in the code, or do you think I just have to avoid faster tempos, or re-write the drum part? Also, I am planning on using a solenoid to strike objects rather than relay clicks, since I don't have access to a wide range of relays. Do you think that the issue of drum hits being too brief would affect the solenoids? I think it's hard to say until I buy them, but I'm leaning towards yes - it would, since it takes time for the plunger of the solenoid to move and strike an object. This would cause the solenoids to "shoot blanks", since the plunger wouldn't be engaged long enough to hit the object. I'm grateful that you are looking at your project so many months later. Many thanks!! |
A solution for the slow relay is a solid state relay, but I think that the
solenoid would be too slow as well.
…On Nov 16, 2017 7:32 PM, "TeslaXC" ***@***.***> wrote:
Hey! I got it working (sort of). I only have a one-channel relay on hand,
so I can only listen to one drum part at a time. I have LED's to flash
representing the other drum parts. I've used a separate UNO on a second USB
input so I may use 8 drives on my original UNO.
Have you run into this problem? Sometimes the drum parts move by too
quickly so that the indicator LED on the relay briefly lights, but the
armature doesn't engage. Is there a solution for this in the code, or do
you think I just have to avoid faster tempos, or re-write the drum part?
Also, I am planning on using a solenoid to strike objects rather than
relay clicks, since I don't have access to a wide range of relays. Do you
think that the issue of drum hits being too brief would affect the
solenoids? I think it's hard to say until I buy them, but I'm leaning
towards yes - it would, since it takes time for the plunger of the solenoid
to move and strike an object. This would cause the solenoids to "shoot
blanks", since the plunger wouldn't be engaged long enough to hit the
object.
I'm grateful that you are looking at your project so many months later.
Many thanks!!
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<Sammy1Am/Moppy2#154 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AHbSeuGlXyj0To3c5f4xXqydoQrr7HiDks5s3NQ2gaJpZM4L9yGg>
.
|
First, @sparklini , I'm sorry I haven't really gotten around to look at merging this code. Just a week or so ago I finally got inspired to start looking into Moppy again, and your relay-drumset sounds awesome, so I'm hoping we get can better support for that available. With regards to your timing issue, @TeslaXC : The current code responds to note-on and note-off events because for pitched instruments the length of the note is a significant factor. For percussion, drum-rolls aside, the "length" of each hit is more or less irrelevant. Rather than using the note-off event to de-energize the relay, you might want to just have the note-on event put a value in an array, decrement that value each tick, and then switch it off when you hit zero. That'd allow you to tune the length of pulse that best triggers your solenoid (I'm actually planning to work on something with solenoids too over the holidays, so I may end up writing something up myself in the nearish future). |
@TeslaXC , I never had any issues with notes being too short. I think using solenoids is a great idea. You would need to remove the "Latching" part of the code otherwise you will only get contact on every other occurrence. @RedFox1177, are you suggesting using a SS relay to drive the solenoid? I did use a few of them in my build to drive some contractors that had A/C coils in them. (This is a good time to point out that contactors/relays are available with A/C or D/C coils. When you drive them with the wrong type of current the collapsing magnetic field induces a currenting back into the coil. I burned out a few before I figured this one out.) I used the SS relays to drive my A/C contactos without burning them out. Thanks @Sammyiam, that sounds correct. I will get that final code posted ASAP as well as some songs that I edited. I think my final build had 12 floppy drives and 8 relays. Thanks for your interested in this. |
@sparklini Yes, you could possibly use a solid state relay to drive the solenoid quicker. The issue with that is that I think you’ll run into the issue that the solenoid won’t be able to keep up, and like TeslaXC said, “shoot blanks”. (For the statement above about shift registers, I think there’s a way to use I2C to communicate between Arduino on the analog ports.) Also, did you use flyback diodes when you were driving the relays? Or did you burn out the coil itself? |
Used diodes on the DC relays. Burnt out the coils.
See that here
https://www.instagram.com/p/BDHj_nilTei/
Sent from my Bell Samsung device over Canada's largest network.
…-------- Original message --------
From: RedFox1177 <[email protected]>
Date: 2017-11-17 10:29 AM (GMT-05:00)
To: SammyIAm/Moppy <[email protected]>
Cc: sparklini <[email protected]>, Mention <[email protected]>
Subject: Re: [SammyIAm/Moppy] Relay Drum Kit (#154)
@sparklini<https://github.com/sparklini> Yes, you could possibly use a solid state relay to drive the solenoid quicker. The issue with that is that I think you’ll run into the issue that the solenoid won’t be able to keep up, and like @TeslaXC<https://github.com/teslaxc> said, “shoot blanks”. Also, did you use flyback diodes when you were driving the relays? Or did you burn out the coil itself?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<Sammy1Am/Moppy2#154 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AQi1YOp1NYGd_ch7WAru0aES-ZpSGFMHks5s3aZtgaJpZM4L9yGg>.
|
Turns out I didn't take many videos of the final project in action but there is a good example of the drum relays on my instagrahm feed here.
https://www.instagram.com/p/BDHjwNFlTeK/
Sent from my Bell Samsung device over Canada's largest network.
…-------- Original message --------
From: TeslaXC <[email protected]>
Date: 2017-11-16 7:32 PM (GMT-05:00)
To: SammyIAm/Moppy <[email protected]>
Cc: sparklini <[email protected]>, Author <[email protected]>
Subject: Re: [SammyIAm/Moppy] Relay Drum Kit (#154)
Hey! I got it working (sort of). I only have a one-channel relay on hand, so I can only listen to one drum part at a time. I have LED's to flash representing the other drum parts. I've used a separate UNO on a second USB input so I may use 8 drives on my original UNO.
Have you run into this problem? Sometimes the drum parts move by too quickly so that the indicator LED on the relay briefly lights, but the armature doesn't engage. Is there a solution for this in the code, or do you think I just have to avoid faster tempos, or re-write the drum part?
Also, I am planning on using a solenoid to strike objects rather than relay clicks, since I don't have access to a wide range of relays. Do you think that the issue of drum hits being too brief would affect the solenoids? I think it's hard to say until I buy them, but I'm leaning towards yes - it would, since it takes time for the plunger of the solenoid to move and strike an object. This would cause the solenoids to "shoot blanks", since the plunger wouldn't be engaged long enough to hit the object.
I'm grateful that you are looking at your project so many months later. Many thanks!!
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<Sammy1Am/Moppy2#154 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AQi1YPfHdmV5z04GLtXS-DDZi2EzTH_9ks5s3NQ3gaJpZM4L9yGg>.
|
I think I've found my final edit but I really don't remember how to upload it to GitHub. I basically learned just enough Java to make the needed changes and once I got it working I started rebuilding a motorcycle. Can anyone tell me the date upload my edit? I think I have files modified in May 2016. |
Looks like February 10th, 2017 to me. I just realized I wasn't running the code changes in the Moppy program, only my second Arduino output. When I went to update the file change in my Moppy program, I can't seem to solve this problem. There is an error caused by lines 116 and line 129 both defining the integer "period". I'm stuck on how to change this, however maybe your updated code will have the fix. |
@TeslaXC looks like Feb 10th is the most recent file I can find too. it seems to run fine for me. package moppydesk.outputs; import gnu.io.SerialPort; /**
// New array to handle drum track. Like above, each "note" is listed in the array and a place holder.
} |
I've copied & pasted that code into my Moppy, and it's error-free! There was definitely a difference around lines 116-129. I'm getting my solenoids in the mail tomorrow (ceterus paribus). Looking forward to getting this running. I'll definitely upload the changes I make to make solenoids functional with this project. Edit: Actually, I've just tried to run the program as is. Getting a lot of errors here. I'll look into it |
@TeslaXC, I always got some sort of error while it was compiling but it always seem to work. Keep me updated. |
For me, the errors are not in the compiler, I also got errors in the compiler even with the original Moppy IIRC. Whenever I try to load a MIDI into Moppy, the error I get is "java.lang.UnsupportedOperationException: Not supported yet." I have a feeling we may have different versions of Moppy, so I'll try to redownload my Moppy to see if that fixes it. |
Okay, I've fixed the code that was originally uploaded in the post in my Moppy program. On line 129, the "int" before the period should not be there. After I removed that, it is working as intended! I will look into editing the code for solenoid-capability now. |
period = microPeriodsDrum[(message.getMessage()[1])]; | ||
System.out.println("Drum Midi value " + (message.getMessage()[1] & 0xff) + " will be played by relay " + period); | ||
} else if ((pin & 0xFF) != 20) { | ||
// if it is not from the drum track | ||
int period = microPeriods[(message.getMessage()[1] & 0xff)] / (ARDUINO_RESOLUTION * 2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"int" before the period causes an error. Removing the int allows the program to work as intended.
i'm a bit late to the party, has this been added yet? i need to add some drums to my setup |
(After at last getting this on GitHub I realize there might be a less technical way to do this with out a Shift Register, using an additional Arduino.
Take a look anyways and tell me what you think.)
Moppy with Relay Drum Kit
I’ve added a small amount of code that allows Sammy’s Moppy program to output the drum track to other analog devices, specifically relays and contactors.
A relay is an electrical-mechanical switch that uses an electromagnet to activate a switch. (The same function as a transistor).
A little about me before I get into how it works. I’m an electrician, not a programer. For me, the physical part of the Moppy is simple. I learned just enough about JAVA to get this going. (There are a number of options that I decided to leave out to keep the changes as simple as possible to understand. Perhaps someone with better computer skills will offer to make some of the additions.)
The relay drum kit uses only 3 Arduino pins so you can still run 7 disk drives and one relay set of 8 (actually any number. More on this later) relays or contactors. This is done using a 74HC595 or similar shift register and the Arduino function of ShiftOut.
The outputs from the shift register are used to control power MOSFETS (similar to a transistor) which provide the current and voltage needed to drive the relays.
Lucky for us there are tutorials!
https://www.arduino.cc/en/tutorial/ShiftOut
There are many for MOSFETs too. Here is one about LED strips. Replace the LED’s with your relays.
https://learn.adafruit.com/rgb-led-strips?view=all
Shift registers work on binary outputs, 8 bits at a time. No drum sounds is represented by
00000000
Each of the zeros is associated with a different relay with the first relay being the digit to the right. If I want relay 1 and 3 to activate at the same time I would send this to the shift register.
00000101
If I wanted to smash everything at once.
11111111
Drum sounds are given a value that when converted to binary will only have one “1” and the rest “0”. We get those numbers but doubling. 1, 2, 4, 8, 16, 32, 64, 128
Converting any one of those numbers to Binary and sending it to the shift register will cause 1 relay to activate. Adding any of those numbers together and then converting to Binary will cause multiple relays to activate.
Because a relay makes a “click” sound both with is is powered and again when de energized the program holds each relay in its current state until that relay (or drum) is called again. The Arduino sketch compares the last beat with the current beat and outputs the opposite value for each digit that calls for a drum sound.
10001000 (last beat)
00001111 (input to Arduino)
10000111 (output from Arduino to shift register)
This way we only get one click each time a drum hit happens (off OR on) and not (off AND on).
Shift registers are linkeble so in theory you could hook up many in series and connect more relays but there are only so many different types of clicking sounds you can get so I just stopped at 8. The average drum kit doesn’t get much bigger than that anyway.
One problem I faced was the number of different MIDI drum sounds. Not wanting to set up a relay for each different option I sorted through them and grouped the most common ones. So all kick drums would be given the same relay number because there is usually only one kick drum on a song. Same with all the different types of snares. This worked well more the majority of the songs but not always.
Another option is to assign each drum sound to a relay as the sound occurred. This worked great for insuring that all the sounds got picked up but can result in the ride cymbal being assigned to a giant motor contactor that would just shake the whole table until everything fell apart.
The set up now does a bit of both.
Some input from other users would be great.