Tiny Houses

Cedarshed Ranchhouse 16X14 Shed [RH1614] in Home & Garden,Yard, Garden & Outdoor Living,Garden Structures & Shade | eBay

Source: Cedarshed Ranchhouse 16×14 Shed RH1614 | eBay

 

According to a reality TV show on Netflix called ‘Tiny House Hunters’, tiny homes are all the rage these days. I got about 15 minutes into the first episode, and just couldn’t take it anymore. I just had to share my thoughts. In this show, this New Jersey couple first looks at a few acres with some tool sheds euphemistically called tiny houses. Next, they look at a custom ‘model home’ of a whopping 400 sq ft, which is estimated to cost them in the $100k range. The hardwood floor alone was $20/ft2!

Now I know that reality TV shows are anything but real, but I am sure there are many people who are thinking just like this couple. That is, they believe a 500 ft2 shed will cost in the $100,000 range. Such ignorance is just too much to not comment on, and share some insights.

I am not making fun of this couple and if you are like-minded to them or know somebody who is, then this article is for you. My point is, you don’t have to pay anywhere near six figures for a small shed or even a small cottage. The image at the top of this post can be bought complete for less than $6,000, and if you put two together it would equal this 400-500 ft2 tiny home idea. Of course, adding amenities such as a kitchen and bath will add to this cost, but surely no where near the $20,000 the show cited for a couple of cabinets and small appliances which would make up a tiny home’s kitchen.

Options

Here are some simple options for building a tiny home for less than $20,000. That is the upper limit. Many of these options should top out at less than $10,000.

Buy a Mini-Barn or Two

Mini-barns are what we call portable sheds in my part of the country. They can purchased in many lumberyards and there are often local builders as well. These structures are plain jane- nothing fancy. You get a cheap shell and you can finish it out anyway you like. Cost:: less than $20/ft2 for the shell.

Buy a Mobile Home

You can buy a beat up single-wide and completely renovate it – new insides, new roof, porch and regular siding. When you are done, it can look pretty nice. Cost: less than $10/ft2 for the shell.

Build a Small Cottage

If you are handy, you can just build a cottage yourself. If not, then hire a local handyman to do so. Depending on your labor charge, this is probably the cheapest and nicest option. Just remember to keep it simple – skip the dormers, complex roof-line and other such complexities which offer little functionality while driving the price way up. Since you are building a simple cottage, and not a big house, you can skip the architect, engineering and other complex load issues. A simple rectangle with a nice porch with wood siding can look just great.

Amenities

Each of the interior options in the show were outrageously over priced. Here is how fit out your house (tiny or otherwise) at a minimum cost:

Flooring – you can get excellent flooring for around $1/ft2 with laminate and vinyl. For just under $2/ft2, you can even go with hardwood. You can install any of these yourself, especially laminate and vinyl tile. Hardwood just needs a special air nailer.

Appliances – why pay full retail when you can get perfectly fine used ones on Craigslist. You can often buy appliances only a few years old for as little as 20% of retail price.

Siding – skip the vinyl siding. It is expensive, gets brittle with age, and is generally not a good choice. Far better is to locate a local sawmill and get wood siding cut there. Wood siding has a bad rap because it is often painted and if not repainted regularly, the paint peels and becomes a maintenance nightmare. The solution is to use stain. You can use transparent stain, partially opaque and even fully opaque. The opaque stain even looks like paint but doesn’t peel.

Plumbing – you can save big money by doing it yourself. Contrary to popular belief, plumbing is not rocket science. Use Pex for your supply lines (one line for each fixture) and look up the simple rules for drain plumbing on the internet. Not only is drain plumbing not rocket science, but high-priced plumbers often do substandard work that will not happen if you do it yourself.

Electrical  – doing your own wiring is even simpler. Hire an electrician to set up the main panel (that is the hard part), and do the finish wiring yourself. It is even simpler than plumbing. Just pick up a book on wiring to learn how.

Kitchen Cabinets – it amazes me how much wealthier folks will pay for plain white cabinets (which are the current fashion) made from particle board. While building cabinets is one of the more complex tasks in home finishing, if you build them in place and buy or make simple doors and drawer fronts, you can save a lot of money and have much higher quality cabinets.

Trim – if you price trim and molding in the lumberyard, the prices are outrageous. A much cheaper option is either to buy a table saw and resaw 2x4s for trim, or buy 4/4 thick boards from a local sawmill and run them through a planer. Plain 1x4s look nice as is, or you can run a router bit over them to get something a bit fancier.

Ideas

If you end up building a custom cottage, there are a couple of options for a simple, low-cost building. One option already mentioned is to build a simple rectangle with a nice front porch. By keeping the house narrow, you can save a lot on expensive structural members.

Another option is to build a hexagon shaped cottage. You can build any size house you want by adding addition hexes just like cells in a honeycomb. Each cell is room sized and just under 200 ft2. Each hex uses simple 2×4 and 2×6 framing and makes full use of cheap OSB sheets. This site offers some great ideas and plans.

Another thought worth mentioning is buying necessary tools. Many of the tasks mentioned such as making trim or kitchen cabinets requires some expensive power tools. In decades past, these tools were a serious investment. Nowadays, the high cost of trade labor and manufactured wood products are way more than greatly reduced costs of these power tools. You can buy a table saw, router table, and planer for less than $1,000 total. A few kitchen cabinets alone will surpass this one time expense, and an added benefit is the usefulness of these tools in the years ahead as well. Buying tools to make something yourself is money well spent. Don’t buy the manufactured product just because you don’t want to invest in a tool.

Gotchas

The biggest impediment to building a tiny home is the ubiquitous zoning laws. In most parts of the country, a dwelling must be a minimum size – usually 1,000 square feet or more. It also must have a septic system. A septic system can cost as much as half of what an entire tiny house costs.

To make matters even worse, frequently local laws are enacted to protect the trades in the name of ‘safety’. They require licensed plumbers, electricians, etc. to perform work that must be inspected anyway. These laws exist for no other reason than to channel business to these trades. Not only are they not required for ‘safety’, but they often provide a cover for shoddy workmanship. Because a ‘licensed’ tradesman did the work, the inspector will skip most of the inspection on the premise that the tradesman knows what he is doing. In reality, the tradesman knows how to cover his mistakes in the cheapest (often very substandard) way possible, and they are not caught by the inspector because he doesn’t inspect them when the trade does the work.

The only solution to these costly regulations is to buy land in states and counties where these laws don’t exist or where there are exemptions. Sometimes in rural areas, land owners having a certain number of acres are ‘farm exempt’. It pays to do your homework and buy in the right locations and the right amount of land in order to avoid these protection rackets.

Regardless of your location and land size, sanitation laws usually require a septic system. If you don’t live on your land full time, you can usually get by with just a composting toilet. Sometimes local laws even allow them as well, but that is rare. If you need a septic for whatever reason, you can save some money by skipping the garbage disposal (its presence requires a much larger drain field) and of course the needs of a tiny house will require only the smallest of systems. Shop around for installers. Often small equipment operators in rural areas can do the job for far less money than a larger outfit.

Conclusion

At the end of the show, the couple came to their senses and erected a cheap shell on their land and began to finish the interior themselves according to some of the principles cited herein. Nevertheless, they could have saved even more money by following more of the ideas I have given.

