Controlling a Fan Using PWM and Arduino

Here is how to give speed control to a regular 12V computer fan using an Arduino and PWM (pulse width modulation). This will work for other motors as well.

This is not intended to be a deep tutorial on the subject, but if you need more information you can check out the various links provided. This is mainly a quick write-up to show a friend how to do speed control on a fan that will eventually be hooked to a temperature sensor so that the fan can regulate the temperature inside an enclosed box.

Items Needed

  • Arduino (can be done with a Raspberry Pi using Python)
  • TIP122 (or adjusted for just about any Darlington transistor)
  • 1N4001 diode
  • 12V computer fan
  • 12V power supply
  • 270Ω resistor

The above items are not special or magical. If you don’t have a TIP122 transistor, you can probably make this work with just about any large transistor or MOSFET (large as in handling power as opposed to just physical size, though they often correspond). The same applies for the diode: as long as it is sufficiently large, it will probably work. The resistor size was chosen simply based on it being the one closest to my Arduino when I started the project.


I leaned heavily on an Instructables article for getting my wiring set up. Certainly check out his article for more details about the wiring if you need more than a schematic to figure this out.

Or, an even more detailed description of what we are doing (at least on a partial level) is the Adafruit article on motor control. They have lots of pictures and a great explanation. But what their article is lacking is how to power a motor that needs much more voltage than what the Arduino can provide. That is why you are reading this article.

Here is my schematic of the build.

Electrical schematic of the project.

The Build Logic

I find it helps to try to understand what is happening in the electrical path so that I can complete the build and adjust the hardware or the code. Let me try to logically walk you through what is happening. Check out the video below for a rough verbal description.

The two connections to the Arduino are ground and digital pin 9 which is what sends the PWM signal to the transistor. PWM signal goes out of the Arduino into a resistor. I’m not entirely sure how much resistance is needed for this build. It works with no resistor and I have seen builds that call for up to a 2.2 kΩ. I don’t know that the resistor value is super critical, but you should probably include one.

So far we have PWM → resistor.

Now you go from the resistor to the base of the Darlington transistor. I am using a TIP122 because that is what I had handy. This should work identically with a TIP120 (and probably dozens of other transistors).

When the base of the transistor gets power from the PWM signal, it will allow power to pass through from the collector to the emitter. Check out Adafruit’s explanation of transistors for more details.

When the signal on the base pin triggers the collector/emitter connection, the transistor begins passing 12V from the power supply to the fan. The signal on the base is making the transistor act like a switch to turn on and off the collector/emitter connection.

Therefore, we kinda have 2 separate halves to this project:

  • The low power side (Arduino side) is PWM → resistor → base → emitter → ground.
  • The high power side is 12V positive → fan positive → through the motor → fan negative → collector → emitter → ground.

Between the collector and emitter we also insert a diode. This prevents the spinning of the fan (or DC motor) from pushing power back through the transistor and blowing up the Arduino. A DC motor (which a fan is) generates electricity when spinning but does not have outside power pushing it. So when the Arduino stops sending a signal to the fan the fan will spin down and in the process create a small DC voltage. In this case it is probably not enough to matter, but it is a good habit to put a diode in place to stop the newly created voltage from traveling backwards into the Arduino. As you probably know, a diode only allows the electricity to travel one direction. We want power to travel from the Arduino to the fan but not the other direction.

Both the ground coming from the Arduino and the ground of the 12V power supply need to be tied together. You should have only 1 ground in a circuit even if you have multiple power supplies and voltages.

In my video below you also see an LED and another resistor. This is just an indicator that power is being supplied. The second resistor is 100 kΩ. Also carefully chosen because of its proximity to my workspace.

Note that the code in the video turns the fan/LED full on and full off. However, the code I provide here is full on and only about 40% off. Being able to adjust the speed of the fan using PWM is what this project is about. Therefore you can adjust the provided code to run the fan at any speed you would like.


int TIP120pin = 9; // PWM signal out to transistor on pin 9

