Saturday, February 22, 2014

ELEC Freaks LCD Key Shield

I'm playing with the ELEC Freaks LCD Key Shield, and this is a simple and fun to use Arduino Shield that contains a 2 line LCD, a rotary encoder,  a joystick, plus headers of unused pins for additional sensors.

First, a warning. On my Arduino, the lcd pins could touch the top of the USB jack (a common issue for many shields), so cover the top of the jack with two layers of electrical tape.

Now, attach the shield to your Arduino. I'm using a SainSmart Rev 3 UNO, but this shield predates the rev 3 specification, so make sure you seat it properly.

Download the code at

This shield uses digital pins 4-10 for the LCD, digital 2 & 3 for the rotary encoder, and analog 0 for the joystick.

Pins available to you for other devices on top of the shield are D13-D11, A5-A1, VCC (5v), and Gnd.

Arduino & uBlox Neo 6M GPS

A buddy of mine sent me a uBlox Neo 6M GPS module and said "figure it out". Cool, I love projects like this.

There are 4 connections, TX, RX, VCC and Gnd. I connected TX of the module to pin 10 on the Arduino, Rx to Pin 11, VCC to 5v, and Gnd to Gnd.

I started with a simple SoftwareSerial demo to make sure I could read the module:

#include "SoftwareSerial.h"

SoftwareSerial mySerial(10, 11); // RX, TX

void setup()
  // Open serial communications and wait for port to open:

  Serial.println("uBlox Neo 6M");

  // set the data rate for the SoftwareSerial port


void loop() // run over and over
  if (mySerial.available())


Then I added Mikal Hart's TinyGPS Library and sample code. This converts all those NMEA messages into a readable format by stuffing the character sequences into variables.

After a bit of massaging, here is the final result: (code)

I still have more work to do, like displaying selected data on a LCD, but now that the data is in variables, that's easy. Stay tuned.

Monday, February 17, 2014

ICStation 5v BMP-085 Pressure / Temperature Sensor

ICStation sent us a BMP-085 Barometric Pressure Sensor. This sensor is 5v friendly, and works with the common BMP-085 libraries that are available. We are using the same library and example code we used with the Adafruit BMP-180. See the Arduino Web Based Weather Server!

#include "Wire.h"
#include "Adafruit_BMP085.h"

  This is an example for the BMP085 Barometric Pressure & Temp Sensor

  These displays use I2C to communicate, 2 pins are required to
  Adafruit invests time and resources providing this open source code,
  please support Adafruit and open-source hardware by purchasing
  products from Adafruit!

  Written by Limor Fried/Ladyada for Adafruit Industries.
  BSD license, all text above must be included in any redistribution

// Connect VCC of the BMP085 sensor to 5.0V
// Connect GND to Ground
// Connect SCL to i2c clock - on '168/'328 Arduino Uno/Duemilanove/etc thats Analog 5
// Connect SDA to i2c data - on '168/'328 Arduino Uno/Duemilanove/etc thats Analog 4
// EOC is not used, it signifies an end of conversion
// XCLR is a reset pin, also not used here

Adafruit_BMP085 bmp;

void setup() {
  if (!bmp.begin()) {
 Serial.println("Could not find a valid BMP085 sensor, check wiring!");
 while (1) {}

void loop() {
    Serial.print("Temperature = ");
    Serial.println(" *C");
    Serial.print("Pressure = ");
    Serial.println(" Pa");
    // Calculate altitude assuming 'standard' barometric
    // pressure of 1013.25 millibar = 101325 Pascal
    Serial.print("Altitude = ");
    Serial.println(" meters");

  // you can get a more precise measurement of altitude
  // if you know the current sea level pressure which will
  // vary with weather and such. If it is 1015 millibars
  // that is equal to 101500 Pascals.
    Serial.print("Real altitude = ");
    Serial.println(" meters");


ICStation 8 Character, 7 Segment Display

ICStation sent us a 8 Character, 7 Segment Display driven by a MAX7219. There's no documentation for this display, but a bit of googling found a library and a sample sketch that activated 4 of the 8 characters.

The module has 5 connections, VCC (5v), GND, DIN (pin 12), CS (pin 10), and CLK (pin 11). The last 3 pins are arbitrary, so you can use any 3 digital outputs, just change the code appropriately.

The library is available at

Full details on using the MAX7219 and 7 segment displays can be found at and my customized sketch that activates all 8 segments can be found below:

//We always have to include the library
#include "LedControl.h"

 Now we need a LedControl to work with.

 pin 12 is connected to the DataIn
 pin 11 is connected to the CLK
 pin 10 is connected to LOAD
 We have only a single MAX72XX.
LedControl lc=LedControl(12,11,10,1);

/* we always wait a bit between updates of the display */
unsigned long delaytime=250;

void setup() {
   The MAX72XX is in power-saving mode on startup,
   we have to do a wakeup call
  /* Set the brightness to a medium values */
  /* and clear the display */

 This method will display the characters for the
 word "Arduino" one after the other on digit 0.
void writeArduinoOn7Segment() {

  This method will scroll all the hexa-decimal
 numbers and letters on the display. You will need at least
 four 7-Segment digits. otherwise it won't really look that good.
void scrollDigits() {
  for(int i=0;i<13 i="" p="">    lc.setDigit(0,7,i,false);

void loop() {