With the resources available today, there is little reason to hire expensive contractors and tradesman. Outfitting a house with either basic Home Depot stuff or used items can be another big source of savings. It still amazes me that two virtually identical toilets or faucets can come in a huge range of prices. Just buy one step up from the cheapest, and in the long run, you really won’t notice the difference from the top shelf stuff and you’ll come out way ahead.

Go forth and DIY, and contribute your experiences in the comments.

Posted in Construction | Tagged , | Section: | Comments closed

Alzheimer’s and Lyme Disease: Caused by Disruptions in Food Chain

When we look closely at the causes of lyme disease and Alzheimer’s, we find its origins in the food production system.

Source: Alzheimer’s and Lyme Disease: Caused by Disruptions in Food Chain

Alzheimer’s has reached epidemic proportions, now the third largest cause of death (not counting deaths by the healthcare industry). While medical researchers continue to search for a cause, this article cites two principal causes. The first one rest on some pretty solid evidence, and the second one is yet a theory, but one that might be worth considering.

The first cause is the one most easily preventable – excess sugar consumption. The cause of the obesity epidemic should be no surprise to health conscious individuals. It is not the consumption of excess fat as is commonly supposed, but excess consumption of carbs and sugars, primarily the latter. The surge of soft drink consumption (both diet and regular) along with supposedly healthier fruit juice has moved lock-step with the obesity explosion. Coincidence? I don’t think so.

Excess sugar consumption causes not only obesity, but also type 2 diabetes. Alzheimer’s has been called type 3 diabetes by some. Do you want to avoid Alzheimer’s? Ditch the sodas and fruit juice. Minimize the consumption of junk food and empty carbs.

The second cause cited is a bit more esoteric. It is just a theory right now, but it bears worth watching. This theory is that rogue proteins found in feed-lot beef are causing brain deterioration similar to mad cow disease, but at a slower pace. These proteins are not naturally occurring, but are caused by feedlot conditions and the type of feed being given to cattle. The suspected feed ingredient causing the malformed proteins is chicken litter harvested from confinement chicken houses. Yes, you read that right – chicken poop is one of the ingredients in feedlot beef.

A simple step to avoid these rogue proteins is to eat only beef from grass-fed cows. However, the article states that these proteins may actually be of a contagious nature, meaning that eating even a small amount of feedlot beef, say from a restaurant or a friend’s house may be enough to do the damage.

I am hesitant to jump to any rash conclusions. It is likely, most of us have already been exposed to feedlot beef and will probably be again from time to time. Of course, at home, I recommend only eating beef from grass-fed cows. The benefits go far beyond avoiding Alzheimer’s, including helping to prevent cancer. I certainly don’t recommend vegetarianism or its even worse variant – veganism. Veganism in particular can bring about a myriad of health problems due to malnutrition. An all vegetable diet, especially one that contains grains, is a recipe for a health disaster. Vegetables are good. Meat, eggs and milk from animals raised naturally on small farms is good. Feedlot meat and highly processed foods are bad. Sugar, junk food, soda and juices are very bad.

You might want to pick up this book for more information on how carbs and sugars affect the brain. Stay healthy – cut back on the sugar.

 

 

 

Posted in Health | Tagged , | Section: | Comments closed

Monitoring Tools for your Website/Server

sitemonitoring_snapshotDo you have a website hosted on a server somewhere – either in your home or in the cloud? Has it ever gone down and you didn’t know about it for hours? I have, and it has happened to me too many times.

As a result, I have often wanted/needed a way to verify that the server which is hosting my websites is up and running properly. While many fine graphical tools exist such as Munin for this purpose, I wanted a simple set of utilities that could return just the parameters I needed and how I needed them.

What’s Needed

There are two different ways in which I want to get my metrics. The first is a command-line utility that I can run from my local computer to test the parameter needed. The second is a set of python functions that deliver the same metrics that I can then use to create a custom webpage.

This webpage (a future project) would run on a local server such as a Raspberry Pi, which could then display all my metrics on a tablet display in a convenient location. A quick glance could then show that everything was running smoothly or that problems have arisen.

Many other possibilities exist as well – sending an SMS message when a site goes down, lighting up LEDs to indicate site performance, etc.

The various metrics needed to maintain server and website health can be grouped into two categories:

  1. Server performance – these metrics indicate the health of the server itself. Metrics such as cpu load and memory usage are most desired.
  2. Website performance – these metrics indicate the health of the webserver application as well as the websites themselves. Metrics include page load speed, site verification, and number of requests per hour.

The Solution

In order to meet the goals cited, I decided to create a custom site monitoring library. This library is a collection of python scripts that provide monitoring tools for servers and websites. These scripts can be:

  1. Run from the command line on a local computer in order to get the needed information any time it is needed without having to login to the server. An added benefit is once the library is downloaded to the local computer, it can be used to monitor any server without needing any further installation on that server.
  2. Individual functions in each file can be loaded and called from custom python applications to provide customizable output. I mentioned some possibilities already. I hope to implement some of those in a future project.

Each of these utilities require a host to be specified. The host can be either a named host in your ~/.ssh/config file, or it can be specified as USER@DOMAIN/IP. Server utilities can also be called to monitor your local computer. In this case, use either local or localhost for the host specification.

Note: if you do not have a computer running Linux or Mac, you may have difficulty using them due to the lack of SSH support in Windows. In that case, I suggest using either a Raspberry Pi to run them on, or upgrade your computer to a more modern operating system.

Getting Started

Installation

Download the library from github, or use git to clone the repo via:

$ git clone https://github.com/provideyourown/SiteMonitoring.git

To execute these utilities as standalone scripts, make them executable via:

$ chmod +x FILENAME.py

You can also execute the standalone scripts repeatedly with a simple bash function (add to your ~/.bashrc or .bash_aliases file):

repeat() { INT=$1; shift; while true; do $*; sleep $INT; done; }

Usage, e.g. repeat systemload every 15 secs:

repeat 15 ./systemload.py local

The repeat function can be very handy to monitor changes in server loads, memory usage or any other parameter provided in this library.

Now let’s examine the utilities themselves. They are grouped into Server utilities and Website utilities.

Server Utilities

System Load

This utility shows the system load as a percentage over a period of time.

Python Funcs

getCpuLoad(server, interval)

Given the host definition for the server, and an interval (in secs), getCpuLoad returns the average cpu load over that interval as a percentage.

Standalone usage:

$ ./systemload.py HOST [-i 5.0]

-i optionally specifies the interval. The default is 1.0 seconds.

Prints the cpu load as a percentage. It is really handy to determine when your desktop or laptop is in need of a reboot.

Memory Usage

This utility shows the memory used out of total available and the percentage of swap memory used (if any).

Python Funcs

getMemoryUsage(server)

Given the host definition for the server, return the memory used, total and swap. Used is given as a percentage, total memory in Megabytes, and swap is in percentage.

Standalone usage:

$ ./memoryusage.py HOST

Prints the memory used as a percentage of total available, the total available, and the percentage of swap memory used.

Website Utilities

Site Test

This utility is a wonderful way of making sure your website is up and healthy. It indicates if a site is up, verifies the site’s page is valid, and provides the total page load time.

Python Funcs

getSite(url, testStr)

Tests to see if the site is up, is valid and its loading time.

Parameters:

  • url: can be just the site’s domain name or can optionally include the protocol (http/https)
  • testStr: a string within the page to verify the page loaded correctly. If this string is not found on the page returned, the site is considered invalid.

Returns:

