Show Posts
Pages: [1] 2 3
1  Using Arduino / Programming Questions / Re: Two servos with different functions on: November 04, 2013, 07:35:15 am
Quote
Do your exsamples reffer to latching buttons? I can use momentary only...

I haven't tried the below with a servo, but it may do what you want.

Code:
//zoomkat servo button test 7-30-2011

#include <Servo.h>
int button1 = 4; //button pin, connect to ground to move servo
int press1 = 0;
Servo servo1;

void setup()
{
  pinMode(button1, INPUT);
  servo1.attach(7);
  digitalWrite(4, HIGH); //enable pullups to make pin high
}

void loop()
{
  press1 = digitalRead(button1);
  if (press1 == LOW)
  {
    servo1.write(160);
  }
  else {
    servo1.write(20);
  }
}



I'll test it.
Thank you

Back to my initial code (for two buttons and two servos)
I found out that problem could be in my functions.
One button is supposed to run both servos and another button only one servo.
It might cause some conflict (I think)

I tried to run one servo with first button and the other servo with second button and it worked.







2  Using Arduino / Programming Questions / Re: Two servos with different functions on: November 03, 2013, 06:28:33 am
Thank you guys!
I really appreciate your help.

@zoomcat
Do your exsamples reffer to latching buttons? I can use momentary only...

@PaulS
Sorry for my silly description of servo behaviour!
I'll try to work more arround my code and get back for more help.
It's obvious that I don't know most basic things about programming but I this time I really try hard before asking for help.
First of all I'll try to move "lastbuttonState" out from ELSE block.
My buttons are properly wired. I tested them by using my old "one button code".

sikter


3  Using Arduino / Programming Questions / Re: Two servos with different functions on: November 02, 2013, 03:26:03 pm
I'm not sure but probably all my ELSE statements are wrong because I got another button and when I press it it's something ELSE
isn't it? I guess it's affecting the counter. It happens that servos go correctly when I press the button several times . After that  they go crazy and so on.
I'll try tomorrow again using only "IF".



4  Using Arduino / Programming Questions / Re: Two servos with different functions on: November 02, 2013, 09:15:10 am
It didn't work!
I'm guessing my ELSE statement is problem now. It worked fine when I had only one button.
Now I got another button and it's obvious that ELSE can mean a lot of other events.
Those "events" make my servos behave crazy.

Is it possible to resolve this code by using "IF"-conditions only?

5  Using Arduino / Programming Questions / Re: Two servos with different functions on: October 31, 2013, 09:37:48 am
It compiles fine, no issues at all.
I'll upload it do test later when I get home.
Thank you very much!
6  Using Arduino / Programming Questions / Re: Two servos with different functions on: October 31, 2013, 08:56:38 am
Thank you Paul,
Pleas confirm if I understood correctly the "cloning part"
Something like this?
Code:
#include <Servo.h>

Servo servoVolume;         
Servo servoGain;         

const int buttonPin2 = 2;
int buttonState2 = 0;         
int lastButtonState2 = 0;   
int buttonPushCounter2 = 0;   
boolean currentButton2 = LOW;
const int ledPin7 =  7;     


const int buttonPin4 = 4;
int buttonState4 = 0;         
int lastButtonState4 = 0;   
int buttonPushCounter4 = 0;   
boolean currentButton4 = LOW;
const int ledPin8 =  8;   



