Time lapse in new printer enclosure

surprised-rainbow-faceSo awhile back I came across an instructables article regarding using some ikea lack tables to make a 3dprinter enclosure…..

I love ikea….

So this was the project.  http://www.instructables.com/id/3d-Printer-Enclosure-from-Upcycled-Furniture/

I went to ikea.  Got 2 lack tables and put them together…. I want my printer higher up.  ELEVATE TO THE LEVEL OF THE GODS!!! no.  just high enough I can watch it cause I like to watch it go back and forth while I make printer noises.

So I ordered a 3rd table.  Put it on top.  Sweet.  Much better.  I moved the printer into the enclosure this weekend (no sides put on it yet) and decided I needed to get the lighting in place.  So I took some neopixel strips I had laying around and hooked them up to an arduino.

13694706_1455593267790887_1215760066_nOk, so that’s now how I am leaving it 🙂  but it did look cool.   Now I can set the colors.  Plain white for printing.  I am trying to figure out how in octoprint to get a hook in to detect when it’s heating up.  That way I can turn the lights orange or red to indicate heating phase.

 

 

So I did a timelapse and a vid.   The vid of the whole rig setup

Here is the timelapse test print

 

I am working more on trying to get some good photo and video in with these projects too.  If you like the videos give a thumbs up and a subscribe.

Is it hot in here? Home Automation AC addition

So my Super Villain lair is super secretly located in my converted garage… shhhh.

So we found out that Florida is a rough place to be a super villain.  It’s hot here.  So I needed a way to help keep my lair cool.  So many full moons ago my minions held a Staples store for ransom till they gave me an AC unit.
lx_140_set

 

This thing is huge.  It’s a 14000 BTU unit.  I have an exhaust vent that goes up through the ceiling and vents outside.  It is actually pretty good at cooling down my lair.  But it is another AC unit that can use up some power.  Since the Super-Wife is not a fan of paying giant power bills, I have to turn it off when I am not in the office.  This was one reason thy the remote was very handy.  But.  It’s 2016.  Hello!  Just a remote?  That’s it?  HA! Right!

I have worked on trying to automate this thing for awhile.  A while back I used the Arduino Infrared Library to read codes from the remote, and then blast them back out.  But it didn’t work… I thought maybe it was using revolving codes.  Nope.

As it turns out, HVAC units have a tendency with their remotes to not send simple codes like “On”, “Heat”, “Fan-High”, “Temp-Up”  as you might think.  TV’s and even some small wall mounts use basic NEC hex codes.  Not this monstrosity.  No no.  After working on this thing for weeks I found an article that spoke about maybe my buffer size for reading the code wasn’t large enough.  The current RecvBuff was set to 100.  I was filling up all 100 locations.

So I changed it in the IRRemoteInt.h file.  Set it WAY higher.  Turns out my remote was sending 228 pulses.

client-pulse

 

So I decided to try to decode some stuff.  Lets try changing the temp.  228 pulses and most of them are the same.  Turns out my HVAC remote sends FULL state code every time you push a button.  To test this theory.  I set my HVAC to 72 degrees.  Went into a different room with the remote, pressed temp up until I was at 74 degrees.  Back in the office, the display still says 72, remote says 74.  I press up, the HVAC screen jumps straight to 75.  Full state!!  So that’s good to know, but a pain in the ass as I would have to do some SERIOUS work to decode the blocks and find out what changes to what.  But I never really need to do anything other than turn it on and off.  So lets find something simple.

I now have the following arrays of values