isUp (bool), isCorrect (bool), load-time (secs – float)

Standalone usage:

$ ./sitetest.py [http://]example.com 'this is an example site'

Prints up status, verifies integrity (is valid), and provides the page load time in seconds.

Get Requests

This utility counts the number of requests to a site over a period of time. It is really useful for determining the load on your webserver at any given time.

Python Funcs

countRequests(server,  logfile,  interval)

Counts the requests to this site over a period of minutes, with a maximum of 1440 mins (60 mins * 24 hours).

Parameters:

  • server: host name as described in the beginning of the article
  • logfile: full path name for the access.log file (can be either apache or nginx standard log file)
  • interval: time interval in minutes over which to count requests

Returns: number of requests (int)

Standalone usage:

$ ./getrequests.py MYSERVER /var/www/MYSITE/logs/access.log [-i 20]

The time interval is specified by -i in minutes, and is optional. If not specified, the utility will return the number of requests over three periods of time: 10 mins, 1 hour, 24 hours (1 day).

Conclusion

Server and website monitoring is a big challenge. Many tools exist, but they often are either difficult to use or provide way more information than what is needed. These simple, open-source, python utilities will meet the most common and pressing monitoring needs. Since they have been kept simple and are written in python, you can easily customize them or write additional ones, using them for a starting point.

If you have useful comments to contribute, please do so in the comments. Any code/feature suggestions or bugs to report should be made on the github pages.

Posted in Tech | Tagged , , , | Section: | Comments closed

Flax Seeds for Breast Cancer & Health

Lignans are a type of plant compound known as polyphenols found in flaxseeds, sesame seeds, berries, and other foods.

Source: Lignans Play an Important Role in Optimal Health

This ground breaking article breaking article by Dr. Mercola, examines some of the many health benefits of eating freshly ground flaxseed.

One of the more significant benefits is in preventing and even curing breast cancer. He cites one case where a woman’s tumor shrank significantly from consuming flax seeds.

One of the principal mechanisms by which it benefits is in estrogen regulation. Since many other types of cancers, including prostrate cancer is estrogen driven, both women and men can benefit from flax seeds.

Another benefit of flax seeds is estrogen regulation. They not only reduce excess estrogen, but can increase low estrogen levels as well. This is an important benefit to aging women. Since older men suffer from excess estrogen levels due to conversion from testosterone, I believe flax seeds would provide similar benefits for older men.

Because of the highly perishable nature of flax seeds once ground, it is important to keep and store only fresh whole flax seeds, and grind them just before consuming. To get sufficient benefits, studies have shown that you need to consume 3 to 4 tablespoons daily.

 

 

 

 

Posted in Health | Tagged , , , | Section: | Comments closed

Non-Slip Pervious Concrete Stepping Stone

This Instructable is to create a stepping stone out of pervious concrete that has a personalized touch. Pervious concrete allows water to flow through it thus eliminating ponding on the surface that may be slick. The personalized patterned is created by using two different types of aggregate that are different sizes and/or color.

Source: Non-Slip Pervious Concrete Stepping Stone

The non-slip stone allows for much safer walking in gardens and walkways. Because after the pathway is water-logged by a lot of rain or hose watering, the pervious stone remains free of standing water. The stepping stone lends itself to creativity with the various colours of aggregate, (the author used crushed limestone and pea gravel). It also has a stone look that is much prettier than pure concrete.

The author of the Instructable gives a very detailed set of instructions, including how to mix the concrete and aggregate together, dry times, tools to use, and how to make personalized designs. Even a beginner should have no difficulty creating their own beautiful stones.

 

 

Posted in Living | Tagged , , | Section: | Comments closed

DIY Powder Coating

Source: Hackaday – DIY Powder Coating

This is so cool. I did not know powder coating could be done so easily at home. Powder coating is similar to paint, but is much harder and more durable, since it’s baked on.

Powder coating can only be done on metal objects and involves these simple steps:

  1. Throughly clean the part – sandblasting if necessary
  2. Hook ground clamp from the powder coating gun to the part and spray on the powder
  3. Place part in toaster oven at 450° F until the powder liquifies

You can mask any parts not to be coated with a high temperature tape such as <a href="http://www.amazon click now.com/gp/product/B00DVBLKZE?tag=provideyourown1-20&linkCode=as2&camp=1789&creative=390957&creativeASIN=B00DVBLKZE” onclick=”__gaTracker(‘send’, ‘event’, ‘outbound-article’, ‘http://www.amazon.com/dp/B00DVBLKZE/?tag=provideyourown1-20 ‘Kapton tape’);”>Kapton tape. Also to be noted is you should use a dedicated toaster oven that won’t be used for cooking food, and the baking should be done outside due to the fumes released.

You can buy an old Crafstman powder coating gun used on e-bay or a newer one here on Amazon.

Here is a video showing the entire process:

I want to try this sometime. Any ideas for applications?

Posted in Household | Tagged | Section: | Comments closed

Neat low cost storage idea

Having a place for everything is key to a productive workbench.We want to make stuff, not look for stuff! :-)While we could make the cabinet out of wood, as long as your the parts are not too heavy, foam core is strong enough, inexpensive, and quicker to make than a wooden cabinet. Plus, no one has ever gotten splinters from foam core! 🙂

Source: Instructables.com

What a great idea for storing small parts like electronics, screws, buttons, etc. I like the idea of using foam core and hot glue. There are a lot of storage needs that can be met with foam core or cardboard instead of wood. Also, hot glue works great for these materials as well as wood. I made a silverware drawer divider from Luan plywood and hot glue years ago, that is still going strong.

 

Please add your own ideas in the comments.

 

Posted in Household, Tech | Tagged | Section: | Comments closed

Windows is a Sinking Ship – Linux is the Lifeboat

I wrote previously about why you should switch to Linux for all your computing needs. I would like to amplify on that assertion. There has never been a better time to abandon Windows and switch to Linux. First I’ll address the disaster that Microsoft Windows has become, and then explore the Linux alternative.

Window’s Ship is Sinking

Just like the Titanic, even though there is widespread denial, Windows is sinking into the abyss just as surely. Despite the grave metaphor, I am not saying Windows will completely go away (who knows for sure), but it will continue to shrink into irrelevance. Linux rules both the server/cloud world and dominates the mobile market as well via Android. As applications continue to move to the cloud and mobile, the raison d’être for Windows as the only platform that can run the applications a user needs is slipping away.

But irrelevance is not the only thing ailing Windows. No siree. The operating system is strangling itself. Years of legacy code combined with a closed development system has left Windows years, even decades behind its competitors, namely Linux. Even the mighty resources that Microsoft have at its disposal cannot hope to compete with the worldwide open source development community that provides us the Linux operating system. Closed source is an antiquated development model that is quickly becoming a relic of the past.

For example, just a few weeks ago, Microsoft announced it will be finally be offering SSH support in Windows after missing this key operating feature for over ten years. SSH is a secure communications protocol between computers that Linux has had almost forever. This news gets even better though. It’s not like they are announcing it is available, but rather it is now in the planning stages! With two aborted attempts in the past, how long will it take them this time?

