QuakeWiki
August 5, 2019

Forums

Welcome Guest

Pages: 1
Theramin Thingy
OneMadGypsyPostJanuary 2, 2019, 00:58
Moderator
Posts: 307
Registered:
November 12, 2017, 00:13
Normal topicTheramin Thingy

Image

I know that looks like total garbage but, it's the super early prototype. I'm just getting everything to work and then I'll worry about building a finalized circuit on a custom PCB and 3D printing a nice body for this thing. I'm calling it a theramin but, it's more like a virtual 1 string guitar.

The way it works is you take a business card or something of that size and place it in front of the range finder. The distance the card is from the range finder is converted to a sound frequency relative to the "fret" the card is located at. You can take a guitar pick or your finger or really whatever you want to "pluck" the vibration sensor which activates the speaker to play the frequency for the location of the card.

I built all of this from ideas, trial and error. The only thing I had to find a tutorial on was how to properly hook up the trigger and echo pins for the range finder. It works pretty good. Sometimes it seems to get a little confused but, this is still a really early prototype. I've only had this arduino for 2 days and I started building this like 3 or 4 hours ago. It doesn't matter that the lines on my board are shit. The values from the range detector are recalculated to be from 0 to 11 and that value corresponds to an array index with the proper and exact frequency. Anywhere between any two consecutive lines is one solid note. However, even though my lines are shitty, they are super close. A few of them are a perfect break between notes. None of that matters though. I just needed some visual data so I could see basically where a note range falls.

Apparently, the language for arduino is C so, I guess I program in C now. At the very least I can do it on an arduino level. This project will get a lot better over time. I play numerous instruments and have been for 30 years. I have ideas on how to add some features that will let people get a lot more out of this than what one string would provide. One idea is to line the side of the neck with a few buttons that will allow you to play double-stops of 3rd, 5th, 7th, and 9th with another button that will flat and another that will automatically shift the pitch of the "string" by an octave. Right now it is hard set at open E4 frequency but, I intend to add a potentiometer to act as a tuning knob.

I have a few ideas how I will replace the current card method with something that can slide on a roller up and down the neck and that same roller housing will actually be what has all the buttons that I just mentioned. That way you can hold it like a guitar neck by the roller housing and all the buttons will be right at your fingertips. Ideally, what would generally be the body of the guitar will actually be an amp, effects processor and excellent speaker ... all of which I will essentially make from scratch (well, except for the speaker)

Why?

IDK, cause I can. I wanted to make something that touches on all of my talents. All of the elements of this project combined pretty much cover it.

My current code is shit. I'll clean it all up and nail down the best method as things progress

#include "Volume.h"

Volume vol; 

#define MAX_DISTANCE 200
float timeOut = MAX_DISTANCE * 60; 

int switchPin = 3;
int echoPin  = 11;
int trigPin  = 12;
float notes[] = {329.63, 349.23, 368.99, 392.00, 415.30, 440.00, 466.16, 493.88, 523.25, 554.37, 587.33, 622.25, 659.25};

bool isVibrate = false;

int soundVelocity = 340;
float nFreq;

void setup() {
  vol.begin();
  
  pinMode(switchPin, INPUT_PULLUP);
  pinMode(trigPin,OUTPUT);
  pinMode(echoPin,INPUT);

  attachInterrupt(digitalPinToInterrupt(switchPin), vibrate, FALLING);
  Serial.begin(9600);
  
}


void loop() {
  
  float v = constrain(analogRead(A0) / 10, 0, 100) / 100.00;
  int x;
  if (isVibrate) {
    vol.setMasterVolume(v);
    x = min(floor(getSonar()), 11);
    nFreq = notes[x];
    isVibrate = false;
    vol.tone(nFreq, 250);
    vol.delay(200);
    Serial.print(nFreq);
    Serial.print("n");
   
  } else {
    //this condition is bullshit and doesn't work properly
    for (int i = ceil(v); i > 0; i--) vol.setMasterVolume(i);

    vol.delay(200);
  }
}

void vibrate() { 
  isVibrate = true;
}

float getSonar() {
  unsigned long pingTime;
  float distance;
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);
  pingTime = pulseIn(echoPin, HIGH, timeOut);
  distance = (float)pingTime * soundVelocity / 2 / 10000;
  return distance;
}
OneMadGypsyPostJanuary 2, 2019, 05:05
Moderator
Posts: 307
Registered:
November 12, 2017, 00:13
Normal topicReply To: Theramin Thingy

Image

I made a circuit for displaying the current note being played. I haven't tested it yet and I still need to write the code but, It's going to work perfect. I followed the below schematic to the T and I am like quadrupley positive my instance is correct. Awful lot of shit to control 7 led bars. They had another picture showing a more "real life" version of hooking this up. Fuck their version. You think my version looks like a wire mess? Their version would have had me criss-crossing the whole display with a wire nest. My version at least keeps the display completely unobstructed and I kept a very strict color-coding for each led bar. Their "real life" example used every color in the rainbow and would have been a completely undecipherable mess.

