Wednesday, October 19, 2016

ESP8266 Gmail Send Email

Found this sweet Instructable http://www.instructables.com/id/ESP8266-GMail-Sender/ detailing how to cook up a Gmail Sender using the ESP8266. So I hooked it up with a temperature sensor and started testing sending notifications based on various temperatures.

Create a new Gmail Account


I created a new account because you have to enable less secure apps access on Gmail.
  1. Create your account and then go to Gmail. 
  2. Go to https://myaccount.google.com. 
  3. You should land on the settings for your new google account. 
  4. Click the Signing into Google Link
  5. Enable the Allow Less Secure Apps option at the bottom of the page.
  6. You google account should be all set

Update the Code


I had some trouble connecting the ESP to the Arduinio IDE at first. I followed several different tutorials online. There are some good detailed tutorials about how to add the board to the IDE and such. I think the final fix was a full reboot of my Desktop. It just magically started working. Perhaps I can cover that in a future blog post, but for now I am just going to assume you have your ESP working with the Arduino IDE.


  1. Go snag the original ZIP file from the Instructable link above or go here to snag a copy of the zip file.
  2. Open the Gsender.h in the Arduino IDE
  3. Near the top of the file you need to provide your new Gmail Login and Password in BASE64 format. Go to this website: https://www.base64encode.org/ and paste your login to convert it to BASE64 and then convert your password to BASE64
  4. Change the FROM address to your new Gmail address
  5. Save this file
So this project will read the temperature from a temperature sensor and then will send an email if the temperature is within a specific threshold. I modified the code on the original Instructable page to enable it to read the sensor and send the email. You may want to work with the original code from the Instructable before moving on. This will ensure the core functionality (wifi connecting and email sending) is working before moving on to sensor reading.
  1. Open the ESP8266_Gmail_Sender file in the Arduino IDE
  2. I have pasted my Sender file below. This file will connect to your WiFi and then will read a temperature sensor every 30 seconds. If the temperature falls within a defined threshold it will send an email.
  3. Save this file
  4. Compile and upload the sketch

Output and Email


If all goes well the sketch will upload and compile. You will start seeing temperature readings in the Serial Monitor output. You will also see a connection to Gmail if the temperature falls within your defined range.





Wednesday, August 17, 2016

GPX Heat Maps

I have been running a lot this year. I am currently training for the Kansas City Full Marathon. I was looking for a way to Heat Map my runs and I stumbled on the solution today.

Here is a sample Heat Map of my Downtown runs.



First you will need to get your files. I use the RunKeeper app to track my runs. RunKeeper allows you to download your run files in GPX format. The website I used to build the Heat Map allows you to use GPX and other files.



  1. Download your RunKeeper GPX files, or grab your files you want to import.
  2. Go to http://umap.openstreetmap.fr/en/
  3. Click Create a Map
  4. Click the Upload data, up arrow on the right side of the screen
  5. Browse to your GPX files, or whatever format you used.
  6. Click the map settings button, little gear on the right
  7. Click Default Properties
  8. Change the opacity to .4
  9. Change the weight to 5
  10. Click the Tile Layers button (little stack of paper)
  11. Choose the background you want to use.


Tuesday, August 16, 2016

ESP8266 GPIO Read

A while back I ordered two LoLin ESP8266 modules from eBay for super cheap. Off and on I was messing around with them trying to get them to work...with not much luck. I wasted a lot of time trying to get the ESP8266s to work with the Arduino IDE for some reason.

I finally wised up and pitched the Arduino IDE idea and started using the LuaLoader. The interface is a little cludgy and old looking but man this thing app works great.



Initial Setup

  1. Download and install the LuaLoader.
  2. Fire up LuaLoader.exe
  3. Plug in your ESP8266
  4. Click the settings menu in LuaLoader. You should see Open COMX on the setup menu. The LuaLoader automatically knows which COM port you are using.
  5. You should see a Connected Response and the COM section on the Top right should be green.
  6. In the Orange section you will see a spot for your wifi details...plug in  your WIFI information
  7. Click the Get IP button
  8. BOOM, you have an IP.

Lua Script