So far, I have only addressed the fact that Windows development has been languishing for about 15 years. Windows XP is considered the pinnacle by many analysts, and the platform has been going down hill ever since. Not only is its development arrested, but the last two major releases have been disasters. Everyone acknowledges the version 8 fiasco, but no so much yet with version 10. Yet version 10 has even more problems. Version 8 was at least stable and usable, albeit with its interface hidden away. Windows 10 in reality offers nothing more than version 8.1, but rather is really buggy and only halfway done. The UI is still only halfway converted to the new way of doing things, and in Microsoft’s rush to get it out the door in hopes of saving the sinking ship, I believe they may have made the situation even worse. Numerous drivers are missing and many major defects have been reported. It basically suffers from all the same complaints about Linux ten years ago (which have now been resolved).

I have another good example. Just recently, a client needed me to mount a remote file share on his Windows 10 laptop. No problem, or so I thought. When I installed usual program for this task (which costs a fair chunk of change by the way) and tried to mount the share, Windows complained very nebulously about a driver being missing. After considerable Google searching proved fruitless, I had to resort to finding another commercial program to do the same task. If the laptop was running Linux, I could have added a single line to the /etc/fstab file (a file mounting configuration file) and be done with it.

On Linux, doing computer configuration is really that simple. Not only that, but if you don’t know how to do it, a few minutes with a browser will return numerous well-written tutorials.

In Praise of Linux

Linux is everywhere. It runs the entire Internet. It runs on many appliances such as your router, Kindle, and some day maybe even your toaster. It runs on credit sized computers that cost as little as $15 (update – the recently announced Raspberry Pi Zero costs only $5 and still runs full-blown desktop Linux).

Microsoft has tried to bolster Windows 10 image by announcing it would run on another credit sized computer, the Raspberry Pi. What a joke. It does no such thing. What they are calling Windows 10 is a development environment you run on your desktop that can compile a program using the Windows API that then runs on the Pi. In contrast, for a few years now, you can run a complete Linux-based, graphical OS on the Pi that is as capable as a typical desktop from several years ago. And not only one flavor of Linux, but you can have you choice among several variants according to your tastes and needs. Running Linux, this little computer can do things your tablet or cell phone can only dream of. You don’t need a development environment on your desktop to build apps on. The Raspberry Pi is the computer to not only create apps, but wonderful interpreted, text-based, Python programs as well.

Linux is also cutting edge. Computers and development are continually evolving. They way things were done last year are not the way to do them today. Linux is where these cutting edge technologies are being developed and deployed. The best we can hope out of Microsoft is to get some of these technologies several years down the road.

Linux has great apps and an even better way to install them. Most applications for Linux are free and open source. Because of these properties, you rarely have to hunt them down, download them from malware sites, or pay for them. Armies of volunteers, scoop them up and put them in repositories, safe, effortless, and free for the taking.

Some stalwarts refuse to see the writing on the wall and stick steadfastly to their creaking operating system. If you are one of them, I won’t try to convince you otherwise. You are free to stay the course – a literal minefield, infested with malware, ransomware and expensive software patches. For those up for fun and adventure, read on.

Let’s Do Linux

Step 1 – Try it out

If you are with me thus far, you are probably wondering how to get started making the switch. The first place to start is by trying one of the many flavors of Linux, called ‘Distros’. Ubuntu or its variant Kubuntu is a safe bet. Also safe is an Ubuntu derivative called Mint top article. If the person you are providing IT support for has trouble adjusting to something new, you can even get a distro that looks just like WindowsXP – literally.

You can install these distros onto a USB flash drive and ‘live boot’ to try them out live without touching your current install. Another way to try them is to buy a Raspberry Pi and try it out that way. You can even get SD cards with the OS pre-installed.

Step 2 – Take the Plunge

After you decide on a distro, installation is easy, even easier than Windows, infinitely easier than installing Windows 8 through 10 from scratch. The popular Linux distros offer easy installation alongside your Windows install, enabling you to dual-boot. You don’t have to go cold turkey, you can still have Windows for training wheels when you get scared or stuck.

Step 3 – Installing the apps

Each distro has the equivalent of an ‘app store’. The Linux world invented the app store long before Apple. Most applications are free, and just like cell phone app stores, you just click to install. That’s all there is to it for apps with graphical UIs. For command-line programs, installation is just as easy, you just do it the command-line way. Each distro has a command-line installer and installing is as easy as saying ‘install appname’. Again, Linux does the rest.

Step 4 – Migrating to new apps

The most common objection to switching to Linux is – “is Photoshop available?” or some similar objection. In probably 90% of the more common needs, there is an open source equivalent that runs on Linux. Instead of Photoshop, there is Gimp. Instead of MS Office, there is Libre Office. Browser’s such as Firefox and Chrome run on both systems, as does the popular mail program Thunderbird. Linux also offers a number of other choices for browsers, e-mail, chat apps and more. The only time you might run into a problem is with a specialized application such as Quickbooks, AutoCad, and other such niche software. For most of us, there is little need for these exotic applications.

If you do need one of them, there are some workarounds. First, look for a Linux equivalent. This is fairly common. If you don’t find one, then try to run the actual Windows application under Wine or Crossover. I recommend Crossover, as it is a spiffier version of Wine; both share the same core code. These programs are not emulators, but rather implement the Win32 API. Well behaved Windows programs will actually run natively using one of them to provide the missing parts.

Another workaround is emulation. You can install VirtualBox (part of the Linux repos) and install Windows XP or Windows 7, and install your Windows app as usual. With today’s fast desktops, you won’t notice a difference from native, except it runs inside this virtual OS. Of course, you can also dual-boot, but that is not as convenient.

A third option, which is only now becoming available, is to either buy a ‘brick’ or ‘NUC’ style desktop or repurpose an old Laptop or Desktop by running Windows on it. Then using VNC, you simply log into that Windows computer from any other computer you have in the house, whether it be a desktop, laptop, tablet or Raspberry Pi. Its like having another computer inside the one you are using. I am currently using a netbook with a broken screen that I bought on e-bay for $20 to run Quickbooks – the one application I can’t be without, that unfortunately has no Linux equivalent.

Speaking of Quickbooks, a fourth option is to just use the Web version of the software you need. This option, being a continual drain on my pocketbook is not suitable for me, but it may be great for you.

So, no matter how dire your need for a particular application, one of these alternatives will make it work for you. Even if you use option three (a dedicated Windows box), it still beats Windows hands down. You can keep it off the Internet and locked down, thus preventing any nasty infection, and enjoy the use of a safe modern operating system for the rest of your needs.

The last corner of application migration is all those little utilities you may have purchased for Windows, which you are new fearing can not crossover. Have no fears, because whatever you needed to keep your Windows box running smoothly, you will find either a better equivalent under Linux, or no need at all. Anti-virus software is a perfect example. You will not need to worry one microsecond about it on Linux.

Conclusion

With all the options available under Linux, the water is nice and warm. Dip your toe in and give it a try. Do not be afraid because everything is new. Likewise do not be afraid of the command line. Take it a little at a time. Do some research. Read some of the thousands of online tutorials. Get a book on Linux or the Raspberry Pi. Buy a Raspberry Pi – it is only the cost of a modest dinner for two. Once you take the plunge, you’ll never look back. I know I never have.

Posted in Tech | Tagged , | Section: | Comments closed

Why You Should Switch to Linux

With the loss of updates for Windows XP and Microsoft’s floundering on Windows 8/10, many have started to consider alternatives. The MacOS is of course an option, but I believe Linux to be an even better one. Not only is Linux a good alternative to Windows, but for makers, hackers, tinkerers and homeschoolers especially, Linux is really the only operating system (OS) worth considering.