unsigned int powerOn[227] = {3400,1700, 450,1250, 450,1300, 450,450, 400,450, 450,450, 450,1250, 450,450, 450,450, 400,1300, 450,1250, 450,450, 450,1250, 450,450, 450,450, 400,1300, 450,1250, 450,450, 450,1250, 450,1300, 450,450, 400,450, 450,1300, 400,450, 450,450, 450,1250, 450,450, 450,450, 400,450, 450,450, 450,450, 400,450, 450,450, 450,450, 450,450, 400,450, 450,450, 450,450, 400,450, 450,450, 450,450, 400,450, 450,450, 450,1250, 450,450, 450,450, 450,1250, 450,450, 450,450, 400,1300, 450,1250, 500,400, 450,450, 400,450, 450,450, 450,450, 450,400, 450,1300, 450,1250, 450,450, 450,1250, 450,450, 450,450, 400,450, 450,1300, 400,450, 450,450, 450,450, 450,1250, 450,1250, 450,1300, 400,500, 400,450, 450,450, 450,450, 400,450, 450,450, 450,450, 400,450, 450,450, 450,450, 450,400, 450,450, 450,450, 400,500, 400,450, 450,450, 450,450, 400,450, 450,450, 450,450, 450,400, 450,450, 450,450, 450,450, 400,450, 450,450, 450,450, 400,450, 450,450, 450,450, 400,450, 450,450, 450,450, 500,400, 400,1300, 450,1250, 450,1300, 400,1300, 450,1250, 450,1300, 400,1300, 450,1250, 500}; // UNKNOWN 3659AD56
unsigned int powerOff[227] = {3400,1700, 450,1250, 450,1300, 400,450, 450,450, 500,400, 450,1250, 450,450, 500,400, 400,1300, 450,1250, 450,450, 450,1250, 450,450, 450,450, 500,1200, 450,1250, 450,450, 450,1250, 450,1300, 400,450, 450,450, 450,1250, 450,450, 500,400, 500,1200, 450,450, 400,450, 450,450, 450,450, 450,450, 450,400, 450,450, 450,450, 400,450, 450,450, 450,450, 400,450, 450,450, 450,450, 400,450, 450,450, 450,450, 450,450, 400,450, 450,450, 450,1250, 450,450, 450,450, 400,1300, 450,1250, 450,450, 450,450, 450,400, 450,450, 450,450, 400,450, 450,1300, 450,1250, 450,450, 450,1250, 450,450, 450,450, 400,450, 450,1300, 400,450, 450,450, 450,450, 400,1300, 450,1250, 450,1300, 400,450, 450,450, 450,450, 450,450, 400,450, 450,450, 450,450, 400,450, 450,450, 450,450, 400,450, 450,450, 450,450, 400,500, 400,450, 450,450, 450,450, 400,450, 450,450, 450,450, 400,450, 450,450, 450,450, 400,450, 450,450, 450,450, 450,400, 450,500, 400,450, 450,450, 400,450, 450,450, 450,450, 400,450, 450,1300, 400,1300, 450,450, 450,1250, 450,1250, 450,1300, 400,1300, 450,1250, 450}; // UNKNOWN 6BF20402

243448-Don-t-Judge-Me.-I-Was-Born-To-Be-Awesome.-Not-PerfectWith those values set in my arduino code I can now turn my AC ON and OFF in my office.  Cool haha, get it?  cool?  Shut up.  Don’t judge me.

 

 

 

 

So I did that work, and that was the end of it.  I didn’t really do anything more with it.  I wanted to figure out a good way of interfacing to it.  Earlier this week I found the following article on the OpenHab community.

MQTT IR transmiter/receiver

This turned out to be just what I needed.   I didn’t even realize I needed this, but it made perfect sense.  In short, use a tiny esp8266 chip with an IR LED and MQTT.

You can get them even cheaper from China.

AliExpress.com Product – 2015 New version 1PCS ESP8266 serial WIFI model ESP-01 Authenticity Guaranteed,Internet of things $1.79 Each.

arduino_dust_sensor_ESP8266-1I had one already laying around…. but where the hell is that tiny bastard!?!?!?!

Like finding a needle in an electronic haystack.  But I found it.

 

 

Threw in the code, built a programming jig for it.  Programmed it and BOOM!!! MQTT messages turning on my AC.  Nice!!!

069But that’s not home automation genius!

I know!

I’m getting there.  Geeze!!! Some freaking people am I right?

So time to hook this up in OpenHab.  I already have an MQTT broker configure in OpenHab for my OwnTracks setup.  So we need an Item created first.  So I setup a new Items file called “HVAC.items”


