browser icon
You are using an insecure version of your web browser. Please update your browser!
Using an outdated browser makes your computer unsafe. For a safer, faster, more enjoyable user experience, please update your browser today or try a newer browser.

Tagged With: Lightswitch

Prototype #3 Dsbox LightSwitch

Summary

Prototype  3 is almost the final assembly bus some more refinement needed. I’ll likely not consider the next iteration a prototype…

 

Outstanding Prototype issues

  • My current capacitive touch sensor works intermittently through the plastic case/stud. I need to understand how to improve the effectiveness reliably
  • The Camera mount is not perfectly centered to the fish eye lens . Next time will better place the mounting screws.
  • I will try alternate glues because the base plate that the PI is connected to doesn’t stay connected well to the plastic case.
  • I want to make the detection of the PIR sensor better so that it detects me in the room but avoids false alerts.

 

 

 

Categories: HomeAutomation | Tags: , , , | Leave a comment

DsBox Light Switches as part of my Home Automation

Summary

After 40+ weekends my DIY smart light switches are working as part of my home automation. There is more to do but i’m pleased with what they do so far.  I’ve now built 5 switches – one for each room of my apartment except the bathroom.  These detect motion as i walk in and out of each room. The switches get/set attributes on a central mysql database and run an evolving logic python script that

  • switches hue lights on in rooms during “evening/night” when there is motion
  • maintains a ranked list of rooms by last activity seen
  • keeps the light on in the most recent room with activity , and switches of other rooms after a period of inactivity.
  • start/stop video recording of activity each room

The shared database allows for global or per room or per switch configuration of of sunrise/sunset times as well as other configurations. It also means a Grafana server can display metrics on switches and room occupancy. The shared mysql database and Grafana server run as docker containers running on a Synology NAS that also provides storage for video recordings and a central syslog service.

Future work to switches

  • Adding the capacitive touch/dial to each switch so that they can be manually adjusted up/down/off etc. For the moment I’ve used a dummy cover until i can perfect the capacitive dial design.
  • Remount some of the fisheye camera modules which are not centered as i would line them
  • Adding/Evolving logic scripts to learn the appropriate brightness for each room at different times, to simulate activity when i am away based on observed usage, to track how long i spend working/sleeping/relaxing
  • Auto update the sunrise/sunset times from https://sunrise-sunset.org/api
  • Adding image recognition to the camera in the kitchen to read barcodes for shopping lists
  • As screens improve i’d like to replace the 8×8 led matrix with a e-ink display. I do not think the tech is where i want it yet. in another 12 months I’ll re-evaluate
  • Enabling me to view the Cameras remotely when i’m out to see if i left the oven on etc

The switches are the first of my DsBox projects based on small cheap compute modules working together to provide Home Automation.  Eventually I may build a small AI to run distributed across the boxes. Its name will be “Leo” as a tribute to a tv character I admired.

Assembly and mounting of the switches

Categories: HomeAutomation | Tags: , , , , , , , | Leave a comment

dsbox-lightgpio , a command line interface for my lightswitches

Introduction

I’m writing a command line tool called dsbox-lightgpio to wrap GPIO and web services. Command can be entered as arguments or interactively.

for example

          dsbox-lightgpio “hue get all”

or

          dsbox-lightgpio

          > all enable debug
          > hue get all
          > exit

I have finished coding handlers…

To get the status of all lights excerpt the office

          hue get all -office

To set all lights on to white except turn the bedroom off and leave the office as is

          hue set all=white bedroom=off -office

To brighten the lounge only if it is on already

          hue set lounge?on=+5

To detect motion ( prints when there is motion detected, and when no motion has been detected for 60 seconds )

          motion enable detection 

To request a heartbeat timer event every 5 minutes ( 300 seconds )

        timer heartbeat  myevent=300

To cancel a timer

        timer cancel myevent

To scroll a text message (once) on the 8×8 led matrix ( including a named icon )

        matrix marque Hello world this is a test 

To display a eye that winks ( and leave it on the display}

        matrix animate “{eyeopen}{eyeoclosed}{eyeopen}”

I’m still coding handlers for …

To blink (once) the lights blue as a notification indicator and then return them tot heir previous state

          hue blink all=blue

To gradually brighten a room to full red on a work day over a 30 minute interval (1800 seconds)

          hue fade up 1800 bedroom=red 

To gradually fade off the office ( if it is turned on ) over a 30 minute interval (1800 seconds)

          hue fade down 1800 office?on 

To detect taps and gestures on a touch device

          touch enable detection

 

Categories: HomeAutomation | Tags: , , | Leave a comment

Prototype #1 of my smart light switch box

Putting the first prototype together

To prototype some ideas, I took an old lunchbox in the shape of a well known toy brick. I cut holes in the base and in some some studs from the lid. The base I stuck on the office wall over the light switch. In the lid of the prototype i put a camera with fish eye lens, a 8×8 led matrix, a PIR motion circuit all connected to a Raspberry Pi. Sliding the lunchbox lid onto the base and connecting a USB power line , my first smart lightswitch box prototype was ready for testing.

So far I have test software that from a pi command line via ssh can…

  • turn my hue lights on and off
  • detect motion in the room including when i am sitting at a desk
  • take fisheye pictures of the room

 

Next

Next on my todo list is a python script to act as logic to…

  • turn the office light on in the evening when there  is motion so i dont need to
  • fade off when there is period without motion to save electricity
  • blink the lights red to remind me to take a break when i am in front of the pc too long
  • possibly record a short snippet of video at the start of each detected motion ( ie when i enter the room )  so that i have a record of activity

I’ve also been prototyping some 3D printed objects for

  • Holding the camera, PIR,Matrix on the outside of the box
  • Mounting the Circuits and Pi inside the box

I hope to have the 2nd prototype ready at the start of July…

Categories: HomeAutomation | Tags: , , , , , , | Leave a comment

Smart lightswitches – Refined first goal

I have decided not to include audio  ( microphones or speakers ) in the smart lightswitches i am creating.

The lunchboxes i am using to house my first home automation project have limited space. From research it seems speakers and microphones of quality would require more space and power. Motion detectors and switches are suited to doorways but I will not be facing that way when giving voice commands. I expect to listen to music or issue voice commands when i am seated in my lounge or laying in bed.

I’m re-framing my first goal as “smart lightswitches”. I will create modular smart boxes positioned over the light switches at the entrances to various rooms.My goal is for the boxes to detect and record which room I am in. They will enable smart control of lights, to track activity and occupancy.

I hope to include in each unit

  • Fisheye NoIR Camera – to detect motion and light levels in each room – I am hoping to use a fish eye lens as wide coverage is more important than detail to me
  • IR LED (940nm)  – to send control pulses to tv and other devices , hopefully can also double as a IR light source when dark
  • Rotary switch with push switch – to provide dimmer like control and other function selection.
  • Adafruit 8×8 LED matrix (I2C) – to provide feedback of state etc

I still hope to add voice recognition and media playback to my home but I now expect to do that as a separate project as part of other units.

Categories: HomeAutomation | Tags: , | Leave a comment

Fritzing- Great tool for designing electonics

I found a tool called Fritzing,  It is a great tool which can help design and draw electronic circuits.

My initial thoughts and therefore untested plans are below. These Fritzing diagrams help give me an idea of what I need to purchase . They also provide a starting idea of how to assemble things. ( There was not a symbol for camera 🙁 )

Now I need to order some parts and stripboard…

Categories: HomeAutomation | Tags: , , | Leave a comment

The perfect box for DIY home automation

I began thinking about building a home automation box in each room with sensors because I wanted the house automated instead of just the lounge.  The boxes would communicate over wifi because I want to combine that sensor data. I realized an optimal place for such sensors is near the entrance to each room because they can detect entry/exit.

Separately i had been thinking about how to cover my light switches.  The switches always stay on because I have Philips hue bulbs.

I had a eureka moment and realized my new home automation could hide the light switches.  I noticed that i already had a box that almost was the right size I like it for obvious reasons because of my childhood love of building things.

I ordered more boxes from amazon in white because they will match the decor. I made some modifications with a Dremel and knife.  I’d already decided to have replaceable sensor/output modules because I want to evolve/replace modules over time. I cut holes in the box where i expected to locate the sensors, holes were the light switch plate would fit and holes for the power for a raspberry pi.

Categories: HomeAutomation | Tags: , | Leave a comment

Getting started with Raspberry Pi and SunFounder kit

I got started making things with raspberry pi boards this summer 2016. I had played with electronics kits as a child but gave it up because I did not have the patience. I took the plunge and ordered one from amazon along with a sunfounder kit with breadboard and assorted sensors.

I had read online and bought books about how to use a Raspberry Pi.

When the amazon package arrived, I downloaded jasper, copied it to a memory card and booted everything up. i felt a little underwhelmed by that first boot because it was so fast and easy that. So next i started playing with the sensors and the fun started. I experimented with an IR receiver and a utility called LIRC because I wanted to record the signals from my TV remote. Next I played with an IR transmitter circuit so that i could play the signals back to control my TV volume. I looked at the clock and the evening had vanished. This was fun.

Categories: HomeAutomation | Tags: , | Leave a comment

Home Automation Goal

I want to create a home automation system with the following

  • Control my philips hue lights and cover the switches which now have to stay on.
  • Detect and record motion in each room
  • Control my tv
  • Respond to voice commands

And because i am a programmer be…

  • Distributed
  • Scalable
  • Flexible

I explicitly do not aim to build a personal assistant. I have a mobile phone with android for that. I want a smart home. My home doesnt need to view my emails or access my finances. My home doesnt  need to view my browsing history. My home needs to do what it is told, take care of things when i am out and make my life simpler.

Categories: HomeAutomation | Tags: , | Leave a comment