Merits

Cost

Without a doubt, Linux is the ultimate low-cost operating system. It is absolutely free. How many times have you had a computer where the OS needs to be reinstalled? With Windows systems so vulnerable to malware infections, it is a regular occurrence. When you do need to reinstall, do you still have the original disks? Can they still be read?

What about upgrades? If you get a new computer (without an OS), and you want to install your latest version, do you have the full version, or just an upgrade version? If it is just an upgrade version, do you have the original version disks? If not, Microsoft’s DRM will not allow the installation.

Have you ever thought about building your own computer, but are stymied by the prospect of having to shell out big bucks for a full Windows OS?

These are all problems I have faced in the past. Since switching to Linux several years ago, I have been free from all of these problems.

Security

Unlike Windows, Linux was designed for security. Infections on a home computer are almost impossible, due to the fact you must explicitly grant permissions for any change to the operating system by providing your password. There can be no stealth infections without you granting this permission.

Not only is Linux significantly more secure than Windows, but if you ever find the need to reinstall the OS, you don’t need to wipe your hard drive, lose data or even application settings. The OS can be installed into its own partition, and all of your personal data and settings are in your home partition. A reinstall will have no effect on your home partition.

Versatility

Linux is incredibly versatile. It can be installed on almost any hardware – all the way from legacy PCs, to servers, to tiny micro-power single board computers. It is not even limited to the 386-Intel instruction set. An increasingly popular alternative, ARM-based computers run Linux equally well. Your cell phone is probably just as fast as your desktop, but because it is ARM-based, it is a fraction of the size and draws a tiny bit of power. More on ARM-based computers later.

Customizable

The Linux OS is the ultimate OS for customizing. You can tailor it to your heart’s content. You can choose from a myriad of distros (flavors of Linux) and also from several different types of desktops (various windowing systems). Some desktops can be tweaked to look just like Windows, some are very lightweight to run on limited systems, and some are far more advanced than anything else out there.

If we really think about the last decade, Microsoft has done virtually nothing with their OS except add some eye-candy, and totally botch trying to produce a one-OS-fits-all-devices while Linux has been steadily advancing. It continues to advance to this day – all thanks to the power of open source. One flavor of Linux, Ubuntu, even promises to produce a one-OS-fits-all-devices that is actually done correctly. It is called Ubuntu Touch and is coming soon.

Open Source

Open source is where the future lies. Microsoft continues to fall ever farther behind because they lack the manpower and vision that comes from thousands of the best and brightest around the world advancing open source projects like Linux. Many tech savvy companies have joined the open source parade, actually paying their employees to contribute to open source projects or even sponsoring open source development companies.

The power of open source is truly amazing. If you are a maker or hardware tinkerer, you are probably familiar with the new open source hardware movement. They got their inspiration from open source software.

Not only do many open source software projects benefit from the contribution of many hands, but if you find something not to your liking, you can even contribute yourself. Even if you don’t do any coding, you can still submit bug reports. I have done so, and unlike submitting bugs to mega-corporations to be ignore, you will probably hear from the developer for that particular area of the software.

While I haven’t yet contributed to any part of Linux, I have contributed to several small programs which were easier to understand and lacked certain features that I needed. I knew that if they were to get that feature I would need to do it myself. It is not as hard as you think, since the code is already written, it is not terribly hard to just make a few minor changes. I have been able to add significant functionality to programs written in languages I didn’t even know, just by examining what was already written.

Deployable

I mentioned small, low-power single board computers earlier. These things are sprouting up like mushrooms after several days of rain. Many have heard of the Raspberry Pi. This computer is an ARM-based system, which is the same type of chip your cell phone uses. Because of the large Intel x86 legacy, the only modern OS it can run is Linux. Since it is ultra-low cost, it can be used in embedded systems like robots and monitors, yet is still capable of being a modest desktop or laptop.

The Rasberry Pi is not the only example. Many similar single board Linux computers have appeared recently, going by names as Banana Pi, ODroid, etc. The newer versions of these computers are quite powerful. I have recently been playing with an Odroid U3 and latest Raspberry Pi 2. They are both ARM-based, have an Ethernet and USB port, and boast a quad-core processor with 2GB and 1GB of RAM (respectively). Add a cheap SD card with Linux and you have a desktop system that rivals the one on your desktop in speed, and yet has no fan, fits in the palm of your hand and runs on a mere 3 to 5 watts of power. You can even power it with a few AA cells or a small solar panel! Since they are so inexpensive, they can be left in place for virtually any task. You can also easily gang several together to make a monster server or desktop system. The one thing you can’t do is run Windows, but I don’t see that as a problem at all.*

Support

You may be asking where you get support if no company is in charge? Contrary to appearances, you can actually get far superior support on Linux than you can on Microsoft products. As most folks know, support for both Windows and their applications requires either annual support contracts or large per incident charges. Neither are very cheap. Even if you spring for paid support, you are likely to get a poorly trained support person for whom English is not their first language.

With Linux, while you can’t get free phone support, you can get free forum support and most problems can be solved instantly via a web search. Amazingly, when you search for problems with Windows, the search results are either irrelevant or pathetic. With Linux, there are dozens of sources for answers, including full blown tutorials for almost every problem. Just like the wonders of open source, the wonders of community supported information is even more incredible.

Education

For homeschoolers, any OS except Linux should not even be considered. Why? Why do you homeschool? To raise cogs in the great industrial machine? No, you homeschool because you want your children to think. That is why the Raspberry Pi was created – so children would not think of their computer as a game console or texting machine, but discover how computers actually work.

Windows actually hinders the process of learning about computers. It hides the real workings behind its closed system. With Linux everything is out in the open. You can view the source for anything, you can get help online and read from thousands of tutorials.

Also, homeschool families are often cash-strapped. With Linux, everything is usually free. The OS is free, the applications are almost always free. Old computers can be hard for free, or new single board computers can be bought for as little as $25. You just can’t beat it – essentially free and the source of a lifetime of discovery and learning.

Linux should be the de-facto OS for all other educational institutions as well – from primary school to college for the same reasons. In England the Raspberry Pi, running Linux is making inroads into those very schools. It will eventually happen in the US as well. As for other countries, they are all climbing aboard the Linux bandwagon. What’s not to like?

Makers & Hackers

Need I say anything more in order to convince you that Linux is the OS to use? You can hardly hack Windows, but Linux can be broken down, dissected, reassembled, enhanced, extended, and hacked to your hearts content. Everything is open source, so everything you need is at your fingertips. Help is just a quick web search away, and you are free to build upon another’s work.

The development tools are far more comprehensive as well. With Windows, you are pretty much stuck with expensive, proprietary tools. With Linux, there are more free, open-source options than you can use in a lifetime. The list includes: editors, integrated development environments (IDEs), compilers, source control software, project & bug tracking software, metrics and more. Sure, some of these tools may be available under Windows as well, but Windows gets the scraps. Linux is the mother-lode.

I have also addressed some of the myriad of hardware issues as well. With Windows, you are limited to large, power hungry, overheated computers that must run the Intel instruction set. With Linux, it can be compiled to run on virtually any hardware, including most of its applications. The hardware options are virtually limitless.

Why would anyone love to hack hardware and make their own custom things, but be content to live within the limiting constraints of an obsolete closed system like Windows?

Web Development

I am amazed at how many web developers still use Windows. That’s like using English wrenches to work on a German car. Except for backward corporate sites, almost all web sites run on Linux servers, for many of the same reasons given above.

