Show Posts
Pages: 1 ... 3 4 [5] 6 7 ... 20
61  Using Arduino / Programming Questions / Re: servo (knob) on: April 15, 2013, 03:19:27 pm
how do we go about writing this
62  Using Arduino / General Electronics / Re: 12v PWM to 5v PWM on: April 15, 2013, 03:17:10 pm
yes that is fine but as I have said is it worth putting some sort of protection after that e.g. the zener diode or something else as the supply is up and down and quite possibly having a few spikes in it which could harm the arduino
63  Using Arduino / General Electronics / Re: 12v PWM to 5v PWM on: April 15, 2013, 03:01:11 pm
that is fine but not if the voltage goes over 5v
64  Using Arduino / Programming Questions / Re: servo (knob) on: April 15, 2013, 01:04:26 pm
all gone a bit quiet lol
65  Using Arduino / General Electronics / Re: 12v PWM to 5v PWM on: April 15, 2013, 12:54:52 pm
ok cool the 12v could veriate from 11-14v so would it be a good idea to put some protection on it like a 5.1v zener diode?
66  Using Arduino / General Electronics / 12v PWM to 5v PWM on: April 15, 2013, 12:05:22 pm
hi there the subject gives it away, I want to read a PWM on my arduino but the PWM is 12v so my question is what is the best way to drop the voltage down to 5 v for the arduino?
67  Using Arduino / Programming Questions / Re: servo (knob) on: April 14, 2013, 11:44:48 am
as you can see I have added calibrate function what works fine, but when the arduino is powered down it forgets it range so can I save the values to the arduino, I presume we have to use the eeprom? how do we do that?


Code:
#include <Servo.h>

Servo myservo;             // create servo object to control a servo

int potpin     = 0;        // analog pin used to connect the potentiometer
int potpin2    = 1;        // analog pin used to connect the potentiometer
int val2;                  // variable to read the value from the analog pin
int buttonPin  = 11;       //caliberate button
int sensorValue = 0;       // the sensor value
int sensorMin  = 740;      // minimum sensor value
int sensorMax  = 0;        // maximum sensor value

void setup()
{
  myservo.attach(9);      // attaches the servo on pin 9 to the servo object
  pinMode(buttonPin,  INPUT);

  if (digitalRead(buttonPin)==     HIGH)
  {                                                        // ** ...cailable... ** //
    digitalWrite(12, HIGH);
    // calibrate during the first five seconds
    while (millis() < 5000) {
      sensorValue = analogRead(potpin);

      // record the maximum sensor value
      if (sensorValue > sensorMax) {
        sensorMax = sensorValue;
      }
      // record the minimum sensor value
      if (sensorValue < sensorMin) {
        sensorMin = sensorValue;
      }
    }
    digitalWrite(12, LOW);
  }
}

void loop()
{
  sensorValue = analogRead(potpin);                                      // reads the value of the potentiometer (value between 0 and 1023)
  val2 = analogRead(potpin2);                                            // reads the value of the potentiometer (value between 0 and 1023)

  // apply the calibration to the sensor reading
  sensorValue = map(sensorValue, sensorMin, sensorMax, 0, 740);

  // in case the sensor value is outside the range seen during calibration
  sensorValue = constrain(sensorValue, 0, 740);

  val2 = map(val2, 0, 1023, 0, 20);                                    // scale from 0 to 10 for the zero for the servo
  sensorValue = map(sensorValue, 0, 740, val2, 150);                    // scale it to use it with the servo (value between 0 and 180)
  myservo.write(sensorValue);                                          // sets the servo position according to the scaled value
  delay(15);                                                            // waits for the servo to get there
}
68  Using Arduino / Programming Questions / Re: servo (knob) on: April 14, 2013, 11:26:59 am
Quote
you have used the serial monitor to check the values you get from analog read is my understanding, yes?

yes on the 10k pot 0-1023 nice and smooth but not linea

