Monthly Archives: July 2017

Smart fan project

BEWARE ! ! !

Sainsmart makes a “wireless” relay module, but IT IS NOT WIRELESS, you must connect a cat-5 connection to it to make it work then you can control it wirelessly from your phone, WHICH REALLY DOESN’T MAKE SENSE. If I have to run cat-5 to the relay anyway, why not just do it with the gpio wires? AND AND AND If you are using just one relay that is fine $31 dollars is cheaper than a Raspberry Pi, but if you want to add another relay, you have to buy another board, another $31!!! With a Raspberry Pi you can add 8 relay boards to 1 Raspberry Pi (1 X $35) if you use SainSmart’s board it would be (8 X $31 = $248!!!) for just the controller boards.

Not so wireless

So here is where I am at with the Smart Ceiling fan project.

This is what I am working with:

Original stock fan

Remove the blades, I won’t actually be using this one, but I will want to make sure that all 3 speeds work.

Before I show you the scary parts, here is what we will be replacing:

Pull string for lights

There are two brown wires that are connected to the power wires for the lights, two lights to each brown wire so you get no lights, 2 lights, or 4 lights on.

Pull string for the fan

I haven’t got to the lights yet, but here is what we are going for with the fan speed pull switch replacement:

Fan relay layout

The relay is obviously a little bigger than the pull switch so we will need to make the wires longer and run them out the top and put the relay in the ceiling when we are done.

Now for some scary pics:

Light switch compartment

Fan switch compartment

Here is the forward and reverse switch which we will leave manual for now:

The white wires in the middle are the common/ground, and it looks like they reverse the yellow and pink wires depending on which way the switch is to (reverse polarity?) to make it spin in a certain direction.

There is also this part which I plan on leaving alone:

And that is where I am at so far, here are some more pics for your viewing pleasure:

It works!

Ugly (at the moment) but functional.

Used a power cord from a power strip to power the fan.

Now the good part, let’s give this thing a brain.

New iPhone single button / wall switch app in the app store soon.

New iPhone Home automation app configuration screen

Settings

Click on Lights ON to turn on lights and reveal fan button:

Turn Fan or Light on and off from this screen.

If you leave the fan on and turn off the lights the fan will stay on for the timer length you set. If no timer is set both the lights and the fan will turn off together.

When the timer completes the screen goes back to:

Still working on the icon.

Fun with ds18b20 !

First,

Germany, France, and Brazil, welcome back from vacation! It’s been a while.

Well if you would have asked me which is more boring before this weekend Fun with Flags or Fun with ds18b20, I would have called it a toss up, but now the ds18b20 might have it beat!

Luckily, I freed up some Raspberry Pi’s last weekend by combining all my connections in my garage onto one Raspberry Pi. (add more 5v pins to your Raspberry Pi)

and I had all these laying around, so I started wiring these up to 3 unused Raspberry Pi’s and put them around the house. I already had the one setup downstairs, I added another one upstairs by where the thermostat was, another in a bedroom that seemed to be rather cold or hot depending on what season it was, and a final one outside.

And the thing that just might make the ds18b20 so great is it might actually end up saving me money.

Oh, and I also made an app that I could run on an Android phone that would ping the Raspberry Pi’s for a temperature reading every half hour and text it to me. That way the Raspberry Pi would also be free to answer requests from another app that can ping for a temperature reading whenever I want it.

So during the day I would get readings from the various locations, and once the heat of the day started kicking in I noticed the bedroom temperature heating up, so I thought I would kick on a fan (I can remotely turn on a floor fan or the ceiling fan) first I tried the ceiling fan, waited a few minutes, and pinged the temperature again. The temperature went up 2 degrees rather quickly. I thought to myself, ok the ceiling fan is probably blowing the hot air down and over the sensor, I’ll give it a few minutes.(oh I was doing all this while I wasn’t at home by the way). Pinged the temperature again about 20 minutes later and the temperature was about the same. Crazy! I have heard of fans actually making the temperature hotter, but I had never seen it, maybe felt it, but seen it with my own eyes. Let’s try the floor fan, pretty much the same result, maybe a little worse since it set’s lower. Oh yeah, it’s summer, supposed to switch the fan direction, when I got home, I did that and not much difference really. Ok, maybe it’s just the location of the room, we’ll see what happens when the sun goes down.

That’s when things got REALLY CRAZY!

It was now 79 degrees outside and 80 in the bedroom. Time to turn on some fans, this room over hangs the foundation by a couple feet, and I just know there is some place I need to caulk or fill to keep the weather from leaking in from the outside. . . . NOPE!

