Need input please

If you are wired as in this schematic, 5v into Vin is not going to work !

TBC the makersguide link shows how to test and experiment with the unit using a battery, LED and resistor.

IMO it is a waste of time until you do this kind of testing!

If you want to play with the code, replace the PIR units with pushbutton and use them to simulate the sensors.

When both parts work, the battle to combine them won’t be. A battle.

a7

why not?

Nano uses a Schottky diode to isolate Vin and 5v so guess it will work after all.

Okay, back to the first thought.
Feeding 5v into Vin does not give the IC2 voltage regulator enough for it to do its job.

The OP should connect external 5v to the 5v pin.

The tutorial OP followed had this connection and no reason to think this was a typo. It could work, LM1117 drops 1.2v at 0.8A but less than that at lower load. Also the power supply used in example project probably gives a bit more than 5v, at least this was my experience. Maybe OP purchased a cheap nano clone (most likely). But you’re right, current wiring could be unreliable.

But it is an instructable, and those are littered with exactly that sort of fault. It probably just worked for the writer but it was probably on the limit of working and a different type of sensor or slight drop on the 5V supply could easily stop it from working.

The vast majority of electronic instructables are crap for exactly this reason, they are written by someone who doesn’t know what they are doing.

I bet the signals have never been even close to an oscilloscope to check them, otherwise they would have picked up on the low voltage going to the sensors.

1 Like

OK then I guess my question is then..... out of this mess is there anyway to get this to work?

If your external power supply is regulated 5v DC, connect it to the Arduino 5v pin not to the Vin pin.

1 Like

Thank you LarryD! I'll give that a try!!!

OK We have a WINNER!!

First let me just say THANK YOU to ALL of you!!

This is what I did...

I tested both Nano's and ALL PIR sensors. I did this by running a simple script to trigger a light when the PIR was tripped. This is how I knew I had 3 good ones.

THEN I simply did what LarryD suggested ...... unhook the power from the VIN and put it into the 5V.

NOW it works!!! The lights run, dim and stay out until I trip the PIR sensor.

You are an expert now !
:+1:

1 Like

I gots to know… do you mean you had 6 bad sensors?

a7

Was it six bad ones or only five?

1 Like

Hi,
Exactly what PIR are you using?
If it is the HC-SR501, have you tried adjusting the pots on the units that fail to "work"?

Tom... :smiley: :+1: :coffee: :australia:

I did adjust them. Caveat is this....... 3 sensors will not work in this system.... 1 will so I went with that and adjusted the delay time :wink:

Can you elaborate on this point?

I don’t see what from a hardware viewpoint would make a system using three PIRs any kind of challenge, so I am sure I do not understand. Yet.

TIA

a7

Here is the code

#include "FastLED.h"
#define LED_DATA_PIN 9
#define NUM_LEDS 196
CRGB leds[NUM_LEDS];

int onTime = 30*1000; // 30 seconds
int motion_sensor_left = 10;
int motion_sensor_right = 11;
int motion_sensor_front = 12;
int fadeTimeDiff = 40;

void setup() {
  FastLED.addLeds<WS2811, LED_DATA_PIN, BRG>(leds, NUM_LEDS);
  pinMode(motion_sensor_left, INPUT);
  pinMode(motion_sensor_right, INPUT);
  pinMode(motion_sensor_front, INPUT);
}

void loop() {
  if (digitalRead(motion_sensor_left) == 1 || digitalRead(motion_sensor_right) == 1 || digitalRead(motion_sensor_front) == 1) {
    fadeIn();
    delay(onTime);
    fadeOut();
  }
}

void fadeIn() {
  for (int led = 0; led < NUM_LEDS; led++) {
    leds[led] = CRGB( 0, 153, 255);
  }
  for (int b = 0; b < 255; b += 4) {
    FastLED.setBrightness(b);
    FastLED.show();
    delay(fadeTimeDiff);
  }
}

void fadeOut() {
  for (int led = 0; led < NUM_LEDS; led++) {
    leds[led] = CRGB( 0, 153, 255);
  }
  for (int b = 255; b > 0; b -= 4) {
    FastLED.setBrightness(b);
    FastLED.show();
    delay(fadeTimeDiff);
  }
  for (int led = 0; led < NUM_LEDS; led++) {
    leds[led] = CRGB::Black;
  }
  FastLED.show();
}

If I actually use the 3 PIR sensors the off and on starts again. I checked with the serial monitor in the IDE and it shows PIR's [multiple PIRS - tested 9] shows 1 and the loop continues. So I hooked up all 3 wires [D10, D11 and D12] to one sensor and the lights worked as they should.

So I only used one of the D pins and didn't use the other wires at all. This would lead me to believes a bad PIR sensor but I found that hard to believe. Again, yes I know I've said it enough, being new the code doesn't totally make sense to me.

Still trying to figure out how to dim these lights a bit LOL VERY bright late at night. I did change the color though :slight_smile:

Maybe change the loop that calls setBrightness to it doesn't run all the way up to 255.

1 Like

That's not how for loops work, the condition is tested before the loop body is entered, so b is never 256. The increment happens at the end of the loop body.

Yeah tried that doesn't seem to help so instead I just picked a darker color :wink: