Pages: [1]   Go Down
Author Topic: 1volt input high output  (Read 869 times)
0 Members and 1 Guest are viewing this topic.
scranton,pa
Offline Offline
Newbie
*
Karma: 2
Posts: 48
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I an confused (mabe its to late) what is the best way to program 1volt on input pin and and (5volts) high on output pin.I don't get 3v on all inputs to make output high
Logged

Austin, TX
Offline Offline
Faraday Member
**
Karma: 63
Posts: 6049
Baldengineer
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Your question is difficult to understand.

You don't set the voltage of an Input.  Are you asking how to make 1V show up as a HIGH?
Logged

Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

scranton,pa
Offline Offline
Newbie
*
Karma: 2
Posts: 48
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i have(see) 1.3volts on input and yes how to make 1V show up as a HIGH
Logged

Left Coast, CA (USA)
Online Online
Brattain Member
*****
Karma: 331
Posts: 16468
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i have(see) 1.3volts on input and yes how to make 1V show up as a HIGH

What is supplying the 1.3 volt signal? You can read a +1.3vdc signal by wiring it to a analog input pin, it should result in about a digitalRead value of 266 counts.

Lefty

Logged

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 435
Posts: 23611
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

One way would be to drive the + input of a comparator like a LM358, with the minus side at a lower voltage.
If the + input is higher than the - input, the output will be High.
Look at U1A on the Uno schematic, it is doing just that, comparing Vin/2 against 3.3V.

Please fill us in some more - where is the 1.3V coming from?  There are other solutions as well.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

scranton,pa
Offline Offline
Newbie
*
Karma: 2
Posts: 48
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


What is supplying the 1.3 volt signal?
it comes form my rovo like a rc car

You can read a +1.3vdc signal by wiring it to a analog input pin, it should result in about a digitalRead value of 266 counts.
i looked at this and am not sure how to do it,do you have an example to help
Logged

Austin, TX
Offline Offline
Faraday Member
**
Karma: 63
Posts: 6049
Baldengineer
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
if (analogRead(0) > 260) {
 // the pin is HIGH
} else {
 // the pin is LOW
}

That's Analog 0 (A0), not Digital 0.
Logged

Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 435
Posts: 23611
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Any chance that would be a PWM-like signal, or some signal that is servo related, hence the funny voltage?
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

scranton,pa
Offline Offline
Newbie
*
Karma: 2
Posts: 48
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thanks guys i will try it and get some pic of project
Logged

scranton,pa
Offline Offline
Newbie
*
Karma: 2
Posts: 48
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ok tried but no luck,tried several diffent ways and no good.pins 10,9 go high with the 1st if statement(4volts is at input on this statement)and pin 8 is dim on turn left statement and nothing else works.  1st if statement is 4volts on both inputs and all outhers are 1.3volts to 2.3volts
Logged

scranton,pa
Offline Offline
Newbie
*
Karma: 2
Posts: 48
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

the rwheel input is a -5volts
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24298
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
the rwheel input is a -5volts
Can you explain in English what that means, please?

Did you check the suggestion that the signal is PWM/PPM (like with a scope or speaker)?
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Rosario, Argentina
Offline Offline
Newbie
*
Karma: 1
Posts: 47
Ye olde electronics school
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Pittom, as per ATmega328 datasheet for digital inputs:
Vil (maximum voltage to be considered a "0") -0.5v to 0.3Vcc (Arduino UNO uses 5V, so 1.5v), which means anything below 1.5V is considerd DIGITAL LOW
Conversely, Vih (minimum voltage to be considered "1")  0.6Vcc(3V) to Vcc+0.5V, which means that anything above 3V is considered DIGITAL HIGH

you can use an opamp comparator to accondition your signal to 0-5V with any standard opamp, Crossroads post above explains it better.

If you don't want to use an external opamp, then use an analog pin and do your comparison in software like Retrolefty said, read this: http://arduino.cc/en/Reference/AnalogRead
Logged

scranton,pa
Offline Offline
Newbie
*
Karma: 2
Posts: 48
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ok her goes  I have a rovio robot and am trying to make it a 4x4 for out doors,i now have +5volts on input that come from rovio wheels going into arduino inputs and the out put pins going to rc 4x4. Now my problem is i have +5 to +6 volts at the pin inputs but am only getting +2.45volts out for the fwheelpin and rwheelpin put,lturn and rturn i get +5volts on all out put pins like i should and does run the wheels on rc 4x4. is there something wrong wih my program? i tried 2 different ones and same problem.
                                      program one
/*
 
 
 4 inputs with with (and &&) and 2 outputs
 

 */
 
// set pin numbers:
 int redpin = 2;      //come in from rovio
 int bluepin = 3;     
 int blackpin = 4;       
 int greenpin = 5;     
 int fwheelpin =  8;      // out to wheels
 int rwheelpin =  9;
 int lturn = 10;
 int rturn = 7;