I turned on the fans and it actually got hotter! 82 degrees and it was 79 outside. Well that pretty much removed the idea that the hot air was coming from outside. The only place hot air could be coming from is the attic. So now I know to focus on the insulation in the attic or the air flow in the attic all from using a $2.50 sensor.(and a Raspberry Pi, but that as you can see has MANY uses) Unlike a $250 (no I didn’t forget the decimal point!) Nest Thermostat. And you can make a Nest from the same $2.50 sensor.

Anyway that was this weekend, we also bought a new ceiling fan, so now I get to turn the old one into a Smart Ceiling fan, should have some pics to post tomorrow. And should cost WAY less than the $350 (ON SALE) hunter fan.

While we were looking at the fans, of course I saw the kit that let’s your retro-fit you current ceiling fan into a remote controlled fan for $50, of course you have to use their proprietary remote (add one more to the pile!, more batteries, etc….) So once I get the hardware figured out, I’ll have a new app to work on.

The single button remote apps are almost done, working on the timer function for the iOS app, the Android app I should probably go ahead and put out tonight.

Update: the iOS timer works like it should, just need to add the timer length slider bar to the user interface and I should be done.

Pretty much got the user interface timer slider working, it just forget’s it’s saved setting if you go in to view your settings but don’t touch the slider and click save. Must be a timing thing, my garage door app doesn’t do this, so I will have to take a look at it’s code.

Not a timing thing, bool flags are MAGIC!, WE ARE READY TO GO!

Oh, have to jump into the left brain and make an icon.

60 Countries ! ! !

Welcome Switzerland!, thanks for buying my watch app, hope you enjoy it. Like I’ve said before, it really works well from bed. But the true MAGIC is when you use it with the cloud, you can do anything from anywhere with a 42mm watch!

Also Croatia is getting a blue pin!

Thank you U.K. keeping a strong 5th place.

And Saudi Arabia, starting to see you regularly.

Germany, France, and Brazil, welcome back from vacation! It’s been a while.

Honorable mention: Russia and Netherlands, thank you.

60 Countries

I have some more apps I will be releasing in the next couple of weeks. The apps out there already, pretty much do it all, but I will release a couple that make it easier to operate without so much concentration. Apps that you would use on your night stand when you are half a sleep, or entering a room where you can quickly turn on the lights without aiming for a certain spot on the screen.

Now these won’t be free, sorry, if you want free you will have to download the apps that do it all, OH DARN!

ANDROID APP

The entire screen will be one button, you could use this to replace light switches on the wall if you have some old devices laying around.

You could also use it on your night stand for your bedroom light and a fan.

The main screen is just one button so you don’t accidentally click on the wrong button, then once you click on that button a second button can appear (you can configure this to happen or not happen) this would also be good for a wall switch so you could reach around without looking and tap the on button.

If you used it for a bathroom wall switch you could use the second button as a fan button. I also allow you to configure a timer to the fan button so that if you click the turn off light button the fan will remain on for the timer length you configure or you can turn off the fan and then the light, or you can leave the timer length set to 0 and both will turn off instantly when you click the lights off button.

You can have two buttons or not, and can set a fan timer or not, it also supports relay’s configured as always on.

iOS version:

I am also going to give the option to remove the configuration menu once it is configured. Because that will be the first thing anyone under the age of 5 finds first. If you remove it, the configuration will be permanent, unless you re-install.

I should be able to add timer functionality for the iOS version, but the device will need to stay on for anything over 3 minutes, Apple only lets things run in the background for around 3 minutes.

Also working on a full-time 2 button remote for iOS:

I really like vibration for positive feedback to let you know it understood your command, but I noticed at night if you have it setting on the nightstand the vibration could wake up the whole house, so I give you the option to turn that off. So many reasons why Alexa will not work.

Thank you France and U.K. for dropping a line!

I probably have just about as much time as you do if you have any improvements or issues you want to try to take care of.

I am not bi-lingual (I know enough German to make someone’s eyes roll) but I have been in computer support for awhile so I’m pretty good with broken english.

A special thanks to the U.K. for stoking my ego . . . (I was trying to tone him down a little)

So let’s get going . . .

If you have a Apple store near you be sure and try and make a visit!

TechCrunch – Apple unveils smart home experiences in its retail stores worldwide

. . . and while you are there, we will just skip to the end, go ahead and download my app. (Now this is TRUE gorilla advertising!)

Now for the middle part we skipped, write down or take a picture of all the prices for things like the Hue light bulbs, DON’T FORGET THE HUB! can’t do squat without the hub! And some outlets.

Then come to this post and let’s compare prices!

I’m going to go straight to the worse case scenario.

So in my basement I have 6 bulbs controlled by a Raspberry Pi and a single relay, I already own the bulbs so I don’t have to buy them to make them smart.

1 Channel 5v relay – $1.17 (I get mine from a local store, have not bought from this site, buy from who you trust)