Switch Office_ac "Office AC" {mqtt=">[mqtt-home:esp8266/02/sender/RAW:command:ON:ON],>[mqtt-home:esp8266/02/sender/RAW:command:OFF:OFF]"}

Next let’s add to the sitemap.


Switch item=Office_ac

f1afa6d8e96b6f69bb5c73776177af24Try to keep up, I know it’s crazy difficult with all those configs and what not..  I need a drink.

Sweet.  Now I have a simple on/off switch for my AC.

……still just a remote jackass.

Really..

 

Really…..

1234931504682 (1)

 

 

 

 

C’mon.  Can’t we be friends?

I mean, you can be pinkie pie.

FANMADE_Pinkie_Pie_and_Rarity_friends_forever

Ok cool.

So for the AUTOMATION part, (I’m not bitter), we create a new rules file.  HVAC.rules


rule "Turn On AC"
when
Time cron "0 17 15 * * ?"
then
Office_ac.sendCommand(ON)
end
rule "Turn off AC"
when
Time cron "0 30 22 * * ?"
then
Office_ac.sendCommand(OFF)
end

So now, each evening around the time I start my crazy battle with traffic home (see here), my AC in my office will turn on then turn off each evening at 10:30.

So where do I go from here?  Well, the next step is to use my previously mentioned OwnTracks setup to see precisely when I leave from work and if I pass through a location which indicates my trip home, it will turn on the AC.  This way, it doesn’t matter if I leave work early or late, my AC will know and have an hour to cool down the Lair before I get home.

 

baby-its-cold-outside-14192655214ng8k

 

 

 

 

 

 

 

 

Traffic (actual cars) Woes

So in the last 2 weeks I have been put to the test of patience and road rage.

giphy

Last week there was a guy that decided to take his dog for a walk on the over pass and decided to stop and contemplate jumping.  This closed down a 3 lane highway and the 2 joining lanes completely in morning rush hour.  Diverted traffic was diverted to a 1 lane exit.  I sat in traffic for 3.5 hours!!!! At that point I called the office and said “i’m working from home, it will take me hours to get there and 30 minutes to get home.”

That was pretty rough.

This past week was obviously not as bad.  But 4 out of 5 days this week my normally 45-50 minute commute was 90 minutes.

So normally I spend 4hrs 10min on the road commuting in the morning and roughly 5 hours in the evenings (traffic gets worse)

But this week was almost 7 hours in the morning and 5 in the evening.

12 hours……

I don’t think you heard…. 12 HOURS!!!!! Just driving!!! It’s stupid.

traffic-zzz

 

Man I could get a lot of work done driving a tesla!

 

 

 

So I had this dream this week, very strange I know, and some of the details I am omitting here because well… some of it was quite sexy…. but that’s not the part I am hiding.  There was another device in my dream that I have thought about making before and in my dream I had it done.  But it had a new feature…. it told me if my drive to work was going to be longer than usual……

I know I know.  “Just watch the news you jackass!”  I can hear you all saying that.  However I cut the cable many many many moons ago.  I don’t get the news.  Two.  Well, my past brain problems have led me to a life where I don’t watch the news often because the news is generally bad and I find myself a much happier well adjusted member of society if I don’t watch the news in the morning.  But I got side tracked.

So after the wife telling me
Untitled

I decided to look into this thing that my brain was hinting at.  So I spent some time looking for mapping/navigation api’s.  I found out that TomTom has one.  Pretty good to, you can tell it what kind of vehicle you have, and if you want traffic to be taken in to account and all kinds of stuff.  So I got an api key and started coding against it.  Pretty neat.  68747470733a2f2f646c2e64726f70626f7875736572636f6e74656e742e636f6d2f752f343034323534372f746f6d746f6d2e706e67

But then I found this.  This turned out to be pretty interesting by itself since I currently use a dashing dashboard for a few things internally.

I set it up for myself in dashing and it works nicely.  So we are close, but not quite what I am looking for.

So I decided to keep working, and thinking, and eating chips.

Wait.  No chips.  Just working and thinking.

