Category Archives: Robotics

Upgrading The Thermostat Bot

The temperature bot a.k.a. the algorithm that controls the temperature in my house underwent a slight upgrade this week.

thermostatbot

The old algorithm:

If (setTemperature > averageHouseTemperature) HEAT, otherwise COOL.

Simple right? Not so much.

Scenario 1:

Let’s say I set the temperature to 70, and it’s currently 71 in the house. According to the bot, the AC would go on, this would be fine if it was 80 degrees outside but not if it’s 55. I’d rather just open the windows, and furthermore, I want it to just stay off until I close the windows.

Scenario 2:

Let’s say I set the temperature to 72, and it’s currently 70 in the house. According to the Bot, the HEAT would go on, this would be fine if it was 55 degrees outside, but not if it’s 80. I’d rather just let it heat up naturally, then if it gets above 72, I want it the AC to come on.

Let’s look at these scenarios in more detail.

In Scenario 1, the set temp is LOWER than the average house temperature, rather than the AC turning on, I want to open the windows and I want the HEAT/AC to stay OFF.

In Scenario 2, the set temp is HIGHER than the average house temperature, rather than the HEAT turning on, I want the house to just heat up naturally but I want AC to kick on if it gets too HOT.

The new LOGIC.

return (outdoorTemp < 62 || outdoorTemp < 67 && setTemp > indoorTemp) 
   ? 'heat' : 'cool';

The final piece of the puzzle is I need to call this on an interval since the indoor and outdoor temperature will fluctuate throughout the day.

(Updated 4/18/2018)

Openzwave Binary Sensors

I’ve been struggling a bit with openzwave items because its so poorly documented. I’ve finally figured out how to get results from a door sensors with the node package node-openzwave-shared.

If you follow the install script, then just add this event handler below, you can receive updates.

zwave.on('node event', function(nodeid, nodeEvt) {
 console.log(new Date(), 'node event', nodeid, nodeEvt);
});

More live examples coming soon here: https://github.com/scottpreston/node-openzwave-examples

And via npm via npm-install node-openzwave-examples

I Created A Book Page!

I decided to create a separate page for my books because I’ve started thinking about expanding the kinds of books I’m writing to include more than just books about robotics.

Currently the books you will find on this page are just my robotics books, which have more detail at my Scott’sBots website, in the near future I’ll have a few more.

Stay Tuned!

New Book – Robotics Programming 101

I have self published my first book Robotics Programming 101.  For this book I used CreateSpace for the soft cover and Kindle Direct Publishing for the Kindle version.

All in all it was a good experience. I had more issues with formatting than I did writing the actual code and copy for the book. I was able to hire an editor and illustrator on oDesk to help with editing and cover art.

Now hopefully I can just sell a few issues to pay for the production cost!

Scott’s Bots – Back to custom code.

I enjoy WordPress for ScottPreston.Com, but for Scott’s Bots.Com, I’ve decided to go with my own custom version of the web site.

The reason is that I wanted to do too many things with the site and was forced to look for so many so-so plug-ins. So rather than do that I just coded what I needed and so far so good, it actually give’s me some practice with my PHP skills, which I enjoy.

How To Hack A Servo

I’ve put together this video showing you how to hack a servo. It’s great for those that want to buy an in-expensive standard servo and convert it to a continuous rotation servo. For more video’s like this, go to www.roboticsed.com.