on the 5k pot it go's 0-740 so I edited the 1023 to 740 what work fine but I still had the dead band so I played with the 0-180 and took it down the 0-150 and now seems to work over the full range
69  Using Arduino / Programming Questions / Re: servo (knob) on: April 14, 2013, 11:02:06 am
Quote
some servos can work outside the 0-180 range, which is in reality a pulse range (1000-2000 uS iirc).  when you create your servo, you can redefine max and min pulse length.  push these limits out further till you find the actual limits of your phsyical servo, then put a saftey margin back in to protect it.  If that was confusing I suggest you look online at servo pulse and control signals, since I am bad at explaining this kind of stuff.

the great thing about standards, is everyone can ignore them

so are you on about playing with the 0-180 in the code or (and) the Pulse frequency if so how do I  alter that?


Quote


I got the below pots for tinkering and they seem to work well with the arduino and the price and service is good.

http://www.ebay.com/itm/10pcs-10K-Ohm-B10K-Knurled-Shaft-Linear-Rotary-Taper-Potentiometer-/260985203825?pt=LH_DefaultDomain_0&hash=item3cc3ee2c71

thanks for that smiley


I have got some of these
http://www.firstmarkcontrols.com/s021g.htm
could I use this instead, I have notes it is a 5k though what do you think?
5K will be OK

I did not see anything saying about it being linear??
70  Using Arduino / Programming Questions / Re: servo (knob) on: April 14, 2013, 10:24:23 am
I have got some of these
http://www.firstmarkcontrols.com/s021g.htm
could I use this instead, I have notes it is a 5k though what do you think?
71  Using Arduino / Programming Questions / Re: servo (knob) on: April 14, 2013, 08:03:42 am
that will be it just looked at me pot's and they are all log
so i'll have to get some  linear one's
72  Using Arduino / Programming Questions / Re: servo (knob) on: April 14, 2013, 05:44:24 am
going back to the arduino example code, it does not seem to use the full range of the pot i'm only using about 25% of the pot to move the servo it full travel and the other 75% of the pot does nave all, I have dun a serial read of the analog input from the pot and it uses all 1024 bit's and looks smooth. I have also tried another pot and another servo and tried another power supply all making no effect
any ideas how to over come this? 
73  Using Arduino / Programming Questions / Re: servo (knob) on: April 13, 2013, 03:34:07 pm
thank you all I think I was thinking to hard lol
74  Using Arduino / Programming Questions / servo (knob) on: April 13, 2013, 12:40:26 pm
hi there
I want to be able to control a servo with a pot which is easily done with a sketch provided in examples knob

Quote

// Controlling a servo position using a potentiometer (variable resistor)
// by Michal Rinott <http://people.interaction-ivrea.it/m.rinott>

#include <Servo.h>
 
Servo myservo;  // create servo object to control a servo
 
int potpin = 0;  // analog pin used to connect the potentiometer
int val;    // variable to read the value from the analog pin
 
void setup()
{
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object
}
 
void loop()
{
  val = analogRead(potpin);            // reads the value of the potentiometer (value between 0 and 1023)
  val = map(val, 0, 1023, 0, 179);     // scale it to use it with the servo (value between 0 and 180)
  myservo.write(val);                  // sets the servo position according to the scaled value
  delay(15);                           // waits for the servo to get there
}

what I want to be able to do is add another pot input that will variate the 0 position of the servo between 0 to 10 degrees I have tried a few things but haven't managed to get anywhere any help would be appreciated ?
75  Using Arduino / Displays / Re: utft code issues on: March 27, 2013, 02:26:05 pm
Quote
When you display a screen, set a variable to say that that screen is being displayed. Then whe nyou are checking the buttons, if the variable says screen x, then check for thethe buttons for screen x, if screen y, then the buttons for screen y, etc.

You need to use an if statement to make the selection of which logic to use at the time.

yes ok im struggling to get started, you couldnt give me a kick start in the right direction?
thanks for your help so far



Quote
Arduino 1.03
       i tried mine on 1.0 but couldnt get it to work so i tried it on 2200 and worked fine ever since
Pages: 1 ... 3 4 [5] 6 7 ... 20