Web site and web application development is much simpler using Linux. Everything makes more sense. The tools are much easier to use. Linux is the future and Windows is the past. For web development, Linux is the only way to go.

Objections

Applications

I can hear the naysayers screaming at this point – “what about applications”? Applications are a very big deal, and ten years ago, alternatives to Windows just weren’t very viable. Fortunately, such limitations are no longer the case today. Linux has many alternatives to Windows apps that are not only capable, but often superior.

Not only that, but the future for desktop applications is pretty bleak. The cloud is the future, and is already here. Along with open source, many applications today are either cloud/web based or are multi-platform and run on multiple OSes.

Another big plus of Linux applications (besides being free for the most part), is their availability in the various repos. Linux repos are kind of like app stores. Long before Apple made ‘app store’ a household name, Linux offered the same functionality in their repos.

When you need a new application for your Linux computer, you don’t need buy disks, or download a zip file and install it. Most of the time, you just go to the repo (think app store), and select it. It will download and install automatically. You don’t even have to go through the silly installer choices. It will just be there and you won’t have to reboot either. Not to mention, most of the time everything is free.

Games

What about games? While I am not a gamer, there are many excellent games on Linux. Not only that, but Steam is abandoning Windows for Linux. They are even offering their own Linux distro called SteamOS. While Linux is still behind the Windows platform for games, it won’t stay that way much longer. Linux is the future home for games. Just wait, you’ll see.

The Command Line

Another common objection is “I hate to use the command line” and doesn’t Linux require the command line? I used to feel the same way, and I must admit, that I learned to love the command line.

Linux is very much like the Amiga OS of yesteryear. It had a beautiful graphical interface back when the most common option was MS-DOS. Yet, the Amiga was a powerful system. In addition to the graphical interface, it also offered a command line. There are so many tasks and customizations that are easier and simpler to perform using the command line.

Using the command line, is nothing like using a DOS program. With those programs, they were kind of like graphical programs today, but you had to remember all these commands in order to make them work. The Linux command line is different. You can happily work all day long, every day in Linux and never touch the command line. However, when you need to do a difficult configuration, the command line is always standing by, ready to obey your every command.

At first, you find these commands from simple Google searches. You then gradually begin to remember the more commonly used ones. Still sounds hard? Let me contrast the alternative using Windows. To set up some network configuration or something similarly difficult, you have to guess and wade through several configuration programs in what is often a vain attempt to accomplish the simple task you need to get done. You then search the internet for hours, again in vain, hoping to find the magical window or button hidden in some bizarre location that does what you need. Even that may not be enough. If you find it, you may have to enter some code into a field that only experts who go to Microsoft technical training know what it is.

Contrast the same task with Linux. You simply search the internet for what you need to do. You will instantly find several tutorials on the exact steps to take – what commands to enter, and what configuration files to edit. In just a few minutes (maybe a bit longer at first), your problem will most likely be solved and you can go back to your merry GUI, feeling a little bit smarter and empowered.

Yes, empowered. In fact, I dare say that using Linux is empowering. Using Windows is deflating. Brutally put, but true.

MacOS

What about the Macintosh? Well, today’s Mac actually runs a version of Unix that is very similar to Linux. There are many similarities between the two systems. However, the Mac also has its dark side. It is a closed system, controlled by one very controlling company. You can’t modify it, extend it or install it on all the wonderful new single board computers coming on the market. In short, it is more like Windows than Linux. In fact, it is far more closed than Windows. I used to use the Macintosh for many years, but eventually migrated to Windows since it was a more open system. But neither can hold a candle to the capabilities and opportunities available to the Linux user.

Questions

How to Get Started

There are many ways you can get started. You can buy a cheap single board computer like the Raspberry Pi 2 with Linux already installed. You can also try it within Virtualbox in your current PC. Lastly, you can boot from a LiveCD or USB stick. Each of these options provide an easy way to try Linux and get your feet wet without having to jump all the way in.

I also recommend getting a good starter book like Beginning Ubuntu for Windows and Mac Users or subscribing to Linux Format magazine. The MagPi magazine, while targeted at Raspberry Pi users, also has some top notch articles for learning Linux. Best of all, its free.

Choosing a Distro

A ‘distro’ is a particular flavor of Linux. They all use the same Linux core, and for most purposes, there is very little difference between them. Two big considerations stand out – support and the package manager. The package manager is the equivalent of the ‘app store’. It is the engine by which you install and remove applications and code libraries. There are two main package managers in use, and it is probably best to stick with distros sharing the same one. That way you can switch between distros, but still be perfectly at home with each one. The package manager I prefer is called ‘apt-get’ and is the one used by the Debian family of distros. This family includes Ubuntu, Mint, and many others.

Support is probably the biggest consideration in choosing a distro. Ubuntu, hands down, wins the prize for the most plentiful support. Mint and some other minor distros actually share much of the Ubuntu distro, so any support for Ubuntu will most likely apply to them as well.

Ultimately, your choice if distro is not a very big deal. If you have a Linux friend, you should probably go with the distro he uses or recommends. If you are striking out on your own, I recommend Ubuntu. It is the most popular and has the most support options.

Desktop Environment

Whenever anyone talks about Linux distros, newbies think their choice affects how the system looks and feels to use. The fact that the choice of distro has very little to do with the actual graphical interface makes Linux all the more confusing.

You see, Linux is full of choices and configurations. Just like everyone is just a little bit different, so it is the same with Linux. The distro is kind of the bone structure of Linux. The Desktop Environment determines the outer appearance. You can usually chose whatever Desktop Environment you like, regardless of your distro. Of course, each distro has a default Desktop Environment, but it is simple matter to install a different one.

Ubuntu has become controversial of late, largely because of their decision to abandon more traditional Linux Window Managers for their own in-house one called ‘Unity’. Unity is a bit different, but is worth trying out. You may like it. For a more traditional look, there are several to choose from – Gnome, KDE, Gnome forks such as Cinnamon and Mate, as well as several others. Gnome, Cinnamon or KDE are all pretty safe bets. For older hardware, Xcfe is a great Windows look-alike that is very light on resources.

Conclusion

I have just scratched the surface in this short article on the many virtues of Linux. It would take a book to sing and elaborate on all its virtues. You may even be agreeing with me, but are afraid to take such a bold step into unknown territory.

You are not alone. Even though I am an engineer and professional software developer, I myself was afraid to take the plunge several years ago. Encouraged by a friend who loved to tinker in Linux, I bought a friendly tutorial magazine and began my journey. You can start out slowly, even just trying it out by booting from CD or USB drive, without abandoning your Windows installation. Then as you become more and more comfortable and knowledgeable, you can advance to either dual-boot or switch full-time to Linux.

You don’t even have to give up completely on Windows. Both Windows and Linux can be run in VirtualBox under each OS, providing the other OS in its own window. Alternatively, many well behaved Windows programs can be run under Linux via Wine, which unlike emulation, actually implements the Win32 api in Linux, making the applications using it to become Linux applications.

The water is warm. Now is the time to embrace Linux. You already use Linux everyday, and you don’t even know it. It runs almost every website and database. It runs most cell phones. It runs your router and many other embedded devices. The desktop is dying and the laptop is not far behind. What remains will be running Linux most likely. What are you waiting for?