void setup()
  pinMode(TIP120pin, OUTPUT);

void loop()
  analogWrite(TIP120pin, 255); // Run full speed (255) 
    delay(3000);               // for 3 seconds
  analogWrite(TIP120pin, 100); // Run at approximately 40% speed
    delay(6000);               // for 6 seconds

This sets pin 9 as the control pin. Then makes its pinMode to be an output. The loop turns on pin 9 at 100% speed (255) for 3 seconds and then drops to 40% speed (100) for 6 seconds.

And that’s it!

The ultimate project is to control the fan based on temperature. Getting temperature values from a digital or analog temperature sensor on an Arduino is fairly simple. It then becomes a matter of telling the fan PWM to raise or lower the speed based on the temperature.

Beginner Rubik’s Cube Method

Recently I have taught a couple of people how to solve a Rubik’s cube using a beginner method. I know there are many of these guides on the Internet (I will link to some later), but I wanted a place where I could look and find the same method each time. Putting it on my site will help me remember where I wrote this.

There are certainly more comprehensive guides. This is not intended to replace them. I don’t intend to explain a lot of what is happening with the cube and I assume a basic understanding of how the cube works for my guide. And that you can solve one side on your own.

Again, this is written down here so that I can consistently go to the same method and talk people through how to use it. (Since I don’t use a beginner method myself, I don’t easily remember these steps).

A good comprehensive guide to fill in any gaps (except where we differ on our steps) is at

Cube Notation

Hold the cube so that one face is pointed to you. You can easily understand that there are six sides with a face (F), left (L), right (R), top (called up) (U), bottom (called down) (D) and back (B). Each face will be turned 1/4 turn either clockwise or counter-clockwise.

For the beginner method you will only use the above mentioned letters to denote turns. The letter by itself indicates a 1/4 turn clockwise. That is clockwise when looking at that particular face directly. If the letter has a tick mark after it (‘), then you turn the side counter-clockwise.

A number after the letter indicates how many 1/4 turns you do. This is only ever the number 2. Because it is a half turn, it does not matter whether you turn the cube clockwise or counter-clockwise. Whichever works best in the situation.

Solve the First Layer Cross

Decide on a color to start with. I only recommend you start by solving the white side because most guides on the Internet assume you are starting with white. Other than for that reason, you can start with any side you want.

We are separating solving the first layer cross and corners though you could actually solve them together. The cross includes the center piece and all four edge pieces.

There is not much to say about solving the cross. If you can solve one side completely, then you can do the cross easily.


  • It is easier to solve the cross and then the corners as opposed to the corners and then the cross even though you could technically do these together.
  • The cross is not solved until you have each edge of the cross correctly lined up with the center piece.

Solve the First Layer Corners

Again, if you can solve one side, you can solve the first layer corners. This is an intuitive step and should be figured out. If you can’t solve one layer on your own, then this guide is not the right one for you.


Each edge and corner of the first layer must line up, color wise, with the other pieces and center pieces on each side

Insert the Second Layer Edges

Turn the cube over so that the solved side is on the bottom. Line up a center piece on what is now the top layer with a side making an upside-down T (as in the illustration). There are three possible edges that could could make the upside-down T. You want one that does not have the top layer color in it. For example, if your top layer is yellow and you are trying to make a blue T, you need a blue edge piece that does not have a yellow side. So a blue-red or blue-orange piece is what you need (on a cube with a standard color scheme).

Inserting Edge to the Left

You now have the upside-down T and need to put the top layer edge piece between the front and left sides.

U’ L’ U L U F U’ F’

Inserting Edge to the Right

You now have the upside-down T and need to put the top layer piece between the front and right sides.

U R U’ R’ U’ F’ U F

Create the Last Layer Cross

You now need to get a cross on the top layer. You may also end up with other top-layer colors in place. If starting the solve from the white face, this will mean you need to look for the yellow pieces on the top layer.

In this step it does not matter what corners are oriented properly. We are only concerned with the edges.

Corner Case

If you have the middle and two edges facing up, and those two edges are side by side (not opposite of one another) you have a corner case. Hold the cube so that the two properly oriented edges are on the left and back edges like in the illustration. In this picture you are looking at the top of the cube. You still need to solve it with the face and right sides being the unsolved edges.

F U R U’ R’ F’

Line Case

If you have the middle and two edges facing up, and those two edges are opposite one another (not side by side) you have a line case. Hold the cube so the line goes left to right like in the illustration. In this picture you are looking at the top of the cube. You still need to solve it with the front and back sides being the unsolved edges.

F R U R’ U’ F’

Dot Case

Perform both the corner case algorithm and line case algorithms one after another. It does not matter which one you do first. Just make sure you orient the cube properly between the algorithms.

Simpler (but possibly longer)

Orient the cube like in one of the cases above and do either algorithm until the cross is in the right place. You might have to do it as many as 3 times. But this requires that you only learn one algorithm.

Solve (Orient) the Last Layer Cross

The cross might be solved at this point. Meaning that you can turn the top layer (also known as the last layer) and all the edges will line up with the side colors all at the same time. More than likely though, you will only have 2 edges that line up on the proper color.

To swap the front and left side edges do the following algorithm. This means that your good edges will go in the back and right sides of the top layer. It is possible that your two good edges are opposite one another. In this case, just do the algorithm twice. The first time to get two solved edges adjacent to one another and the second time to finish orienting the top cross.

This algorithm has a name–Sune.

R U R’ U R U2 R

Last Layer Corners to Correct Slots

In this step we need the last layer corners to be in their correct places even if they are not twisted the right way. With the first two layers and the top cross solved and correctly oriented, you need to look at each corner and see if they are in the right spot. Meaning, the yellow/blue/orange corner piece is in the corner between the yellow/blue/orange sides.

You should have at least one corner that is in the right place. Turn the whole cube–not just the top layer–so that the correct corner piece is in the front-top-right corner position.

This algorithm may need to be done twice from the same orientation. Check to see if all corners are in the right spots after the first time. If not, then do it a second time.

U R U’ L’ U R’ U’ L

Solve the Last Layer Corners

Only one super-simple step away from solving the cube! While it is super-simple, it may also be the most confusing. There are a couple of parts in this step that seem to trip people up until they understand it.

To review:

  1. You have the bottom two layers solved. These are also known as the first two layers because you solved them first.
  2. You have the top cross edges oriented correctly and lined up with the correct side colors.
  3. You have the top layer corner pieces all in their right slots even if they are not twisted correctly.

If any of the three statements above is not true, then you are not ready to move on to this step.

Place an unsolved corner in the front-top-right position. Perform the following algorithm two or four times to twist that corner into proper orientation.

R’ D’ R D

After 2 or 4 cycles through that simple four-step move, you will have the corner solved. However, it may look like you have messed up the cube. Don’t panic!

Do not turn the cube, but turn the top layer until the next corner that needs to be solved is in the front-top-right corner and do R’ D’ R D again either 2 or 4 times. Keep turning the top layer (not the cube) and performing the algorithm until the whole cube is solved.

If it doesn’t work one of the following is probably the reason:

  • You turned the cube when you should have only turned the top layer.
  • You did not do the final D move in one of the many R’ D’ R D combinations.
  • You are turning the D layer the wrong direction. This is your first experience with the D layer. Make sure you are turning it clockwise and counter-clockwise appropriately based on looking at the bottom layer directly.


If not, read through the description carefully and try to figure out what went wrong. It could also be that my description does not make sense to you. There are plenty of other beginner’s guides. Try one of them to see if another works better for you.

Alternate Guides

Not every beginner’s method is the same. There are many different methods that could be considered a beginner’s one. Beginner’s guides are usually defined by having more steps but with fewer or simpler algorithms. In each step the algorithm should work even if you have to apply it several times. This is in contrast to advanced solving methods where an algorithm will solve the case each time but there may be as many as 57 algorithms to choose from in each step.

Solve the Cube’s guide is very similar to my guide, but with much better pictures and explanation.

Mats Valk’s video guide playlist. As of this writing, Valk holds the world record for the fastest human solve–4.74 seconds. However, the videos are a beginner’s method using one main move to explain the method. Very clever and might become my go-to way to teach new cubers.

Yet another guide from Ruwix. They link to more at the bottom of their page.

My Homemade Book Light

I can’t actually remember when I started my book light project, but a recent trip to the Atlanta Maker Faire motivated me to get back to some projects that I had worked on in the past but never finished. The book light was one that benefited from this renewed interest.

LED strip lights and 1/8" acrylic sheet.
LED strip lights and 1/8″ acrylic sheet.

My book light project wasn’t really as much about making a usable lamp as much as it was about learning how to work with certain materials. After buying a 5 meter roll of white LED lights for a bigger project, I wanted some simple lighting task to learn how to use them. I also had a partial sheet of 1/8″ acrylic (Plexiglas) that I wanted to do something with.

The project proposal was inspired by something I saw on Instructables. (At least I think it was there. I did a quick search and could not find it). I needed to hollow out a book then install the lights and acrylic sheet. That was the basics of the project. I also wanted to make a switch so that when the book opened it would automatically turn on the light. That switch mechanism is what delayed the project every time I got into it again.

Oh, and, as always for my projects, I wanted to spend as little money as necessary.

I got two books from a used book store that gives away books that they don’t feel have any resale value. I got two because my original plan was that I would practice on one and then I would make my final project from the nicer book. At this point, the second book light will never be made. I learned what I wanted from the project and don’t really plan to make the second one.

Preparing the Book

When gluing the pages together put wax paper between the cover and pages.
When gluing the pages together put wax paper between the cover and pages.

I closed the book with wax paper between the front cover and the rest of the book so I could glue all the pages together. This kept the front cover free from the glue I was about to apply. I painted the edges of the book with Elmer’s glue to hold them together. I think I may have fanned the pages a bit to make sure I got glue in between the pages as much as was practical and not just on the edges (I really don’t remember since it was well over a year ago that I started the project). While the book dried from the gluing, I pressed it down with other books on top. I wanted to make sure the pages didn’t wrinkle too much.

Cutting out the Pages

I figured out how much margin I wanted to leave in the book and cut everything inside that line using an array of X-Acto knives and box cutters. The variety in blades was because I kept thinking that something would make the process easier and quicker. It is just a tedious process. You should not try to cut more than a few pages at a time.

After the book was hollowed out I painted the inside of the pages with Elmer’s glue, put my wax paper back in the front cover and then weighted the book down again to dry. I don’t remember how long I let it all dry, but as you can tell, I was not in a hurry.

I painted the acrylic sheet with a frosted spray paint. I did this on both the inside and the outside of the acrylic. This helps to diffuse the lights and make a more even glow instead of seeing the harsh individual LEDs.


Cut out pages, LEDs and frosted acrylic sheet. You can see the strips of wood I added later.
Cut out pages, LEDs and frosted acrylic sheet. You can see the strips of wood I added.

I installed a little wooden strip on the inside of the hollowed out area to act as a platform for the Plexiglas. I used contact cement for this. Hot glue would have probably been sufficient. The wood needed to be about 1/8″ below the top of the book pages so that the acrylic sheet could sit flush with the pages.

The LED strip has an adhesive back that helped me to attach it to the wood strips. However, I just used very rough scrap wood and did not think to sand the strips because they would not be seen. The problem with not sanding them is that the LED adhesive back did not stick too well. I had to hot glue some parts of the strip to the wood.


The lights are 12V lights. With LED strips you have to be careful to make sure you have enough amperage to run the lights. However, since I am using such a small number of lights, I figure just about any 12V power supply that I have will be strong enough (I really should do the math and find out).

12V power supply. 5.5 mm plug and jack.
12V power supply. 5.5 mm plug and jack.

I have a box full of wall plugs (or wall warts, or AC-DC power supplies). I found one with the right plug and had a positive center polarity. Because I was wiring this up myself I could have reversed the wiring if I needed. However, what seems to be standard in the maker world (and is a standard in my personal construction) is that the center pin of an electronics project should be positive polarity. By always doing it this way I never have to guess as to how I wired a project. But you must check your power supply because they aren’t always wired this way.

Another seeming standard is the size of the plug and jack used in these types of projects. Unlike the commercial world where every manufacturer wants to have a different size plug and wiring standard, we use 5.5 mm plugs and jacks. Not the smallest, but easy to work with. Plus by using the same thing every time all you have to look for in your pile of power supplies is one with the right voltage.

A Painful Switch

The main thing that held up my project is I wanted a certain type of switch. My desire was to have the light automatically turn on when the book was opened. When explaining my project to a friend he introduced me to a reed switch. This is one that is activated in the presence of a magnet.

What I needed was a normally closed (NC) reed switch. The magnet would be on the cover of the book with the switch being near a metal plate under the diffused acrylic sheet. When the book was closed the magnet would stick to the metal plate and activate the switch. This activation of the switch would open the circuit and cause the light to go off. The normally closed reed switch allows the electricity to turn the lights on when the magnet was not close to it.

But going back to one of the premises of the project—spend as little money as necessary—I quickly found that reed switches could be had for next to nothing or be very expensive. A normally open (NO) reed switch cost about a quarter each if you didn’t go for the bottom of the barrel (the ones I bought were 11 cents each). But NC reed switches are about $2 each. I didn’t want to spend that much for a simple switch.

So the project went on hold every time I started into it again because I could not get the switch mechanism the way I wanted it. There is a fairly simple way to make an NO switch act like an NC switch using a transistor, but, the way I understand it, it uses a little bit of electrical current to not turn on the lights. If the book is plugged in and not being used it is still draining electricity. I didn’t want to do that.

Two magnets and a normally closed push button make up the on-off switch.
Two magnets and a normally closed push button make up the on-off switch.

Enter Maker Faire and my renewed interest. I dug through all the switches I have at the house and could not quite find what I needed. My friend who introduced me to reed switches said that he had an extra normally closed pushbutton left over from another project. It was much bigger than what I wanted, but I was able to make it fit the project.

Demagnetizing a Magnet

I needed more magnetic strength to close the book and push down the switch than what I had originally put into the book. So I replaced my metal closing plate with another magnet. However, because these were strong neodymium magnets, they were almost too strong to be able to open the book without tearing all the glue apart.

Book lights up just by opening it. It makes a nice reading lamp or mood lamp.
Book lights up just by opening it. It makes a nice reading lamp or mood lamp.

Did you know you can demagnetize a magnet? I found out through Google searching that you could heat a magnet and it would demagnetize it. This is because a magnet (at least a neodymium magnet) is made by heating the material inside a magnetic field. The hot molecules in the neodymium align to the polarity of the magnetic field. Keep the new magnet in the magnetic field as it cools off and those molecules are fixed in that North/South arrangement and you end up with a strong magnet. By heating the magnet outside of a magnetic field those molecule get all jumbled up and it is no longer a strong magnet. I assume this would work with any type of magnet, though you probably should not do it with rubbery craft magnets unless you like potential toxic materials filling your kitchen.

My wife cooked my magnet with lunch. 450 degrees for 10 minutes did the trick. It was still magnetic but not nearly as strong. The book opens and closes very easily now but is still strong enough to push the plunger on the push button switch.

Maker Faire Connection

I took my local librarian to the Maker Fair in Atlanta with me. She enjoyed all the different projects she saw. She went because she is interested in various STEAM programming that could be done in the library to attract young people. We have talked about me teaching various projects to kids at the library, but have not found the right project. We did know that we wanted to do something with soldering irons so the kids could learn that useful skill.