void setup() {

  pinMode(ledPin7, OUTPUT); 
  pinMode(ledPin8, OUTPUT);     

  servoVolume.attach(9); 
  servoGain.attach(10); 
  delay(15);

  pinMode(buttonPin2, INPUT);
  pinMode(buttonPin4, INPUT);
}
boolean debounce2(boolean last2)
{
  boolean current2 = digitalRead(buttonPin2);
  if (last2 != current2)
  {
    delay(5);
    current2 = digitalRead(buttonPin2);
  }
  return current2;   
}
boolean debounce4(boolean last4)
{
  boolean current4 = digitalRead(buttonPin4);
  if (last4 != current4)
  {
    delay(5);
    current4 = digitalRead(buttonPin4);
  }
  return current4; 
}
void loop()
{
  buttonState2 = debounce2(buttonPin2);
  if (buttonState2 != lastButtonState2)
  {
    if (buttonState2 == HIGH)
    {
      buttonPushCounter2++;
    }
    else {
      lastButtonState2 = buttonState2;
    }
  }
  if (buttonPushCounter2 % 2 == 0) {
    digitalWrite(ledPin7, LOW); 
    Loud();
    delay(15);
  }
  else {
    digitalWrite(ledPin7, HIGH);
    Quiet();
    delay(15);
  }
  buttonState4 = debounce4(buttonPin4);
  if (buttonState4 != lastButtonState4) {

    if (buttonState4 == HIGH)
    {

      buttonPushCounter4++;
    }
    else {
      lastButtonState4 = buttonState4;
    }
  }
  if (buttonPushCounter4 % 2 == 0) {
    digitalWrite(ledPin8, LOW); 
    volumeup();
    delay(15);
  }
  else {
    digitalWrite(ledPin8, HIGH);
    volumedown();
    delay(15);
  }
}
void Loud()
{
  servoVolume.write(90);
  servoGain.write(160);
}
void Quiet() {
  servoVolume.write(0);
  servoGain.write(0);
}
void volumeup() {
  servoVolume.write(90);

}
void volumedown() {
  servoVolume.write(0);
}
7  Using Arduino / Programming Questions / Two servos with different functions on: October 31, 2013, 06:44:52 am
I'm running two microservos controlled by Arduino Uno and one momentary switch.
Microservos are fysicly attached to Volume and Gain potentiometres of my guitar amplifier.
There are two functions in my code both triggered by the same button:
Loud (servos turn up )
Quiet ( servos go back to zero positions)

This is my code:
Code:
#include <Servo.h>
Servo servoVolume;         
Servo servoGain;         

const int buttonPin2 = 2;
int buttonState2 = 0;         
int lastButtonState2 = 0;   
int buttonPushCounter2 = 0;   
boolean currentButton2 = LOW;
const int ledPin7 =  7;     
   
void setup() {
 pinMode(ledPin7, OUTPUT);   
   servoVolume.attach(9); 
     servoGain.attach(10); 
      delay(15);
    pinMode(buttonPin2, INPUT);
  }
boolean debounce2(boolean last2)
{
  boolean current2 = digitalRead(buttonPin2);
  if (last2 != current2)
  {
    delay(5);
    current2 = digitalRead(buttonPin2);   
  }
  return current2;   
   }
 void loop()
{
   
 buttonState2 = debounce2(buttonPin2);
  if (buttonState2 != lastButtonState2)
{
      if (buttonState2 == HIGH)
    {
      buttonPushCounter2++;
      }
    else {
    lastButtonState2 = buttonState2; }
   }
  if (buttonPushCounter2 % 2 == 0)
 {
 digitalWrite(ledPin7, LOW); 
    Loud();
   delay(15);
  } else {
 
  digitalWrite(ledPin7, HIGH);
   Quiet();
   delay(15);
  }
 }
void Loud()
{
  servoVolume.write(90);
  servoGain.write(160);
}

void Quiet() {
  servoVolume.write(0);
  servoGain.write(0);
}

I want so to add another button and function to my code.
This new button should control servoVolume ONLY 

I tried for a week to write a new code but in vain.

Would anyone be so kind and at least put me in the right direction?
When I add another button I really get lost in statment about it's last state and button pushcounter




8  Community / Exhibition / Gallery / Re: Wireless Amp Control on: April 08, 2013, 04:00:58 am
I enjoyed that too and I liked your guitar work .
Will you post a schematic and code?
Also I can't download Utube videos is it possible to give a download link that I don't have to log into to download
I just won't support these tightening controls on who posts and who downloads all over the net . It will just keep getting worse if we accept it..

I'm not sure if I understand why do you need to download video.
I need to make one nice main diagram and upload it.
My project went through many phases while I added more and more components.
Right know it's real schematic mess on several sheets. They are mostly written by hand on piece of paper and I didn't really use right symbols all the time.
I hope I will manage to understand each of them and make a one clear pdf because I'm going to need it.
I can upload the code, that part would be easy. I need to get home first.
9  Community / Exhibition / Gallery / Re: Wireless Amp Control on: April 08, 2013, 03:47:43 am
That is very cool, and the mods on the guitar aren't intrusive (or even obvious until you flick the controls in the vid and give their positions away).

Would it have been possible to put these controls on a strap-mounted enclosure or do they need to be tied into the guitar's electronics?  Reason for asking is part laziness because I have more than one guitar...and part not wanting to cut my axes.  To be fair, part 2 is probably the primary reason smiley

Very inspirational stuff - thanks for sharing,
Geoff
I don't know if you have seen whole video because I showed my old transmitter which can be taped on any guitar and no modification is needed.
Mounting on strap would be possible too.
I never cut my guitars. New transmitter is mounted through the hole where the original tone control potentiometer is usually mounted.
The potentiometer is turned to max and hidden inside the guitar.

