Instructional: Blink an RGB LED with Arduino

December 1, 2013

When I was at the World’s Maker Faire in NY this past fall, the kind people at Sparkfun gave me several free Arduino’s and WS2811/ws2812 RGB LED breakout kits to give away.

This is a very brief collection of resources needed to get  new users started using a programmable RGB LED. The beauty of these units is their ability to be chained together.

Take a gander at the goods:

Ws2811 / WS2812 RGB Breakout Board

This is actually a prototype board with an Atmel Mega82U

Sparkfun “Arduino Compatable”













And this is what the end product of this tutorial will look like.

Ooooooo the blinky.

WS2811 Breakout board with Arduino













High level overview:  You will be installing the Arduino IDE, copying the neopixel library folder into the arduino libraries folder, then opening the example project file and upload it to the arduino.

You will need the following items:



Download and install the latest Arduino environment.










Download the Neo Pixel library.


Install the library by copying it to the correct folder for your Arduino IDE. This varies by operating system. The following instructions are for PC.

Mac holds its files in a different location. Instructions for installing a library on Mac are located here.

Linux users probably won’t be reading this article.


For Windows:
Locate your downloaded .zip file and extract it to a folder.


Open the folder and change the name of the folder to Adafruit_NeoPixel, removing the  -master, otherwise you will receive an error.

Copy the folder and Paste it into your libraries folder. (My Documents/Arduino/libraries)

Close and re-open the Arduino program

If you receive the following message, you missed step #4




If all goes as expected, you should be able to open the “strandtest” NeoPixel example code from the File> Examples> menu.


You should see the following code: 


I would like to call your attention to the comments in the code. They tell you two pieces of information you need to update before uploading your code.
The first is what pin the LED breakout will be connected to.

This is the first line after the include statement:

#define PIN 6

(btw, that is how you use a library, you have to invite it to the party by using the #include.)

We are going to go ahead and hook up the DI pin of the breakout board to digital pin 6. We are going to keep it at pin 6 in the code. If you want to use a different pin number, this is where you would change it.

On the breakout board – DI for Digital In. DO is for digital out.


We are going to physically connect the DI (Digital In) to Pin 6 (digital pin 6) on the Arduino.

We will also set up the number of LEDs. In this instance we only have 1 of these breakout boards connected. If we had more than 1, they could be connected in series.

Change this single line of code from a 60 to a 1

Adafruit_NeoPixel strip = Adafruit_NeoPixel(1, PIN, NEO_GRB + NEO_KHZ800);

Verify that the wiring and environment to ensure we do not perform a smoke test.

Connect the USB cable. 
Tech Tip: If this is your first time connecting the Arduino, your computer may have to load or install a driver to allow your computer to communicate with the Arduino. This driver should be included in the Arduino IDE. If you have problems getting the board to be recognized, you’re gonna have a bad time. See here and here for additional troubleshooting and information. Oh and hereCommunication between the Arduino (Atmel Mega328) and the computer is done over a serial connection. Most Arduinos with a USB connection utilize some form of USB to serial adapter. The board I am using in this particular example uses an FTDI chip to do the USB>serial communication for us. Other boards may use another AVR microcontroller or even implement serial directly in code using v-usb.


Click tools > Serial Port and select your COM port.

I tested COM3 – no go.

COM8 is our man

Select the board type from the Tools >Board menu. The Sparkfun Redboard that I am using is Arduino Uno compatible.


Click upload.

If it works you will see some LEDs on the Arduino flashing. On mine it was the red and yellow RX /TX LED’s.

Wonder of Wonders, it works!

Prototyping is fun, but we can do better.












If you get errors like this when uploading, go back to step #11. You may have to go back and select a different COM port or a different board.

If your board had a few flashes of lights but no activity on the breakout board, double check the 5v, ground, and DI wire are securely connected and plugged in to the correct pins on the Arduino.


Going Further:

-Connect multiple WS2811′s in Series

-Connect multiple WS2811′s in a matrix

Alternative Libraries


-Neopixel by Adafruit



This post was composed and uploaded from Microsoft OneNote 2013
1 Comment

Server Room Environmental Monitoring – Part 2

September 4, 2013

[This post should have been published 2 years ago... oops]

In an earlier post I began working on a Server Room Environmental Monitoring based on an Arduino.

Arduino with Temperature and Light sensors

Arduino with Temperature & Light sensors and potentiometer.


This project was started just for fun-  I wanted to learn more about micro controllers (specifically the arduino platform), and partially because I didn’t have room in my technology budget at work to do it the “right way” (not even sure what way that is for a small business…netbotz?). I wanted to improve on my original idea by having it accessible remotely via my network. Thus we end up with our first semi-finished prototype:

prototyping on breadboards

prototyping on breadboards

This device monitors the temperature and ambient light readings and displays the values on an LCD and displays them in a browser windows rendered in html. I have the 2nd iteration pretty much completed, just working through some of the programming issues. [At the time] I wanted to expand the sensors to include multiple i2c temperature sensors, and possibly make the LCD display wireless via Xbee. Later posts will show I ended up using a Nanode with Grove sensors [but I digress as this is documenting the original build.]

Semi- finalized product

Semi- finalized product


Arduino Duemilanove (ATMEL 328p)
DFRobot Ethernet Shield DFR0110, Powered by a Wiznet W5100
Sparkfun Protoboard (v2)
TEMT6000  Ambient Light Sensor by Vishay via the Sparkfun Breakout Board
JK Device HD44780 Compatable 2 x 16 Char LCD display
Sparkfun SerLCD I2C backpack
Adafruit Arduino enclosure


I had to add the Xbee out of necessity (I had them from another project, but when I burned out the FTDI chip on the Arduino I had no way of programming it, but it turned out being rather convenient!)
Two Xbee with a chip based 1mw antenna.
Xbee Explorer Regulated
Xbee Explorer USB

Generic PIR Sensor module from ebay - looks very similar to this.

I have most of the code working. I made the code available as a download. It includes the two libraries for the I2C Serial LCD backpack controls and the LibTemperature library for the I2c temperature module:
Arduino_Environmental_Monitoring_Webserver [this is a .zip file]
The code is also available here in plaintext [here]



This is how it works:

pull in the libraries for all the different modules
set up the variables to store numbers
some code to control the LCD
Set the pins for the LCD and for the LED
Setup the MAC and IP for the Ethernet Shield
read the sensors and store the values to the variables
convert the C temperature to F and store to a different variable.
Print the values to the display
Send the values inside HTML to the browser
Send the browser a command to refresh every X seconds.


The Challenges:

When using my Arduino for another project  I was testing a large number of SMT led’s all at once, pulling a decent amount of current through the 3.3v regulator, far exceeding the 50Ma spec of the L.D.O inside the FTDI. I inadvertently short circuited or over drive the 3.3v line , burning out the FTDI USB to RS232 chip on the board. I ended up utilizing two Xbee modules and connecting one to the TX /RX lines for serial connection. This worked out great, because It forced me to get the Xbee working! I now have 2 Xbee units paired for serial communications.

There were some small issues with the Ethernet Shield. #1. The pin map on this particular model uses (Arduino) pins A4 and A5 to access the SD card, which I am currently using for my I2C temperature sensor communication. There were also issues with the bottom of my proto-shield hitting the ethernet plug and grounding out, so I extended the pins the quick and dirty way by  extending it with pin headers.

The enclosure from Adafruit fit great, but the end plate did not work with the Ethernet shield. I had to discard the plate for the connectors.


mounted, splayed

mounted, splayed

Dirty Coding Schemes:

I was getting some odd looking numbers on the LCD screen when testing it in a variety of light and temperature ranges. The number would “print” to the screen, and when it poured over to the 3rd digit, that digit would stay on the screen, regardless of what was being written to the block immediately to the left.


I didn’t bother figuring out how to erase data or clear the screen between refreshes, so in my code I had it over-write 4 blank spaces, then go back to the beginning and write the data value. probably a very dirty way of clearing that part of the screen.

[Browser Refresh]

the arduino code strings together the HTML and streams it to your browser. there is a small snippet of meta html HTTP-EQUIV “REFRESH” that tells your browser to refresh every few seconds to see the new values gathered in the loop code.

[Hard Coded IP Address]

Unfortunately, I found that the DHCP library did not work so well for me. I decided to hard-code my device. this has certain advantages, but makes it less portable. Not everyone uses a class B /16 subnet at home.


Final Results:



Finished device






connectors... the business end

connectors… the business end



Leave a Comment

IP Cameras

July 11, 2013

So… I finally purchased an Ip Camera, courtesy of the cheapest eBay listing I could find.

It’s a Foscam FI9818W. Pan and Tilt, wired and wireless networking, 2 way audio and Infared illumination. Pretty slick for $45. If only it had relay outputs.

So I plugged it in and got it talking to my network. Here it is looking at the wall.

 I also got it working with the Foscam App for iOS. 2-way audio built in!

Firmware is a bit old… Lets update that.

It also has motion detection and can automatically email photos or upload them to an FTP server.

I set it to email me a few snapshots when it detects motion outside of the regular business day.


Wave for Mr Blurry Cam!

This post was composed and uploaded from Microsoft OneNote 2013 
Leave a Comment

Nanode Round 3: SketchGarden

March 17, 2012

Speaking of clouds, finally launched in Beta (as of 3-13-2012), allowing the remote upload of Arduino sketches over the internet. As I have already have a working specimen running on my Nanode v5 hardware, I popped in the new atmega328 chip, and it couldn’t have been a simpler process.

This have been a long time coming. In my prior post covering the build of the v5 nanode kit, I included details regarding possible remote firmware uploads and tftp bootloaders. Sketchgarden surpassed my expectations by eliminating the requirement for a server or  any server side configuration. I only need to worry about configuring my code. Minimal hardware is also a big advantage- they were able to fit the code for everything into the Atmel328p chip in flash and eeprom, aside from the external eeprom used to store a permanent  MAC address. (picture)

There are two elements that will be required for widespread adoption – Number one, the release of the bootloader. On twitter, Vic indicated a post-Makerfaire release of the bootloader in a finalized form. In the meantime they plan on shipping pre-loaded chips from

The next element required to get the ball rolling is compatibility with both ENCJ and Wiznet ethernet modules. The Nanode uses the Microchip ENC28J60, while the official Ethernet shield and the Arduino Ethernet use the Wiznet W5100 chip. Both chips are also available as ethernet shields. Support for both chips will enable non-nanode customers to utilize sketchgarden, enabling WickedDevice to reach a critical mass. Boom.

The WickedDevice Nanode V5 is available assembled($49)or as a kit ($39, includes FTDI adapter). The Sketchgarden chip comes preloaded with the custom Sketchgarden bootloader, but is currently listed as unavailable,-It may not be offered for sale until the initial beta is complete.

A big thanks to Vic and Dirk at Wicked Device. You can find out more information at, or check out Vic and Dirk on Twitter. You can also check out their blog.



I went ahead and documented the process, including specifics for OSx users:

In a nutshell: Install new Chip, configure network settings locally, set up new nanode on, Compile hex file and convert to a binary image. Then upload image and assign to your device. Boom. Done.


#1. Install New Chip (available soon at wickeddevice)

chip swap

You should use caution when removing microchips… 

#2 Connect to your device on your local network, and change the settings to fit your network as necessary. The settings will be stored to the atmel328 eeprom and will remain static until changed.

Note: The sketch  seen below is called “SketchGarden Config” to re-load on your device should you need to re-configure your IP address, should you decide not to incorporate 

This is the pre-loaded Sketchgarden Config Sketch. It will be replaced with your sketch on first upload. Don’t forget the copy down your API key from this screen.

#3 Connect your twitter account at

You don’t have to tweet, but you gotta have a twitter.

#4 Add your device with the Api key you obtained before.



#5 Compiling your working Nanode/Arduino sketch to hex:
Go to your working arduino / Nanode sketch. Hold down the Shift key and click the > compile button. Look at the last section and identify the file path. If you are cool like me, and have OSX, your files will be hidden in some folder that you can’t see.

/var/folders/ blablabla

That’s ok, here is a shortcut for OSX users. From finder, select Go, then Go To Folder, then paste in your long folder location.

complicated eh?

For me it was /var/folders/RZ/RZv65MxvH4GoCj14HxLTjk+++TI/-Tmp-/build654337670699641674.tmp/  sketchname.cpp.hex


locate your file and copy it somewhere you can see it.

organized files? I think not.

Now convert  the hex file to a bin file using the tool from sketchgarden – currently a java program called HexToImage.jar, (located in the help menu from
Open a terminal window, and navigate to the directory with your .hex file and the hextoimage.jar app.
Type in java -jar HexToImage.jar yourfilehere.cpp.hex yourfilehere.bin

For me, it was:

cd desktop
cd environmental
java -jar HexToImage.jar PachubeV3_LibTemp_Motion_light_Webserver_SEEDLCD_JH.cpp.hex PachubeV3_SeedLCD_for_Sketchgarden.bin


I’m going to bash your head in.

#6 Upload To Sketchgarden

Take your compiled and converted .bin file and upload it as a new sketch. Dont forget to copy in your source code to remind you of what this file does.


It’s Peanut Butter sketchy time

#7 Upload to your nanode

click and  drag the file from the left over to the grey square… it took me a few tries, the page seems buggy. then click Upload Sketch.

Master preview artist, at your service.

I dont do GIFS.

# 8 Wait a few minutes, then give up thinking it failed….hours later return and rejoice that it actually did work, but you were to impatient the first time around!




Somewhere along the line I had an issue with my nanode resetting every time I try to capture from more than 3 sensors. Currently, I am only capturing Temperature and Light information. The motion capture device (A PIR motion sensor) was randomly freezing my Nanode and causing it to stop reporting data. Unfortunately I uploaded my old code in this ketch, but I should be able to recall what I did to get it to work. I beleive i excluded the reading of those sensor pins, and filled the values with an arbitrary or duplicate value.


It doesn’t look like much, but I made it.


final enclosure

final enclosure. 


Leave a Comment

Nanode: Round 2 – Pachube with Various sensors

January 5, 2012

Webservers are so 1990′s. We need fresh ways of collecting and displaying data. Too bad there isn’t a “cloud” service out there for that.

Oh, wait, There is!

Following the basic code on the Nanode website I was able to set up my own Pachube (Now COSM Xively) account and configure my nanode to stream data over to their logging service.

Here is the list of items used in this build:

Nanode V5 by WickedDevice
ModernDevice TempSensor (i2c temperature sensor) from Liquidware, which is a breakout for the TMP421  from Texas Instruments.
Serial LCD v1.1 – 16×2 “Twig” Grove display from SeeedStudios SeeedStudio “Grove” light sensor v 1.0
PIR sensor (Motion Detector) , Ebay


Sample Code

The internal IP address is staticly defined, along with the DNS settings for This was cobbled together in november / december, and since then new code is available for proper DNS resoloution.

Upon power up, the Nanode checks it is connected to the network, then polls the sensors and stores them to variables. It refreshes the LCD and ”prints” it to the screen, prints to the serial port, and shoots the data up to


As seen in my office, hanging precariously off my booklamp.




Leave a Comment


December 20, 2011

Download [zip] PachubeV3_LibTemp_Motion_light_Webserver_SEEDLCD_JH



* Arduino + Analog Sensors Posted to Pachube
*      Original Source Created on: Aug 31, 2011
*          Author: Victor Aprea
*   Documentation:
*       Source Revision: 587
* Licensed under Creative Commons Attribution-Noncommercial-Share Alike 3.0
*    Utilized in the following example by in “Nanode Round 2″
* Modern Device TempSensor i2c Temperature sensor – analog pins 2,3,4,5 – from liquidware
* Generic Motion Sensor Analog pin 0 – from Ebay
* Grove – Serial LCD – “twig serial LCD” 2×16 chars-  from Seeedstudios

#include “EtherShield.h”
//for temperature Sensor
#include “Wire.h”
#include “LibTemperature.h”
#include <SerialLCD.h>
#include <NewSoftSerial.h> //this is a must
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* The following #defines govern the behavior of the sketch. You can console outputs using the Serial Monitor
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

#define MY_MAC_ADDRESS {0×54,0×55,0×58,0×10,0×00,0×25}               // must be uniquely defined for all Nanodes, e.g. just change the last number
//#define USE_DHCP                                                     // comment out this line to use static network parameters
#define HTTPFEEDPATH “/v2/feeds/#####”                               // change this to the relative URL of your feed, #’s replaced with your own feed.
//-the temperature stuff – variables
LibTemperature temp = LibTemperature(0); // more temperature variable stuff

SerialLCD slcd(5,6); //assign soft serial pins 5 as RX, 6 as TX.
//Connect 6 to the RX of LCD, and 5 to TX of LCD.

//sets size of LCD
const int numRows = 2;
const int numCols = 16;

#define SERIAL_BAUD_RATE 19200

#ifndef USE_DHCP // then you need to supply static network parameters, only if you are not using DHCP
#define MY_IP_ADDRESS { 192,168,  1,175}
#define MY_NET_MASK   {255,255, 255,  0}
#define MY_GATEWAY    { 192,168,  1,  1}
#define MY_DNS_SERVER {  8,  8,  8,  8}

// change the template to be consistent with your datastreams: see
static char feedTemplate[] = “{\”version\”:\”1.0.0\”,\”datastreams\”:[{\"id\":\"sensor1\", \"current_value\":\"%d\"},{\"id\":\"sensor2\",\"current_value\":\"%d\"},{\"id\":\"sensor3\",\"current_value\":\"%d\"}]}”;
static char feedPost[FEED_POST_MAX_LENGTH] = {0}; // this will hold your filled out template
uint8_t fillOutTemplateWithSensorValues(uint16_t node_id, uint16_t sensorValue1, uint16_t sensorValue2, uint16_t sensorValue3){
// change this function to be consistent with your feed template, it will be passed the node id and four sensor values by the sketch
// if you return (1) this the sketch will post the contents of feedPost to Pachube, if you return (0) it will not post to Pachube
// you may use as much of the passed information as you need to fill out the template

snprintf(feedPost, FEED_POST_MAX_LENGTH, feedTemplate, sensorValue1, sensorValue2,sensorValue3); // this simply populates the current_value filed with sensorValue1
return (1);

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* You shouldn’t need to make changes below here for configuring the sketch
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

// mac and ip (if not using DHCP) have to be unique
// in your local area network. You can not have the same numbers in
// two devices:
static uint8_t mymac[6] = MY_MAC_ADDRESS;

// IP address of the host being queried to contact (IP of the first portion of the URL):
static uint8_t websrvip[4] = {173,203, 98, 29 }; // should be resolved through DNS

#ifndef USE_DHCP
// use the provided static parameters
static uint8_t myip[4]      = MY_IP_ADDRESS;
static uint8_t mynetmask[4] = MY_NET_MASK;
static uint8_t gwip[4]      = MY_GATEWAY;
static uint8_t dnsip[4]     = MY_DNS_SERVER;
// these will all be resolved through DHCP
static uint8_t dhcpsvrip[4] = { 0,0,0,0 };
static uint8_t myip[4]      = { 0,0,0,0 };
static uint8_t mynetmask[4] = { 0,0,0,0 };
static uint8_t gwip[4]      = { 0,0,0,0 };
static uint8_t dnsip[4]     = { 0,0,0,0 };

long lastPostTimestamp;
boolean firstTimeFlag = true;
// global string buffer for hostname message:
#define FEEDHOSTNAME “\r\nX-PachubeApiKey: ” PACHUBE_API_KEY

static char hoststr[150] = FEEDWEBSERVER_VHOST;

#define BUFFER_SIZE 550
static uint8_t buf[BUFFER_SIZE+1];

EtherShield es=EtherShield();

void setup(){
Serial.println(“Nanode + LibTemp Sensor + Pachube = Awesome”);
// Initialise SPI interface

// initialize ENC28J60
es.ES_enc28j60Init(mymac, 8);

#ifdef USE_DHCP


//init the ethernet/ip layer:
es.ES_init_ip_arp_udp_tcp(mymac,myip, 80);

// init the web client:
es.ES_client_set_gwip(gwip);  // e.g internal IP of dsl router
es.ES_dnslkup_set_dnsip(dnsip); // generally same IP as router

Serial.println(“Awaiting Client Gateway”);
int plen = es.ES_enc28j60PacketReceive(BUFFER_SIZE, buf);
Serial.println(“Client Gateway Complete, Resolving Host”);

resolveHost(hoststr, websrvip);
Serial.print(“Resolved host: “);
Serial.print(” to IP: “);



lastPostTimestamp = millis();

void loop(){
long currentTime = millis();

int plen = es.ES_enc28j60PacketReceive(BUFFER_SIZE, buf);

if(currentTime – lastPostTimestamp > DELAY_BETWEEN_PACHUBE_POSTS_MS || firstTimeFlag){
firstTimeFlag = false;
uint16_t sensorValue1 = ((temp.GetTemperature() * 9 / 5) + 32);;
uint16_t sensorValue2 = analogRead(SENSOR2_ANALOG_PIN);
uint16_t sensorValue3 = analogRead(SENSOR3_ANALOG_PIN);

if(fillOutTemplateWithSensorValues(0, sensorValue1, sensorValue2, sensorValue3)){
Serial.print(“Posting sensor values to Pachube: “);
Serial.print(sensorValue1, DEC);
Serial.print(“, “);
Serial.print(sensorValue2, DEC);
Serial.print(“, “);
Serial.print(sensorValue3, DEC);
Serial.print(“, “);

//begin coimmunication, turn on display, turn on backlight

//Col, row
slcd.setCursor(0,0);  // Scroll to X,Y position
slcd.setCursor(0,1);  // Scroll to X,Y position
slcd.print(sensorValue1, DEC);

slcd.setCursor(5,0);  // Scroll to X,Y position
slcd.setCursor(5,1);  // Scroll to X,Y position
slcd.print(sensorValue2, DEC);

slcd.setCursor(12,0);  // Scroll to X,Y position
slcd.setCursor(12,1);  // Scroll to X,Y position
slcd.print(sensorValue3, DEC);

es.ES_client_http_post(PSTR(HTTPFEEDPATH),PSTR(FEEDWEBSERVER_VHOST),PSTR(FEEDHOSTNAME), PSTR(“PUT “), feedPost, &sensor_feed_post_callback);
lastPostTimestamp = currentTime;




#ifdef USE_DHCP
void acquireIPAddress(){
uint16_t dat_p;
long lastDhcpRequest = millis();
uint8_t dhcpState = 0;
Serial.println(“Sending initial DHCP Discover”);
es.ES_dhcp_start( buf, mymac, myip, mynetmask,gwip, dnsip, dhcpsvrip );

while(1) {
// handle ping and wait for a tcp packet
int plen = es.ES_enc28j60PacketReceive(BUFFER_SIZE, buf);

//    dat_p=es.ES_packetloop_icmp_tcp(buf,es.ES_enc28j60PacketReceive(BUFFER_SIZE, buf));
if(dat_p==0) {
int retstat = es.ES_check_for_dhcp_answer( buf, plen);
dhcpState = es.ES_dhcp_state();
// we are idle here
if( dhcpState != DHCP_STATE_OK ) {
if (millis() > (lastDhcpRequest + 10000L) ){
lastDhcpRequest = millis();
// send dhcp
Serial.println(“Sending DHCP Discover”);
es.ES_dhcp_start( buf, mymac, myip, mynetmask,gwip, dnsip, dhcpsvrip );
else {

// hostName is an input parameter, ipAddress is an outputParame
void resolveHost(char *hostName, uint8_t *ipAddress){
es.ES_dnslkup_request(buf, (uint8_t*)hostName );
int plen = es.ES_enc28j60PacketReceive(BUFFER_SIZE, buf);
if(es.ES_udp_client_check_for_dns_answer(buf, plen)) {
uint8_t *websrvipptr = es.ES_dnslkup_getip();
for(int on=0; on <4; on++ ) {
ipAddress[on] = *websrvipptr++;

void sensor_feed_post_callback(uint8_t statuscode,uint16_t datapos){
Serial.print(“Status Code: “);
Serial.println(statuscode, HEX);
Serial.print(“Datapos: “);
Serial.println(datapos, DEC);
for(int i = 0; i < 100; i++){


// Output a ip address from buffer from startByte
void printIP( uint8_t *buf ) {
for( int i = 0; i < 4; i++ ) {
Serial.print( buf[i], DEC );
if( i<3 )
Serial.print( “.” );

void printNetworkParameters(){
Serial.print( “My IP: ” );
printIP( myip );

Serial.print( “Netmask: ” );
printIP( mynetmask );

Serial.print( “DNS IP: ” );
printIP( dnsip );

Serial.print( “GW IP: ” );
printIP( gwip );



1 Comment

Nanode: Round 1 – Webserver and temperature sensor

September 26, 2011

First project with the nanode was getting a sensor to display the current temperature, then display it on a self refreshing webpage. Pretty simple, since I have already done this before. Just a few minor differences in how the libraries work. Currently it is pulling the temperature data from a ModernDevice temp sensor, and displaying on this website, which refreshes every second. See it in action here.

My Code:

Nanode_Server [.ZIP FILE!]
Contains: (my simple Arduino Sketch, Libraries for the Nanode compatable ethernet shield and the Lib Temp Sensor )

Code examples:

Programming help:

hardware:   (As seen in my prior post)

Leave a Comment

Nanode : First Impressions

September 25, 2011

The Nanode kit – an open designed, web enabled, “arduino compatible”? for $39 Are you kidding me? Thats a great deal!

The Nanode!

That was the first thought that crossed my mind when I saw the Nanode at the World Maker Faire in New York. This product is now available (and manufactured) in the USA thanks to the colaboration of its original designer, Ken Boak from London Hackspace and Vic and Dirk from WickedDevice. My board revision (Nanode 5) was the first set of kits available in the US.

I had heard of the nanode before, but never really was able to get over the international shipping costs and was not sold on a Microchip ethernet controller when the “standard” is any shield based on the Wiznet ethernet controller.

but $35? Heck. Why not!

So I bought one.


And it works!

Here is my take on the assembly.



The online pictorial building guide included plenty of visual and text instructions, however there were a few discrepancies between my board and the pictures. This is not surprising, as the PCB pictured in the instructions is from London Hackspace, where as my device is a new product made in the USA and sold by WickedDevice. They are working on their own documentation, as it should be available soon.

Most of the differences were minor  component variations (the level shifter and capacitors were from a different manufacturer, the PCB was a different revision with a different screen print.





The first item to catch my eye was the SMT SOT23 labeled 11AA02E48 which is a 3 pin serial eeprom, pre-soldered to the bottom of the board. This was identified as the “MAC Address IC” in the instructions. This kit is intended to be assembled by the hobbyist, and most of us dont have surface mount soldering equipment (Well, some of us do). Props to the guy who has to hand solder and pack all these boards!


Another set of empty pads left room for an 8-lead SOIC, labeled 23k256, which is a 256k of SRAM connected to the SPI bus. No chip included with the N5 kit, but its listed as an optional component (original design notes here) to be used for additional code storage or data logging  Ethernet based arduino sketch uploads! This is based on a new bootloader called WickedBoot. Code is available in the invite-only Sketchgarden beta site. Code was previously in in development by the Arduino guys, but the guys over at wickedDevice are not quite ready to let their code go mainstream yet.  (Other similar projects for TFTP arduino boot available here )







C'mon, Baby, Let's Do The Twist.

The only real “gotcha” is the 3.3v voltage regulator. The orientation does not match the orientation of the screen print. There is a “note” and a dashed line,probably a quick fix enabling them to deliver a working product in time for MakerFaire. This orientation is addressed in the documentation, but could be easily missed if you are used to jumping in without reading directions first (guillty as charged!). This has been identified by WickedDevice as something that is going to be fixed in version 6.









Once everything is assembled, loading up the first test sketch only requires a minor tweak to the line to tell it to use Pin 8. The code was developed for the Nuelectronics EtherShield The source code is up on Github, but hopefully there will be a custom library for the Nanode available directly from WickedDevice shortly.

Modify this line to specify pin 8.


Pop the ethernet cord in, fire up the browser, and go to the default IP address. you should see the first webpage served by the new Nanode!




I did notice  lots of spare holes for missing components- 2 zener diodes, 2 resistors and a capacitor was left out- the instructions make reference to a Virtual USB option. Sweet!  A quick search on their Wiki page reveals that its in the works,  Code for virtual USB available here.

USB and FTDI header


The thing that really got me excited was the Ethernet Bootloader. WickedDevice have a video showing this over on their blog. Cant wait till they release the code!

Soft lighting sets the mood for some sweet ethernet and I²C lovin'



Overall I think it’s a great buy for under $40. Go buy one one!

Available from the following vendors:

WickedDevice -USA/Canada/Mexico

Earthshine Electronics -UK

SK Pang Electronics -UK

1 Comment

CODE: temperature and motion – server

July 10, 2011

Look at this code, bishes – for the wiznet based ethernet shield.

LiquidCrystal Library - display() and noDisplay()
Demonstrates the use a 16x2 LCD display. The LiquidCrystal
library works with all LCD displays that are compatible with the
Hitachi HD44780 driver. There are many of them out there, and you
can usually tell them by the 16-pin interface.
The circuit:
* LCD RX pin to digital pin d2
* temp sensor analog pins a2,a3,a4,a5
* Light Sensor analog pin a0 (TEMT6000)
* xbee tx d0
* xbee rx d1
* Ethernet shield attached to pins 10, 11, 12, 13
* led Pin D3
Library originally added 18 Apr 2008
by David A. Mellis
library modified 5 Jul 2009
by Limor Fried (
example added 9 Jul 2009
by Tom Igoe
modified 22 Nov 2010
by Tom Igoe
This example code is in the public domain.

Web Server
A simple web server that shows the value of the analog input pins.
using an Arduino Wiznet Ethernet shield.
* Ethernet shield attached to pins 10, 11, 12, 13
* Analog inputs attached to pins A0 through A5 (optional)
created 18 Dec 2009
by David A. Mellis
modified 4 Sep 2010
by Tom Igoe
// include the library code:
//------------------Start web server Setup -mac and IP address---------
// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 10,0,0,174 };
// Initialize the Ethernet server library
// with the IP address and port you want to use
// (port 80 is default for HTTP):
Server server(80);
//----------------- End Web Server Setup--------
//------------------Start i2c LCD backpack setup----------
// since the LCD does not send data back to the Arduino, we should only define the txPin
#define txPin 2 //pin used for i2c based LCD backpack
SoftwareSerial LCD = SoftwareSerial(2, txPin);
const int LCDdelay=10; // conservative, 2 actually works
//------------------End i2c LCD backpack setup
//-----------------Setup the Variables for sensors-------
int sensorPin1 = A0; // select the input pin for the light sensor
int sensorPin2 = A1; // select the input pin for the PIR sensor
int sensorValue1 = 0; // variable to store the value coming from the Light-sensor, default 0
int sensorValue2 = 0; // variable to store the value coming from the PIR-sensor, default 0
float tempF = 0; // variable to store the value coming from the temp sensor after converted to F degrees
const int ledpin3 = 3; //pin corresponding to pin 3 for LED
//-----------------End sensor variable madness------------
//-----------------Start LCD controlls-------------------
// wbp: goto with row & column
void goTo(int row, int col) {
LCD.print(0xFE, BYTE); //command flag
LCD.print((col + row*64 + 128), BYTE); //position
void clearLCD(){
LCD.print(0xFE, BYTE); //command flag
LCD.print(0x01, BYTE); //clear command.
void backlightOn() { //turns on the backlight
LCD.print(0x7C, BYTE); //command flag for backlight stuff
LCD.print(157, BYTE); //light level.
void backlightOff(){ //turns off the backlight
LCD.print(0x7C, BYTE); //command flag for backlight stuff
LCD.print(128, BYTE); //light level for off.
void serCommand(){ //a general function to call the command flag for issuing all other commands
LCD.print(0xFE, BYTE);
//---------------------End LCD controlls-----------------
//---------------------Begin LCD setup -----------------
void setup() {
pinMode(txPin, OUTPUT); //sets up Pint as output to LCD
//--------------------End LCD Setup-----------------------
//---------------------Begin LED Output-------------------
pinMode(3, OUTPUT); //setup pin for digital out - pin 3
//---------------------End led Output---------------------
//------------------Begin Web SErver Setup---------------
//void setup()
// start the Ethernet connection and the server:
Ethernet.begin(mac, ip);
//------------------End Web SErver Setup----------------
//-------------------Begin Sensor read and LCD control----------------------
void loop() {
// read the value from the sensors:
sensorValue1 = analogRead(sensorPin1); //light sensor
sensorValue2 = analogRead(sensorPin2); //PIR
LibTemperature temp = LibTemperature(0); // reads temperature in Celcius
// convert to degF
tempF = (temp.GetTemperature() * 9 / 5) + 32;
//stores float to int because serlcd wont send floats
int tempfd = tempF;
// Print sensor value to the LCD.
LCD.print(" ");
LCD.print(" ");
LCD.print("Temp F");
//Iluminate LED if motion.
digitalWrite(3, HIGH); // set the LED on
{if (sensorValue2 < 10) {
// no motion
digitalWrite(ledpin3, LOW); // set the LED off
else {
// motion
digitalWrite(ledpin3, HIGH); // set the LED ON
//-----------------End Sensor read and LCD control------------------------
//-----------------Web Server code---------------------------
// listen for incoming clients
Client client = server.available();
if (client) {
// an http request ends with a blank line
boolean currentLineIsBlank = true;
while (client.connected()) {
if (client.available()) {
char c =;
// if you've gotten to the end of the line (received a newline
// character) and the line is blank, the http request has ended,
// so you can send a reply
if (c == '\n' && currentLineIsBlank) {
// send a standard http response header
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
// output the value of each analog input pin
//for (int analogChannel = 0; analogChannel < 1; analogChannel++) {
int analogChannel = 0; //select channell 1
client.print("Light Level from channel ");
client.print(" is ");
client.print("Temperature is ");
client.print(" Degrees F");
if (c == '\n') {
// you're starting a new line
currentLineIsBlank = true;
else if (c != '\r') {
// you've gotten a character on the current line
currentLineIsBlank = false;
// give the web browser time to receive the data
// close the connection:
//--------------------End web server code ----------------------
Leave a Comment

Maker Faire 2011, San Francisco

May 23, 2011

I’m at the Maker Faire in San Francisco this weekend. I got a chance to meet lots of cool people – Jeri Ellsworth, Jeff Keyzer, Garret Mace, Ian Lesnet and lots of other really awesome individuals.

I stopped in the Element 14 booth and had a chat with one of their Software developers, Drew Fustini, who is also a member of Pumping station one in chicago. We talked about The Amp Hour and who we had seen here in the expo hall. He hooked me up with a free Element 14/ Adafruit mini POV (persistence of Vision) solder kit and a station to put it together. As I was sitting working away, who should arrive but the Mighytohm (Jeff) himself!

Later in the day (once my mini POV was complete) I got a chance to talk to Ian from Dangerous prototypes. He had a new oscilloscope board that they had on display. He showed me some of its features, though we failed to read anything lower than 50 mhz square waves. He also showed me the BusPirate, and how it can be used to interact and read back data from various devices.

I then moved on to the MaceTech where I chilled in the awesome party tent with Garret and purchased a Centipede shield and an Octobright Cyanea .

I also ran into Mark Sproul from Rutgers University and Fubar Labs (Hes the guy who did all the pic software development for the chipKIT Max32, and Rick Anderson did the compiler modifications. (EDIT: Hack-a-day had some additional coverage on Mark from Saturday’s event here. )

Basically he said the Ethernet shield has some IC’s that talk on the physical level, and is going to be out in July.
He also was referencing how the kit is possible, by working at the abstraction layer and making a simple text file that goes between the lower code and the h file. “Give me a GCC compiler, any GCC compiler, and ill have it running in a week”

He said he wants to work on ARM Cortex, and some other platforms, and that essentially its so simple you could do it, its just a text file.
By the way, He’s just as much a hacker as anyone. While yes, Digilent sent him lots of free dev boards, hes not getting paid to develop this.

Off to day two of Maker Faire 20011, San Francisco Bay, and the “Bring a Hack” Meetup!

Leave a Comment

Next Page »