I was hesitant to take a book that I butchered into the library to show it off. But when I showed it to the librarian last week she immediately knew that is what she wanted to do for our Teen Tech Week program coming up in a few months. And, as barbaric as it sounds, she volunteered to gather the needed books and cut out the pages. I guess she would rather have the kids wielding 350 degree hot pokers than using a bunch of box cutters.

What I Learned

The purpose of this project was to be a learning experience. And it was. I learned that it is possible to weaken a magnet by heating it. I learned how to work with the LED light strips. I have even made another project since then using the LEDs—the tracing table that the book is sitting on when I took the pictures. I also learned that cutting out the guts of a book is harder than it looks. Though the switch isn’t what I originally planned, I learned that sometimes it is better to complete a project than to insist that it be a certain way and never be completed.

I also learned that not all librarians will weep at the sight of a hacked book.

My Love of Learning Did Not Begin Until After School

Math Dude podcast logoYesterday I heard a podcaster make the comment that “if you’re like me, your love of learning did not end just because you finished school.” I immediately thought, “well, I guess I am not like you.” Before I tell you how the Math Dude and I are different, let me talk about how some people’s love of learning has seemed to end.

Old Dogs, New Tricks

I know plenty of people who seem to have stopped learning because they graduated from high school or college. It is amazing—and sad—to me to see so many people who seem to have the attitude that because they are now out of school, they don’t need to learn anything else. Some even feel like they can’t learn anything new. All their learning took place in school as if it is required to have a classroom and a teacher to guide the learning process.

“You can’t teach an old dog new tricks” is one of the worst attitudes that has permeated our society. I certainly understand that some things might get more difficult with age. But the majority of the time I hear this in relation to something that a person just doesn’t want to learn. Or, worse yet, is when the person is convinced that they can’t learn.


Let’s take typing as an example, but this can be applied to so many skills and areas of learning.

How many times have you seen someone who sits at a computer all day but has never learned to type properly? I don’t know that everyone needs to learn to type 100 WPM, but most people could do better than what they do. I have friends who use two or three fingers on each hand and claim that they do just fine with typing. They refuse to try to learn to type properly because “it will take too much time to learn the right way and I have real work to do.”, “I have my own way and it works for me.”, or “I’ve tried it the right way and I can’t learn it.”

old typewriterCertainly there may be a better way to type than what we are taught in school. However, I think most typing curriculum is based in research. Using 8-10 fingers on the keyboard has to be more efficient than 4-6. Yet, if you still think that your way is better I would love to read your scientific basis for that. I wouldn’t mind learning a new way to type if it is better. Over the years we will end up doing more and more typing, not less and less. I am all for a better way.

I don’t expect everyone to learn the superior Dvorak keyboard layout, but at least learn QWERTY the best you can.

If these folks would consider how much time they would save by learning to type properly, they would understand that it is worth taking 2 weeks to learn the right way. Then they will hone their new-found skill as they go about their normal jobs.

As to “I can’t learn it (typing/language/grammar/whatever)”, who was the expert in that skill who convinced you that you were not capable of learning it? Many people with the attitude that they can’t learn something made that determination on their own and are limited by that attitude—not by their actual ability.

My Love of Learning

I don’t think I was like the Math Dude who said his love of learning did not end after school. The truth is, I don’t think mine even started until I got out of college. I somewhat remember a time a couple of years after college that I discovered the wealth of knowledge contained in books. This was before the world had easy access to the Internet.

It’s not that I didn’t have a thirst for knowledge in school, it was that I wanted so much more of some subjects and much less of others. I still don’t consider myself a lover of history, but give me a compelling historical account of an event and I will learn every detail there is to learn. I do remember in high school really enjoying physics, calculus and something called college math (it seemed to be a primer on logic that used various math disciplines as the teaching tool). Enjoying those subjects and actually getting good grades were not necessarily synonymous.

I also loved any statistic I could get my hands on concerning the Dallas Cowboys and the many great players we had through the 1980s. As often as I could, I would buy The Dallas Morning News from the gas station on the way home from school on Mondays. That gave me the best set of facts and figures from the weekend game.

