AUTOMATIC ILLUMINATION OF A LADDER

AUTOMATIC ILLUMINATION OF A LADDERGood day! In this post I want to share with the Internet community on how I happened to make a automatic light on the stairs in his two story cottage. About four months ago, returning from work in the dark, I successfully slipped and broke two pljusnevyh bone (finger) on his left foot. A whole month had fail in bed, so as to step on the foot was incredibly painful. Then another half of the month was lame without plaster (who had fractures, I’ll understand). After this sad story, I began to think about automating the lighting of the stairs. A bit of tinkering with the search query found a very simple solution in this blog, just based on my favorite Arduino microcontroller. The scheme did not cause any difficulties, but was baffled by the number and length of the wires that I had to mount. Prior to that, did nothing of the sort. To buy ready decisions, or to hire someone is expensive.

During the month ordered needed parts, and slowly assembled a few days on your ladder. For anyone interested, what came out of it, welcome under kat!

Components

Will give the approximate cost of all the components that were used in the work. Most components are bought in stores of my town so bring everything in rubles.

 

Arduino Pro Mini 300 p
Ultrasonic Module HC-SR04 Distance Sensor — 2 PCs 230 p
Led driver M5450 88 R
Voltage regulator L78M05CV 26 p
Photoresistor FR-764 16 R
The cable duct 20×10 mm — 10 M 100 R
Wire 2×0,12 — 100 M (to tape) 190 R
The wire 4×0,12 — 20 M (for sensors) 60 R
Led strip LSP0603W15 White — 17 PCs 30 cm 1020 R
Small things: 15x15cm PCB, ferric chloride, drill 0.9 mm,
pin header connector type PLS the plugs on the PCB BLS, shrink tube,
capacitors and resistors
 
200 p
12V power supply (aka building) the alarm “Sail 4” Free

 

Prototype

Debug firmware for Arduino, like everyone, I made on the breadboard using conventional LEDs.

Scheme

With the help of the notorious environment for designing Eagle CAD was modified scheme of the author and the printed circuit Board. Here I added a voltage regulator To 5 volts, changed the sensors with 3 pins expensive Ping on four contact cheap HC-SR04. In order that the illumination of the stairs worked only in the dark, is added to the schema of the Soviet photoresistor FR-764 (you can use another).

 

Scheme

 

Scheme

 

Scheme

The sketch

The sketch uses a freely distributable library for working with led driver M5450 and library to work with an ultrasonic range finder HC-SR04.

 

#include “lightuino3.h”
#include “Ultrasonic.h”

//Set the pins to the first sensor
#define TRIG_PIN 12
#define ECHO_PIN 13
//Set the pins for the second sensor
#define TRIG2_PIN 10
#define ECHO2_PIN 11
//Define the first sensor
Ultrasonic OurModuleUp(TRIG_PIN, ECHO_PIN);
//Define the second sensor
Ultrasonic OurModuleDown(TRIG2_PIN, ECHO2_PIN);
// pins 0, 1 used by Serial
const unsigned char DataPin = 6;
const unsigned char clockPin = 7;

// delay between steps
const long lightSpacing = 280;
//delay illumination of the stairs
const long lightHold = 10000;
//shot delay sensor
const long pingReadDelay = 50;

// Range at which the work sensor
const float minBottomIn = 33.0 f;
const float minTopIn = minBottomIn;

LightuinoSink sinks(clockPin, DataPin, 100, 4);

bClimbStarted boolean = false;
bDescentStarted boolean = false;

int val;
void setup() {
Serial.begin(9600);
pinMode(DataPin, OUTPUT);
pinMode(clockPin, OUTPUT);
delay(1000);
sinks.set(0,0,0);
}

void loop() {
val = analogRead(0);
//Check the lighting in the room
if (val>=1020){

UltrasonicDownFire();//the Shot, the lower sensor
if(bClimbStarted) {
bClimbStarted = false;
bDescentStarted = false;
climbLightSequence();
}
else {
// Shot upper sensor
UltrasonicUpFire();
if(bDescentStarted) {
bClimbStarted = false;
bDescentStarted = false;
descentLightSequence();
}
}
delay(pingReadDelay);
}
}

//Top sensor
void UltrasonicUpFire() {

if((OurModuleUp.Ranging(INC) < minTopIn) && (OurModuleUp.Ranging(INC) > 0))
{
Serial.println(“Top sensor tripped.”);
bDescentStarted = true;
}
}

//Handling the lower sensor]
void UltrasonicDownFire() {

if((OurModuleDown.Ranging(INC) < minTopIn) && (OurModuleDown.Ranging(INC) > 0)) {
Serial.println(“Bottom sensor tripped.”);
bClimbStarted = true;
}
}

void climbLightSequence(){
LedsOnDown();
}
void LedsOnDown(){
//Reset
byte ledState[9];
for (int j=0;j=0;k–)
{
for (int j=8;j>=1;j–)
{
ledState[k] = (ledState[k] >> 1) + 128;
sinks.set(ledState);
delay(lightSpacing);
}
}
//Delay
delay(lightHold);
//Extinguish
for (int k=1;k>=0;k–)
{
for (int j=8;j>=1;j–)
{
ledState[k] = (ledState[k] >> 1);
sinks.set(ledState);
delay(lightSpacing);
}
}
delay(pingReadDelay);
}

void descentLightSequence(){
LedsOnUp();
}

void LedsOnUp(){
//Reset
byte ledState[9];
for (int j=0;j ledState[j] = B00000000;
}
//Light
for (int k=0;k {
for (int j=0;j {
ledState[k]=(ledState[k] << 1) + 1;
sinks.set(ledState);
delay(lightSpacing);
} }
delay(lightHold);
for (int k=0;k {
for (int j=0;j {
ledState[k]=(ledState[k] << 1);
sinks.set(ledState);
delay(lightSpacing);
}
}
delay(pingReadDelay);
}

A little about installation

Since I have the most simple wooden ladder (without podstupenej Board), mount the led strips was carried out from the end of each step.

 

A little bit about the installation

Is through the length of the cable channel with the laid wires, which are glued with liquid nails. Led strips have the adhesive side, they stay on the tree.

 

A little bit about the installation

The sensors were installed at the beginning of each of the first stage at the top and bottom of the stairs. As mount used conventional escutcheon for drywall.

 

A little bit about the installation

From the housing of the power supply alarms have been thrown a dead battery, place it easily fit our controller.

 

A little bit about the installation

The cover is in place. Place the controller under the landing.

 

A little bit about the installation

The result

Actually the video does not reflect the real picture. Ladder covers are much prettier and brighter.

Recommend to read

  • WHITEBOARDWHITEBOARD
    Good day dear reader. Today I'd like to tell you about how a few hours in his pocket only 300 rubles, and behind a bag of enthusiasm to make yourself such a useful thing as a dry erase...
  • WELDING WITHOUT CHARTS AND FORMULASWELDING WITHOUT CHARTS AND FORMULAS
    Homemade welding machines are engaged not the first year. In their manufacture into account the advice and recommendations of the "Model construction" and other well-established...