The EthNode – Hardware build

A quick update on the EthNode: I developed and etched a double side PCB for the EthNode last night and have just finished assembling the components. It’s a tricky build as I can’t plate the through holes with my home setup. If it works, I’ll be getting a few PCB’s professionally made!

The PCB developed with good clean traces.  I was trying to make a JeeNode too, put my inkjet printer ran out of ink and the laser version of the artwork was not dark enough.. so I guess I now know that inkjet is the way to go for printing artwork for PCB production!

Here is the top side of the PCB with a few parts added:

Ethnode - Build start

Ethnode – Build start

The back side is good a clean too, and the hole alignment is much better for this PCB.  I converted an old scanner to a light box which made alignment of the artwork quick and easy to do.

Below is a photo of the assembled PCB, you can see more on my Flickr page if that is your thing!

Ethnoe - Fully assembled

Ethnoe – Fully assembled

Another view.. from the MagJack end:

Ethnoe - Fully assembled (MagJack side)

Ethnoe – Fully assembled (MagJack side)

A close up of the only SMD part on the board (the 25LC512 serial EEPROM):

25L512 serial EEPROM memory

25L512 serial EEPROM memory

All the rails (+5 an 3.3V) are good and a quick electrical check with a multimeter didn’t show up and shorts as I guess it’s coding time..

 

The EthNode – ATMega based Ethernet board

Taking inspiration from the good folks at Nanode and an Instructable I saw recently, I’ve come up with “another” AVR based Ethernet board that can be programmed and used like an Arduino.

It’s a simple design based on the ATMega and Microchip’s ENC28J60 Ethernet controller with SPI.  Running MQTT on one of these will open up a few options for home automation and remote sensor monitoring.

It’s not as complex as the Nanode.  It doesn’t have the Arduino header locations, but all the major pins are available at headers. There is a 25L512 chip providing 512 Kbit Serial EEPROM for MAC addresses and logged data if one needs it. The PCB is only 80x50mm in size!

Here is the schematic:

EthNode Schematic

EthNode Schematic

Here is the PCB layout:

EthNode PCB Layout

EthNode PCB Layout

All the resources (KiCAD files, libraries, etc) can be downloaded here:Ethnode-V0.9.tar

This morning I got a delivery from Farnell with all the parts.. Busy weekend ahead!

Arduino RGB LEDs and MQTT

Yesterday I took my RGB LED strip project and upgraded it to use MQTT instead of the simple terminal server I was using before. I couldn’t get it working using my WiFly shield, the system would work fine for five minutes or so and then crash. I did a little digging around, thinking it may be a memory issue, put came up blank.  So ditch the WiFly shield and dig out an Ethernet shield…

Arduino Ethernet RGB Lights

Arduino Ethernet RGB Lights

Then installed the Nick O’Leary’s Arduino MQTT library, and got coding:

/*
 * Ethernet RGB LEDS with MQTT 
 * (c) Mark McKillen
 *
 */

#include <SPI.h>
#include <Ethernet.h>
#include <PubSubClient.h>

#define MQTT_SERVER "<Mosquitto Server IP>"

byte MAC_ADDRESS[] = { 0x91, 0xA3, 0xAA, 0x00, 0x01, 0x03 };
char message_buff[30];

int redPin   = 3;   // Red LED,   connected to digital pin 9
int greenPin = 5;   // Green LED, connected to digital pin 10
int bluePin  = 6;   // Blue LED,  connected to digital pin 11

EthernetClient ethClient;  // Ethernet object
PubSubClient client( MQTT_SERVER, 1883, callback, ethClient); // MQTT object

void setup() {
  Serial.begin(9600);
  Serial.println("Net begin");

  if (Ethernet.begin(MAC_ADDRESS) == 0)       // Get connected!
  {
      Serial.println("Failed to configure Ethernet using DHCP");
      return;
  }

  Serial.print("IP: ");                       // A little debug.. show IP address
  Serial.println(Ethernet.localIP());

  if (client.connect("arduinoClient")) {      // connect to MQTT server
    client.subscribe("rgblight");             // subscribe to topic "rgblight"
    Serial.println("Connected to MQTT");      // let us know this has happened
  }
}

void loop()
{
  client.loop();                              // loop for ever waiting for MQTT event
}

// handles message arrived on subscribed topic
void callback(char* topic, byte* payload, unsigned int length) {
  int i = 0;

  // create character buffer with ending null terminator (string)
  for(i=0; i<length; i++) {
    message_buff[i] = payload[i];
  }
  message_buff[i] = '\0';

  long colorVal = strtol( message_buff, NULL, 16);

  analogWrite(redPin, (colorVal&0xff0000)>>16 );
  analogWrite(greenPin, (colorVal&0x00ff00)>>8 );
  analogWrite(bluePin, (colorVal&0x0000ff)>>0 );
}

Really simple, that is the cool thing about MQTT, it’s so easy and powerful.

To light the lights all I need to do is:

mosquitto_pub -h <mqtt server> -t rgblight -m "ff0000"  # All red
mosquitto_pub -h <mqtt server> -t rgblight -m "00ff00"  # All green
mosquitto_pub -h <mqtt server> -t rgblight -m "0000ff"  # All blue

The lights respond quickly, much faster than my last version. Success!

pcDuino on it’s way….

Much excitement here at the moment, my new pcDuino is on it’s way from EXP-TECH in Germany (very cool site BTW!).

pcDuino product picture

pcDuino product picture

Here is a short description from the pcDuino site..

pcDuino is a mini PC platform that runs PC like OS such as Ubuntu and Android ICS. It outputs screen to HDMI. Moreover, it has hardware headers interface compatible with Arduino.

Looks like it might be what I hoped the APC SBC would have been!