Go Down

### Topic: 1volt input high output (Read 2826 times)previous topic - next topic

#### pittom

##### Feb 08, 2011, 05:08 am
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

#### cmiyc

#1
##### Feb 08, 2011, 05:17 am
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?
Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

#### pittom

#2
##### Feb 08, 2011, 06:02 am
i have(see) 1.3volts on input and yes how to make 1V show up as a HIGH

#### retrolefty

#3
##### Feb 08, 2011, 06:05 am

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

#4
##### Feb 08, 2011, 06:10 am
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.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

#### pittom

#5
##### Feb 08, 2011, 06:37 am

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

i looked at this and am not sure how to do it,do you have an example to help

#### cmiyc

#6
##### Feb 08, 2011, 06:39 am
Code: [Select]
`if (analogRead(0) > 260) { // the pin is HIGH} else { // the pin is LOW}`

That's Analog 0 (A0), not Digital 0.
Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

#7
##### Feb 08, 2011, 06:43 am
Any chance that would be a PWM-like signal, or some signal that is servo related, hence the funny voltage?
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

#### pittom

#8
##### Feb 08, 2011, 06:50 am
thanks guys i will try it and get some pic of project

#### pittom

#9
##### Feb 09, 2011, 02:31 am
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

#### pittom

#10
##### Feb 09, 2011, 04:12 am
the rwheel input is a -5volts

#### AWOL

#11
##### Feb 09, 2011, 04:09 pm
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)?
"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.
I speak for myself, not Arduino.

#### Eliminateur

#12
##### Feb 09, 2011, 08:12 pm
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

#### pittom

#13
##### Feb 10, 2011, 12:46 am
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(){

// 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(){

// 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);
}
}

#### Eliminateur

#14
##### Feb 10, 2011, 03:12 am
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...

Go Up