How much current can flow through Vin?

Looking into plugging a massive LED array into the Vin of the Arduino, I figure I would look into the current limits, if any, on that pin.

Destroyed Duino
A Destoyed Duino

I stubbled upon the Ruggedduino from a very well written blog post on 10 Ways to Destroy an Arduino. I’m considering buying one. First because I do a lot of Arduino work in the evening (when most errors happen and most bugs are introduced). Second because Applying more than 5v to the 5v pin on the Arduino can potentially damage your computer’s USB port. Getting a Ruggedduino as a main experimental board might not be a bad idea.

So getting back to the Vin max current. The Vin pin on the Arduino is directly connected to the power supply. So you are limited by the power rating of your power supply. Other limiting factors are a diode rated at 1A and the traces on the board which are rated at 2A. So final answer, under 1 amp please. This electronics stack exchange answer cover it.

Another thing to consider is the fact that the Vin pin is after the polarity protection diode of the board’s power input. This mean you are directly connected to the Arduino chip and you can potentially destroy it if you reverse the polarity of your power input. This short article on Fork Electronics covers it.

Which Arduino Pins support analogWrite() PWM?

After spending a few long minutes debugging a sketch and a breadboard, wondering why my analogWrite wasn’t dimming a LED as expected, I recently discovered that the Arduino board does not support analogWrite() on all it’s pins. Only pins 3, 5, 6, 9, 10, and 11 provide PWM output with the analogWrite function.

Then, (another discovery!) I realized that the Arduino board doesn’t really provide a analog voltage output in the strict sense, It fakes it using Pulse Width Modulation (PWM). This works great for LEDs, but probably not in application that require a steady 2.5 volts. The full explanation is on the Arduino PWM tutorial.

Reassuringly all 14 pins of the Arduino (pin 0 to pin 13) provide digitalRead() and digitalWrite() depending on your call to pinMode().

Thing I Learned About The Arduino Today

Two Power Supplies Is Okay

You can drive the Arduino Uno from the external power source and have it plugged in your computer with the USB cable at the same time. Having a recently purchased computer I was worried that having an external power source could feed back into the USB port and somehow overload the computer. This Stack Exchange answer goes over the details and the schematic about why this is possible.

A 9 volt battery can drive the Arduino and a Pixel Strip

Working on a halloween costume, I was testing running the Arduino and a strip of LED pixels from a single 9 volt battery. I works, but I don’t know for how long…

The Vin Pin = The Power Input

The Vin pin is used to drive external boards and accessories. It sports the same voltage as the external power input. In my case I drive for the Plexi Project, I drive the Arduino with a 12v power adaptor and I can drive my LEDs from the Vin. No need to splice the input from the power adaptor separately.


Adjusting the PIR

The PIR sold at Adafruit has a few adjustable components: retriggering, time and sensitivity.


No idea. Even the Adafruit page is cryptic about what this setting does…


The sensitivity potentiometer can’t really be quantified, but it reacts intuitively. The higher the potentiometer, the more sensitive the sensor will be. Adjust depending on your application. I have mine cranked to 11 ;-)


The time potentiometer sets the amount of time the sensor will stay “ON” after a trigger by mouvement. This is designed to go from 2.5 seconds to 4 minutes, but my PIR can only go as low as 6 seconds.

I have previously implied that there was a frequency adjustment possible on the PIR, but that is not exactly the case. You can adjust the length of time the trigger stays ON (as explained above), and you can adjust the length of time the trigged will stay OFF after that but for this you need to change a resistor that is soldered on the sensor’s board.

Introduction to Passive Infrared Sensor

I just received a PIR sensor in my latest Adafruit delivery. I quickly scanned the web and found 2 projects that I don’t want to do with infrared: Send email and a Walmart greeter… But I’ll use these projects to learn how to wire the PIR and how to read it’s input.

The PIR is very simple to wire up. Black and red to ground and +5v, the middle yellow wire goes into an input pin on the Arduino.  To keep things simple, I’m using a digitalWrite() so the motion sensor will either output HIGH when motion is detected and LOW when no movement is sensed.

Here’s the code. It’s light a LED on pin 11 when the sensor is triggered:

* Simple example of reading from a Passive IR Sensor

// Connect PIR miidle pin to A1
const int inPirSensorPin = 7;
const int redLedPin = 11;

void setup() {
  // initialize serial com
  // PIR will be a digital input
  pinMode(inPirSensorPin, INPUT);
  // Red LED is an output
  pinMode(redLedPin, OUTPUT);

void loop() {
  // read the sensor:
  //int pirSensorValue = analogRead(pirSensorPin);
  int pirSensorValue = digitalRead(inPirSensorPin);
  if (pirSensorValue == HIGH) {
    analogWrite(redLedPin, 255);
  else {
    analogWrite(redLedPin, 0);
  // print out to serial
  //Serial.print("PIR value:"); Serial.println(pirSensorValue);
  // wait 100 ms

My first surprise is that the signal is very low frequency. You can read it every 100 milliseconds if you like (as in the example), but the signal only changes about every 10 seconds. I noticed there are 2 pots on the side of the PIR sensor unit. I will look into and report on a following post.

Two Blinking LEDs at different rates with the Scoop Library

Here is an example of doing two things at once on an Arduino Uno.

The red LED is blinking fast and the yellow LED is blinking at a slower rate. Each blinking operation is a separate task with its own loop() function. Each loop calculates a sine function which is applied to an analog output pin of the LED.

For this simple example, you could easily do this inside the main arduino loop() function. However, the projects get a little bigger, having separate tasks makes things a lot simpler to manage,

Here’s the interesting part of the source. It’s based on a Scoop template created by Fabrice Oudert.

// First Task - Fast Red LED
struct task1 :
SCoopTask<task1> {
static void setup() {}
static void loop() {
  for (int x=0; x<180; x++) {
    float sinVal = (sin(radians(x)));
    int ledVal = int(sinVal*255);
    analogWrite(redLedPin, ledVal);
    sleep(2); // this sleep defines the sine frequency
  sleep(10); // this sleep add a down time between sines
} task1;

The complete source code is in my bitbucket under BlinkingLedsScoopTest.

I will post the Fritzing schematic a little later…