I decided what I needed was 2 fold.

  1.  Traffic time must be in my Home Automation system so I can create rules based on the time.
  2. The times must be stored somewhere so I can get a new idea of “average” drive time.

I got it.  Create an item in Openhab.  Update said item periodically.  I already have openhab mysql persistance enabled.  This will work.  I will be able to run data reports based on time of day (aka MORNING during the week) and see what the average/no accident drive time is and over time even see how much time an accident add’s to my trip on average.

So now in my openhab I have the following ITEM configured in my home.items file.

Number WorkDriveTime "Drive Time [%s minutes]"

and in my home.sitemap file

 Text item=WorkDriveTime

I have a cronjob that runs every 5 minutes that just fires off a php file to get the tomtom info, convert seconds to minutes, round it off and update openhab.

My simple php file is here.


<?php
$string = file_get_contents("https://api.tomtom.com/routing/1/calculateRoute/28.3852,-81.5639:33.8121,-117.9190/json?routeType=fastest&traffic=true&travelMode=car&key=YOURAPIKEY");
$json = json_decode($string, true);


$DriveTime = round($json["routes"][0]["summary"]["travelTimeInSeconds"]/60);

if ($DriveTime != 0) {
sendOpenHabUpdate("WorkDriveTime",$DriveTime);
}


function sendOpenHabUpdate($item, $data) {
 $openhabserver = "http://192.168.2.90:8080/rest/items/" . $item;
$options = array(
'http' => array(
'header' => "Content-type: text/plain\r\n",
'method' => 'POST',
'content' => (string)$data,
),
);

$context = stream_context_create($options);
$result = file_get_contents($openhabserver, false, $context);

return $result;
}


So with this now running in my crontab I have my database slowly updating with drive times.

Oh. If you want to get a key for TomTom yourself just go to http://developer.tomtom.com/

So what do I have in store for this. Well, there is another value that comes back in this specifically related to “delay from traffic” so I may add this in as another number item to track. But the plan is to know before I leave the house if I should take a regular coffee or a giant coffee to get me through the morning commute. download

New Firewall Status!

So a couple weeks ago I wrote about the new firewall setup.

Quick update on the status of that.  I built it out.  Got it working.  yay!

294989But I want more cool stuff.  So I have a business class fiber line run to the house with 5 static IP’s.  So I decided to see if I could get pfsense to do failover router.  You know, because why not.  I tried to get pfsense to install on this old thin client I had.  No go.  WAY TOO OLD!!!

So I moved on.  I too my esxi box and with the second nic ran it to another small unused switch of mine.  I then configured esxi with a second virtual switch that uses that NIC on the new physical switch.  I know, I could do that with vlans.  Duh!  But I am waiting for a cable for my switch so I can configure said vlans.

vSphere ClientSo with this new physical port I was able to build a pfsense box in my virtual environment.  I configured it with dual nics, 1 in each switch.  As you can see here.   My routers are named voot1 and voot2.  Named after the voot runner from the show Invader Zim.   My main network scheme is based on characters and vehicles from this show.

So now I have a physical router configured with one of my public ip’s   x.x.x.253.  Internal its configure as x.x.x.2.  I then configured my CARP ips.  You create a virtual IP for both lan and wan.   External is x.x.x.250, internal is x.x.x.1.

pfsense - New Page (1)

Set the outbound nat to use the .250 address and we are golden.  Setup all the carp sync settings to push the settings to the backup pfsense.  This works BEAUTIFULLY.   I was so amazed as how easy it is.  I just make a change pretty much anywhere in the main router and its automatically sync’d to the backup.

Once the backup is sync’d it’s time to test.   Reboot the primary.  Network dropped and didn’t come back up until the primary fully booted…

stewiegriffin-familyguy

Ok.  I got it.  The arp change caused some problems with the esxi side.  There is a switch security feature that blocked it.  You have to set the switch to accept promiscuous mode….. $%^& I think my switch is a slut.samantha_jones_promiscuitypromiscuous

 

Ok.  So now that my switch is acknowledged as a slut, it works.  Reboot primary router and the backup comes online, takes over the gateway x.x.x.1 and the external x.x.x.250.  This is awesome for various servers that I have in different datacenters that have ip security configured.