Anyway transmitter doesn't share any wire with guitar electronics.
I hope this helped.


10  Community / Exhibition / Gallery / Wireless Amp Control on: April 07, 2013, 09:57:24 am
I finally got it on the video. I would use this opportunity to thank you all who helped me to get so far with this project.
For those who are not familiar with guitars, amp and gigging:
I made this to be able to control my amp and effect pedals wirelessly from my guitar.
This allows me to move on the stage and still be able to switch on/off some effects or amp channels.
I'm connected to amp by ordinary instrument cable on this video but I use guitar wireless system during the live show.
http://www.youtube.com/watch?v=aJmPjkDfolA&feature=youtu.be
11  Using Arduino / Audio / Re: Audio noise caused by a micro servo on: January 06, 2013, 07:31:32 pm
Just a little update:
I connected arduino and microservo to battery so
they had no common wires with my other circuits.
It worked perfectly without any noise. I'll run a couple more
tests to find out what caused problems first time.
This time I had all our rig in different building where we played the gig.
I'm going to test it again in old building where we do our rehearsals.
I'll try with DC adaptor too.

12  Using Arduino / Audio / Re: Audio noise caused by a micro servo on: December 10, 2012, 09:09:25 am
Quote
I wonder is there any way to prevent this noise... Maybe micro servo and audio equipment just don't work together.

Electric guitars/amps are Hi-Z input and it's very easy for noise to couple into it.  (example: AM radio, RF buzz, fluorescent lamps, etc)....

I suspect the micro servo motor (unshielded even!) butt up against the metal case of the amp is a sure fire way of transmitting the EMI/RF noise of the servo to your amp.

You can try "mechanical shielding", see faraday cage, and then grounding that metal case. But the fact that it's supposed to be butted up/pressed against your guitar amp (to be able to turn the knob) I don't know if that will still be effective. 

Thank you,
I was thinking of faraday cage and installing servo on volume pedal not direct on the amp but ... it wouldn't be exact what I had in my mind.
I would like to use this device on GAIN knobs mostly not on the volume master.
Maybe I'll try test it with de-coupling first and take it from there.

13  Using Arduino / Audio / Re: Audio noise caused by a micro servo on: December 10, 2012, 08:47:14 am
Quote
Let's say I run arduino on 9V DC buttery and my pedals are powered by 9V DC switch adaptor.
Can I still connect grounds together?

I once tried to make a common power supply for a collection of five peddles for my son, to replace all the batteries. The result was that two of then went up in smoke.
It turns out that they have what is known as earth lift resistors in place to cope with common grounds on the signals. There was not a common power ground. In the end I had to make five small mains powered isolated supplies, one for each peddle.

So beware trying to power two things off the same circuit. Test first to see that there is a common ground on the supplies.

Hello Grumpy_Mike,
Thank you for your input. I've been connecting several pedals to very same power supply in many years ( 30+). So it works.
There are many pedal boards ( Like Boss BCB60 or BCB30)on the marked  where 3 or 6 pedals share common none isolated power supply.
http://www.bossus.com/gear/productdetails.php?ProductId=610
Of course I too think isolated power supply is best.
Still when all those pedals are connected in series they share common ground by their screen wire. Aren't they?

Rolland Boss power supplies unlike many others have +9V and ground swapped in the pin. If you connect wrong pedal to it that has no protection diodes it could result with the smoke.

14  Using Arduino / Audio / Re: Audio noise caused by a micro servo on: December 06, 2012, 09:39:28 am
Thank you!
15  Using Arduino / Audio / Re: Audio noise caused by a micro servo on: December 05, 2012, 03:15:18 am
Thank you guys,
I spent most of last two days reading about de-coupling. It makes sense but I never figured out how
to do it in my case.
If it was only my amplifier it would be clearer to me, but how to prevent noise in PA?
PA has nothing common with my amplifier and my pedal board. But it looks like the noise affects PA through main 240V AC power supply.
The building is old and probably bad electrical system but still...

I think I'll try to run my servo and arduino on battery and see what happens.
Then I'll try to experiment with metal box and shielded servo cable.

What do you guys think about battery as power supply for servo and arduino?

There are guitar tuning systems on the marked which run on the battery.
They're probably controlled by a microcontroller and driven by special servos. They don't affect amplifiers arround them.


Another critical question:
Let's say I run arduino on 9V DC buttery and my pedals are powered by 9V DC switch adaptor.
Can I still connect grounds together?

thanks










Pages: [1] 2 3