---

Showing posts with label shield. Show all posts
Showing posts with label shield. Show all posts

Monday, January 23, 2012

A Review of SnootLab's 'Memoire' Arduino Shield

SnootLabs were kind enough  to send me one of their Memoire Shields. This useful little shield combines an SD card slot with a DS1307 Real Time Clock (RTC). If you haven't come across one before, an RTC is a hardware clock with its own battery back-up, so that when your Arduino gets turned off, it does not forget the time.

The rationale for combining SD card with a RTC is that you can read temperatures or whatever and write then to the SD card along with the date and time form the RTC.


This useful card costs about 25 USD in kit form and a bit more ready assembled. I actually enjoy this kind of thing in kit form. It is easy enough to assemble and the instructions are clear and logical. They are found on the 'downloads' tab for the product information and you will also find the schematic and Eagle files there too.


One immediately noticeable feature of the board is the prototyping area. Which gives you can solder in your own temperature sensors or whatever else you want to log along with the time.

Rather than make a logger, I decided to make myself a thick juicy Arduino sandwich and combine it with a Freetronics LCD shield and an Arduino Uno to make a clock. I reviewed LCD Shields a while back.

Its a rather expensive and over-engineered clock - but none the less a clock. You set the time by sending a string from the Serial monitor and from then on, it will keep time for you.


The three boards are shown below.


The Snootlabs shield is placed on the Arduino Uno and then the LCD shield on top of that.

The only potential conflict in pin usage between the two shields is for pin D9 that is used for a general purpose LED on the Snootshield. As the LCD shield uses this for LCD Enable, occasional flickering of  the LED was not seen as a problem.

Conclusion
In summary, its a useful shield with good documentation from SnootLabs.

There are other boards including this from AdaFruit. The AdaFruit version is a similar price and even a similar layout. It does however use a buffer chip for the SD interface, where as the Snootlabs design uses potential dividers to drop the SD card levels.

Correction: In an earlier version of this post, I stated that the Snootlabs device did not have its own regulator - actually it does. Its a SMD ready soldered onto the bottom of the board. 


The code for the example project was adapted from here. Its Arduinio 1.0 code.


#include "Wire.h"
#include <LiquidCrystal.h>

#define DS1307_ADDRESS 0x68
byte zero = 0x00; //workaround for issue #527
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);

void setup()
{
  Wire.begin();
  Serial.begin(9600);
  Serial.println("Set date sending format: YYMMDD HHMMSS W");
  Serial.println("Where W = day of week - 1-7");
  lcd.begin(16, 2);
  lcd.print("Clock");
}

void loop()
{
  if (Serial.available())
  {
    setTimeFromSerial();
  }
  printDateTime();
  delay(1000);
}

void setTimeFromSerial()
{
  byte year = (Serial.read()-'0') * 10 + (Serial.read()-'0');
  byte month = (Serial.read()-'0') * 10 + (Serial.read()-'0');
  byte day = (Serial.read()-'0') * 10 + (Serial.read()-'0');
  Serial.read();
  byte hour = (Serial.read()-'0') * 10 + (Serial.read()-'0');
  byte minute = (Serial.read()-'0') * 10 + (Serial.read()-'0');
  byte second = (Serial.read()-'0') * 10 + (Serial.read()-'0');
  Serial.read();
  byte weekDay = (Serial.read()-'0');

  Wire.beginTransmission(DS1307_ADDRESS);
  Wire.write(zero); //stop Oscillator

  Wire.write(decToBcd(second));
  Wire.write(decToBcd(minute));
  Wire.write(decToBcd(hour));
  Wire.write(decToBcd(weekDay));
  Wire.write(decToBcd(day));
  Wire.write(decToBcd(month));
  Wire.write(decToBcd(year));

  Wire.write(zero); //start 

  Wire.endTransmission();

}


byte decToBcd(byte val){
// Convert normal decimal numbers to binary coded decimal
  return ( (val/10*16) + (val%10) );
}

byte bcdToDec(byte val)  {
// Convert binary coded decimal to normal decimal numbers
  return ( (val/16*10) + (val%16) );
}

