I need help...

Hey y'all,

I'm new to the Arduino world. Im working on a project that runs a PIR motion sensor to trigger a fan. I was wondering if there is a way I can wire the board to run the sensor then trigger on the fan? I'm making this unit self contained with a solar panel but I've got that figured out. Any help is appreciated! TIA

You may find it surprising but everyone here needs help so your title is not very informative.

If your title briefly describes your problem you are more likely to attract the attention of people with useful information. You can change the title by modifying your original post.

I was wondering if there is a way I can wire the board to run the sensor then trigger on the fan?

The short answer to that question is YES.

However you need to provide more information if you want a useful answer. For example post a link to the datasheet for the PIR you are using and explain how you envisage that the Arduino will control the fan - are you using a relay?

If you have written some code post it here so we can see it.

...R

Yes, you could do that.

Take a look at some of the examples to see how a switch (or digital sensor) is read (input), and how an output is turned-on.

I'd start by just turning-on the LED when the motion sensor is triggered.

Then, look for an example using a transistor or MOSFET to control a motor or fan. (The Arduino can't directly power a fan.)

Assuming you are new to programming, read-through the Arduino Language Reference. You won't understand it all or remember it all, but it will give you a good idea of what the Arduino can do. And, it's not that much to read through.

The two most important concepts in programming are conditional branching (such as if-statements) and loops (doing things over and over).

You'll obviously need an if-statement to turn-on the fan if the PIR is triggered, and otherwise turn it off. You probably won't need loops other than the main loop. You do need at least that one main loop, because you aren't going to read the PIR only once, you'll be checking it "continuously" over-and-over in a loop.

You may also want some timing... You might want to hold the fan on for some period of time after the PIR is triggered. You can use delay() for that, but just be aware that delay() is rarely used in real programs because your sketch (program) is "frozen" during the delay time and it can't do anything.

NOTE - What you've described doesn't require a "brain" (microcontroller) or programming. It could be done with just a MOSFET. And, if you wanted some simple timing, you could use a 555 chip which costs less than $1 USD and doesn't require any software.

P.S.
You'll need to calculate or measure the power required for the fan & Arduino to make sure the solar panel has enough power (Watts or Amps). You might want to try the solar panel with just the fan first, and if you have a multimeter, make sure the voltage doesn't drop too much when the fan is attached. (The Arduino needs at least 6V or so into it's voltage regulator.)

You'll probably need to derate the solar panel... i.e. If it's rated for 10 Watts, that's probably at noon on the equator in the middle of the summer. :wink: