Sunday, October 21, 2012

Why do open source hardware?

I haven't posted lately.  This is due to other non-technical things in my life getting in the way of doing cool stuff.   Fortunately, the projects featured on this blog are open source.  That means world progress doesn't need to stop simply due to poor time management skills on my part.  That is just one advantage to open source hardware!  I ran across a good video that shows some other advantages as well.  Enjoy! 


Tuesday, May 22, 2012

Adding Ethernet capability

Adding Ethernet capability I really like devices that can be controlled over a network. So, a natural add-on to this project is an Ethernet shield. This capability could eliminate the need for readouts and possibly physical controls. I discovered that there are several different Ethernet options all with different costs and benefits. Some boards are simply expansion shields while others apparently have features that don’t even require a controller board! Here are the options I considered.

  • One easy way of matching Ethernet with an Aurduino is simply to buy a unit with Ethernet already built onto the board (over $50). I'm sure it's nice & probably works right out of the box.
  • The more expensive “shields” have advanced features. Once feature is to use DC from a POE capable switch. If the feature is present, these higher-end switches can configure ports to provide (48v DC - usually 15W max) which can be used to power end devices.  Usually, this is a feature only found on commercial switches.
  • Then there are the really cheap Ethernet “shields”. Their main advantage seems to be price ($15-$25).  They are lower cost but more complex to program than the higher cost W5100 based shields.  Here is a good article that explains the differences in the ENC28J60 board varieties.
The board I ordered from Ebay cost $16 (most of which was in shipping). Although the board itself seemed to be new, it was an older design. It had the markings HanRun HR911105a. along with 11/16 on the second row.  It also had the markings “ekitzone.com’ on the board. Otherwise, it was undocumented. From somewhere, I also found that this board is also referred to as type ENC28J60.

Once it arrived, I first tried loading the example web server code that came with the latest Arduino editor. I had no luck making the example code work.  The example apparently expected another board type. So, I visited the ekitszone site to see if they had a different library that should be used. They did.

After downloading the ZIP, I unzipped the file into the \libraries directory and moved the examples directory to the proper place. 

After some trial and error, I finally got an Arduino board to spit out the webpage below.

The HanRun Ethernet board was tested with....
XP professional SP3
Arduino editor 1.0.3
Two board types were tried. They were:
-A genuine Arduino Uno 
-An Arduino Duemilanove compatible called the Freeduino
Thanks to Google Drive, I can also provide the specific files used for testing          
The above webpage was generated using this sample sketch HERE.
A copy of the Ekitzone library file required for the above example (which now appears to be rarer than hen's teeth) can be downloaded HERE

Due to working with XP, I can only use version 1.0.3 . Higher versions don't seem to allow XP to upload sketches to boards.  

There seems to be quite a bit of code used to write out a web page. So, making the assembly do things other than displaying static web pages may be a bit of a challenge.

And now for something completely different - the Freeduino!

Assembling the first piece - a Freeduino
A while back, I attended the Syracuse Hackerspace event where they were introducing users to the magic of soldering together micro-controllers. I met some nice people, soldered my project and generally had a good time. At the end, I had a really cool looking board. I figure combining this technology with a 3-D printing part or two may allow me to make something really cool.

Unfortunately, I didn't get any documentation with the board. Fortunately, it's well documented online. Looking at the origins of the board, the words Freeduino v 1.22 appear on the board. After some investigation, I found this was equivalent to a Duemilanove model (pictured to the right). I also found a guide which shows how it's soldered together.
The development kit software can be downloaded which includes a mini program that makes an LED flash. The software and tutorial are available at: http://arduino.cc/it/Guide/Windows
There are several other board versions such as Nano and Diecimila which have slightly different layouts. The Freeduino 1.22 has two main advantages over the other boards. First, it’s rather inexpensive. Second, it has adapters that allow “shield” boards to be added for extra functions such as temperature sensors, GPS sensors and such. The adapters work with . A good assortment of add-on shields can be seen at http://sparkfun.com.
As for powering it, the board can draw from a standard USB cable or by a 7 to 12 volt DC adapter. Powering the board by either method is set by a jumper.
I downloaded the latest version of the software (version 1.0) from the Arduino website. Once the zip package of software was downloaded, I extracted it to it’s own directory (c:\Ardunio1.0). There was no need to run an "install" program. Just click to run the executable.
Then came the time to decide what firmware I should use. Here's how I found the pedigree to match the firmware to. I observed that the main chip has markings of… ‘atmega328p-pv’ . Looking on the sofware menu, I noticed that this is also known as a “Duemilanove”.
Then, I followed the instructions below for installing the driver:
When you connect the board, Windows should initiate the driver installation process (if you haven't used the computer with an Arduino board before).
On Windows Vista, the driver should be automatically downloaded and installed. (Really, it works!) Start à Control Panel à System and Security à System à Device Manager. You’ll see the UNO. Update software driver à Point to the driver’s folder that was created with the installed softare.
On Windows XP, the Add New Hardware wizard will open:
  • When asked Can Windows connect to Windows Update to search for software? select No, not this time. Click next.
  • Select Install from a list or specified location (Advanced) and click next.
  • Make sure that Search for the best driver in these locations is checked; uncheck Search removable media; check Include this location in the search and browse to the drivers/FTDI USB Drivers directory of the Arduino distribution. (The latest version of the drivers can be found on the FTDI website.) Click next.
  • The wizard will search for the driver and then tell you that a "USB Serial Converter" was found. Click finish.
  • The new hardware wizard will appear again. Go through the same steps and select the same options and location to search. This time, a "USB Serial Port" will be found.
From here, the website instructions get a little confusing. It specifies picking out a COM port. Now for me, when I think of COM ports, I think of serial devices. However, this board is a USB device. Then remembering my A+, I recalled that not unheard of to have a USB device work as a COM resource. As an example, there is a product which allows a USB dongle to act like a serial device. It was for computers that had no serial ports. Once plugged in, it provided an instant serial port! The Arduino board apparently is being used in that way too.
So, here’s how to tell what COM port the USB device is using. Start the Device Manager MMC and scroll down a bit. There will probably be a “PORT” on COM3 used by a USB device. Chances are, that’s our device!
Once the COM is known, set it in the Arduino software by going to Tools à Serial Port
Now, let's check if the board was assembled OK. Time to upload a test file! Go to FILE then Examples. A program appears in the main window called LED flash. Then select FILE then Upload. It will automatically compile the sketch, upload the sketch, then start it. The whole process takes about 15 seconds. If all goes well, the sample program will start and the on board LED will start blinking.
Now that the basic board is operational, the next post will show how to add an additional shield we'll need for this project.