// variables will change:
int redState = 0;         // variable for reading rovio status
int blueState = 0;       
int blackState = 0;         
int greenState = 0;       
void setup() {
   // initialize the pin as an output and input
  pinMode(10, OUTPUT);
  pinMode(9,OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(7,OUTPUT);
  pinMode(3, INPUT);
  pinMode(4, INPUT);
  pinMode(5, INPUT);
  pinMode(2, INPUT);
   
}

void loop(){
  // read rovio input
  redState = digitalRead(redpin);
  blueState = digitalRead(bluepin);
   blackState = digitalRead(blackpin);
   greenState = digitalRead(greenpin);
 
  // if it is, then it is high
  if (redState == HIGH && greenState == HIGH){   
   
    // turn LED on:   
    digitalWrite(fwheelpin, HIGH);
 
  }
  else {
     // turn LED off:
    digitalWrite(fwheelpin, LOW); 
  }

 
  if (blueState == HIGH && greenState == HIGH) {     
    // turn LED on:       
    digitalWrite(rwheelpin,HIGH);

  }
  else {
   
    digitalWrite(rwheelpin,LOW);
  }
  //turn left
  if(redState == HIGH && blackState == HIGH){
    digitalWrite(rwheelpin,HIGH);
    digitalWrite(lturn,HIGH);
     
  }
  else{
     digitalWrite(rwheelpin,LOW);
      digitalWrite(lturn,LOW);
}
  //turn right
  if(blueState == HIGH && greenState == HIGH){
    digitalWrite(fwheelpin,HIGH);
    digitalWrite(rturn,HIGH);
     
  }
  else{
     digitalWrite(fwheelpin,LOW);
      digitalWrite(rturn,LOW);
}
}


                              program 2
/*
 
 
 4 inputs with with (and &&) and 2 outputs
 

 */
 
// set pin numbers:
 int redpin = A3;      // 2red come in from rovio
 int bluepin = A2;    // 3blue
 int blackpin = A1;     // 4black 
 int greenpin = A0;   // 5green 
 int fwheelpin =  2;      // out to wheels
 int rwheelpin =  4;
 int lturn = 7;
 int rturn = 8;
// variables will change:
int redState = 0;         // variable for reading rovio status
int blueState = 0;       
int blackState = 0;         
int greenState = 0;       
void setup() {
   // initialize the pin as an output and input
  pinMode(8, OUTPUT);
  pinMode(4,OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(2,OUTPUT);
  pinMode(A3, INPUT);
  pinMode(A2, INPUT);
  pinMode(A1, INPUT);
  pinMode(A0, INPUT);
   
}

void loop(){
  // read rovio input
  redState = analogRead(redpin);
  blueState = analogRead(bluepin);
   blackState = analogRead(blackpin);
   greenState = analogRead(greenpin);
 
  // forward, then it is high
  if (redState >100 && greenState >100){   
   
    // turn LED on:   
    digitalWrite(fwheelpin, HIGH);
 
  }
  else {
     // turn LED off:
    digitalWrite(fwheelpin, LOW); 
  }
  // revers high
  if (blueState >350 && greenState >350){
   
    //turn on
    digitalWrite(rwheelpin,HIGH);
  }

  else{
    //turn off
    digitalWrite(rwheelpin,LOW);
  }

  //turn left
  if (redState >350 && blackState >350){
    digitalWrite(rwheelpin,HIGH);
    digitalWrite(lturn,HIGH);
     
  }
  else{
     digitalWrite(rwheelpin,LOW);
      digitalWrite(lturn,LOW);
}
  //turn right
  if(blueState >200 && greenState >200){
    digitalWrite(fwheelpin,HIGH);
    digitalWrite(rturn,HIGH);
     
  }
  else{
     digitalWrite(fwheelpin,LOW);
      digitalWrite(rturn,LOW);
}
}
 
Logged

Rosario, Argentina
Offline Offline
Newbie
*
Karma: 1
Posts: 47
Ye olde electronics school
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Pittom, a couple tips before i delve into it so you can edit your post:
1) enclose your program in [ code ] (without the spaces) [ / code ] tags, it's very hard to see as normal text and it's not clear where one program starts and when it ends, it's all a big mix right now, use separate CODE tags for it please
2) it's kind of hard to follow your explanation between the typos and the string of continuous text you wrote, split the lines, explain more clearly and paused, use numbered lists if must.
then the good people in the forum will be able to help you more efficiently.

now on to the program.
1) DO NOT PUT +6V ON AN INPUT PIN, you're gonna FRY the AVR!, read my previous post!, NEVER apply more than 5.5V!!!!(if your Arduino is 5V). Even if by fortune you don't fry it, it will sink that difference in the internal clamp diodes heating them and can also lead to undesired effects.
2) Why do you initialize pins using the numbers if you already declared them, that is a prime cause for problems and confusion if you change a pin and forget to update, look:
 int redpin = 2;
and then you do: pinMode(2, INPUT);
a much much better approach that will save you lots of problems in the future is to use the declared name: pinMode(redpin, INPUT);
3) ¿have you tested the fwheelpin and rwheelpin pins(8 and 9) output voltage with nothing plugged?(i.e. the pin itself), if it's 2.4V then it could be hardware damage and you need to check it with the arduno alone(without anything other than power/USB cable) and a simple sketch turning outputs, if it's 5V then your circuit has a problem sinking too much power from Arduino, beware of this too!.
4) post schematics of the circuitry connected to those pins, not everyone knows what a rovio is and even less to what circuitry are you connecting it to.
5) what happens if you put +5V from your supply on the Rovio input for those functions?, does it drop to 2.4V?, what current is it sinking?
5) have you tested assigning them to other pins?(but beware of the stuff i've put before!, don't blindly plug it without checking first)
6) i don't see anything wrong with your programs, they're pretty simple and when a pin is digital HIGH it should output +5V, you can't make it output other voltage....

hope it helps...
Logged

Pages: [1]   Go Up
Jump to: