This is day zero of my Month Of Writing

Controlling an Arduino project over a serial connection is one of the most common tasks you might want to do, and yet it's surprisingly hard to find a good library. I really don't like the official ones because they are limited and require too much setup. After much googling with Bing I found one called CmdArduino by Akiba at Freaklabs.

CmdArduino does exactly what I want, minus a few tweaks. I emailed Akiba about it. Even though he had never done an update to the library in three years he responded right away. I asked if I could take over the lib and he said yes! So I'm now the official maintainer for CmdArduino. For my first release I've added Stream support so it will work with more than just the regular Serial port; very important for working with alternative streams like Bluetooth LE modules.

CmdArduino is super easy to use. Create your command functions with a signature like:

void left(int arg_cnt, char **args)

Then register it like this:


Now the left function will be called whenever you type 'left' into the other end of the stream. If you add arguments after the command they will show up in the args array. At OSCON I build a robot controlled by a chat app on my phone over BLE. When I typed in spin 3000 the robot's spin function would be called with the value 3000 for the duration. The code looks like this:

void spin(int arg_cnt, char **args) {
    int time = 1000;
    if(arg_cnt > 0) {
        time = parseInt(args[0]);

void setup() {

It's that easy. The code is up in my github repo now.

Thanks Akiba!

I’m happy to announce Electron 0.2. We’ve done a lot of work to improve the compiler and library tools. The biggest news is Windows and Linux support. Also, you don’t need to pre-install the regular Arduino IDE anymore. Electron will auto-download it’s own copy of the required toolchain. Here’s the details:

  • Initial Windows and Linux support!
  • You don’t need to modify settings.js anymore. Electron will auto detect your Arduino/Sketchbook dir.
  • You don’t need the regular Arduino IDE installed anymore. The appropriate toolchain will be auto-downloaded for you the first time you compile something.
  • User installed libs work now. Note that user installed libs take a priority over libs installed by the IDE.
  • the serial port will be automatically closed and reopened when you upload a sketch. If this crashes your computer please let me know. I might need to increase the timeouts.
  • Preliminary support for auto-detecting which board you are using by the USB VID/PID. Special thanks to PixnBits for that.
  • Set the serial port speed
  • Sketch rename works now
  • download progress is shown in the browser (partially)
  • tons of under the hood fixes
  • auto scroll the console

The arduino-data project was also updated with new boards an libraries:

  • New boards: TinyLily and Gamebuino
  • More networking libs: CmdMessenger, OneWire, PS2Keyboard, SerialControl, SSoftware2Mobile, Webduino
  • More specs on various boards
  • The rest of the built in libraries: Ethernet, Firmata, GSM, LiquidCrystal, SD, SoftwareSerial, TFT, WiFi
  • Support library sub-dependencies

Thanks to contributors:

  • Dan O’Donovan / Dan-Emutex
  • Nick Oliver / PixnBits
  • Sean McCarthy / seandmcarthy
  • trosper

You can get the latest code on the github project.Please test this with every board and OS you have. File bugs in the issue tracker.

I’ve registered a domain for Electron,, though don’t bother going there yet. I haven’t built the website. If anyone is a talented webdev who’d like to help with that job, please contact me.

I’ve you’d a sneak peek of the next version of Electron, check out the mockup here. It’s got a new library picker, a proper tree based file picker, and resizable panes. It still needs a lot of work before it can go live, but this will give you an idea of where we are going.

Thank you, and keep on testing.

I love the Arduino platform. I have official boards and lots of derivatives. I love how it makes hardware hacking so accessible. But there’s one thing I hate: the IDE. It’s ugly. It’s ancient. It has to go.

Sure, I know why the IDE is so old and ugly. It’s a hacked up derivative of an older IDE, written in a now-deprecated UI toolkit. Fundamentally, the Arduino guys know hardware and micro-controllers. They aren’t desktop app developers. I suppose we should be happy with what we have. But I’m not.

My previous attempt

About two years ago I created a new IDE built in the same UI toolkit as the original (Java/Swing for those who are interested). It worked roughly the same but looked better. It had a proper text editor (syntax highlighting, line numbers), better serial port and board management, and a few inline docs, but basically worked the same; just some UI improvements.

I posted my new IDE on the Arduino forums and got almost no response. Pondering this for the past two years I realize this forum was the wrong place to launch a new IDE. The people there are experts. They are happy enough with their current tools that they don’t want to switch. They are experts. They don’t need all of the improvements that a better IDE could provide, like inline documentation and auto-library-installs. They are also more likely to simply use a general purpose IDE. I’ve done this myself and it works okay, but I’m still not satisfied. Arduino is special. It deserves better.

As the Arduino platform grows it needs a better out of the box experience. We have more and more novices hacking for the first time. We need an IDE that is truly top notch. Something that is custom built for Arduino, and the tasks that you do with it.

Some have asked me, “What do you want to do that the existing IDE doesn’t already?”. That’s a good question. If we are going to seriously invest in something new then we need some good reasons. Let’s start with the basics: installing libraries and boards.

Library management

Right now you find a library somewhere on the web, download the zip file, and unzip it into your ‘libraries’ directory. You do all of this outside the IDE even though you will be using it inside the IDE. Next you need some docs. There is no standard for the docs, but there’s probably something to read on the website you got the lib from. At least there are some examples. Oh, but they are buried deep inside a menu.

Now suppose it’s a month later and you are working on a new sketch. Do you remember all of the libraries you have installed? How do you search for them? Do you have the right versions? Do they work with all of your Arduino boards or just some of them.

It’s the year 2014. Why can’t the IDE just already know about the libraries out there. It should let you search for them by name or keyword. It should let you search through the example code. Once you find the library you need it should install it for you automatically. Where does it go on disk? Who cares?! That’s the IDEs problem. Finding and installing a library should be a single button click (or maybe two clicks if we are picky).

Board management

The many Arduino boards are listed in a nested menu, derived from the boards.txt file. This text file is only updated when the IDE itself updates, which isn’t very often, and the list isn’t comprehensive anyway. If the board you need isn’t listed then you have to add it manually, outside the IDE, duplicating the effort of other developers everywhere. Why can’t the IDE just fetch a list of all boards from the internet somewhere; a list updated by the actual vendors of those boards, so it’s always up to date.

This list of boards actually contains quite a bit of useful information, like how much RAM is in that board. However, this information isn’t actually shown anywhere. It’s only shown to the compiler. The IDE should give you full specs on your chosen board right on screen so you can refer to it whenever you want. Furthermore, the IDE should have extra board info like the number of pins, the input and output voltages, and if we are being generous an actual pinout diagram! All of this information is available on the web, just not in your IDE.

The IDE should just do all of this for you. Choose your board from a gigantic list downloaded from the internet. This list includes detailed specs on every known board, updated as new boards are made. You can refer to the board specs in a side pane, and even correlate the pins in your sketch with the pins on the board reference. This isn’t rocket science folks!

So you can see, there’s good reasons for a new IDE. This is before I’ve gotten to forward looking features like a built in Firmata client or data analysis tools. It’s time. Let’s build this.

Now for something completely different

Two years ago I tried by recreating the IDE in the same form. Now I want to do something different. I’ve started a new IDE completely from scratch, written in NodeJS and HTML. While it does use web rendering it won’t be a cloud based IDE. It will still run locally as an app, but using newer GUI technology than Java Swing. Don’t worry, you’ll have a proper app icon and everything. You won’t know it’s NodeJS underneath. It’ll just be a nice looking GUI.

Since it’s a back to basics effort I’m calling this new tool Electron, the fundamental particle of electronics.

So far I have basic editing, compiling, and uploading working for an Uno. I’ve also built a system for getting installing libraries and board definitions from the Internet using a git repo. This separate repo will contain a JSON file for every known library and board. Currently it has the basics from boards.txt and a few libs that I use, but more will come online soon. If you want to help, adding to this data repo is the easiest way to start. Pull requests welcome.

Electron IDE repo

Arduino Data repo

Here’s a rough screenshot. The GUI will greatly change between now and the 1.0 release, so just think of this as a guideline of the final look.

If you are a Node/HTML hacker please get in touch. There’s tons of work to do. Even if you are just an Arduino user you can help by providing feature requests and testing, testing, testing.

Thank you. Let’s bring Arduino development into the 21st century.

SparqEE's Cell is a just launched Kickstarter project to build a GSM data module ready to integrate with Arduino, Raspberry Pi, or any other embedded hardware kit. In addition to the cellular board they are also offering SIM cards with discount data service; a first in the projects I've looked at.

Chris Higgins, one of the SparqEE founders, graciously agreed to answer a few questions about the project and their vision for how the Cell will be used. Enjoy!

Josh: Hi Chris. Before we talk about the Kickstarter project and Cell, could you tell me a bit about your company. Where did the name come from and where are you located?

Chris: SparqEE is a Southern California company that is “of the people, by the people, for the people,” if I may borrow those words from President Lincoln. We created SparqEE to make great technology that helps the world but also to change the game - in our society, money is horded by few when it’s the workers who drive companies - SparqEE shares all equity with our team. Anyone who wants to be involved and works hard will get a slice of the pie.

My 7 years in the defense industry was very demoralizing because even though I always delivered, successfully ran projects, attained patents, and innovated continuously, my income was fixed. But now with SparqEE, the harder we work the more benefits we reap.

Josh: How did you found it and find your co-conspirators?

Chris: It started back in 2009 when I was running a transportation based R&D project, I met my co-founder when meeting with the University of California, Riverside’s Center for Environmental Research and Technology (CE-CERT) team. We immediately recognized each other’s talent, had a phone conversation and talked about working together, and then in early 2010 made it official and started SparqEE.

Both co-founders are electrical engineers with a heavy background in programming, hardware, and networking so we wanted to write that into our name with “Spark” being related to electricity, the blood of technology.

Now our team has expanded and includes people we’ve worked with in the past, people we’ve met at MeetUp events, others from CoFoundersLabs – good people are everywhere, you just have to look and get involved!

Josh: What other products have you created? What other products will you create?

Chris: As for what we’ve created already and what we’re focusing on, it's vehicle telematics. We already have some history making a device for Raytheon and Oregon DOT but will be expanding that line greatly – we’ve got some fun stuff coming out for the car buffs out there! We are bootstrapping a few different directions but Telematics is one we’d definitely like to focus on.

Josh: Tell me about the Cell, your Kickstarter project. What can it let me do that I can't do with a typical Arduino?

Chris: The CELLv1.0 actually easily plugs into an Arduino, Raspberry Pi, or other breakout board – just take a look at the available shields. So right out of the box you can send messages over the cellular network.

If you take it one step further and look into the very minimal selection of cellular dev kits out there, you’ll soon realize the real reason for launching this Kickstarter.

On face value, the CELLv1.0 hardware is simply much more compact and less expensive than any other option currently on the market, but it’s the other facets that are the real differentiator, the entire ecosystem SparqEE has setup is where the value is:

  • Price: definitely an important aspect as we're driving down the price of not only starter kits in the cellular arena but in production systems too. The CELLv1.0 is definitely the least expensive dev kit currently on the market.
  • Servers: We're offering our servers for use by the community so that users don't need to know anything about the server-side, all they see is the CELLv1.0 attached to their Arduino or Raspberry Pi, then the reception of that data at their internet enabled device.
  • SIM: With the CELLv1.0 users can use their own SIM straight from their smartphone, a prepaid one, or the SIMs we set up for this Kickstarter which are actually one of the most beneficial pieces of this project and for the community at large.

With M2M (machine to machine) applications and anything cellular really, the providers are one of the biggest hurdles. Since our goal is to make cellular as ubiquitous as Bluetooth and WiFi we needed to take care of everything, including the providers. So we put together a SIM card offering that works anywhere in the world, is the easiest to setup, no minimums, and is the lowest cost I've ever seen - check out for more info.

Josh: I see that some of the reward levels include Dev Points. What are dev points and what can I do with them?

Chris: If you take a look the Kickstarter project under the section titled “Reward Levels” we list a number of possible breakout boards, such as GPS, accelerometer, and relay, as well as shields for the Arduino and Raspberry Pi. Then, we assign a number of “Dev Points” to each one – so essentially you just add up the number of dev points for the rewards you want and select that purchase level.

Josh: Why did you go with dev points instead of traditional Kickstarter rewards?

Chris: Kickstarter rewards always seem to have way too many options and variations. The “Dev Points” is our attempt at simplifying the choices. Since our project offers a number of optional breakout boards and shields, we wanted people to easily be able to select whatever they wanted without having a million reward levels for every combination – as an example, if someone wants a relay board and accel board, all they have to select is 2 dev points under the rewards and that’s it!

Josh: Does this really work with Arduino out of the box? Can I use the regular Arduino IDE with it?

Chris: Yes, definitely. As we progress we’ll be having simple and quick explanations and examples showing you just how to connect all the hardware and the code to use. For the Arduino, if you get the Arduino shield along with the CELLv1.0 simply plug CELLv1.0 into the shield and then onto the Arduino, plug-in power, open up the Arduino IDE and you’re off – right out of the box without any extra components!

Josh: I'm confused by why there is a separate cellular board and jumper board. What is the advantage of making it two pieces?

Chris: The Jumper board is mainly for development and not meant for production systems (although you could use it for that). The main point of making it a two piece is to allow people to affix the small Cellular board to any product whether development or production.

To give a bit of insight into the cellular industry – the certifications are very stringent and expensive (~$30k), so by creating and certifying the small Cellular board, it allows others to use this module in their final products without having to go through the whole recertification process.

Josh: What do you think people will do with the Cell once they get it?

Chris: People have already been writing in to tell us about what they're going to do with the CELLv1.0 from tracking their bike for theft protection to real-time updates while racing. Others have mentioned plugging this into their BeagleBoard and thus expanding the capabilities of yet another very useful development platform.

Some ideas we came up with at SparqEE were a vehicle tracker and engine kill switch, a device that could open doors, turn on lights, and control temperature at a remote cabin or beach-house, and even early warning systems looking for heat signatures of forest fires or earthquake monitoring.

The possibilities really are endless with this component, but my favorite idea is to make a remote quadcopter to hold my Canon 60D. I really like photography and videography and with the CELLv1.0 I could fly across the city and snap pictures or take video of anything, anywhere.

The SparqEE CELLv1.0 steps in wherever there is a project that is simply out of reach using Bluetooth and WiFi.

Josh: SIMs for GSM data aren't cheap. Typically you need a full plan like the kind you'd have on your cell phone, right?

Chris: Yes and no. You do need a SIM card with a plan, similar to your cell phone, and they are typically expensive but we’ve solved this one too. With the CELLv1.0 you can use the SIM straight from your phone, a prepaid one, or the SIM card offering we put together for this project. We’re able to provide SIMs that work anywhere in the world, are the easiest to setup, no minimums, and are the lowest cost we’ve ever seen! - Check out for more info.

Josh: How are you able to make your own SIM cards be so cheap? Is there a monthly fee in addition or is it just cents per kb?

Chris: There are no additional monthly, yearly, or whatever other fees. We do have to charge once for the SIM card itself and activation, which comes out to less than $10, but past that there’s nothing more than the cost for data or SMS usage that you need. What you see on our page is really the extent of the costs.

As for how we’re able to offer these plans and prices, it’s because people believe in SparqEE and Kickstarter and want to see M2M flourish as much as Bluetooth and WiFi have. With affordable SIM cards, a whole new range of applications is enabled.

Josh: When will the SparqEE SIMs be available?

Chris: Since we’ve garnished so much positive feedback for our SIM offering itself, we’re working to get it up and running for the Kickstarter launch so people that need SIMs will be able to get them with their CELLv1.0.

Josh: The page mentions integrating the Cell into a product. Does that mean I could order a bunch of the boards from you for a discount? When will that be available?

Chris: Our first objective is to deliver to our supporters through Kickstarter – if you believe in our goals and support us through Kickstarter, our first priority is you. Only after the Kickstarter rewards and ecosystem are delivered and setup will we offer units for sale. At that point we imagine people would be able to order either the Jumper or Cellular boards or both, but as far as price is concerned we’re comfortable saying that if you pick up a CELLv1.0 and some dev points through Kickstarter you’re getting a great deal, a deal that won’t exist later. We appreciate the Kickstarter community and the early funding they’re providing.

Josh: Why did you choose to go with a Kickstarter instead of other funding routes?

Chris: I doubt you’ll be surprised to hear that investors aren’t all that interested in spending money to help the technological community nor thin margins. Kickstarter is a great way to get initial seed for an idea, a little bit of PR, giving you maybe just enough to be noticed if you need another round. But in our case, we believe Kickstarter will provide enough capital infusion to actually allow us to bootstrap our next iterations, circumventing the investors entirely.

Josh: When can we expect a followup project from you guys? Cell 2.0 maybe? Anything else on tap?

Chris: We’ll have follow-up projects coming up right after the CELLv1.0, maybe not on Kickstarter, but we’ve got ourselves a roadmap which includes using the CELLv1.0 on 2 other projects. People can "Like" our Facebook to get our updates! But really, we don’t imagine that the CELLv1.0 will need to be upgraded for tens of years – 2G is only just being phased out by AT&T by 2017 so 3G support will last for a great while and the CELLv1.0 will still dominate in both the 2G and 3G spaces.

Josh: What's the one question I should have asked you but didn't?

Chris: How about how we came up with the idea for the CELLv1.0? We were working on the Keychain Tracker project and thought it would be easy to get a small, inexpensive cellular module, SIM and integrate it – we were dead wrong. So, we saw that the industry needed someone to come in and minimize the pain for everybody out there and help make cellular technology and SIMs, or what amounts to relationships with cellular providers, more readily available. Thus the Kickstarter project was born.

Thank you Chris. Good luck to the whole SparqEE crew. Go check out the Kickstarter project and the SIM pricing now.

I know it's been quite a while since I've posted. I have no defense other than to say I have an 18 month old baby. Toddler on the move 24/7 makes for a very tired daddy.

Last night I gave an intro to Arduino talk for our local tech meetup. My research work at Nokia has involved building hardware prototypes to test out ideas, so I've gotten to learn a lot about embedded hardware of all shapes and sizes. Arduino is clearly the leader in this area, making hardware hacking more accessible than it ever has been.

I won't try to recreate my talk here. Such things are better in person. Instead, here are links and descriptions of the many cool Arduino libraries and products we covered.

Arduino and Clone Boards

Because Arduino is an open hardware platform anyone can take the schematics and build their own compatible boards. Wonderfully, this has resulted in a huge variety of available hardware for purchase as very reasonable prices. Here are a few of my favorites:

Freeduino Leo Stick The LeoStick is another small USB enabled Arduino. This twist with this one is that it has tons of IO and has the USB connector integrated into the PCB, meaning you plug it directly into your computer without any extra cables. It's perfect for bit bashing. Stick some sensors into the pins and start writing code. An ideal prototyping board.

DigiSpark DigiSpark is a Kickstarter project I recently backed. They are a local company (Portland Oregon) building what they call "an Arduino so cheap you can afford to leave it in your projects". The boards are cheap and tiny, with a slew of attachments to snap on top. They haven't shipped their first production run yet, but they expect to before Christmas.

SeeedStudio's Seeeduino Film is a thin and flexible Arduino clone with a built in LiPo (battery) charger and a chainable communication bus. They are great for wearable projects or tight spaces.

Adafruit's DC Boarduino The DC Boarduino is made specifically for breadboard work. Long and thing with pins the right distance to drop right in the middle of your breadboard. I love it for prototyping new circuits.

ExtraCore A tiny arduino on a board, less than one square inch. I'm using one for my alarm clock project. Works great.

The JeeNode is my new favorite Arduino clone. It is small, very power efficient, and has a built in wireless module. You can be sending wireless data in just a few minutes with these little guys, and they are super cheap. US residents can buy them through Modern Device

Makey Makey
Makey Makey isn't your traditional arduino. You can start building fun things without any coding at all. Just hook alligator clips up to things, plug the board into your computer, and start making things happen. It's hard to explain with words. Just watch the short video. You'll be hooked.


Here are a few Arduino accessories I've purchased and really enjoy.

The 12MM LED strips A strip of bright diffused RGB LEDs. These are amazing. You can control each LED "pixel" independently and they chain together without using extra pins. (You can also split them into multiple shorter strands). Adafruit's open source library makes it trivial to code with these. I plan to use them as my Christmas lights this year. 40$ for a strip of 25 LEDs.

Easy Driver Stepper Motor Driver I've been using these for my home built CNC machine (still not finished) and I love it. Very easy to work with and quite affordable.

RedPark iPhone serial cable If you need to have your iPhone communicate over a serial port, these cables are pretty much your only option. They come with an iOS library to make serial communication quite easy.

Amazon has the Getting Started with Arduino book on sale for $8.26 , written by one of the Arduino founders Massimo Banzi. Free shipping if you have amazon prime.


My new Arduino IDE: ArduinoX

While I love the Arduino Platform I hate the official IDE. It's not really bad, just extremely dated. It clearly looks like a hacked up Swing app which was written by someone who doesn't write client side Java for a living. After trying to fix a few bugs I decide to write my own with a modern UI. My new IDE (currently codenamed arduinoX) has a better editor, nice fonts, built in examples and docs (still prototypes) and in general tries to address long standing usability problems of the official IDE. It still uses the same compiler toolchain underneath so no code changes are required. It's just a better coding experience.

You can get the latest build for Mac or Windows here

Have a Happy Thanksgiving!

Disclaimer: I did not pay for many of the books I review here. One of the perks of being an O'Reilly author is easy access to free copies of almost everything O'Reilly publishes. However, all of these reviews are freely done of my own initiative. I choose the books I review and I receive no compensation other than the free copy. These are my own opinions and do not reflect the opinions of O'Reilly or my employer Nokia.

The Arduino Cookbook, by Michael Margolis

When you first begin hacking with Arduino, as I recently have, you will most likely spend the first few weeks scouring the Internet for information. The Arduino system is so cheap, powerful, and flexible that you will immediately think of a million things to do with it. This can be a problem. Not only do many of us lack the time to build every project we've dreamt up, but using just the web for information is problematic. The docs on are great for introductory topics but I quickly found my self at its limits. As a software guy I need to know not only about Arduino itself, but sensors, components, 3rd party libraries, and power systems. In short, I need a complete electronics background to fully use my Arduino board. That's where the Arduino Cookbook comes in.

The second edition of Arduino Cookbook, by Michael Margolis, was recently published by O'Reilly. In my opinion this is the best one stop shopping source for Arduino information. It is not a pure introductory tome, though the first chapters do give you a quick review of Arduino to keep you up to date. The bulk of the book is organized around functional topics; things you would actually want to *do* with your Arduino.

The first few chapters cover the Arduino language, math, serial IO, and basic switches. Though it was not hard for me to pick up the Arduino language (essentially a simplified C++), these chapters covered a lot of finer details I had missed when reading the online docs. Each chapter is structured as a series of how-tos such as "Shifting Bits" and "Using a Switch Without External Resistors".

Later chapters cover specific topics like Getting Input from Sensors, Physical Output, Audio Output, and Wireless Communication. I really like that each how-to section not only shows you how to complete the task at hand but also gives you background into what is really going on. This is especially useful when you reach advanced topics like driving motors. The book gives a background of different kinds of motors, how they work, and how they are controlled before diving into specific tasks. This structure gives you a great electronics primer as you learn the ins and outs of Arduino.

If you buy only one book on Arduino, make it this one. It gives you everything you need to get the most out of your hacking endeavors.

on Amazon, paper and Kindle


direct from O'Reilly as paper, ebook, or no-DRM PDF

Building my own CNC machine has been quite an educational experience. I've got a better idea of what I'm up against now, and have plans for moving forward.

Lessons Learned so Far

First. Hardware is hard. Much harder than software. I expected programming or wiring the electronics to be the difficult part, but thanks to good docs and helpful Arduino libraries I was able to get basic movement going pretty quick. The biggest challenge has been the mechanical construction of machine. I've gone through several iterations of the pen mount, sliders, and lead screw attachments but there is still much more to do. Software is so much easier to modify and test out new ideas. Creating a new slider took several hours to design, build, and test.

I have also learned how much of hardware success is based on component sourcing. Throughout this project I have added to a growing list of good online shops to getting interesting pieces; and how to repurpose unexpected materials like plumbers tape. I also learned that Amazon Prime is your friend. I honestly don't know how Fedex can make any money off of them.


So far I'm happy with the progress I've made on my CNC machine. I can now make a pen move in the X and Y directions with a fair amount of repeatability. The machine is a good test of ideas but not reliable enough to actually use yet. The biggest issue is tightness. Everything in the CNC machine has some slack in it. Each component of slack multiplies to make the pen slide all over the place; and a sliding pen means bad drawings. So that will be the main driver of the next version: making it super tight.

The other night I designed a new slider. It still uses roller skate bearings but applies them to the support beam from three sides instead of two. It also uses more rollers spaced further apart. The new sliders greatly improve stiffness without adding too much friction.

To remove the stickiness of then pen I realized I need a way to press the pen into the paper but still have some slack. This calls for a spring. After reading work that others have done I devised a new holder using two ballpoint pens. They are, interestingly enough, identical pens but with different brands on the side. Most likely from the same swag manufacturer. If you attend conferences you likely have tons of these guys lying around.

By combining two pen barrels and putting a spring at the top I can get the pen to sort of float in the middle but pressed against the bottom end. The spring pushes it against the paper but lets it slide up when needed. It acts sort of like a tiny shock absorber. Good enough for this version.

On the electronics side I finally mounted the various boards on a sheet of plastic. Using my Dremel drill press I set them up on inexpensive spacers from the Robot Shop. I also gave the steppers proper four pin connectors from Adafruit since I'm always plugging and unplugging them. The drivers still have some breadboarding to get rid of, but things are improving. I also added a real power switch for the motor current instead of having to constantly unplug the wall wart.

On the software side I wrote some new Arduino sketches using the excellent open source library AccelStepper. It handles acceleration and multiple steppers with ease. Now the motors sound like engines powering up.

NES Controller

Oh yeah; my teaser from before. The NES Controller.

I found two original NES controllers at our local electronics recycling shop for five bucks each. I love these things. These two are probably over 20 years old and they still work perfectly. Nintendo designed them to be bullet proof. (Sadly their design of the cartridge connector was not so well thought out).

The controllers use a simple serial protocol over their five pins. You can hook them up directly to an Arduino using jumper wires but I found an NES breakout board (Robot Shop) to give it that nice finished look. The software side is easy using the NESpad library. Note that this code is a few years old and won't compile out of the box. I suggest using my fork of the lib which is patched to compile with Arduino 1.0 and higher.


Every good project needs a name. I'm tired of saying "my CNC drawing machine thingy" over and over. Thus I dub thee "Clyde" after the orange ghost of Pacman fame. Apparently his other names are (translated from Japanese) are "stupid", "slow guy", and "pokey". Fortunately Clyde is easier to pronounce than Guzuta and Otoboke. He may be slow but he tries really hard and gets the job done.

Next Steps

I'm going to take a week off from Clyde during my parents' visit. Instead we will play with Jesse and finish up some house projects. When I return I will build a new machine over twice the size of the current one: 40cm x 60cm x 10cm. This is big enough to do some real work while still able to fit on my desktop. My latest extrusion order from OpenBeam is enough to build the new machine with plenty left over for reinforcement and experimentation. Have a good weekend!

As regular readers know I have recently jumped into Arduino and hardware hacking full-time. One of the things which fascinates me is the idea of monitoring our environment. I mean not only the global environment but also our own local spaces. Sensors and computation are incredibly cheap. Network access is almost ubiquitous. This means we can easily monitor our world and learn interesting things by analyzing simple data points over time.

Being an engineer I started by picking out some books to read. First up is an amazingly thin but info-packed tome from Maker Press: Environmental Monitoring with Arduino: Building Simple Devices to Collect Data About the World Around Us by Emily Gertz and Patrick Di Justo. As the name would suggest, it is exactly the book I was looking for.

Before I continue I must warn you, reading this book will make you spend a lot of money. You will find yourself spending hours checking out cool sensors and outputs on websites like Adafruit, SparkFun, and Emartee. Tracking your environment with simple sensors is simply too intriguing. I apologize in advance for the new habit you will form.

Though short (81 pages by my count), Environmental Monitoring with Arduino contains a lot of information. It starts with a chapter called "The World's Shortest Electronics Primer" introducing Arduino, basic electronics, and then runs through an LED blinking tutorial. From here you jump straight into your first sensing application: a noise monitor with an LED bar graph.

The book is organized in mostly alternating chapters. Each chapter either introduces a new piece of hardware or a project using that hardware. The chapters cover how to measure electromagnetic interference, water purity, humidity / temperature / dew point, and finally atomic radiation as used by individuals in the wake of the Fukushima disaster.

The components required to build most of the projects in the book are surprisingly cheap. For example, Emartee's mini sound sensor, a tiny board containing a microphone and the support circuitry, is only seven dollars.

The only really pricey component is the Geiger counter from Goldmine that costs $137. Of course it uses a special beta and gamma ray sensitive mueller tube from Russia so it's actually fairly cheap. Most components are under $10.

While I love the book there are a few things that could be improved. Each chapter contains a few paragraphs explaining what we are measuring and how it works (water conductivity was especially interesting), but I'd like to learn more about the science behind each effect. This probably isn't possible in a book of this size, so links to external websites would be greatly appreciated.

I'd also like an appendix with links to learn more about Arduino and environmental sensing, as well as a list of sites to buy cheap components that are easy to work with.

Finally, there is no information on the authors. Most books include a short bio or an introduction by the authors to explain who they are and why you should listen to them. This book contains no biographical information at all beyond the authors' names.

Go - No Go?

A definite go.

If you are new to environmental monitoring this book is a great place to start, even if you know nothing about electronics and Arduino. And for the price ($7.99 for the print copy and half that for ebook) it's a steal. You can get it on:

This is part 2 of my N part series on building a DIY CNC machine. If you missed it, here is part 1.


One of the trickiest parts of building a CNC machine is the linear sliders. Each axis requires a rail to slide the carriage on. This is called a linear slider. The sliding mechanism must have very low friction but also be strong to support the weight of the other axis and the head (which could be as heavy as a router). The carriage must also grip the slider tightly to ensure it doesn't slip or turn. The accuracy of the final CNC machine is directly related to the quality and tolerances of the slider. Needless to say, professional slider mechanisms aren't cheap.

After researching what others have done I decided to build my linear sliders out of OpenBeam using #608 roller skate bearings. Skate bearings have a few advantages: they are produced in mass quantities so they are pretty cheap for the quality you are getting. They are also usually sealed to keep out road dirt, so they can handle any debris the CNC might produce. And, because they are a standard size, getting parts to fit them is fairly easy. Here's a quick look at two versions of my bearings.

Skate bearings typically start at 1 USD each in sets of eight and go up from there. However, if you can afford to buy a lot at once you can get them as cheap as 50 cents a piece. I purchased my bearings from Amazon as a pack of 100 for 50 USD. A CNC will end up using at least 20 bearings so it's worth going for the large pack.

To attach the bearings to the beam I used long M3 screws from my local hardware store, about 20mm. Of course the inner diameter of the bearings (the bore) is much bigger than the diameter of the screws, so I needed to fill in the space.

After playing around with a variety of spacers, sleeves, and bushings I found a combination that would work, as depicted in this photo:

This works and is what I used in the current version of the CNC machine, but it has a few disadvantages. The nylon parts are longer than the bearing is wide so I had to trim them by hand. Plus there is two of them needed for each bearing, which adds cost and assembly time. I also had to add some washers to prevent the screw head from going through the center and to give more space between the beam and the bearing. Not bad for a first try, but I need something better.

Some searching on Amazon turned up some better pieces:

This bearing assembly uses a slightly shorter screw, 16mm (also in cool anodized black). I also found spacers that the were the perfect length, no trimming required. The interior diameter is perfect for the screws. the outer diameter is a tight fit in the bearings but I can pop them in easily with pliers. Since they fit in with friction I don't need to worry about washers to hold the bearing on. To give more space I used some of my standard M3 nuts. Since I already have to buy tons of them they are cheaper than washers, and adjustable to boot. Score!

I'm learning that creative sourcing and constant redesign is the only way I will reach the 200 USD goal.

Shaft Coupler

The next big challenge for a CNC machine is attaching the lead screw to the stepper motor. I would think this would be easy. I would be wrong.

The lead screw needs to be attached to the stepper motor securely so it won't slip, but it also needs a bit of flexibility to absorb vibrations. The two shafts also must be perfectly concentrically aligned or else the carriage will bounce up and down. Doing all of this for a decent price is very hard. Commercial solutions run 30 USD per shaft coupler.

I found several people online who use rubber tubing with clamps. Unfortunately I found the tube around the stepper shaft was too loose. If I tightened it with the clamp then the shaft would never be concentric with the lead screw.

My next attempt is what you see in this photo:

I used two pieces of tubing, one nested inside the other. The smaller tube is shorter and only goes around the stepper shaft. The larger tube contains the smaller tube as well as the leadscrew. The small tube is tight enough that it doesn't need a clamp, so that reduces the complexity a bit. The larger tube still slips, so the clamp must remain.

The two shafts are now more concentric but still not perfect. It's a good start though. For my next attempt I will switch to aluminum tubing from a hobby store.

Pen Mount

I can't turn my CNC machine into a plotter without a pen of course. I started with a Sharpie rubber banded onto a piece of extrusion.

It almost works but not quite. The pen has no give. It is either pressing very hard against the paper or doesn't touch at all. When it presses hard it prevents the carriage from moving smoothly, so I get lots of skips and jumps. I'm still looking for a better solution that will add some spring.

That's it for now. Next time I'll show some of the improvements I'm making to the electronics side for V3.

I've been posting little teasers of the CNC machine I'm working on.  It's time to reveal a bit more.

In my spare time I have been working on a tiny two axis CNC machine that will be powerful enough to move a pen around like a plotter. Future versions will be larger and handle more powerful tools, but this is a good start to work out the kinks.  

So here she is in all her glory:

She's a two axis CNC. The X axis is the lower level and the Y axis is the upper, set at 90 degrees. A future version will have a Z axis as well. The structure is made of aluminum extrusion from Open Beam. This version uses about 4 meters.  You can see the nice ABS brackets on the corners, also from OpenBeam.  

Each axis consists of a structure sitting on sliders created from roller skater bearings. For movement I'm using standard stepper motors from Spark Fun powered by EasyDriver boards.  The steppers convert rotation into linear motion through the long threadscrews. While you can spend a great deal on threadscrews, these are just standard steel all thread from the hardware store (~3 USD). Everything is bolted together with Open Beam screws, which are standard M3 6mm screws and matching nuts.


Stepper motors have to be powered and controlled by a driver board. I'm using the open source EasyDriver from SparkFun.  There are more powerful motors and boards available, but these will suffice for version 1.  They are cheap, effective, and very simple to wire up as you can see in this photo:


Each stepper motor has it's own driver board.  The four wires go into the four motor pins of the board, labeled A1, A2, B1, and B2.  These aren't actually labeled on the motors themselves so I had to test and label them by hand.  Each board also has power and ground.  They receive more than 5V since the motors usually need more. In my case I've connected them directly to a 9V battery. This would never be enough power in production, but it's okay for testing and very portable.  I'll dive more into the EasyDriver's later, but for now just know that they can take almost any power you can throw at them and convert it safely to run your motors. 

Finally the drivers have ground, step, and direction pins connected to the Arduino, which you can see in this photo:

The Arduino code toggles the two step pins over and over, occasionally changing the direction.  That's all there is to the electronics.  Arduino and the EasyDriver make it very simple.

Now let's look at the mechanicals:


The beams are aluminum extrusions from Open Beam. In addition to being open hardware (the schematics are available to make your own) it has a few nifty features.  Take a look at this end cut:

There is one channel per side. Each channel takes a metric M3 nut or screw.  Hex nuts are the perfect size to slide in easily and not rotate. Because these are standard sizes you can buy screws from other vendors, such as these black anodized 16mm screws I got from Amazon.

I've cut most of the extrusion by hand using a hacksaw and plastic miter (the kind used for cutting wood). Eventually I bought a cheap 6" power saw from Harbor Freight that uses cutoff disks. The final cuts are smoother than a hacksaw can produce and are done in a quarter the time. It's good enough for 60 USD but eventually I will probably upgrade to a proper miter saw with a metal cutting blade.


The extrusions are put together using injection molded ABS plastic brackets, also from Open Beam.  I mostly use angle brackets with a few Ts thrown in.

The stepper motors are attached with Open Beam stepper brackets. These are designed to accept any NEMA 17 stepper motor and come with matching brackets for the other end.

But here is the genius part: Open Beam sells an adapter which accepts #608 roller skate bearings, which look like this:

These brackets make building a lead screw very easy. I chose a 5/16 inch all thread screw at my local department store (~3 USD). It fits inside of a roller skate bearing perfectly.  The blue stuff in the photo is the skate bearing.

Speaking of skate bearings, they are completely awesome. But that will have to wait until tomorrow.

Next Time

I'll go into the bearings and shaft coupler tomorrow, two of the most critical parts of a CNC machine. Oh, and one more question. What should I name this contraption?

I've been wanting to get into electronics and building physical things for a while. I have a lot to learn though. My only exposure to micro-controllers was when I played with an Arduino for a day about two years ago. The last time I picked up a soldering iron or drew a schematic was my lone electrical engineering class in college nearly twenty years ago. My degree is in computer science with a focus on graphic and AI giving me a decidedly software-only career. This makes picking up electronics both challenging and fun.

To start off I decided not to go the easy route; which would be to buy a prefab micro controller and then program it. While I have an Arduino sitting on the shelf, that would be too comfortable for a software guy. Instead I decided to approach this from two directions. First, I bought some kits put together entirely by hand with soldering, no programing at all. This should beef up my skills and introduce to me to the various physical components available (resistors, capacitors, switches, etc.)

Second, I've came up with a project too challenging for someone with my skill level to build: a CNC machine. While I will likely fail during my first attempt, doing something so far out of my areas of expertise will force me to learn a lot of new things.

Learning to Solder

To kick things off I picked up a Larson Scanner kit from the Evil Mad Science store. This kit is quite easy to build; a great starter project for beginners. The micro-controller is pre-programmed and it comes with a PCB (Printed Circuit Board) so you just need to solder in some resistors and LEDs. It even comes with comic book style instructions.

To learn how to solder read this short comic on I was wrong in my initial assumptions. You aren't melting the solder with the iron. Instead you are heading up component and metal pad on the board, which the solder then melts on to. Once I figured that out my joints started to look a whole lot better.

As you can see my soldering skills improved from the beginning to the end of the scanner kit.

Oh, and remember that the battery pack has a switch on it. The first time I put in the batteries nothing happened because I forgot to turn it on. :)

A soldering iron can be had for very cheap, but since I plan to do this for a while I invested in a good one. Spark Fun sold me this soldering station of their own design, which has plenty of power and temperature control, for a very good price ($40).

CNC Machine

Now, on to the CNC machine. A Computer Numerical Control machine, or CNC, is sort of like a plotter. It moves a head in X and Y directions over a surface. However, instead of moving a pen or printer head it uses a drill or other cutting tool. Advanced versions also have a Z axis. This lets you cut many kinds of materials from wood and styrofoam all the way to thin aluminum and sheet metal. And of course it's only a few steps away from having a full 3D printer. All of these features make it a good project for me: something that I can improve over time and has real world uses.

Since I know absolutely nothing about these machines I have a lot to learn. What I've discovered so far is that it's best to start small and build up from there once you have something that works. To that end I created my first prototype of a single axis. It just moves a little carriage up and down a rail using a stepper motor turning a long screw.

CNC Machine Test 01 from Joshua Marinacci on Vimeo.

The stepper motor and driver came from Spark Fun. Interestingly, the stepper driver is actually an open source design called the EasyDriver designed by Brian Schmalz. You could of course build your own from components for less than what SparkFun charges, but I prefer to get the nice polished version rather than saving a few bucks. (And I do mean only a few. SF's is pretty well priced). For power I'm using a 9 volt battery, but will to upgrade to a larger supply once I'm done testing.

The driver is controlled by an older Arduino I already had. The EasyDriver is quite easy to use. You simply toggle one pin for each step and set the direction with a second pin, high or low. Beyond that there is an open source AccelStepper library that can handle multiple motors at once and use acceleration.

I created the metal carriage by hand using aluminum extrusion and brackets from OpenBeam, an open source hardware company based in Seattle. I'll have a lot more on OpenBeam in a future blog soon. OpenBeam uses standard M3 hex nuts so I have a mixture of sliver ones from OpenBeam and black ones from Amazon.

The Big Challenge

Making a CNC machine is not actually my challenge. My real challenge is to create one for under 200$. After pricing out components I really think this should be possible. By reducing costs, Arduino has greatly reduced the barrier to entry for learning about electronics and micro controllers. If we can build a 200$ CNC I think it will kick off a revolution in home construction. Even if I fail to meet the sub-200 price tag I will learn a whole lot in the process.

Hopefully it goes without saying that I will document everything on this blog and open source the plans and schematics. No matter how smart one brain is, a team of brains can do more. I would love your help on this project.

If you don't already please subscribe to my RSS feed or follow me on Twitter. Exciting things are in the works.