void printDateTime(){

  // Reset the register pointer
  Wire.beginTransmission(DS1307_ADDRESS);
  Wire.write(zero);
  Wire.endTransmission();

  Wire.requestFrom(DS1307_ADDRESS, 7);

  int second = bcdToDec(Wire.read());
  int minute = bcdToDec(Wire.read());
  int hour = bcdToDec(Wire.read() & 0b111111); //24 hour time
  int weekDay = bcdToDec(Wire.read()); //0-6 -> sunday - Saturday
  int monthDay = bcdToDec(Wire.read());
  int month = bcdToDec(Wire.read());
  int year = bcdToDec(Wire.read());

  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print(hour);
  lcd.print(":");
  if (minute < 10) lcd.print("0");
  lcd.print(minute);
  lcd.print(":");
  if (second < 10) lcd.print("0");
  lcd.print(second);
  

}

About the Author
These are my books. Click on the image below to find out more about them.





Sunday, January 1, 2012

Arduino Screw Shield Review

This is a review of the Freetronics Terminal Shield and the SnootLabs Power Screw Shield.

Introduction.
The Arduino socket strips are okay for attaching components, but sometimes, when putting together a quick prototype it would be useful to be able to have something more substantial - like a screw terminal.

These shield boards provide just such a feature.


                                  Snootlabs                                                          Freetronics

The shields are intended for the Arduino Uno and earlier versions of Arduino. They break out all the terminal sockets into screw terminals.

Prices
The Snootlabs shield costs around 21 USD as a kit and 28 USD fully assembled.
The Freetronics shiled is only available fully assembled and costs around 17 USD

In Common
Both boards use straight through headers that mean as well as having screw terminals, you can also fit another shield on top. In both cases, the designers have left enough room to easily access the screw terminals even with a big shield like an LCD shield attached.


Both boards have a reset button.

SnootLabs Power Screw Shield
This is the larger and more expensive of the two shields. It has a large prototyping area where you can solder in components. It also has special areas of the board for soldering in a SMD chip and for DIL through hole ICs.

The other noticeable difference is the power connector. This is the same type of four pin connectors that you used to find on PATA Hard Disks to supply the power.

Jumpers allow you to configure this socket to either provide the power to the Arduino, or to pass through the Vin 2.1mm socket on the Arduino to the 4 pin socket to provide power to other devices.

There is also an LED that can either be linked to an IO pin of your choice or to 5V to act as a power-on indicator.

The Snootlabs website has very good information on this shield, including a photographic style sheet of instructions for constructing the board and a useful datasheet that explains what all the jumpers do without having to start working out whats going on from the schematics.


Providing the board in kit form is a nice idea. As well as being cheaper, its a nice easy project for someone new to electronics wanting to practice their soldering.

Freetronics Terminal Shield

As with all Freetronics kit. This is a high quality board that is sold fully assembled. Its smaller and cheaper than the Snootlabs shield and does not have a dedicated IC area for SMD or 0.1inch DIL. It does exactly what it says on the tin.

The board comes with a number of surface mount components already attached to it. This includes three (red, green and blue) LEDs and their current limiting resistors. These are positioned on the back ende of the shield where they are easily visible and can be wired to any of the IO pins.


Conclusion

Both products are good quality and neither will dispoint.

If you need to use an SMD IC for your project then the dedicated area for this makes the Snootlabs shield a good choice. The same applies if you need all the prototyping area you can get.

If this is not a consideration then the cheaper Freetronics shield will serve you just fine.


Other Options

Other screw shields are available of course and if you do not need the prototyping area then something like the WingShield may be of use to you. http://wingshieldindustries.com/products/screwshield/

Sparkfun and Adafruit both sell shields similar to the Freetronics offering: http://www.sparkfun.com/products/9729 and http://www.adafruit.com/products/196

About the Author
These are my books. Click on the image below to find out more about them.


                                                                                                                           

Friday, March 26, 2010

Simplified Ethernet Library for 28J60 Shield










