New Arduino shield – Phi-1

Add to FacebookAdd to DiggAdd to Del.icio.usAdd to StumbleuponAdd to RedditAdd to BlinklistAdd to TwitterAdd to TechnoratiAdd to Yahoo BuzzAdd to Newsvine

I have developed this shield in my spare time to make prototyping with Arduino much easier. The shield, when assembled, has one LCD monitor, 6 buttons, real time clock and battery backup for keeping time, EEPROM for data storage, GPS connector, buzzer, LED, and two RJ11 connectors for things you absolutely want secured against pull.

Here is a video of a 360 degree view of an assembled Phi-1 shield:

Just running a clock with DS1307 Real Time Clock (RTC) module

Running a testing routine to make sure everything works

Running a fully-functional alarm clock (it woke me up this morning) Details of making the alarm clock is on a separate post. The code is listed near the end of this post.

Morse encoder: type in a sentence and translate it into Morse code.

Function list:

  • 16X2 LCD character display
  • 6 push buttons –  four arranged in arrow keys and two more on the side
  • 2 RJ11 ports for long and robust connections with sensors or control devices
  • Optional buzzer and LED in place of the RJ11 ports
  • Real time clock with battery backup keeps the time when Arduino is turned off
  • EEPROM for easy data logging keeps data when Arduino is turned off. Use 24LC256 or compatible I2C EEPROM
  • GPS connector and breakout for this popular GPS module (http://www.sparkfun.com/commerce/product_info.php?products_id=465)
  • Reset button for Arduino
  • All Arduino pins are brought out for maximal flexibility.
  • Hackable for more functionalities (see the end of the assembling)

 Possible projects with this shield:

  • Alarm clock
  • Standalone or PC data logger
  • Lab data acquisition system (Physics, Chemistry etc)
  • Weather station
  • Input or operating panel, like security panels or garage door opener
  • Handheld GPS
  • Morse code generator
  • The list goes on… 

Documentation:

Phi-1 shield documentation revision 11/19/2010

PCB design:

Schematic:

Fully assembled shield running clock:

 

PCB and parts:

Connector board design pictures:

Standard board breaks out connections from the RJ11 jack and 5V/GND. The prototype space has 5V/GND running down middle for convenience. You can make a TTL-RS232 circuit on it, or maybe power an opamp, add I2C A/D converter to it or else. The screw terminals are pretty convenient and their connections are brought out for prototyping. You can also simply plug it into a breadboard. It also has two LED indicators and has connections for X, Y, 5V and GND.

The relay board has a standard AC or DC relay with control signal coming through the RJ11 jack from the main board. Several screw terminals are included for wiring. A power jack is also included so that it can easily power a single piece of equipment with the relay. You can turn on and off an electromagnetor else light with it. 

This board passes the RJ11 connection to a 3.5mm stereo plug. It also has an LED indicator.

Assembling pictures:

Sample codes:

Clock display This is a basic program that displays the Clock. You can modify it to suit your needs.

Testing all functions This program tests everything, LCD, buttons, the clock, and EEPROM if you have one on board. Learn the basics of everything with this program.

Alarm clock (buzzer and LED) This program is a fully-functional alarm clock. You will find it more complex than the basic clock. If you can’t understand, try the Click display first.

Morse encoder This program allows you to type in a sentence in letters, numbers, and symbols. Then it plays it in Morse code. Use the arrow up and down to type letters (think old-school arcade game record) use left and right to move cursor. Use B to enter.

More to come!

I am coordinating an effort to have it made in a small quantity so it will be affordable. If I have one made, it will cost me around $30, but if I have more made, I could cut the cost down and possibly have it for $12. Leave me a message if you’re interested in getting one. I might be able to get my favorate electronics online store to sell these so you could buy the board along with all needed components in one purchase.



How to connect Arduino with a character LCD

A character LCD can be pretty useful to an Arduino project since Arduino has no display itself. You see them everywhere: vending machines, laser printers, fax machines, etc. You can use the serial port to output information to a PC but that ties the Arduino to a computer. Arduino can do a lot without a PC, taking data and interacting with a user at the same time.

There are many types of LCD, color, mono, dot-matrix, character. A color LCD is always dot-matrix. Some even has touch sensors. We won’t need a color display since information we will display won’t be more useful with a fancy display. The more complex the display gets, the more resources it consumes. An arduino has 20 general I/O lines. A character display uses 6, a dot-matrix display uses 14. In order to use a color dot-matrix display, a microcontroller needs a lot  of memory and send a lot of data to the display, neither of which is what Arduino is best for. The simpler, the better. We will use a mono character display. We need a display for information.

Once in a while you see a teaching equipment company comes up with a handheld all-in-one lab measurement equipment with color display and touch screen. It’s tempting but most of the function it does like spreadsheet, and calculation, can be much better done with even an entry-level netbook. So we’re better off letting what lab equpiment does best, measurement, and leave data analysis to a PC. Enough of unhappy feelings towards teaching equipment companies.

Back to how to hook up a 16 column X 2 row character display.

You can find a very cheap one here:

http://www.dipmicro.com/store/LCD-1602A-Y



Make sure you pick up some male header pins and a 10KOhm potentiometer:

http://www.dipmicro.com/store/HEADS40T

http://www.dipmicro.com/store/R4V10-3386

An LCD has a total of 16 pins. Here is a list of all pins and functions:

Pin 1 GND

Pin 2 +5V

Pin 3 Contrast

Pin 4 RS (Register select)

Pin 5 R/W (Read or write)

Pin 6 EN (Enable signal)

Pin 7~Pin14 D0~D7 (Data)

Pin 15 A (Anode of back light LED)

Pin 16 C (Cathode of back light LED)

Luckly we only need to connect 6 of above pins to Arduino, and 5 additional pins to +5V, ground, or potentiometer.

If you want to do this on a breadboard, you will need some soft jumper wires.

First, you need to solder the male header pins to the LCD. Just break away 16 pins from your 40-pin male header pins, push them through the LCD pin holes and use possibly this iron (http://www.radioshack.com/product/index.jsp?productId=2062758). If you can’t find this in your local store, find a similar one around 30W and a sharp tip.

The LCD won’t stand well on its own with the pins. My trick is to take a piece of eye-glass cleaning cloth, fold it a couple of times, then stick it underneath the LCD as support. First heat up your iron for at least 3 minutes. Then add a little bit of solder to the tip. Wipe excess with sponge. Stick the tip of your iron against the first pin. The first pin takes a while to heat up. Just patiently count to 15. Bring the solder to the pin not the tip of the iron. If the solder melts, good, add around 1/4 inch of solder, wait for the solder to grab on the pin and get sucked in the pin hole. Move on to the next pin. If the solder doesn’t melt, don’t force it against the iron, just wait a few more seconds. When the pin and the hole are both hot enough, the solder will stick or wet them. The curvature is just the opposite when you force melted solder against cold pin.

Finish off all the pins. Check for shorts.

Now push your LCD into your breadboard, keep your Arduino near the LCD. Use a couple of jumper wires, bring the +5V and GND to the breadboard’s power rails. Add the potentiometer near the LCD pin 1. Connect left pin to +5V and right pin to GND. Connect the following LCD pins:

Pin 1 GND

Pin 2 +5V

Pin 3 middle of the potentiometer

This should power the LCD logic and contrast.

Now turn the potentiometer until you can see a row of black boxes on the display. This confirms that your display is working.

Now connect the following LCD pins:

Pin 15 +5V

Pin 16 220 Ohm resistor

The other side of the resistor goes to GND.

This should power up the LCD back light. If the back light is too dim, reduce the value of the resistor. Don’t connect Pin 16 directly to the ground. Doing so will reduce the life time of the back light by a lot. Most spec sheets tell you what to do regarding series resistors on back light. In doubt, try a 150 Ohm. Then gradually dial up or down the number (with a pot) to find the brightness you need.

I would turn my lights off at night and dial the brightness just enough for comfortable viewing in the dark. In this case the back light is not visible in well-lit rooms, which doesn’t need back light in the first place.

Now connect the following LCD pins to Arduino pins:

Pin 4 RS to Arduino digital Pin 7 (green on the left)

Pin 5 R/W to GND

Pin 6 EN to Arduino digital Pin 6 (orange on the left)

Pin 11~Pin14 D0~D7 (Data) to Arduino digital Pins 5~2. (blue, green, orange, white)

From left to right on LCD, black(GND), red (5V), blue (potentiometer middle), green(RS),orange(GND),another orange(EN, sorry running out of jumper wires), not connected (next 4 pins), blue, green, orange, white (D4-D7), red(5V), resistor (to GND)

We don’t need all 8 data pins. The LCD can work at 4-bit data mode, which saves 4 Arduino pins.

Now load the HelloWorld example code in Arduino IDE under examples->LiquidCrystal.

Make sure you change the line with LiquidCrystal(x,x,x,x,x,x); to LiquidCrystal lcd(7, 6,  5, 4, 3, 2);

Compile the sketch and upload it to Arduino. It should show “hello, world” and followed by a second count. If you’ve gone this far, you’ve made it. Go ahead and load more examples and modify them to learn how to work with the LCD. It’s easy, like LCD.print(“This is a message”);

If you want a more permanent installation of an LCD, instead of 12 loose wires, look at my Phi-1 shield. You can directly plug the LCD on the shield to make connection or take it off for a different project.

Updated photogate shield PCB – simple

I’ve decided to get rid of the buttons and LCD connector and make a bare minimal PCB for those that are only interested in using Arduino for photogates. This shield should work with both Pasco and ScienceSource photogates. I’ve used Pasco gates since the summer. I asked the tech at ScienceSource. Their gates are compatible with Pasco.
Here is schematic:

Here is the board:

Design file:

Simple photogate shield design

You can download it and have it made at a PCB online service. But making one or two is very costly (>$20 per board). If you want these made. Leave your contact info as a comment (your email address in the email field is not published) and I could coordinate an effort to bacth make for low cost (<$10 per board).

You will need a couple of 3.5 mm to 1/4 stereo plug adapter to connect to Pasco or ScienceSource gates. If you use the smaller gates, here’s the PCB for the smaller gates ($2.5 from various vendors). The part number is Sharp IA57HR:

Design files:

Simple photogate shield design

Again just getting a couple of these made will cost around $20, but batch make saves a lot (a few bucks each). Let me know if you want these.

Download these programs:

PC software

Arduino source code

Arduino photogate shield

So I set out to make my own photogate with Arduino and got some success. I then tried to make my design more robust for students. The breadboard version is not safe enough or convenient for labs. I decided to make a printed circuit board so there won’t be any loose wires that would be pulled out or even short the board. Also I want to stack the board on top of the Arduino, as a shield. I made this design back during the summer of 2010. This is a basic design with connections to photogates via stereo audio cables, a few buttons and an LCD connector for future development.

This is the assembled picture:

Here I powered it on with an LCD to display some information:

This is the schematic diagram:

This is the PCB design:

 

I will add more detail of the design and testing results in a later post. Time to grade papers.

How to add some pin numbers to your PCB design?

Many times I feel uncomfortable with the Eagle PCB program under the board view, because I’m looking at a pin header, and there’s no pin number. Which side is pin 1? If I go back to the schematic, I see all the pin numbers 1 through 8. Then back to board view, there’s no numbers. I’ve gotta fix this.

Here is how to display pin numbers of a pin header on the board view. Well, there isn’t a way. The pin header numbers don’t exist in the package so there’s nothing to display. In order to display pin number, you need to open the Eagle library and add those numbers yourself. Here’s how.

First I added an 8-pin header onto my schematic and connected pin 1 to a resistor. I turned to the board view, no pin nmuber:

Then, I go to Eagle’s control panel and double-clicked the library that has this half-cooked part, the library is pinhead.lbr.

Then I go and click package button and choose the 1X08 package.

With the text tool, I added 1 and 8 and repositioned the other texts. Save it.

Then I go back to Eagle and choose menu Library->update all.

Here is the new look of my board view:

This will not only make the number 1 and 8 display on the board view, but also add the numbers to the final PCB’s silk screen, which will help a person populate the board. So don’t put all the numbers, the board gets too busy.

Here is another way from macegr on arduino forum:

In DRC>Shapes>First you can choose the shape of pads marked “First” as you already tried. The problem is that pretty much nobody marks the first pin when they’re creating their part packages. You can go into the library, call up the appropriate package, right-click on the first pad, choose Properties, then check the “First” box. Now, if you use that part on a board, when a First shape is chosen in DRC, the shape of that pad will change to what you selected.

It doesn’t add that much flexibility and isn’t that much more convenient than just changing the shape of the first pin permanently in the library.

In general you’ll want to mark the first pin on silkscreen anyway. When you’ve soldered a header in place, the square pad isn’t visible anymore.

Arduino and photogates

Photogates are optical sensors that are are routinely used in physics labs to measure speed of objects passing through them. Arduino can sense photogates fairly easily. The following is an example of how to use arduino to sense photogates.

What is a photogate made off?

It has an infrared LED that emits IR light. It also has an IR phototransistor to sense the IR light. There are two ways to make a photogate: one way is to build an interruptive gate. One will have an IR LED emit light and an IR transistor on the opposite side of the gate to receive the light. If no object obstruct the light, the transistor reports low. When an object passes through the gate, it blocks the IR light and the transistor reports high. This way reduces false triggers since the transistor only looks at the IR LED and is not easily disturbed by nearby IR sources, like a lamp. Another way is to construct a reflective photogate. This gate has IR LED and transistor on the same side but a reflective surface needs to be brought near the assembly so enough IR light is reflected by the surface back and hits the transistor to product a signal. This way larger objects can be detected but the sensor is more subject to external noise.

There are pre-manufactured photogates for a few bucks so I will use one made by Sharp.

Here I have connected two photogates to arduino.

Here is a detailed hookup picture:

Here is some video:

Arduino project – Mores code generator

Using an arduino, I created a Mores code generator. In the video, the arduino is connected to a tiny buzzer, which makes the sound. Code is posted below. In the video, the arduino welcomes you to wikipedia. I used the example on wiki so that I could compare their waveforms to confirm that arduino has actually generated the correct Mores code.

Here is a picture of waveform of my generated message compared with wikipedia’s original message to show my generator works:

Source code:

#define period 90 //13.33 WPM
#define buzzerPin 11
// Dr. Liu 10/03/2010
unsigned char message[]="WELCOME TO WIKIPEDIA, THE FREE ENCYCLOPEDIA THAT ANYONE CAN EDIT.   ";
unsigned char space_to_Z[][8]={" ", "!-.-.--", "\".-..-.", "# ", "$ ", "% ", "&.-...", "\'.----.",
 "(-.--.", ")-.--.-", "* ", "+.-.-.", ",--..--", "m-....-", "p.-.-.-", "/-..-.", "0-----", "1.----",
 "2..---", "3...--", "4....-", "5.....", "6-....", "7--...", "8---..", "9----.", ":---...", ";-.-.-.",
 "< ", "=-...-", "> ", "?..--..", "@.--.-.","A.-", "B-...", "C-.-.", "D-..", "E.", "F..-.", "G--.",
 "H....", "I..", "J.---", "K-.-", "L.-..", "M--", "N-.", "O---", "P.--.", "Q--.-", "R.-.", "S...",
 "T-", "U..-", "V...-", "W.--", "X-..-", "Y-.--", "Z--.."};
void setup()
{
}
void loop()
{
  char pointer=0;
  char pointer2=0;
  while (pointer2>=0)
  {
    if ((message[pointer2]>=' ')&&(message[pointer2]<='Z'))
    {
      unsigned char character=message[pointer2]-' ';
      pointer=0;
      while (pointer>=0)
      {
        switch(space_to_Z[character][pointer])
        {
          case '.':
            di();
            break;
          case '-':
            dah();
            break;
          case ' ':
            delay(6*period);
            break;
          case '':
            delay(2*period);
            pointer=-2;
            break;
          default :
            break;
        }
        pointer++;
      }     
    }
    else if (message[pointer2]=='') pointer2=-2;
    pointer2++;
  } 
} 

void di()
{
  analogWrite(buzzerPin, 2.5);
  delay(period);
  analogWrite(buzzerPin,0);
  delay(period);
}
void dah()
{
  analogWrite(buzzerPin, 2.5);
  delay(3*period);
  analogWrite(buzzerPin,0);
  delay(period);
}
 

Arduino and physics

Arduino is a physical computing platform with onboard inputs and outputs. With sensors and relays, arduino can perform jobs as simple as turning on a light-emitting diode or as complicated as flying a model plane. Use arduino to make yourself gadgets or audio and visual arts.

%d