So this all went great, but the original reason for the upgrade was my old hardware choked itself out with my ipsec tunnel to AJ doing the encryption/decryption.  So we need to get the tunnel back up.   We got some time over this weekend to get the tunnel working.  We now copy back and forth at 30mbps.  30!!!!!   Fully maxing my fiber line over a secured tunnel and my cpu was only at 25%.  WIN!!!

 

BUT!!!!!! We have this awesome failover working…. will the tunnel come up on the backup too?   *checks the backup router* well the ipsec tunnel config was sync’d.  So what happens if I reboot the primary now….

NO EFFING WAY!!!!!  My tunnel re-establishes to AJ on the backup router too!!! HAHAHAHA this is awesome.

So Aj had asked me about a raspberry pi project on friday called pi-hole.  From the website..

“The Pi-hole is an advertising-aware DNS server that prevents ads from being downloaded. Once installed, configure your router to have DHCP clients use the Pi as their DNS server and then any device that connects to your network will have ads blocked without any further configuration. Alternatively, you can manually set each device to use the Raspberry Pi as its DNS server.”

But it seems like something that screams virtual machine.  I didn’t want to tie up a raspberry pi just for dns.  Turns out pi-hole doesn’t require pi hardware.  So it is possible to put in a vm.  So I configure a tiny ubuntu server and install pi-hole.

curl -L install.pi-hole.net | bash

Very simple.  But it works.  So I build out the vm.  Export it as an ovf and ship it off to AJ over the new tunnel.  He brings it up in his virtual environment and gets it working on his end.  Now to update our respective DHCP servers to tell our networks to use the new adblocking dns.   But… what if it’s down.  Ads/banners coub-1137363

There is a tunnel…. use each others as a backup!!!  Beautiful.

No my pi-hole is the primary on my network, AJ’s is secondary, and if both are down for some reason the network defaults to google.  services_ DHCP server

How well does pi-hole work?  Why do I keep saying pi-hole?  It sounds dirty.

pi-hole pi-hole pi-hole pi-hole pi-hole pi-hole pi-hole pi-hole

Yep.  Still sounds dirty.  But I got distracted.

Pi-hole Admin Console

That is insane…. 1726 ad’s blocked today.  We were gone for 4 hours and it’s still that high.  Crazy.  But you should see some sites without their ad’s.   Interesting.

This week/weekend has been pretty cool for getting some network stuff done.

 

Some projects and upgrades

So I have a few things on order coming from china for some various projects.

I figured since I haven’t posted much lately I will post some pre-project dribble.

Phoenix Connectors – Aliexpress

phoenix connectors I have these coming to be able to connect audio up to my ClearOne XAP800.   ClearOne XAP-800 Professional Audio Conferencing System Pic 4 xap800_l

The XAP800 is going to be added to my Home Automation system to be able to control/mix/route audio from various sources to various destinations.  If you want to read more about what this can do check out my buddy here.

http://hazymat.co.uk/2015/04/multi-room-audio-options/

 

3d Printer Upgrades

Its funny.   The whole time I have had my printer I have been constantly wanting to upgrade.  Maybe because I built my printer from a kit and know each piece.  I look at upgrades thinking, this will help just a tiny bit more.  This will make it a tiny bit better.  But also, I enjoy these projects.  So I have what I can only hope are my last big round of updates.  Nevermind.  I just thought of one more.  Bowden extruder…. but that’s for another post.

Motor Coupler – Aliexpress
The motor coupler is going be to used to connect my 5mm drive shaft to my below 8mm threaded rods.

Lead Screws w/ Copper Nut – Aliexpress
Replacing my current threaded rods and nuts with some nice thick Lead screws and longer copper nuts should add some additional stability and durability in that I won’t have to replace the nuts regularly like I do now.

Aluminum Build Plate – Aliexpress
The aluminum build plate will replace my glass bed.   I have hard it does well for heat distribution but also I need it for the below proximity switch.

Induction Proximity Switch – Amazon
I am going to get rid of current auto level setup.   I am going to the inductive sensor so there is no longer going to be a swinging arm.  This will hopefully improve start up time, and keep better accuracy.

