Use Vin and normal output pins at the same time

Hello,

I want to use my Arduino to power a sensor. Depending on the input recieved from the sensor I want to turn the LEDs on or off. However I find that when I connect the sensor to the Vin the leds turn off. I have the sensor connected to the vin and the gnd to one of the gnd on the power terminal.

My leds are powered from the terminal with pins 1-13 and they are all commonly tied to gnd on the same side of the board.

I am hooked up to a DC 12V powersupply. What is it that I am doing wrong?

Br,
Billy

"a sensor"
Which? What? Details.

"connected to Vin"
Why?

Time to break out the pen and paper, sketch out what you've done, take a decent picture of that and upload it as an attachment.

Wow. You haven't given us much to work with, so I'll make up some suggestions.

BillyDrenan:
I want to use my Arduino to power a sensor. Depending on the input recieved from the sensor I want to turn the LEDs on or off.

OK.

However I find that when I connect the sensor to the Vin the leds turn off.

You said that you want to power the sensor from the Arduino, but this sentence suggests that you're powerint the sensor from Vin, which means that you're powering it from an external power supply. Which is it? If you're powering from Vin, you'll want to be sure that the sensor output voltage is compatible with the Arduino - that it's voltage doesn't exceed 5V, and, for a digital output, that the low output is low enough to reliably read 0, and the high output is high enough to reliably read 1. Make sure that you're not hooking it up backwards, and sending your DC supply into current-limiting.

My leds are powered from the terminal with pins 1-13 and they are all commonly tied to gnd on the same side of the board.

It sounds like you have 13 LEDs, you're driving each one with a separate pin, and they all come on at once. So let's ask:

  • Are you using series resistors with the LEDs? If you're not, then the pins are delivering too much current.
  • What's the current per LED? If the total is 200 mA or more, the IC is delivering too much current.

I'll suggest that you take the LED off of pin 1 so that you can get Serial working, and print some diagnostic messages. Something like, "Sensor reads , turning LEDs off." That will give you a lot of clues. You'll also do well to reduce the number of LEDs to as few as are necessary, to reduce the load on the IC and the on-board voltage regulator, until you verify that drawing too much current isn't your problem.

What is it that I am doing wrong?

You're not telling us enough. You've offered very few clues; it's unlikely that we can guess what you're doing wrong. Post some code, at least, and if, as a new poster, the system won't let you post a schematic, give us a much better description of your circuit. Tell us what the sensor is sensing, and give us a part number, and a link to its datasheet. Take some voltage readings when the system behaves unexpectedly - especially Vin, VCC, and the sensor output.

My mistake it is powered from the 5v pin. But yes i want to power it from the external source. The sensor is a 5vdc ultrasonic sensor. I have it wired up the same as the example on the website. There are only 3 leds. They are powered from pin 4,6,9. Should this setup work?

BillyDrenan:
I have it wired up the same as the example on the website.

Which website would that be?

Please post a link to the specific page for the sensor you're using.

As stated before, posting a circuit diagram is very helpful. Simply pointing to the website is a good start, but not enough, because you're also using LEDs, and a 12V supply. It will be difficult to assist without knowing what you're really doing.

What is it that I am doing wrong?

You are not describing what you are doing with enough detail for anyone who is not a mind reader to work out what on earth you are trying to do, or what you have infact done.
Address that and we can help.