Monday, March 19, 2018

My Smart Sprinkler System Part 1.


Introduction
You might be aware that I have been frustrated about forgetting to switch off appliances before leaving home. I guess its a sign of old age, my forgetfulness is becoming fairly pronounced. but instead of grumbling, as a technological determinist, I decided to create a smart home.

I have been tinkering with microcontrollers for some years, but creating a smart home got me jumping into the deep end of Internet of Things IOT. I have short listed several projects that I will need to create to have a smart home, and you can find them from looking through my blog for IOT and my smart home. here -

As you can see I have a whole lot of projects to keep me busy for a long long time. but not to worry, they are all simple modular systems that latch unto each other to create a smart system. I usual, I will share them here with you. you can follow the steps and recreate them for yourself if you have the basic skills of soldiering and following simple instructions. I will also share Gerber files, circuit diagrams and a whole lot of information to help you build these systems on your own.

To Sprinkle Or not to Sprinkle
for today, I will focus on the plants in my compound. I want to be able to automatically water the lawn, plants around the compound at preset times every single day of the year without much manual intervention. Yes one can easily buy a working water sprinkler of the shelve in any hardware store. but there is no fun in that. Plus, we can build a smarter system that takes cognizant of the weather to decided if it should give the plants their usual dose of water, or not water at all if it has rained in the last 24 hours.



The making of the Project Circuit Boards PCB
Examples abound on the internet on how to create a PCB.

1. Transfer a circuit trace from a Laser Printer to a paper and unto a PCB board.
2. Rule traces manually by hand.

feel free to look them up and choose which one to use. but there are basically only two methods open to you, One, to carefully draw it with your hand using a permanent maker like a fine point sharpie, or two, to use a purpose built application to design the circuit and print it out using a Laser printer (not a bubble jet ink based printer).

1. Manual Trace
I typically use the manual tracing method only when the design is simple or I don't have access to a Laser Printer and time is of the essence. Though this would typically give a rough amateurish outcome, but as usual, I put a little method to the madness. As expected, this manual process, though fast, creates a not so professional outcome. but there are a whole lot of lessons to learn from this method, so I will show you how to make a PCB using the manual writing method.

1st step is to clean the PCB with steel wool and use 4 pins to sandwich the dotted project board, the two sided board against a piece of paper.




I usually pull out a dotted project PCB as a guide to help me mark the necessary points from studying my circuit on the bread board, I experiment with where each component will fit by placing them on the paper, punching a tiny hole through the doted project board.

 At the end I get a fair idea of where things would end up and I rule the lines on the paper.


I then manually rule the necessary traces with a sharpie (permanent marker). If I make mistakes, I wipe them off with cotton wool dipped in acetone and touchup with a fine tipped sharpie or any permanent marker after it dries.



These markings are actually thin plastic traces protecting the copper upon which they are written. the protection prevents corrosion by the chemicals when dropped in an etching bathe. Spend all the time you need reviewing the traces, make sure there are not shorts and that each pad connects to a matching hole that way when drilled the components will easily fall in place. this is particularly important if they are surface mounted components - I avoid  them cos they are very difficult to solder, but they are cheaper and also small, ideal for compact designs.

If you are able to follw these steps you will have something similar to the image above and ready for the next phase - etching the copper plate in an acid bathe. I will show you just how in another article. until then cheers.


Thursday, March 1, 2018

Internet Of Things IOT

Hello Thinkers, Its been quite a while since I hooked up, but believe me, I have been very busy doing so many many things. I can only sum them up as my deep dive into the rave of the moment - Internet of Things (IoT). We have all had our share of that sad moment after driving hours into town only to realize that you didn't switch off the air conditioner at home. Or perhaps, there was no power when you left, but you know you left several appliances running before the power cut - meaning that you will be running (wasting) energy with no one around to enjoy them. In the 3rd world where these are scares resources, no body wants anything to go to waste. It could be anything;-

you forgot to close the garage door. you forgot to switch the generator to manual to prevent it from kicking in when there is a power cut. You forgot to switch off the TV, Fan, AC, etc. depending on where you are, your problem might be different.

The Problem
My problem was how to create a smart home, that allows me the freedom of switching these things off even after I have left home. Yes! without coming home, or calling in the neighbors. Literally from anywhere I am in the world. My plan is to create a smart home, capable of doing the following;-
  1. Open & Close the gate (electric gate already exist)
  2. Arm Electric fence
  3. Let the Dogs out of their kennel 
  4. Monitor the weather to ascertain steps to take for air-conditioning, watering plants, letting out dogs, switching on lights, notifying the pool maintenance guy,
  5. Switch off / on several equipment's
    1. Generator
    2. Air Conditioners
    3. Fence / Outside Lights
    4. Borehole pump
    5. Swimming pool pump
    6. Swimming pool lights
  6. Monitor the battery level of the inverter
  7. Monitor the temperature of the deep freezer
  8. Water the lawn and the plants at home
  9. Monitor the security alarm
  10. Track motion after hours
  11. etc.
As expected, I had to do some research, and I found several projects I could latch unto - one of the is My Sensors Project. MySensors is an open source hardware and software community focusing on do-it-yourself home automation and Internet of Things IOT. They provide easy to follow build instructions, ready to use code examples and adaptable open source hardware designs. All of this runs on the MySensors software library for secure communication that has been battle-tested with more than 20 of the leading home automation controllers on the market.


MyController?
Controllers as the name suggests are the brain behind an IOT architecture. The controller is the unit like a CPU is to a computer, that does the processing of data fed in by sensors like temperature sensor on a node circuit tucked away somewhere in the compound. The controller uses this data to make rule based decisions (as created by me) to set switches on or off as desired. For example, I could use the rain gage data that shows that it rained today to tell the water sprinkler not to come on as scheduled every 4:00pm. In addition, the controller can tell, the node that controls the fence light to come on as soon as it gets dark, this could be set at a specific time, or just based on day light, the latter being the preferred as it will switch on the lights both in summer or winter when day light is delays or even during a storm when it could get dark even at noon.

My choice of controller was stressful. I was looking for a neat easy to use (and understand) controller with an active community to help when I get stock. I settled on MyController another open source project by JKandasa. The system is based on pure java (back end) and angularJS (front end) it can run it in any platform supporting Java SE 1.8. I liked its look and feel. and as expected JKandasa himself was readily on hand to support newbies like me. but after a difficult start and several huddles I faced with frustration, I went back to the square one to look for an alternative... my research lead me to Domoticz.

Domoticz is a free/open-source Home Automation System that lets you monitor and configure various devices such as lights, switches, temperature, rain, wind, UV and meters (electric, gas, water). It appeared quite powerful and intuitive as it promised. In less than an hour after I downloaded and installed it, it had latched on to the flimsy MySensors Gateway that I had arranged on my breadboard. with that, my journey has begun.

IOT here we come1