shoppingUT82quJXalbXXagOFbXSReprap-Prusa-i3-3D-printer-parts-Anodized-Aluminum-BUILD-PLATE-for-Heated-Bed-3D-Printer-RepRap.jpg_640x64061fxf9nPCFL._SL1100_

 

Random

20 555 Timers – Aliexpress
ne555I have these 555 timers coming because I plan to use them on a small solar charge controller project I need for my Green Sprinkler system Project.

 

100 Optocouplers – Aliexpress
111781498246_1A couple weeks back I designed and tested a small circuit that will detect when the 12v accessory line in my car is turned on and off.  Using these optocouplers I will be able to use this signal to either power on my raspberry pi in my car, or to tell it to turn off.  This is going to be useful so that the pi doesn’t turn off as soon as I get home, but will be signaled to turn off in about an hour.  This will give enough time for sync jobs to run, backups and any config changes I want to do.

So there it is.  Some of my up coming projects

  • Big Printer upgrade
  • Solar Charge Controller
  • CarPi Power circuit deally (i need a better name)
  • Green Sprinkler System
  • Home Automation Audio Router

juggling-businessman-image

This guys has his shit way more together than I do.  Look at him!  He’s wearing a suit….  I barely wear pants!!!!

 

 

 

 

 

 

OpenHab crashing with Z-Wave FIX IT FIX IT FIX IT FIX IT!!

So,  my openhab system periodically decides to leave the building.  Appears there is a problem from time to time when the z-wave binding loses communication to the z-wave stick it gets upset and tells openhab to take a hike.

This is bad.  Once because it exposed something I missed in my fault tolerance.   I had compensated for network issues and full machine failover.  But the actual process going belly up…. ooops.  My Bad.

Soooo I see it crash while at the gym today and the only thing in my head….

gSHIj

So I appear to have done that.

Let me bring you up to speed on the current state of my home automation.  After the great NAS failing of 2015 I was forced to reduce some of my virtual environment.   I have not brought my secondary HA controller back online yet.  However, it appears that still using keepalived I am able to help address this random problem.

I have added in a new option in my keepalived.conf

 


vrrp_script chk_hahealth {
    script "/usr/local/sbin/healthcheck.sh"
    interval 10 # check every 10 seconds
    fall 2 # require 2 failures for KO
    rise 2 # require 2 successes for OK
}

vrrp_instance VI_1 {
   state MASTER
   interface eth0
   virtual_router_id 220
   priority 150
   notify /usr/local/sbin/notify-keepalived.sh
   advert_int 1
   authentication {
        auth_type PASS
        auth_pass fakepass
   }

   virtual_ipaddress {
      192.168.2.90
   }
   track_script {
     chk_hahealth
   }
}

So what this does is add a keepalived health check.   Every 10 seconds keepalived runs the script /usr/local/sbin/healthcheck.sh and gets an exit code of 0 or 1.  0 if all is good.  1 if the world fell apart.

Environmental concept. Some images in montage provided by NASA (http://visibleearth.nasa.gov/)

The code for this script is


#!/bin/sh
SERVICE=openhab;

if ps ax | grep -v grep | grep $SERVICE &amp;gt; /dev/null
then
 echo "$SERVICE service running, everything is fine"
 /usr/bin/logger "$SERVICE service running, everything is fine"
 exit 0
else
 echo "$SERVICE is not running"
 /usr/bin/logger "$SERVICE is not running"
 /etc/init.d/openhab restart
 exit 1
fi


Explanation:

So this script just checks to see if the openhab process is running.  If its good, exit 0.  If its not, exit 1 but go ahead and try to restart openhab.  When keepalived gets the exit 1 code it keeps track of it.  You will see in the config that there is a fall 2 line.  That means that if there are 2 exit 1 status’s keepalived will go into a failed state.  When the second HA box is back online this will force openhab to move over to the other one.  However, I have not seen this happen so far as openhab loads pretty quick so since there is 10 seconds between the checks the second check comes back with an exit 0 and resets the fall count.