Pin Voltage Pullup

Hi, I have an Arduino Uno rev4. This is my first project and I have managed to get further than I thought but have stumbled across my understanding of PULLUP.

I have a single line with around 6v coming from an external device that I need to pulse to 0v so that the external device can count how many pulses.

I thought the 6v was a little too much for the Arduino so I have used 2x10K resistors to bring this down to 3. I have attached this line to D2 and end of the loop to GND just after D13.

The issue I have is that I can't seem to pull the voltage low enough to get the external device to register the count.

Any help would be appreciated as I have spent the last 6 hours trying different ways :slight_smile:

Read the posting at the top of the forum on "how to"....then...
post a drawing of your (complete) circuit (no fritzing)
Then post whatever code ( in code brackets)

Hi, I can't locate the "how to"! I have searched this forum and google for answers. I don't have a diagram and don't know what fritzing is. I think my post explains what I'm trying to achieve and that I just need some guidance on the possibility. Any code I have tried doesn't work so I have started again. I used this forum once before and had comments about using it correctly. I think I have selected the correct area and give most of the information I know.

Here it is: How to get the best out of this forum - Using Arduino / IDE 1.x - Arduino Forum

Then make it!

Words are not the way to tell how the circuits are wired.

?????

1 Like

Thanks for posting the link. I feel like I selected the right category and also give enough information to answer my question. I don't have a schematic but I did outline the board in use and what pins I was using as well as the resistors that were in play. I think I need to source a beginners forum. Thanks.

Use a bipolar NPN transistor switch to do this, with a 330 (for the R4, use 1K) Ohm resistor to the base, emitter to GND and collector to the line. A HIGH written to the pin turns on the transistor and connects the line to GND.

Capture

1 Like

end of the loop just meant after the 2x10k resistors. 6v - 10k - wire to D2 -10k - wire to ground

Much appreciated. I will look to order one. Many thanks.

Maybe, but You gave it in the wrong way. Don't expect helpers to compile poetry and make schematics.

Words, words and words. That's not the way to get any ware. Use the words and draw the diagram showing it.

Please read and use this advice: How to get the best out of this forum - Using Arduino / IDE 1.x - Arduino Forum

Use a bipolar NPN

I'm going to "me too" this because I'm in the middle of assembling a dozen circuits like this to bring a +12V signal into a bunch of arduinos :slight_smile:

Sorry for the late reply. Is this what I need order?

Also, you mention using a 1k resistor, is this to switch down the 6v to 3v for the Arduino?

Thanks

The PN2222 will work. Make sure you identify the E, B and C leads correctly.

The 1K base resistor (shown as 330 Ohms in the schematic) sets the transistor base current to a little over 4 mA, which is safe for the Uno R4 to provide.

Thank you. Just so I fully understand, the device pin will have 6v and will be going to the NPN and when the Arduino digital pin is set to high the NPN will switch and send the 6v to ground which then will be read by the device pin as 0v so I can then count how many times this happens?

That is the intention.

If you have a multimeter, set it to current scale (100 mA?), connect the positive test lead to the device pin, the negative test lead to ground, and measure the current from the device pin to ground. Hopefully it will be around a few mA. Let us know if you find otherwise.

Hi, I have tried this today but it still doesn't seem to be pulling to ground. Here is a diagram of what I have.

const int VOL_PIN = A0;

void setup() {
  pinMode(2, INPUT);
  pinMode(13, OUTPUT);
  }

void loop() {
 //voltage read
 int value;
 float volt;

    value = analogRead( VOL_PIN );
    volt = value * 5.0 / 1023.0;

    if (volt > 1)
    {
    Serial.println("Voltage Started");
    Serial.print("Volts: ");
    Serial.println( volt );  
    digitalWrite(2, HIGH);
    delay(500) ;
    digitalWrite(2, LOW);
    Serial.println( "Complete" );
    }
1 Like

Connect the transistor collector directly to the pin. No resistor to ground.

If I understand the text and markings on your schematic, the transistor is connected backwards. Connect the emitter to ground.

On a schematic diagram, the transistor emitter lead has an arrow showing the direction of the current flow, and is identified as "E" on the data sheet pin diagram.

I think it is the right way round as I looked up a diagram to explain which pin was which. So I have the collector pin 1st which the device is going too, then the 2nd pin (Base) to the 1k resistor which then connects to D2 and then the emitter is to ground.

Not sure if this helps!

No, the photo does not help.

Once you have removed the collector resistors, let us know if the circuit works. If not, post a revised schematic.

Most common PN2222 pinout, but you should use the diode check function of a multimeter to be sure.
Capture