With an Ethernet shield you can transform your Arduino into a tiny little web server. Not only that but a web server with Inputs and Outputs. So you can use it to measure things on an analog input and then access those readings from anywhere on the Internet. Or, if you like, you can use it as a remote control to turn things on and off.

There are two flavours of ethernet shield for the Arduino. There is the official one, based on the Wiznet W5100 chip and the unofficial but significantly cheaper board based on the 28J60 chip.

Nuelectronics sell a board based on this chip and have also produced a library to use it. There are also clones of this to be found on eBay, some of which have a neat little prototying area (see above)

The Nuelectronics library is very thorough, but not the easiest library in the world to use, so I decided to write a library that wrapped up this library with a simpler interface.

You can download the library from here but you will also need to download the Nuelectronics library from here.

Install both libraries into your Arduino environment by unzipping them into a folder called 'libraries' in your sketches directory.

You can now create a simple sketch like this hello world web server example:










#include "etherShield.h"
#include "ETHER_28J60.h"
static uint8_t mac[6] = {0x54, 0x55, 0x58, 0x10, 0x00, 0x24};                                        
static uint8_t ip[4] = {192, 168, 1, 15};                         
static uint16_t port = 80;
ETHER_28J60 ethernet;

void setup()
{ 
  ethernet.setup(mac, ip, port);
}

void loop()
{
  if (ethernet.serviceRequest())
  {
    ethernet.print("<H1>Hello World</H1>");
    ethernet.respond();
  }
}

This example just displays Hello World when you connect to it in a browser.

I have included some other examples that display the values at the analog ports, set a digital output and also echo the request parameters.


This is all heavily influenced by a posting I saw and now cannot find by some who had done a very similar thing to this. If you are reading this, please let me know so that I can give you the credit you deserve. I just kind of did things a slightly different way, and put it in a library rather than a set of functions.


The API is documented below:


Setup.
void setup(uint8_t macAddress[], uint8_t ipAddress[], uint16_t port);


Example:

static uint8_t mac[6] = {0x54, 0x55, 0x58, 0x10, 0x00, 0x24};                                                        
static uint8_t ip[4] = {192, 168, 1, 15};                         
static uint16_t port = 80;
ETHER_28J60 ethernet;

void setup()
{ 
  ethernet.setup(mac, ip, port);
}
You will need to find an ipAddress that is both in a valid range and unused on your local network.

The mac address just has to be unique on your network, so unless you have two of these boards on the network, the value above will be fine.

Servicing Web Requests


char* serviceRequest();
Example:




void loop()
{
  char* params;
  if (params = e.serviceRequest())
  {
    e.print("<H1>Web Remote</H1>");
    if (strcmp(params, "?cmd=on") == 0)
    {
      digitalWrite(outputPin, HIGH);
      e.print("<A HREF='?cmd=off'>Turn off</A>");
    }
    else
    {
      digitalWrite(outputPin, LOW);
      e.print("<A HREF='?cmd=on'>Turn on</A>");
    }
    e.respond();
  }
}

serviceRequest either returns null if there has not been an incoming web request to service, or it returns a string containing the request parameter string for the incoming request. The request string includes the '?' character.

In the example above, if the request parameter string is '?cmd=on' then the digital output is set high and the hyperlink to turn the output off is rendered. Otherwise, the digital output is set low and the hyperlink to turn it on is rendered.

This also shows how to write the response and make the final response to the browser's request.

Writing the Response

void print(char* text)
- adds a string of HTML to the response to be returned.

void print(int value);
- adds an integer displayed in decimal form to the response.

void respond();
- commits the response back to the requesting browser.

Some things to watch.
The board consumes about 250mA which seems a lot to me. When driven from a power adaptor rather than USB, that makes the Arduino board get pretty hot around the voltage regulator. So just be careful, particularly if you plan to put your project in a box.

If you start to get strange things happening with the code, and you are using a 168 Arduino, you may well be running out of memory. The examples in the library will work with a 168, but to do anything more substantial use a 328.


About the Author
These are my books. Click on the image below to find out more about them.