So I’ve always had an intense desire to learn something, but I certainly didn’t enjoy school and having to study everything equally. I didn’t even enjoy college all that much. It was one of those things that I endured because it was the right thing for me to do.

Don’t let your love of learning die just because you are no longer tortured by a teacher and a classroom. Find something to be curious about. I just can’t imagine going through life without any desire to learn something new. I see people who have lied to themselves about not being able to learn new skills or information and I have to wonder where the fun in life is for them. I may be missing something and they may have a curiosity that I never see, but people who are curious usually have trouble containing their curiosity when talking with others.

Stay curious!

When a Traditional Publisher Acts Like a Self-Publishing Company

I always enjoy when I get a book recommendation by someone who knows what type of books I like. This happened a couple of months ago when my local librarian showed me a new book that the library just purchased. The book was not yet cataloged nor was it ready to lend, but she said that if I stopped by later that afternoon she would have it prepared for me.

The book was The Internet of Things by Donald Norris. Though I hadn’t read much about IoT, nor anything by Donald Norris, I was still excited about getting the book. The subtitle of the book got me even more excited since I am a fan of the Raspberry Pi and becoming an Arduino aficionado: Do-It-Yourself at Home Projects for Arduino, Raspberry Pi and BeagleBone Black.

PHP Error

Knowing quite a bit of what would be in the front several pages of the book, I decided to skip ahead and start reading at the first thing that might catch my eye. Unfortunately, the first thing that jumped out at me was a poorly formed portion of PHP code on page 25.

I tried running the code and was surprised to find that it worked even though it wasn’t written correctly. Since PHP isn’t a language I know well, I decided to get some help in figuring this out. I sent off a message to my PHP friend and he confirmed that the code was not correct, but explained that the reason it still worked was because there was only one error of that type in the code. The server was smart enough to compensate for the mistake but would have failed had there been another one like that.


The Internet of Things CoverI then continued to scan through the book not thinking that one error was that big of a deal. But I noticed—just 4 pages later—the text gave 2 different names for the same table when talking about setting up a database for a project. That particular section of the book asked the reader to manually create database tables from the command line in MySQL. If that last sentence didn’t make sense to you then you probably understand that this was harder than normal people usually deal with. Yet the book seemed to be written for normal people.

Because there were two different names for the same table, there was no way for the reader to accomplish the task of setting up a working database the way the text expected. This was on page 29 of a 352 page book. If the book had many more errors like this then it would be unusable…

Sticky Notes

At this point I started looking for errors. Since it was a library book, I used sticky notes to mark my findings. From page 25 to 201 (a little more than half the book), I ended up with 46 sticky notes pointing out mistakes that I found. The vast majority of them were editing and formatting errors. Because it is a technical book, many of the errors were not the kind that could be easily caught by a proofreader, but there were a good handful of those too.

It seems like this book skipped a couple of steps before it got sent to the printing press.

Back to the Library

This book is published by TAB, an imprint of McGraw-Hill. A month or so previous to this incident I had pointed out a couple of minor mistakes in another McGraw-Hill/TAB book (Hacking Electronics) to my librarian. Though nothing was too egregious with Hacking Electronics, I told her when I returned the book that I had previously noticed a few mistakes in other TAB books. When I brought The Internet of Things book to show her my findings I also grabbed Hacking Electronics from the shelf.

My librarian was eager to know what I thought about the new book. That is, until she saw that I was also carrying Hacking Electronics. She remembered my complaint about that book and knew immediately that the new book probably had mistakes in it too.

She began flipping through the book to look at my colorful sticky notes. On the first page of the first chapter she saw a style error that I had not even seen. With an average of one mistake every 3.8 pages that I found, it did not surprise me that she caught one immediately.

Contacting the Publisher