In mine (as an example) the top-right green wire is coming from upper pin 5. The top left green wire is coming from the resistor for upper pin 5. The bottom-right green wire goes to the lower pin 5 and even though the bottom-left green wire has to cross over to the top side it is coming from the resistor for lower pin 5. The same can be said for all the other pins with mirrored colors for upper and lower. It is waaaay easier to check your work when you don't just randomly use colors... which is what the "real life" example seemed to do.

I don't have a way to cut my wires to perfect lengths AND put nice solid tips on them, yet. So, I am kinda stuck using the precut wires which is what makes this look so messy. If I cut these wires it will just be stripped copper and that's going to fray and become an entirely different kind of mess. I'd rather have a wire mess than messy wires.

Image

OneMadGypsyPostJanuary 2, 2019, 20:52
Moderator
Posts: 307
Registered:
November 12, 2017, 00:13
Normal topicReply To: Theramin Thingy

My project finally reached a point where I ran out of spots to plug things into the arduino. I decided to study the atmega328p chip to see if things can be overlapped. They can on some inputs but, that lead to 5 hours of studying every pin on the chip and researching what everything means. Now that I have a much higher understanding of the chip my brain has exploded with much more complicated ideas than a virtual one string guitar. I've taken detailed pictures of all the circuits that I built and ordered another arduino ultimate kit. I then stripped my boards and started a new idea. When the next arduino comes I'll put the "theramin" back together.

Oh, I also ordered a 500farad ultra capacitor, a shit load of copper wire and a few other simple parts. I am going to build a deadly rail gun. Hopefully the capacitor doesn't kill me .... LOL! 500farads is insane and the voltages I will be using to make this happen are dangerous as fuck. I want the bolt to get so hot it comes out of the barrel glowing. My buddy is a certified electrician and works with high voltages often. I'm going to get him to help me with this side project. I don't trust myself not to make some deadly or incredibly painful mistake. Ya'll have seen some of the gruesome shit I've done to myself with things that aren't deadly.

AdmerPostJanuary 3, 2019, 12:41
Moderator
Posts: 57
Registered:
December 31, 2017, 23:20
Normal topicReply To: Theramin Thingy

500 farad capacitor. Wow. The most capacitive one I've ever touched was a 2000 micro-farad cap. :D

OneMadGypsyPostJanuary 3, 2019, 14:40
Moderator
Posts: 307
Registered:
November 12, 2017, 00:13
Normal topicReply To: Theramin Thingy

IKR... :D. Basically the power of 500 stun guns in one capacitor. LOL.

Image

He fills his hands with lightning and commands it to strike its mark. ~ Job 36:32

Edit: Hmmm, maybe I should make it very clear right now that I could never use this against any living creature. I just want to build something terrifying. I'll probably unload on some watermelons for a video when it's done and then completely remove the capacitor to make sure there can't be any accidents. Like some nosy guest ... "Hey what's thi" !!!POW!!! ... "It's do not touch! That's what it is!"

That scenario is never gonna happen.

OneMadGypsyPostJanuary 4, 2019, 20:00
Moderator
Posts: 307
Registered:
November 12, 2017, 00:13
Normal topicReply To: Theramin Thingy

I did a bunch of research. I'm going to need a lot more than 1 ultra-cap to make this rail gun terrifying. 16 or so would be a good place to start.

Probably 3 rails of this is sufficient
Image

So instead of the power of 500 stun guns, now we are up to the power of 9000 stun guns. Unfortunately, that would put this gun at a weight that is impossible to hold with any accuracy unless you are the incredible hulk. It would be like trying to shoulder and aim 2 cases of beer (or so) for just the capacitor weight, not to mention the battery and all the other parts necessary. The barrel of this gun is also going to be super heavy because it is basically one long and heavy duty electro-magnet. Something of this caliber is beyond wound coils. The core of the barrel is basically going to be a bored out block of copper. Maybe all the capacitors and battery can be built into a backpack.

Now you know why everybody still uses regular guns. The amount of shit that it takes to equal the power of a gun with electricity is not feasible as a personal carry weapon. However, I am trying to make something that can completely demolish brick and keep going so, my lil gun is on a completely different level than a standard firearm. Not to mention charge times. Can you imagine being in a gun fight with something like this? "Hey, Enemy! Wait! I need 20 minutes for my gun to charge so I can fire 1 shot. Just wait right there. I'll tell you when you can run."

I need to check the legal definition of "firearm" cause, if this railgun is considered a firearm I could get in a hell of a lot of trouble for building it. Which in real world terms just means I can't talk about it anymore.

Pages: 1
Page loaded in: 0.046 seconds.