Tran-Duino Under Progress
Hi to all,
I have posted already about my Final year Acadmeic project , based on Arduino ,
“ Tran-Duino “. Now after a delay of nearly 2 months due to the purchase of components, I have started with the project.
First of all I Thank my project Guide Mr. Thyagarajan Shanmugham, a FOSS enthusiast. He has given me this idea of Tran-Duino and has extended his great support.
Goal of Tran-Duino :
The main idea of Tran-Duino is
- To provide the information to a user traveling in a vehicle say a bike or a bus , about the upcoming location using a LCD display with the help of GPS.
- To include localized advertisements on the display based on the location by which the vehicle currently moves through.
- To display nearest community landmarks like hospitals, fuel stations, police stations based on locative technology
I am a newbie to the Arduino and also to FOSS world. Initially I had no components to work with and my guide gave his freeduino ATMega8 to work with. I started with interfacing LCD display with Arduino and then did the interfacing of SD card with out using any shield using the help from Arduino Forum . http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1206874649/8 .
But due to some problem in building the schematic, I was not able to interface it successfully. I tried several other possible ways and also seeked help from Forums. But I could not make it.
Then my Guide suggested me to buy the components that will be required to built the project. So , I made arrangements for money and purchased the components.
This Blog is about how to interface Arduino, EM-406a GPS module and a JHD162a 2-line LCD Display.
Components used :
For my Project “Tran-Duino” – An Arduino based project , I have purchased the following components.
USGlobalSat EM-406a GPS module from Adafruit Industries, USA.
Adafruit GPS Shield V1.1 with inbuilt SD card slot from Adafruit Industries, USA.
Freeduino ATMega328 from Bhasha Technologies, Pune.
JHD162a LCD display
I followed the schematic from the following links to interface the LCD display with Arduino . http://www.arduino.cc/playground/Code/LCD3wires
Usually If we need to interface the LCD display with Arduino we need to atleast 6 digital pins from Arduino. We can make use of LiquidCrystal library that is available inbuilt with the Arduino IDE versions. The LiquidCrystal library makes use of
- Arduino pin 12 – LCD 4 pin [ RegisterSelect ]
- Arduino pin 11 – LCD 6 pin [ Enable ]
- Arduino pin 5 – LCD 11 Data pin [D4]
- Arduino pin 4 – LCD 12 Data pin [D5]
- Arduino pin 3 – LCD 13 Data pin [D6]
- Arduino pin 2 – LCD 14 Data pin [D7]
and also 5V power for LCD pins 2 and 15 , GND for LCD pins 1 and 16. The LCD pins 15 and 16 are used to power the backlight and LCD pin 3 for controlling the contrast using a 3K POT [ variable resistor ] .
The usual interface is as follows,
But incase if we need to interface LCD and Arduino with less number of pins, we can make use of Shift Register like HEF4094. This interface utilizes only 3 digital pins from Arduino thereby saving pins of Arduino so that we can interface other devices.
The Schematic for the 3-wire interface is as follows.
Pins Availability :
For my project I need to interface LCD display, EM-406a GPS module, SD card with the Arduino.
The Arduino has 14 digital pins. The SD card interface via GPS shield utilizes Digital pins 10-13 of Arduino.
The EM-406a GPS module utilizes
- Arduino pin 0 – GPS shield Rx pin
- Arduino pin 1 – GPS shield Tx pin
- Arduino pin 2 – GPS shield PWR pin [ power to GPS shield ]
- Arduino pin 3 – GPS shield L2 pin [ Red LED to denote SD card read/write ]
- Arduino pin 4 – GPS shield L1 pin [ Green LED to denote Location Fix ]
Now, a total of 9 out of 14 pins are used by GPS and SD card. Hence I have made use of 3-wire interface to connect LCD since I have left out with only 5 pins of Arduino.
GPS , LCD , Arduino Interface :
The GPS shield was provided as a Prototype board with individual parts. So, It took time for me to solder it into a unit . I followed the schematic and soldering information from the link http://ladyada.net/make/gpsshield
Since the Arduino is made of male pins, I soldered the female headers at the Base of the shield so that it can be mounted on the Arduino. I also soldered the male pins on the top side of the GPS shield inorder to connect other devices to Arduino [ LCD ].
After soldering , I initially tested whether the GPS module was working by removing the ATMega328 IC from Arduino and interfacing the GPS directly to it as given in the link http://ladyada.net/make/gpsshield/directconnect.html
The GPS module worked fine and It was logging data on the serial monitor. Then I placed the IC back into Arduino and connected the GPS module onto the Shield.
Please never forget to place the sticker provided along with the GPS module at the base of the GPS , since placing the GPS directly on the GPS shield may cause shorting of the module.
Stick the GPS module on the shield using the sticker onto the Shield only after finalizing the project.
I also soldered few missing pins on the shield and then connected the sheild with Arduino using jumper wires.
Then I mounted the GPS along with the shield on the Arduino as shown in the picture .
The TX JMP jumper pin is a hardware setting that is used to stop the GPS logging into the SD card. If we remove the TXJMP jumper, the GPS stops the logging. Then we can remove the USB power to the unit after the RED LED on the GPS shield is not lit.
The SD card was formatted with FAT16 filesystem and is inserted into the SD card slot on the shield before mounting the shield over the Arduino.
The Connections were done and I uploaded the GPS-logging code from the link http://ladyada.net/make/gpsshield/GPSLogger_v3.pde
The code got compiled and I placed the GPS module in open space for sometime and after several minutes the GPS module started logging to SD card and the logging details got displayed on the Serial monitor of the Arduino IDE.
Now, I needed the latitude and longitude that is returned by the GPS alone to be printed on the LCD display connected to the Arduino.
The data being returned by GPS (ie) the NMEA Sentences were in String format. Hence I modified the GPS logger code, extracted the latitude and longitude alone and printed it on the Serial monitor at first trial.
It got printed since I dint convert anything to float or double values. Then I connected the LCD display to Arduino via GPS shield. I once again modified the GPS code , included the LiquidCrystal library and tried to print the extracted latitude and longitude values.
But, the LCD display was printing only junk characters and I was confused on what went wrong. Then I identified the problem. Since the GPS Shield is mounted over the Arduino, I have soldered all the digital and power pins on the Shield so that when shield is mounted over Arduino, I can interface other devices using those pins.
The Arduino has only 14 digital pins, 6 Analog pins and power pins. The Shield makes use of digital pins 10-13 of Arduino , the GPS module makes use of 0-5 pins of Arduino . Hence I was left with only 5 pins from pin number 5-9.
But to Interface an LCD , minimum It needs 6 digital pins which was not available now. So, I made use of the LCD 3-wire Library and built the 3-wire schematic.
I made use of HEF4094 shift register and LCD3WireLibrary in the Arduino IDE. Intially It dint work due to some loose wiring in the circuit. I also tried out other complicated schematic using shift registers like 74HC164, 74LS164N, 74HC595. But even these circuits did not work for me. I got only Black blocks getting displayed on the first line of my Display unit.
I once again re-built the schematic using HEF4094 and this time It worked by POT adjustments, proper wiring. I tried the LCD3Wireexample sketch and the text was getting printed on the LCD display.
Now, I remodified the same GPS logger code and included the LCD3Wire library , tried to print the converted [ String to character array] latitude and longitude value that are received from GPS module.
I connected the LCD with the left-out pins of Arduino and uplaoded the code. It was working fine . But both the latitude and longitude was getting printed on the same line of the Display unit.
I Set the cursor position correctly in the code and uplaoded it again. This time the latitude was getting printed dynamically on first line of the Display and longitude on the second line.
I also modified the code to extract the lat lon values from the GPS string, convert it to float values and printed it on the Serial monitor.
Hence the possible way to interface an LCD display when Arduino is interfaced with several other devices is by using a Shift Register or we can also buy a Serial LCD which consumes only three pins – digital pin, 5V power pin, and a GND pin.