Connecting a Freetronics Twenty Ten to a HanRun Ethernet Adapter

Connecting a Freetronics Twenty Ten to a HanRun Ethernet Adapter (ENC28J60 Ethernet LAN+Network Module)




What hardware you will need

  • 1x Freetronics TwentyTen
  • 1x HanRun HR911105A 12/18 Ethernet Board (eBay)
  • Misc Solder-less breadboard cables (Male/Female)

Router Configuration

I prefer to assign static IP’s to any of my test devices (Arduino or Raspberry Pi). This way I know what the IP is in case I need to connect to it. If you want to use your arduino in a Dynamic IP network then you may not have much luck with this guide as I am configuring the arduino to use an static ip that I have reserved in my router.

    Arduino Static

The HanRun Ethernet adapter does not have a mac address built in so I made one up ( 00:12:34:43:21:00 ), you can generate mac addresses here

Software Configuration

  • IDE (Set the ‘Board’ to ‘Arduino Nano w/ ATMmegda 328’ and the virtual serial port for your USB cable)
  • Download ‘Ethercard’ from (add it as a library into IDE)

The Wiring

HanRun Side | Arduino Side

    GND = Power Ground
    SCK = Pin 13
    SO = Pin 12
    VCC = Power 3V3
    CS = Pin 8
    SI = Pin 11

photo 2

    The Code
    Now this is my code solution for returning a date from a website (php script). Yu can change the IP, Gateway, Server Name, IP and Path to your server if need be.

    // This demo does web requests to a fixed IP address, using a fixed gateway.
    // 2010-11-27
    // 2013-11-23 Modified by Simon Fearby


    #define SLEEP_TIME_AFTER_SETUP 10000 // How often do we poll the server

    //static long timersetup; // Used to remember the last millisecond for the last call (during setup)
    static long timerloop; // Used to remember the last millisecond for the last call (after setup)

    static byte mymac[] = { 0x00, 0x12, 0x34, 0x43, 0x21, 0x00 }; // ethernet interface mac address
    static byte myip[] = { 192,168,1,201 }; // ethernet interface ip address
    static byte gwip[] = { 192,168,1,1 }; // gateway ip address
    static byte hisip[] = { 175,107,162,121 }; // remote website ip address and port

    char website[] PROGMEM = ""; // remote website name

    byte Ethernet::buffer[1000]; // a very small tcp/ip buffer is enough here

    void setup () {
    while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
    if (ether.begin(sizeof Ethernet::buffer, mymac) == 0)
    Serial.println( "Error Failed to access Ethernet controller");

    ether.staticSetup(myip, gwip); // Our router has a Static IP already setup for us so dont ask for a IP via DHCP
    ether.copyIp(ether.hisip, hisip); // Is it the IP we expect?

    ether.printIp("My Gateway: ", ether.myip); // Output the routers IP (Gateway)
    ether.printIp("My IP: ", ether.gwip); // Output the Arduino's IP)
    ether.printIp("Remote Server: ", ether.hisip); // Output the IP of the remote server.

    while (ether.clientWaitingGw()) // Check to see if the gateway is up before moving on.

    Serial.println("Gateway found"); // Congrats, Move on

    Serial.println("Waiting 10 seconds before polling data."); // Congrats, Move on


    static void my_result_cb (byte status, word off, word len) { // called when the client request is complete
    Serial.print("<<< reply "); // We got a reply from the web server Serial.print(millis() - timerloop); // Time Stuff Serial.println(" ms"); // Print the time diff between the call and data received Serial.println((const char*) Ethernet::buffer + off); // Ok print the contents of the webpage } void loop () { ether.packetLoop(ether.packetReceive()); // Process Incoming Packets if (millis() > timerloop + SLEEP_TIME_AFTER_SETUP) { // Do we need to sleep? We dont want to load a website 10,000 a second.
    timerloop = millis(); // Remember the last time we loaded the webpage
    Serial.println("\n>>> Webpage Request Sent.."); // Lets get a Webpage
    ether.browseUrl(PSTR("/temp/printdate.php"), "?", website, my_result_cb); // Query Google

    Result from the Arduino


    Where to now

    Remember that this code running on a small circuit board that runs < 20Mhz 8bit processor that can be powered by AA batteries.

    You can point to your own scripts and save/read database values or trigger other Arduinos or external processes.

    The next step is to have this device read from any external sensors or control the physical world around us with expansion cards.


iPhoto on a Mac is actually responsive on a SSD


Importing 13,000 photos into iPhoto on a Mac takes minutes with a SSD instead of hours on a spinning HDD.

The only down side is the CPU is now the bottleneck, its running at 100% while face recognition is scanning photos. The new iPhoto is not a memory hog anymore.


Installing an SSD to my Mac Mini


A quick computer hardware post to report I have upgraded my Mac mini Hard drive to a Solid State Drive (SSD). With a spinning magnetic drive it would take 148 seconds to boot up and open system preferences.

Opening Photoshop CS5 and creating a 5000×500 image and applying a color gradient would take 115 seconds. I had already upgraded the memory from 4GB to 8GB but I found an adapter to add a second hard drive to a mac mini

A mac Mini ( is the cheapest way to access OSX to do development as your BYO your own monitor/keyboard and mouse. I ended up going for a 256GB Crucial M4 SSD.

Opening the hard drive was a breeze with the iFixit tools and video ( The only problem was the video stopped giving advice right where I needed it (how to place the cables in between the two drives (instead of wrapping around them). After a few hours I figured it out.


Installation Steps:

1. Open the Mac Mini
2. Install the SSD Drive
3. Reassemble
4. Boot OSX from the old HDD
5. Clone the drive with Carbon Copy Cloner

6. Boot off the SSD (hold option during boot up). Set SSD and default boot.

7. Delete the old drive and re-partition.
8. Enable TRIM with this utility
9. Enjoy the benefits of a SSD.


Boot Time Time:

    Before: 42.4 sec
    After: 24.2 sec

Boot Time + Login + Open System Preferences:

    Before: 148.9 sec
    After: 39.9 sec

Open Photoshop CS5 + Create 5000x500px image + Apply Colour Gradient

    Before: 114.9 sec
    After: 17.5 sec