* Microsoft has promised Windows 10 would run on the Raspberry Pi, but that promise has proved to be hollow. All it will run is a single “modern” style app specifically written for the Pi. It won’t even run existing ‘modern’ apps. It isn’t a true operating system in any real sense of the word. One more plus for Linux.

Posted in Education, Tech | Tagged , | Section: | Comments closed

Using ATtiny Chips for Arduino-Like Projects

The Arduino platform is great for prototyping. Its easy-to-use shield architecture, readily identifiable pin numbering scheme, and beginner friendly IDE and software library has created a large and loyal following. In the life of many projects, however, there comes a time when the project is to be permanently deployed. When that time comes, leaving a precious Arduino in the field is often not the best option. Instead, a specialized board with either an ATmega chip or even an ATtiny chip is the best choice.

When cost or space is a factor an ATtiny chip is an attractive alternative to the ATmega for simpler projects. Thanks to the Arduino-Tiny project, an ATtiny can be used as a drop-in replacement for most Arduino projects. This initiative provides ATtiny chip configurations as upload board choices in the standard Arduino IDE. By following the instructions described in my previous article – Program an ATtiny Using an Arduino – your Arduino sketch can be uploaded as easily to an ATtiny board as it can be to an Arduino one.

More recently, the ATtiny has gained semi-official support given the variants posted by David Mellis on Github. Please note that this new firmware specification has a different pinout than the one used by the Arduino Tiny project. It is therefore best to base your projects on this newer version.

In response to that article, there has been considerable interest in the differences between the ATmega based Arduino compatible boards and ones based on ATtiny chips.  There has also been some confusion over these differences as well. This article is meant to address those differences and clear up any confusions.

The Arduino Language

On the official Arduino website, the following is proclaimed:

The microcontroller on the board is programmed using the Arduino programming language (based on Wiring) and the Arduino development environment (based on Processing).

The phrase Arduino programming language is an unfortunate choice of words and is the cause of considerable confusion among newcomers to the platform. By following the link provided, the official Wiring site says it better:

Wiring is an open-source programming framework for microcontrollers.

Since the aforementioned is probably still confusing, permit me to state the matter plainly. The Arduino is programmed using the language C++, and makes use of the framework library Wiring. There is no Arduino programming language. What the Arduino IDE (integrated development environment) does is hide the complexities of C++ compilation and linking via the Processing IDE. Behind the scenes it uses the GNU GCC compiler for C++, and links internally to both the AVR Libc library and the Wiring library.

C and C++

Beginners may be put off by the idea of programming in C++ due to its reputation for being a complicated language. This fear is unfounded. It is due to the power of C++ that makes programming the Arduino much more simple than more conventional AVR techniques using C. For an example, look at this string concatenation example:

// concatenating two strings:String str1 =  String("This is a string");
String  str2 =  String(str1 + " with more");
// prints "This is a string with more":
Serial.println(str2);

Try doing that using straight C code. and you’ll see how much easier using C++ is. C++ can be complicated when trying to create complex class constructs, overloading operators, etc., but when using existing library code, it is as easy as Java or any other simplified object oriented language.

You may also read in various sources that the Arduino is programmed in C. That is not entirely correct either. Using the previous example to illustrate, it is heavily dependent on the object oriented capabilities of C++. Since C++ was designed to be backward compatible with the C language, the two terms are often thrown about interchangeable today. When it comes to programming micro-controllers however, straight C is often used because of its extreme efficiency. It is also a major point of departure with the Arduino in its use of C++. While you are free to use any of the more primitive C constructs such as you’ll find in most non-Arduino AVR programs, Arduino sketches have the distinction of using the more powerful features offered by C++. It is this use of C++ that makes the Arduino so much easier to program than traditional methods using just C.

Wiring Framework

The Wiring Framework is the other feature that sets programming the Arduino apart from other common micro-processor projects. Another minor point of distinction is worth mentioning here as well. The Wiring Framework, is not much of a framework. It is mainly just a library. A framework is a superstructure library that sits above your code, where a library is a set of already written code that you call when needed. The bulk of Wiring is mainly its extensive library. The framework portion is limited to two functions: setup and loop. Rather than calling these functions, your sketch implements them and the framework calls them. For example:

void setup()
{
  pinMode(WLED, OUTPUT);  // set pin as output
}

void loop()
{
  digitalWrite(WLED, HIGH);  // set the LED on
  delay(1000);               // wait for a second
  digitalWrite(WLED, LOW);   // set the LED off
  delay(1000);               // wait for a second
}

While the Wiring framework part is pretty basic, its two simple functions provide an excellent starting point for organizing and writing an Arduino sketch. In this example, you can see the library functions: pinMode, digitalWrite and delay. These replace complex C-based register manipulations that make micro-processor programs difficult to write, difficult to debug, and difficult to understand. It is this wonderful, high-level interface to the AVR chip that makes the Arduino such a compelling platform, and is probably what lends so much weight to the idea that it is its own language when it is really C++ with a great abstraction library.

Library Compatibility with ATtiny

Another area of concern when substituting ATtiny chips for an Arduino is whether the sketch will run correctly on the ATtiny due to differences in the library. Since the same sketch is compiled using the exact same framework/library, the concern becomes not so much a library compatibility issue, but whether the underlying chip supports the given library function. Here are some of the major differences between ATmega series chips and ATtiny ones:

Pins

Each AVR chip supports a different number of digital and analog pins. Mapping from AVR registers to Arduino numbered pins is done by the code from David Mellis github repo, and extended to support 20-pin chips in the forked version over at ProvideYourOwn’s github repo. That mapping will be covered in the next section. The following table compares the number of GPIO (general purpose IO) pins and the number of analog pins supporting analog to digital conversion.

AVR IC #GPIO pins #Analog Pins #PWM pins INT Pins
ATmega48/88/168/328 20 6 6 2
ATtiny25/45/85 5 4 4* 1
ATtiny24/44/84 11 8 4 1
ATtiny87/167 15 10 3** 2
ATtiny2313/4313 17 0 4 2
ATtiny13 5 4 2 1
ATtiny261/461/861 15 10 3 1

NOTE: The number of available ouput pins reflect those not available due to being the RESET pin, and supporting clock crystals in the case of the ATmega serias.

* While the ATtiny x5 series of chips support 4 PWM pins in hardware, the current variant definition does not.

** Two of the PWM timer outputs can actually drive up to 4 pins each. Each of these 4 pins would have the same PWM output waveform of course.

GPIO pins can be used for digitalRead() and digitalWrite(). Since all analog pins support GPIO, they are a subset of the total number of GPIO pins. For example, in the basic Arduino, it is often considered that there are 14 digital pins, numbered 0 – 13. There are actually 20, numbered 0 – 19. The last 6 pins are analog pins. For sake of clarity, digital pin number 14 is the same as analog pin number A0. Either constant can be used in calls to digitalRead() and digitalWrite(). To obtain the number of pins exclusively for digital I/O, simply subtract the number of pins supporting ADC (analog input) from the number of GPIO pins.

Another popular feature of the Arduino is PWM (pulse modulated output), expressed in the Arduino library as analogWrite. As you look at the table, there is not a lot of difference between the various chips. All the ATtinys (except the tiny13, tinyX61 & tinyX7) feature 4 PWM outputs, while the ATmega has 6.

Support for ATtiny13 & ATtinyx61 series

One last item to mention is the fact that there currently is no variant support for ATtiny13 series. The tiny13 is very similar to the ATtinyx5 series, so it would not be difficult to add the necessary code.

