Project showcase
Arduino Serial Port Shield for Linkit One

Arduino Serial Port Shield for Linkit One © MIT

A Legacy Serial Port

  • 1,194 views
  • 1 comment
  • 2 respects

Components and supplies

max232 IC
×1
1uF Capacitor
×5
DB-9 Connector
×1
Rhxvhx2dhljmbtloxexc
Arduino Proto Shield
×1

Necessary tools and machines

09507 01
Soldering iron (generic)

About this project

I use a lot of Lantronix WiBoxes. They let you hook legacy serial devices to a Wifi network. I use them for Digital Signage and Security monitoring apps. I usually only use one port on them.

I made a legacy serial port adapter for the Linkit One's serial pins. This way I can replace the Wiboxes on my devices without making any hardware changes.It works equally well on most Arduino compatible boards like the Diavalino's I have.

Step 1: Schematic

Pretty Simple. Just follow the data sheet and you cant go wrong. I run it off the 3.3V line and it seems fine. That way I don't need a level shifter on the data pins. If you want to run it off 5V you should probably add a resistor and 3.3V Zener on the rx line before it get to the Linkit One digital pin 0.

Step 2: Assembling the Shield

I used a standard Arduino prototyping shield. I chose the MAX232CPE since I have plenty on hand. These need 1uF caps. Other chips need Larger or smaller caps so be sure to use those that match the chip you select.

I followed the schematic and placed the components to the rear of the shield. I originally thought I would place the connector so it would be on the same side as the Linkit One connectors but this orientation suits a specific application I have in mind. Lay yours out to match your own application.

I wired RTS and CTS pins to digital I/O pins on the Linkit. While not supported by the Serial1 routines I will implement them manually when needed. Some devices draw power from them too.

It clears the GPS antenna too.

Step 3: Testing & Enhancements

Looks like I misjudged the serial cable length I needed. Oh well, some protoboard jumpers will do for now. For testing lets try a Magtek serial port mag stripe reader. I got these from a surplus house that claims they were made for Diebold and intended for use in gas pumps. I found a spec sheet online that explained all the dip switch settings. It looks like only the top board was custom made for Diebold. These read tracks 1 & 2.

That seems to work great for input. The raw data is good.

Next I made another sketch to parse it. Had to do a little work to read just the data I wanted.

So for output lets try a Futaba VFD Serial Display. I encoded a dummy card so I don't have to worry about posting the output for everyone to see.

OK, Legacy Serial devices work. I have some I want to start working on now.

I left plenty of room in case I want to add circuitry.

I cant really think of any right now but I'm open to suggestions.


Code

Serial Test TerminalArduino
This is just the Software Serial Demo remixed for the Linkit One's serail1 port
//****************************************************************
//*  Name    : Serial Demo                                       *
//*  Author  : Robert Joseph Korn                                *
//*  Date    : 12/14/15                                          *
//*  Version : 1.1                                               *
//*  Notes   : Really just the software serial demo              *
//*          : changed for serial1                               *
//****************************************************************

void setup() {
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

 Serial1.begin(9600);
}

void loop() { 
  if (Serial1.available()) {
    Serial.write(Serial1.read());
  }
  if (Serial.available()) {
    Serial1.write(Serial.read());
  }
}
Mag Stripe Reader DemoArduino
Simple Magtek Serial Swipe ReaderDemo
//****************************************************************
//*  Name    : Serial Mag Swipe Reader Demo                      *
//*  Author  : Robert Joseph Korn                                *
//*  Notice  : Copyright (c) 2015 Open Valley Consulting Corp    *
//*  Date    : 12/14/15                                          *
//*  Version : 1.1                                               *
//*  Notes   :                                                   *
//*          :                                                   *
//****************************************************************

int SER = 0;
int state = 0;
int numlen=0;
int namlen=0;
int o=0;
char nam[255];
char num[55];

void setup() {
  
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  Serial1.begin(9600);

//  Serial1.write((int)0x07); // Boot Message
  Serial1.write((int)0x0C); // Clear Message
  Serial1.println();
  Serial1.write((int)0x0F);
  Serial1.println("MediaTek Linkit One");
  Serial.println("MediaTek Linkit One");
  Serial1.write((int)0x0E);
  Serial1.println("Mag Swipe Read Demo");
  Serial.println("Mag Swipe Read Demo");
  Serial.println("");
 delay(500);

}

void loop() {
   
          if( state == 3 ) 
          {     
              Serial1.write((int)0x0C);
             Serial.print("Track 1: ");
              
            for(int o=0;o<namlen-1;o++)
             {
               Serial1.print(char(nam[o]));             
               Serial.print(char(nam[o]));             
             }
             
             Serial1.println("");
             Serial.println("");
             Serial1.write((int)0x0E);
             Serial.print("Track 2: ");
 
             for(int o=0;o<numlen-1;o++)
             {
               Serial1.print(char(num[o]));             
               Serial.print(char(num[o]));             
             }
             
             Serial1.println("");
             Serial.println("");
             Serial.println("");

            numlen=0;
            namlen=0;
            state=0;     
          }
  
  if (Serial1.available() > 0) {
      SER = Serial1.read(); 

  switch(state)
  {
    case 0:if (SER==0x3B)  
               {
                 state=1;
               }
           if (SER==0x25)  
               {
                 state=2;
               }break;
               
    case 1:num[numlen]=SER;  
            numlen++;             
              if (SER==0x3F)  
               {
                 state=3;
               }break;
               
    case 2:nam[namlen]=SER;  
            namlen++;              
              if (SER==0x3F)  
               {
                 state=0;
               }break;
          
     default:break;
  }
 
  }

}

Schematics

Schematic
Almost verbatim from the data sheet
Fcw0zixii4ysi56

Comments

Similar projects you might like

Serial to LANC (Control-L)

Project showcase by L-Rosen

  • 5,877 views
  • 2 comments
  • 5 respects

Making a Screw Shield for the Arduino Pro Mini

by Iain

  • 1,626 views
  • 3 comments
  • 5 respects

Programming Learning Shield

Project showcase by Nicole Jesse

  • 769 views
  • 0 comments
  • 3 respects

Simple ATTiny13 Shield for Arduino UNO

Project showcase by Hugo Blanc

  • 677 views
  • 0 comments
  • 4 respects

Real Theremin Using Open.Theremin Shield for Arduino

Project showcase by Urs Gaudenz

  • 10,737 views
  • 8 comments
  • 18 respects

Nixie Tube Shield for Arduino

Project in progress by Marcin Saj

  • 8,604 views
  • 2 comments
  • 14 respects
Add projectSign up / Login