You are now ready to start your quest to learn the .lua language. Below is a sample script. This script will start up a web server on the ESP8266 and will present some HTML. The web page will allow you to interact with an LED. Each 10s button will increase the intensity of the LED. If you click OFF it will turn the LED OFF, if you click ON it will turn the LED on 100%. If you click BLINK it will blink the LED on and off.

You will also notice that we read the GPIO Pin to determine if the LED is on or off. This will come in handy as we start to incorporate some other sensors. We can start adding Relays, Temperature sensors, Motion detectors, etc.


  1. Connect an LED to a Ground Pin and the D1 Pin on your ESP8266
  2. Open your favorite text editor
  3. Paste this code into your text editor
  4. Modify the code as needed. You will notice I am using port 85, you can use whatever port you want. Also I am loading an image from my web server. You can change that to whatever you want as well.
  5. Save your script with the name init.lua.
  6. Open up the LuaLoader interface again
  7. Click the Upload File Button on the right side
  8. Browse to your init.lua file and click open
  9. LuaLoader will upload your file.
  10. Once the upload is complete click Dofile. 
  11. Hit the IP address with the Port you specified in a web browser. 
  12. You should be able to control your LED using the web page.


So if you call the lua file init.lua, the ESP8266 will load this file on boot. This is cool because now you can find an external power source (I've been using a spare ChromeCast power brick, anything 3.3V to 5V should work) and the ESP8266 will load your program on boot. Meaning you can plug this thing in anywhere it can hit WiFi and you can start interacting with it via the web.



Tuesday, June 7, 2016

Super Mega Baseball 2016 Sirloins Game 3

It is safe to say I now realize how much work this is. 30 something regular season games...sheesh what was I thinking. Oh well. I have played I think up to game 6 here is the Game 3 review.

Game 3 features a clash against the Moose. The Moose sent out their ace hurler Horstman. Horstman shutem down in the fist at what looked like a long day for the Sirloins batters.

Things changed quickly in the second when this happened.

  • Hammer steps in Bottom of the second singles to left
  • Royal follows up and crushes a 470 blast to dead center
  • Benny hits a towering shot off the top of the center field wall for a long single
  • Jake Pounders is the next batter...415 bomb to left center, no doubts.
  • Glovey hits a rope to center
  • Green Gras hits another blast off the top of the wall and checks in with an RBI Triple
  • Jack Longballo singles in Gras
  • Hammer coming up for second time and the Moose finally stop the bleeding down 6-0

Things get uglier in the Bottom of the 4th for Horstman as a string of hits adds another 3 runs to the score. The Sirloins have a commanding 9-0 lead.

The Sirloins tack on another in the bottom of 5th to go up 10-1. At this point Sirloins ace Blaze is crusing having only given up 1 run.

Bottom of 6th another big inning for the Sirloins

  • Jack smokes a laser shot to left 387ft with Green Gras aboard. 2run blast
  • Hammer follows with a single
  • Jake Poundes just misses a 2 run shot for out 3


The final nail in the coffin for Horstman's day was in the bottom of 7 after Blaze steps up. Blaze jacks a 375ft solo shot to left finally chasing Horstman from the game.

Vaughn comes in to close it down. Final 13-3.




Wednesday, June 1, 2016

Desk Workout Script Take 3

So the Toast Notifications did not work as I wanted. The notification would appear then disappear real quick sometimes and I would not even see the notification.

So I went back to make a large window show up every hour approach. I found a link on how to make custom forms in PowerShell and started tweaking it.


So every hour the script is running I am greeted with that amazing PowerShell Form. Here is the code:

My buddy Doug Challenged me to do some Overhead Bulgarian Squats so that is the exercise of the day. It is going to be a rough day.

Monday, May 23, 2016

Sizzlin Sirloins Game 2: Sirloins power past Herbisaurs for Win 2

After a close game 1 victory the Sirloins kept their winning ways in a matchup against the Herbisaurs in Game 2 of the 2016 season.

Casey Royal got the 2nd inning run explosion started with a leadoff double. Benny Rodriguez followed up with a single to right. In stepped Jake Pounders who pounded a 3-run 426 Foot blast to right field. Hole Camels bloops a single into right followed by a Willy Mays Hayes single.

Green Gras hits a double to right to make the score 4-0.

The Herbisaurs flashed some leather with a sweet 2 out snag at third by Henny Hampster.

Not to be outdown Hole Camels started a sweet double play in the bottom half of the second.  Camels showing his skill at the plate with a triple off the top of the wall in the 4th. Green Gras then hits a towering 2-Run 433 ft blast to center to make the score 6-0.

Hammer adds a RBI single in the 9th to increase the lead 8-2. Wild Thing Vaughn is called in to close it down. The Sirloins add another tick in the W column.







The 3 Stars of the Game




Sunday, May 22, 2016

Sizzlin Sirloins Game 1: Harry Butts tosses a gem

The Sizzling Sirloins are off to a hot start after their ace Harry Butts tosses an 8 inning 1 earned run gem to kick off the season with a 1 in the W column.



The Sirloins got on the board first in the bottom of the 2nd inning when Casey Royal leads off with a double. Followed by a Jake Pounders double to Center Field scoring Casey.

Opposing pitcher Jovita Pulo helped out his cause in the third scoring on a Casey Royal throwing error to tie the game. Harry Butts gets some help from his defense Green Gras knocks down a laser and makes the play. Hammer Longballo smokes a 436ft bomb to center to give the Sirloins the lead in the 6th frame.

Bottom of the 8th saw some more action as Hammer starts off the inning with a single. Casey Royal lines one off of Pulo and the runners are safe at first and second. Pulo may have been razzled a bit after taking the line drive from Royal because he throws a mistake to Benny Rodriguez and Benny makes him pay with a three run jack to center. 432ft titanic blast.

Wild Thing Vaughn comes in and gives up a few garbage runs but starts a double play to finish up the game.

The 3 starts of the game were Harry Butts, Benny Rodriguez and Hammer Longballo








Friday, May 20, 2016

Super Mega Baseball Season 1

Thought it would be fun to start a league on Super Mega Baseball and follow them like a beat reporter/sports reporting for a few weeks this summer. I will track the team's games and progress. I hope to have video highlights of games, player interviews, etc

I enlisted the help of some friends to name the team. I received several naming ideas and whittled them down to 18 players to fill the roster. It is my pleasure to prsent the 2016 Sizzlin Sirloins.

Batters


NamePositionNotes
Jack Longballo1BPart 1 of the Longballo Bros. Jack no where near the athlete of his bro Hammer but he can mash
Green Gras2BWirey second basement called up from the Triple A team in Cheboygan. Usually nervous and squirrely
Benny RodriguezSSMeteoric rise from the Sandlot to the Sizzling Sirloins Starting Short Stop.
Jake Pounders3BCompetes with Hammer to see who can crush the ball the farthest. Hates Green M&Ms
Casey RoyalLFAll American kid from Clarksville, TN. Country Strong can go deep effortlessly
Willy Mays HayesCF"Don't your guys go anywhere, I plan to put on a hitting display".
Hammer LongballoRFPart 2 of the Longballo Bros. Hammer is a 5 Tool player and with the Mojo to back it up.
Glovey McGlovefaceCBaseball is Glovey's second career. He runs a high power hedge fund in NYC. Sometimes he wears one of this Bluetooth ear pieces closing deals during the game.
Joltn Joe GarageiolaBenchOK Power, great contact. Ol Joltn Joe can give you a hit when you need it. Has some peculiar pregrame rituals.
Skweez BundtBenchShort Pop Fly power, can barely make contact but can field decently with a decent arm. No surprises what Skweez is up to when he is called in to hit.
Jacque StrapBenchWith a name like his you at least need confidence. 99 Mojo, dude is energetic to say the least. Locker next to Hammer, which Hammer complains about often.
Sabre MetricsBenchSpeed and Contact to deliver timely hits when needed. Calculates his BABIP in real time after each AB.

Pitchers


NamePositionNotes
Harry ButtsSPThe Ace. I guess its sorta my fault when I said Middle School Humor was acceptable, but hey should be a fun season talking about Harry Butts Pitching Dominance.
Hole CamelsSPDistance cousin is a starter for the Phillies. Junk ball pitcher with great accuracy. Ground ball machine.
Blaze N. KaysSPConvinced he can throw it past anyone. Off-speed stuff is sub par so he relys too much on the heat.
Ed HarrisRPOld Ed Harris limps out of the bullpen when skip needs him.
Ross N. BaggRPNo Heat, No Junk, Not much accuracy. Ross N. Bagg pretty much just sits in the bullpen working on closing hedge fund deals with Glovey McGloveface
Ricky VaughnCPWild thing Vaughn, straight from his playing days in the California Penal League. How did you get there, "Stole a car"

Skills
Below is a list of all the players attribute values.

Batters

NamePositionPowerContactSpeedFeildingArmMojo
Jack Longballo1B532219201074
Green Gras2B502147472555
Benny RodriguezSS372234284170
Jake Pounders3B631936243363
Casey RoyalLF603021281255
Willy Mays HayesCF56160324568
Hammer LongballoRF604858435367
Glovey McGlovefaceC531019384374
Joltn Joe GarageiolaBench305418152460
Skweez BundtBench182412424260
Jacque StrapBench60181262499
Sabre MetricsBench115360131270

Pitchers
NamePositionMojoVelocityJunkAccuracy
Harry ButtsSP73485845
Hole CamelsSP63445150
Blaze N. KaysSP54604051
Ed HarrisRP7314546
Ross N. BaggRP5531287
Ricky VaughnCP73601515

So there we have the opening day line ups. I will start the season with the EGO set at 40. The EGO is a measure of how difficult the game is. I played a pre-season game with an EGO set to 50 and was beat 9-4. Hopefully the 40 EGO will make the games nail-bitingly close. I will adjust the EGO as needed.

Tuesday, May 17, 2016

Desk Workout Powershell

I work in IT, which means I have the opportunity to sit for about 7-8 hours a day. I hate this. Therefore I try to run over my lunch break, I purchased a desk cycle to pedal while I am sitting, and recently I added another tool to my Battle the Sedentary work lifestyle toolbox: Weights.

Me and a buddy started doing some weight trainnig at the desk. We brought in a pair of 25 pound dumbbells and a pair of 10 pound dumbbells. Now we are doing some weight training at our desk by executing burnout sets (as many as you can lift) with various exercises.

A frequency of every hour was decided on meaning at the top of every hour we would complete a burnout set of an exercise in a round robin format. Of course some days you get head down in some work and sometimes may forget to execute your burnout set. Therefore we had a need to build some kind of notification system to remind us its time to workout.

Sample Desk Wrokout Toast Notification

Thus the DeskWorkout2.ps1 script was built. The first version would pop up an HTML file based on what exercise was up in the list. This worked ok for a while, but I was looking for an excuse to use Windows 10 Toast Notifications. So I started searching around for a solution.

Python


I quickly found a python solution that would create a Windows tosat notification. It is really straight forward and simple.



The original Desk Workout script was written in PowerShell so I searched for a PowerShell solution as well.

PowerShell


The PowerShell solution was created using the BurntToast Module available on Github. Since the original script was already created in PowerShell I went ahead with the PowerShell version. The Powershell Version allowed me to put a picture in there too, so that was cool.

I wrapped the Script with an hour of sleep. So now all I have to is remember to turn it on in the morning. I stored the various excercises in a local database and wrote a stored procedure to advance through the various workouts.



Friday, May 13, 2016

Flush Reminder 7000

Should be pretty self explanatory here. I have two sons at home and needless to say they have a hard time remembering to flush. Why not build a tech solution for it.

The Flush Reminder 7000 has a PIR motion sensor and a buzzer. It will sense motion and then will mark when the motion ends. If the measured time between start and ending motion is > 10 seconds the buzzer will play the Eye of Tiger tone to help them remember to flush the toilet.





The Code.


I am still tweaking the sensor position and some of the code, but it is working pretty good for a 30 minute Friday Night Arduino project. Video of the Flush Reminder 7000 in action.