The tinyx61 series and tinyx7 series chips are well worth considering. With their whopping 10 analog pins, they are a real sensing powerhouse. While Provide Your Own’s github supplies these variants, they are currently untested.

Interrupts

AVR chips support two kinds of interrupts – a multi-state interrupt and a pin-change interrupt. The Arduino library only supports the multi-state interrupt through the functions attachInterrupt() and detachInterrupt(). There are only two pins supporting the multi-state interrupt on most Arduino boards, and are designated by INT0 or INT1. Most ATtinys sport only one of these interrupt pins (Int0) as seen in the previous table.

The pin change interrupt is usually available on all GPIO pins for AVR chips. While the Arduino language doesn’t support it, there are community supplied libraries that do. The PinChangeInt library is an excellent one that makes attaching interrupts to any pin desired a breeze.

Timers

The ATmega series has a total of 3 timers. Each timer has its own special set of features. For most applications, the explicit use of the timers is not required, and when they are, the spec sheets for the chip in question can always be consulted.

One of the primary uses for timers is to perform the PWM function. The number of pins supporting PWM is twice the number of timers. Each timer expresses its output on two pins – one pin is always low, while the other pin is high. In the Arduino library, except for PWM, only one timer is used – Timer 2.

On the Ardunio, Timer 0 is used for basic timing operations unrelated to PWM output. The Arduino functions that make use of this timer are: pulseIn(), millis(), micros(), delay(), and delayMicroseconds(). Timer 1 is used for the tone() function. That leaves Timer 2 free for custom timing operations. The various ATtiny chips (except for the ATtiny13) have only two timers, which provide for the exact same functionality offered in the Arduino library as the ATmega series does.

The variant file for each of these chips maps these timing functions to the appropriate timer for each ATtiny chip used. You normally won’t need to worry about which timer is used unless you need to change the timer frequency or make some other use of the timer. You can see which timer is used for these functions in the file core_build_options.h.

Oscillator

The basic Arduino boards make use of either a quartz oscillator or a ceramic resonator to keep accurate time. In most ATtiny projects, neither of these devices are used, leaving the two pins they use free for other types of I/O. In my previous table on the number of pins available, this practice was taken into account in the table. Both the ATmega series as well as the ATtiny series chips have both internal oscillators and can make use of more accurate external ones.

The use of an oscillator makes little difference in the code of your projects, other than the reduction of available pins by two. A factor that does make a difference is the clock speed your chip is running at. The default clock speed (as shipped from Atmel) for both the ATmega series chips as well as the ATtiny ones is the 8MHz internal clock with a prescaler of 1/8, which yields an actual clock speed of 1MHz. These settings can be changed my setting the necessary fuses. Most Arduino boards have them changed to use an external 16MHz clock with a prescale factor of 1.

Unless you change the fuse settings, your ATtiny projects will be running at 1MHz, and you need to make sure you select the board running at 1MHz when uploading your sketch. If you accidently choose the 8MHz board, your timing will be off by a factor of 8. If you see your LED blinking really slowly, then you will know what you did wrong.

Analog Reference

Like the ATmega series, the ATtiny series of chips offer three choices in analog reference selection – external, internal Vcc and internal 1.1v. The ATtinyx5 series offers an additional internal reference of 2.56 volts. The standard Arduino library provides support for each of these choices. In review, they are:

  • DEFAULT: the default analog reference of Vcc
  • INTERNAL: an built-in reference, depending on the chip (not supported by the ATtiny version of the Arduino library – use Internal1v1 instead)
  • INTERNAL1V1: a built-in 1.1V reference (not available for the ATmegax8 series – use Internal instead)
  • INTERNAL2V56: a built-in 2.56V reference (only supported by the ATtinyx5, ATtinyx7 & tinyx61 series)
  • EXTERNAL: the voltage applied to the AREF pin (0 to 5V only) is used as the reference.

One of these constants as passed as the parameter to the analogReference(type) function.

Communications

While the ATtiny series implement many of the same protocols as the ATmega series chips, there are some limitations. These limitations are manifest when trying to use some of the Arduino libaries. Here is an overview of each one:

  • Ethernet – this library is for connecting to the internet using the Arduino Ethernet Shield. Since it uses the SPI hardware that is part of all Atmel chips, it should work with no problem on ATtiny series chips.
  • Firmata – for communicating with applications on the computer using a standard serial protocol. Since all the ATtiny chips except for the ATtinyx313 series lack a hardware based serial I/O, I doubt this library will be usable.
  • SPI – for communicating with devices using the Serial Peripheral Interface (SPI) Bus. This library should work on all Atmel chips.
  • SoftwareSerial – for serial communication on any digital pins. This is a software implementation of serial communications. Since most of the ATtiny series chips lack the hardware for a serial interface, this library will no doubt be useful for many ATtiny based projects.
  • Wire – Two Wire Interface (TWI/I2C) for sending and receiving data over a net of devices or sensors. The ATtiny series chips support I2C/TWI, so one would think this library would work without any problems. However, this thread seems to indicate that it needs modification for the ATtiny chips. One of the contributors has provided a ported version of the Arduino library.

If any of these communication protocols are confusing, please consult my earlier article that explains the various Atmel communication protocols and their support in various chips, including the ATtiny.

Other Libraries

There are some additional libraries provided for the Arduino IDE, that I have listed below. As none of these libraries make use of any special hardware other than the basic functionality of most AVR chips, they should all work without any problems when using ATtinys.

  • EEPROM – reading and writing to “permanent” storage
  • LiquidCrystal – for controlling liquid crystal displays (LCDs)
  • SD – for reading and writing SD cards
  • Servo – for controlling servo motors
  • Stepper – for controlling stepper motors

Pinout Differences

When either designing the hardware or writing the software to drive it, there is nothing more essential than a chart showing the pinouts of the chip being used. Please bear in mind that these pinouts have been revised by David Mellis and are different from the earlier ones used in the ATtiny project. The 20-pin chip pinouts have been assigned by yours truly, and as such are in no way official. Without further fanfare, here are those charts for each of the ATtiny chips:

ATtiny Pinouts-8 ATtiny Pinouts-14 ATtiny Pinouts-20x13 ATtiny Pinouts-20x61

Note – there is a minor error in the 861 pinout (above) – pin17 should be D3/AREF (not D10/AREF).

Since the ATtiny13 currently does not have a variant file, I am not including its pinout diagram.

Conclusion

We have clarified the term Arduino language. Since this language is ordinary C++, any language constructs mentioned in either the Arduino documentation or in C++ literature will be perfectly valid regardless of the Atmel chip you are using.

The basic Arduino library, consisting of calls such as digitalWrite(), digitalRead() and so forth have been fully implemented by the Arduino-Tiny project. You can use them without concern in your ATtiny projects.

The other libraries included in the Arduino IDE are supported for the ATtiny as well. The only one that is not – Firmata – is because except for the ATtiny x313 series, serial communications are not supported by the ATtiny hardware.

The advantages of the ATtiny series chips are numerous – small package size, big capability and ultra-low cost among them. The Arduino IDE and its associated libraries enjoy a high level of support for these chips. Programming them is as easy as any Arduino. There is no reason to not make full use of them in your projects.

Feel free to make any corrections, clarifications, and contribute your own knowledge in the comments below.

 

Posted in Tech | Tagged , | Section: | Comments closed