I contacted McGraw-Hill and asked if there were any corrections submitted for the book. I was put in touch with a senior editor for the division. He said that nothing had been submitted for the book. Unfortunately, McGraw-Hill does not have a system in place for the public to submit corrections like O’Reilly does.

I told the editor that I had found some mistakes in the material and said I was disappointed in the quality of the book. He was kind (or at least diplomatic), and asked me for some examples of the problems so that he could ask the author about them. My level of disappointment reached a new low at that comment. In my mind, not a single one of the errors I found were author errors.

The way traditional publishing companies work, at least as I understand them, is that the author submits the material and an editor works with them to make the material better. The few frustrations that I had with the author were because of comments like, “I showed you the right way to do this in chapter 2, but I already have this example written this way, so you modify my code to do it the right way that I showed you.” That came from page 150 of the book. (Not a direct quote but the same sentiment). While I don’t like that the author said that, an editor is the one who should have slapped the author and said, “Don’t be lazy! Fix it yourself!”

It is an editor’s job to find problems like that and tell the author to do better. Therefore, I still don’t see that as anything that the author should have to fix. He doesn’t know the problem exists. He is too close to the work. An editor is the one who is supposed to catch problems like that.


Sticky notes removed from the book when the book went back to the library.
Sticky notes removed from the book when the book went back to the library.

In response to the editor who said that he would take some examples and pass them along to the author, I told him I didn’t think that the problem were author problems. I was glad to provide some examples, but the examples were more formatting, editing and proofreading errors. I did not give him the example from page 59 where the author told the reader to write their code properly. I wanted to emphasize that, in my opinion, the problem was a McGraw-Hill / TAB problem, not an author problem.

Here are a few examples.

  • flowing line instead of following line (page 125)
  • missing space between sudo and the following word (pages 156 (twice), 166 (5 times), 170, etc.)
  • preceding table instead of following table (page 173)
  • missing colon (page 170)
  • Rasbian instead of Raspbian (pages 155 and 163)
  • MAC address not properly capitalized (page 182)
  • EEPROM not properly capitalized (page 201)

Then there are the many places where formatting is not consistent in the book. The book uses mono spaced text for code examples, but several places there is normal text within the code that will break the code if put into a program. Those lines should be normal text or set off from the code as comments.

What’s Next?

In the whole time I communicated with their editor, I felt like I had a listening ear. However, he kept insisting he would talk to the author about the things I found. Without trying to be too unkind I told the editor that I didn’t think the author was responsible for the majority of the errors, “unless McGraw-Hill/TAB is a self-publishing platform and the author is responsible for doing his own editing and layout work.” After that comment I didn’t hear from the editor for another month until after I sent 2 more emails asking if the line of communication was still open.

Though I only sent the editor about 1/3 of my findings, he didn’t seem to want any more. Of course, I also didn’t want to spend much time doing, for free, the work that McGraw-Hill is already paying their staff to do.

At this point I think I have reached the end of what I can do with my contact at McGraw-Hill. I really want them to continue to put out books on subjects like this. This is the kind of book that gets me excited to go to my library. But, if technical books, from a publishing house that is a major player in textbooks, have so many errors in them that the information is not usable, then I am not sure I want to read them.

I know it sounds like I am being nit-picky about the book, but I really never even fully read it and I found all these mistakes. I only skimmed through looking for things that caught my eye or sounded interesting to read. There were huge sections of code that I completely overlooked because they were in languages that I didn’t know. So unless I was actually trying to do the project, I didn’t need to try to understand how it worked.

The thing that bothers me most about all of this is that my library has been given no assurance that they can confidently buy a McGraw-Hill / TAB book that will be better edited in the future (an assurance I asked the editor to give me on several occasions). I also don’t feel like I got anywhere with the publisher. As I said, the editor I talked to was kind, but his responses were very political. There was no commitment to assuring me that this was a one-time case.

My hope is that there will be an improvement in their process and that I can confidently enjoy books by publishers like McGraw-Hill. But when traditional publishers begin to act like the self-publishing companies they seem to detest, they lose their authoritative position in the market through laziness.