Hardware and Software
This project uses the following hardware
- Arduino Ethernet I picked mine up at Microcenter. They describe this unit as an Ethernet Shield but it is a full Arduino Ethernet for $49 (as of 2014/06). The Arduino IDE supports this board. I used version 1.0.5.
- Adafruit NeoPixel Shield a 5x8 matrix of individually controllable RGB LED. The software library is available on github.
- A simple protoshield with pass-through connectors. The Ethernet connector is very large and the Neopixel Shield sits right on top of it. I used a prototyping shield to lift the NeoPixel board off the connector. You can see the cutout around the Ethernet connector in the right of the picture. It also gives me an easy place to connect the Nokia 5110 LCD display.
- Nokia 5110 LCD display. Sparkfun makes one with a nice breakout board that is also available at Microcenter. I soldered a connector for it to the protoshield. The LCD is not shown in the picture.
- FTDI USB adapter for programming the Arduino.
This project uses the following libraries our source. Close any open Arduino IDE windows before installing any libraries. Install the first three libraries in your Arduino libraries directory in ~/Documents/Arduino/libraries. Restart the IDE. The libraries should now show up in the import list. (Ignore MSTimer2 in the picture)
- Adafruit NeoPixel Library on GitHub
- Bonjour compatible zeroconf library on GitHub
- Arduino webserver capability, aka Webduino, available on GitHub
- Example 5110 sample code embedded in this project since it was not available as a library when I first pulled it in.
My source code is available on GitHub. The NeoPixel shield uses pin 6 by default. I used pins 3,4,5,7,8 for the optional Nokia display Pin assignments are as follows
// 0 RX when programming/debugging
// 1 TX when programming/debugging
// 2 W5100 interrupt when bridged
// 4 SD Card SS (if not using Nokia 5110)
// 3 optional Nokia 5110 CLK
// 4 optional Nokia 5110 DIn
// 5 optional Nokia 5110 DC
// 6 NeopPixel Sheild (default pin)
// 7 optional Nokia 5110 Rst Reset (6 and 7 are twisted on LCD breakout board)
// 8 optional Nokia 5110 CE Chip Enable (6 and 7 are twisted on LCD breakout board)
// 10 SPI Wiznet SS
// 11 SPI
// 12 SPI
// 13 SPI
Communicating With the Board
Finding the Board
The board uses DHCP to acquire an IP address and registers itself with zeroconf Bonjour under the name http://arduino_neo.local/. This means you can find the the device address using dns-sd on a windows machine.
Verify Function with Web Interface
The program provides a simple test web page to verify network connectivity and simple LED control. It is located at http://arduino_neo.local/. The three RGB sliders set all the lights to the same color based on slider values. They use r=, g= and b=
You can change LED colors and brightness by POSTING form data. The system will return 200 if the data appears to be basically correct. It will return 400 if any data is out of range, a non existent LED number for instance. The form parameters are as follows:
// r=<value> set all RED LEDs to this value
// g=<value> set all GREEN LEDs to this value
// b=<value> set all BLUDELEDs to this value
// r#=<value> set RED LED number '#' to this value
// g#=<value> set GREEN LED number '#' to this value
// b#=<value> set BLUE LED number '#' to this value
// s#=<value> set Nokia 5100 LCD text on line # to this value
// c=<value> clear Nokia 5100 LCD value is ignored
The "#" signs represent the LED number. "r#" lets you set the red value for a specific LED. "r" by itself means set all the LEDs. You should be able to post several parameters as part of a single packet. I have have only tested forms with similar field types. r=, g=, b= and r#=, g#=, b#= .
This shows Advanced REST Client posting valid updates to 3 LEDs. Two of the fields point at the same LED. The web server returned 200.
This shows Advanced REST Client posting to an LED index (99) that does not exist. All of the valid form fields were processed correctly. The invalid index was not processed and a 400 was returned.