Bike generator for 18650 battery packs – Part 1

Part 2 of the Bike generator for the 18650 battery packs. In this one we build the mounting frame for the treadmill motor, 3dprint an axle connecting sleeve and do some tests with the multimeter to see what kind of voltage we can!. Getting closer to starting to record power generation data to the home automation system!

 

 

Bike generator for 18650 battery packs – Part 1

Welcome to part 1 of the bike generator build.

This build will add a pedal powered bike generator to help charge my 18650 battery packs. This will be in additional to the small solar panel currently in use.

The charge controller and statistics will be build on an arduino controller and tied in to my openhab home automation system for tracking and graphing.

The controller will connect wirelessly using mysensors and an nrf24l01 radio.

 

Good Vibes!!!

So… I have a “friend” that asked if I could help with something.

 

She had something called an OhMiBod.  It’s a …. um… it’s a vibrator.

HAHAHAHA

Super mature.  Anyway.  She has this thing called an OhMiBod Club Vibe.  It’s supposed to vibrate to your music  Looks like this.

HAHAHAHAHAHA

Pervert

Dude really?  ANYWAY!

So apparently she prefers to crank her music from her phone to said vibe.  But apparently this thing is when you crank the volume, the primary function of this thing (vibrating to the music) all but disappears and it’s just “on.”  So I was asked to fix it.

I bet you fixed it.  Haha

Don’t you have somewhere to be?

So.  I decided to see if I could knock back the levels on the audio.  I remembered a tutorial I saw once on how to make an attenuator for video to create a safety track on one of the channels.

Really?  Safety Dance?

So I built out a quick little voltage divider.  Started with a 150 ohm and a 1k ohm.  It helped but it got better once I went down to a 150 ohm and a 220 ohm.

Hehe

*sigh*

So I tested everything out using the breadboard and alligator clips.

Nipple clips..

DUDE!

So now it’s time to tighten everything up

….

NO!  Before this guy completely implodes here.

I took a dead marker out of the craft bin and cut it apart.  Put a piece on each side of the attenuator and soldered it up and have a male and a female 3.5mm jack on each side.

Shut it…

 

 

 

 

 

 

 

 

 

 

 

Once it was all soldered up, I hot glued the pieces together and wrapped some tape around the one end to give the shrink wrap something to hold on to.

 

 

 

 

 

 

 

 

Now lets throw some shrink tube on it and make it nice and neat.

So I gave it to her and from what I “hear” it’s getting the job done.

And I’m the perv… 

So in all seriousness.  This was actually interesting.  I have never hacked part of someone’s sex life before but this was interesting.  Not my normal stuff, but hey, glad I could help.

You lended a helping hand..

I’m done.

PS.  Is a hackgasm a thing?

Progress on the green sprinkler system project!

I have made some progress on the green sprinkler system project.   I even shot some video recently!!!

 

Here is some testing of the water quality…. WHO PEED IN MY BARREL!!

 

Now for the big update!!! Built a battery from recycled 18650 laptop cells.  Hooked it to my pump.  Drained my rain barrel!!  Then charged the battery back up via solar!!!

Man I am feeling kind of green!

Like this guy?

Oh and I am the one that peed in your barrel

Oh %^&* you’re back too huh.

You do realize I am you, you are me right?

Man I had a long night last night.  Don’t do that deep %^&* on me.

Ok Ok.  Check out his (my video)

Rain Barrel Growth Check!

My last barrel was the white kind and it did not do well at keeping light out so there was a swamp monster in it when I checked it.  Glad I wasn’t using it for anything, that water was gross.

 

I switched over to these blue barrel’s in hopes it would be better.

Got a cool endoscope camera from amazon

Amazon

With this camera I figured…. where can i put this….

STOP THAT!!!!

 

 

 

 

Check out my youtube channel for other project videos!!

Cranky Coder Youtube

 

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.

OpenHab Wall Switch

So recently I started thinking about my HA system when I have guests.  I have a small house (not a tiny house) just a small house.  When my parents visit they setup camp in the living room.

vYtvpWpWorking on getting PIR motion sensors to turn things on and off.  But with guests, I need a guest mode to disable the motion sensor…. and not because I tend to dance in front of the motion sensors.

 

 

89b1c00006954836a703dfc0457c8626But with the motion sensors disabled.  There still needs to be a way for the folks to control the lights.  So I started thinking.

What I came up with was physical buttons, pass something to mqtt, then to openhab.  Openhab rule to control “group” of lights aka living room.

So time to start proto typing some things.  First I wanted to see if I could somehow make it work without putting holes in the wall.   WAF = 10 on that one.

2016-06-12 17.31.52So I started by 3d printing a light switch blank panel.  It’s a rough print, but needed to see if I could make it deep enough to put some triple A batteries to run it.

Once I tested some depth I was happy.

Frank-GrimesNext to build build some electronics.

 

So I broke out the good old arduino uno.  This is my go to for initial builds even though I usually end up with a pro mini in the end.  The uno is a great test bed.

So it started out with Uno + Ethernet Sheild + 2 buttons.

2016-06-12 12.53.39-2

 

I ended up adding just a notifcation LED just so I know once it’s connected to MQTT since I am not watching via serial monitor now.   2016-06-12 17.34.42So what does this get us now?  Well.  It boots up.  You press one button, all the lights in the living room turn on.  Press the other and they turn off.  I know what you’re thinking.  So what?

One of the lights is a phillip hue light.  The other is controlled via z-wave.  So how did I do this.  Lets start with the item definitions in openhab.

//Group Definition
Group gLivingRoomLights

//Items
Switch Switch_LivingRoomStandingLight "Living Room Light"     <light> (gLivingRoomLights,gDashboard) { zwave="2:command=switch_binary" }
Switch LivingRoomTableLight   "Living bulb" (gLivingRoomLights,Switching) {hue="1"}

//Dummy ITEM that is set via mqtt
Switch LivingRoomLights "Living Room Lights" {mqtt="<[mqtt:switches/livingroomlights:state:default]"}

So in my items file, I have the 2 light items and a dummy switch.  Notice the 2 light items are in the “gLivingRoomLights” group.  This is important.

Now for the rules.


rule "Living Room Lights"

when
Item LivingRoomLights changed
then
if(LivingRoomLights.state==ON)
{
gLivingRoomLights.sendCommand(ON)
logInfo("All Living Room Lights","ON")
}
else
{
logInfo("All Living Room Lights","OFF")
gLivingRoomLights.sendCommand(OFF)
//off
}
end

So this rule is triggered when the Dummy Switch (LivingRoomLights) changes.  If the state was changed to ON then i send the “ON” command to the entire group.  Same for when I turn it off.  So to test it I used mqtt-spy and manually did it.  All is working.

k16232506

What’s next is I am going to work on shrinking said project down to using an arduino pro mini, 2 AAA batteries.  For the network transmission I am back and forth between 2 options.

  1.  esp8266 – using the esp is great, but it’s not very forgiving on power.   I know there are deep sleep modes, but they aren’t really good for what I need with multiple buttons.
  2. nrf24l01 – RF modules.  These little suckers are really easy on the power.  If I use these I have to build a rf->ethernet bridge.  But with these I think the power consumption is much simpler.

Either option I go with, I can use a pro mini and have 2 interrupts I can attach to buttons.

Down the road if I need more buttons, I can use a pro micro and get something like 14 interrupts and still be able to use deep sleep.

iphone-battery-iconIf I wanted to cut holes in the wall and run cable I wouldn’t be as concerned with the battery levels.

 

 

 

Want to see it being tested?

 

 

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.