Raspberry Pi – $36.98

16GB Memory – $7.99

Power Cord – $7.89 (free if you have a Android charging cable laying around)

Wires to connect the relay to the Raspberry Pi – $3.95

Enough cat 5 to get from the Raspberry Pi to the relay – $0.99 (if you buy one with connector ends you will just be cutting them off, but get whatever you want to pay for, if you are going to do your whole house, just get a box of cat 5)

My App – free.

Total: $58.97 (Man, that makes me laugh! wait till you see the price of the Hue Hub)

Stuff you will find at the Apple store:

Hue lights starter kit – $64.99 (not too bad, more than the whole project doing it my way, but not bad, you are essentially getting one bulb for free)

But we are not done! That get’s you two bulbs, we need 4 more, time for some PAIN!

Hue bulb 3 pack – $39.97!

Keeeeeep going!

I guess you have to get 2 more, you better find some place to use it! – $29.99

There app: free.

Total: $134.95! ( I can barely type right now . . . )

CONGRAGULATIONS! YOU HAVE STARTED ON YOUR NEW SMART HOME!

So that’s JUST YOUR LIGHTS, some of your lights, no outlets yet (gonna need another hub!)

but first, that only did one side of my basement, what about the other side?

Again 6 more bulbs.

My way:

Raspberry Pi – already have (free)
Power cord – already have (free)
Bulbs – already have (free)

1 Channel 5v relay – $1.17 (I get mine from a local store, have not bought from this site, buy from who you trust)

Wires to connect relay to Raspberry Pi – already have (free)

Enough cat 5 to get from the Raspberry Pi to the relay – $0.99 (if you buy one with connector ends you will just be cutting them off, but get whatever you want to pay for, if you are going to do your whole house, just get a box of cat 5)

First total my way: $58.97
Second total my way: $ 2.16
Grand Total: $61.13 – almost up to the STARTER KIT!

UPGRADE THEIR WAY:

I ONLY! need 5 bulbs (had one extra)

Hue bulb 3 pack – $39.97!

I guess you have to get 2 more, you better find some place to use it! – $29.99

First total their way: $134.95
Second total their way: $ 69.96
Grand Total: $204.91 – getting close to a car payment here!

Oh, and I don’t ever want to blow that much money on light bulbs, so I’m not for sure, but I’m guessing since they are all individual bulbs you are going to have to set them all up and connect them together so they all come on with one click.

Doing it my way you are connecting to them at the switch so you set up one gpio pin number and it turns on all the lights automatically.

We’ll stop here for now, I want to show you what would happen if you want to add outlets to the mix, but their way will have multiple options, you will still have to buy another hub, be it an echo or a proprietary hub and then a single outlet, the outlet itself will cost almost as much as a Raspberry Pi and that only gets you 1 outlet.

My way you can use the Raspberry Pi that you have, but you need to buy a powered 5v usb hub, a relay and cat 5, less than the price of 1 of their outlets.

China Alexa Amazon Echo speaks Mandarin

500 downloads! O’Canada!, my mistake, it also could have been Mexico, or India, or Germany, THANK YOU ALL!

U.S.A. – 131, Germany – 64, France – 44, India – 28, U.K. – 26

(58 countries total, 6 Continents, Still waiting Antartica!, I will send you a Raspberry Pi, E-MAIL ME!). (4 makes me smile)

Thank you, Netherlands and China.

USA came back on the 4th of July, Mexico again!, and Turkey, hopefully the pictures below are a litter easier to help you make it through the process.

BUY THIS NOW! ACTUALLY WORKS, LONG

Go here

Select Raspbian

Download this

Wait til done

Unzip image using 7zip

Select downloaded zip file

Extract it

let finish

when you have a .img file

Use disk imager on windows machine

write image to micro sd card

when write is complete, eject micro sd card from PC and put in Raspberry Pi

Open terminal app

Update Raspbian

Upgrade Raspbian

Upgrade can take a while, so watch some TV or do something else for a half hour.

Install Apache Server

Install PHP

Open file to set permissions

Scroll to end of file and add permission line

ctrl-o to save
ctrl-x to exit

Install GIT:

Install GIT

Make a GIT directory in /home/pi (you should already be there)

Go into GIT directory:

GIT directory

Get my files from GIT:

Get my files from GIT

Go into new directory with my files:

Home-Automation-Production

Enter into dangerous admin mode:

sudo su

Copy PHP files:

cp *.php /var/www/html

Copy Python files:

cp *.py /home/pi

EXIT OUT OF ADMIN MODE!

exit

DONE! You can make sure the files are where they need to be if you want:

file check

PHP files

Added my weekend project to the Projects Page

Free iPhone App

Free Android App