Archive

Archive for the ‘projects’ Category

Control electrical appliances using PC UPDATED

November 23, 2011 Leave a comment

 Introduction

In this article I will first tell you about how to build the LED interface circuit for the Parallel Port and then how to control the circuit using software. With this very basic prototype you will be able to learn a lot how the parallel port works. So, I’ll start with the circuit first.

                                              

Circuit Description

Components Used:-
Eight RED colored LEDs
DB-25 Male Connector
Zero PCB
Ribbon WireAll you need to do is to connect each data pin from the parallel port (pins 2 to 9) to positive terminal of a LED and one ground pin (any one from 18 to 25) to the negative terminal of all the LEDs.
Since LEDs have polarity, you should pay attention to correctly locate its positive and negative terminals. If you pay close attention, you will see that LEDs are not completely rounded, the cathode side is a little bit flat. Also the longer leg of LED is anode or positive terminal and the shorter leg is cathode or negative terminal.

                                          

How the circuit works?

Working of this circuit is pretty simple. When data at any pin 2 – 9 is ‘1’ , that particular LED will glow, else if data is ‘0’, the LED will stop glowing.

When data at any pin from 2 – 9 is ‘1’,then it means that 5 volts is coming out of that pin and is going towards +ve terminal of LED. Circuit gets completed through ground pin (any from 18 to 25) and the LED glows until data at that particular pin is not ‘0’.

This data flow is controlled using software discussed below.

Software

To control any port we need a kernel mode driver software. Softwares generally run in USER mode. But to control theParallel Port we need a software running in kernel mode. I have used C#.Net for developing this software.
Download and install Microsoft .NET Framework Version 2.0.
Now download and install My Parallel Port Control Setup.
Download the source code in C#.Net.

In The End

This article was just an building block to the parallel port interfacing.

Categories: circuit, projects

AVR MICRO CONTROLLER BASIC ROBOT (atmega8)

September 13, 2011 Leave a comment



This video is my first AVR atmega8 project in my workshop check this out if any one wants a help on it let me reply ill answer

           
In our journey with the AVR we will be working on Atmega8 microcontroller, which is a 40-pin IC and belongs to the megaAVR category of AVRfamily. Some of the features of Atmega8 are:
·      16KB of Flash memory
·         1KB of SRAM
·         512 Bytes of EEPROM
·         Available in 40-Pin DIP
·         8-Channel 10-bit ADC
·         Two 8-bit Timers/Counters
·         One 16-bit Timer/Counter
·         4 PWM Channels
·         In System Programmer (ISP)
·         Serial USART
·         SPI Interface
·         Digital to Analog Comparator.
Categories: microcontroller, projects

Temperature controller using DS1820 and LCD display

July 5, 2011 Leave a comment

This Project is used to indicate the temperature and it is also used as controller. The system will get the temperature from the DS1820 and it will display the temperature over the LCD display. There are 2 preset levels, one is low preset and the other is High preset. The temperature was compared with the value stored by the user and if the temperature goes beyond the High Preset temperature then an relay is switched ON until the temperature comes below the Low preset temperature.

The System is fully controlled by the microcontroller AT89S52. It is a popular 8 bit microcontroller. The circuit consists of four switches, in which two buttons are used to increment and decrement the High limit temperature value and the other two buttons are used to increment and decrement the Low limit temperature value.

The temperature limits are stored inside the EEPROM, since 89s52 dont have inbuilt eeprom. The IC 24C02 is the eeprom chip and it is connected to the microcontroller through the I2C bus. The DS1820 is the temperature sensor chip which is connected to the microcontroller through 1 wire bus.


Download the microcontroller code and PC application: Temperature-controller

Categories: projects

Laser communicator

July 4, 2011 Leave a comment

                              


                                              









A simple laser communicator. 

How would you like to talk over a laser beam? In about 15 minutes you can set up your own laser communication system, using cheap laser pen pointers and a few parts from Radio Shack.
For the transmitter you will need. A laser pen pointer. A battery holder that holds the same number of batteries as the laser pointer (often 3 cells). The batteries can be any size, but they must be the same voltage as the laser batteries. You may need to get one that holds two cells, and another that holds one cell, and wire them together in series. Radio Shack has a decent selection.  A transistor radio. Later we will use a microphone and an amplifier (Radio Shack #33-1067 and #277-1008), but at first we will send your favorite radio station over the laser beam. An earphone jack that will fit your transistor radio (Radio Shack #42-2434).
                                                                                         A transformer of the type known as an audio output transformer. It consists of an 8 ohm coil and a 1000 ohm coil. The one I used is the Radio Shack #273-1380. We now carry them. Some clip leads (wires with alligator clips on the ends) to put it all together. At least one of the clip leads should be the type with a long slender point (Radio Shack #278-016, #270-372, or #270-334), to connect to the inside of the laser pointer. You can substitute regular wire and solder if you like, but the clip leads are fast and simple. Radio Shack has a wide selection of clip leads (such as ##270-378).
         A two-lead bicolor light emitting diode, to protect the laser from high voltage spikes.
For the transmitter you will need:
         A laser pen pointer.
         A battery holder that holds the same number of batteries as the laser pointer (often 3 cells). The batteries can be any size, but they must be the same voltage as the laser batteries. You may need to get one that holds two cells, and another that holds one cell, and wire them together in series. Radio Shack has a decent selection.
         A transistor radio. Later we will use a microphone and an amplifier (Radio Shack #33-1067 and #277-1008), but at first we will send your favorite radio station over the laser beam.
         An earphone jack that will fit your transistor radio (Radio Shack #42-2434).
         A transformer of the type known as an audio output transformer. It consists of an 8 ohm coil and a 1000 ohm coil. The one I used is the Radio Shack #273-1380. We now carry them 
         Some clip leads (wires with alligator clips on the ends) to put it all together. At least one of the clip leads should be the type with a long slender point (Radio Shack #278-016, #270-372, or #270-334), to connect to the inside of the laser pointer. You can substitute regular wire and solder if you like, but the clip leads are fast and simple. Radio Shack has a wide selection of clip leads (such as ##270-378).
         A two-lead bicolor light emitting diode, to protect the laser from high voltage spikes.
For the transmitter you will need:
         A laser pen pointer.
         A battery holder that holds the same number of batteries as the laser pointer (often 3 cells). The batteries can be any size, but they must be the same voltage as the laser batteries. You may need to get one that holds two cells, and another that holds one cell, and wire them together in series. Radio Shack has a decent selection.
         A transistor radio. Later we will use a microphone and an amplifier (Radio Shack #33-1067 and #277-1008), but at first we will send your favorite radio station over the laser beam.
         An earphone jack that will fit your transistor radio (Radio Shack #42-2434).
        A transformer of the type known as an audio output transformer. It consists of an 8 ohm coil and a 1000 ohm coil. The one I used is the Radio Shack #273-1380. We now carry them 
      Some clip leads (wires with alligator clips on the ends) to put it all together. At least one of the clip leads should be the type with a long slender point (Radio Shack #278-016, #270-372, or #270-334), to connect to the inside of the laser pointer. You can substitute regular wire and solder if you like, but the clip leads are fast and simple. Radio Shack has a wide selection of clip leads (such as ##270-378).
    A two-lead bicolor light emitting diode, to protect the laser from high voltage spikes.
For the receiver you will need:
    A small solar cell (such as Radio Shack #276-124). You may have to solder your own wires to it if it doesn’t come with wires attached.
         A microphone jack that will fit the phono input of your stereo (Radio Shack #42-2434 or ##42-2457). Instead of a stereo, you can use the small amplifiers that Radio Shack sells (#277-1008).
It may be hard to find a battery holder that holds three batteries. You can use two battery holders (one that holds two batteries, and one that holds a single battery) and connect them in series.
Remove any batteries from the laser.
Connect a clip lead to the inside of the laser pointer where the battery touched. Usually there is a small spring to which you can attach the clip lead. The other end of the battery usually connects to the case of the laser. Since there are many different styles of laser pointer, you may have to experiment with clip lead placement to get the laser to work with the new external battery pack. You may also have to hold down the laser’s push button switch by wrapping a rubber band or some wire around it. Test the connection before you attach the transformer, to make sure the laser works with the new battery pack. If it doesn’t light, try reversing the battery. Battery reversal will not harm the laser.
Connect the 1,000 ohm side of the transformer between the battery and the laser. The 1,000 ohm side of the transformer has three wires coming from it. We only use the outside two wires. The inside wire is called a center tap and we do not use it in this circuit.
Connect the bicolor light emitting diode to the two outside wires of the transformer on the 1,000 ohm side. We are using this part (the bicolor LED) as a protection device to prevent the laser from getting high voltage spikes from the transformer. We didn’t need to do this with the old-style lasers that had protection circuits built into them, but there are a lot of lasers being sold lately that have no protection, and need the bicolor LED to absorb any extra high voltage the transformer may produce when it is connected or disconnected. If you see the LED flash when you connect the battery, you will be seeing it absorb a high voltage spike that might have otherwise damaged the laser.
Test the laser by attaching the battery. The laser should operate normally at this point.
Connect the earphone jack to the 8 ohm side of the transformer. The schematic of the transmitter looks like this:



                                       
The transformer modulates the power going to the laser. The signal from the radio is added to and subtracted from the battery power, and the laser gets brighter and dimmer along with the volume of the music or voice in the signal.
The receiver is the simplest part. You simply connect the solar cell to the microphone jack, and plug it into the amplifier or stereo phono input. It does not matter which way the wires are connected to the solar cell.

Here is the schematic of the receiver:
                                         
Setup and testing
Make sure the transistor radio is turned off, and the laser is on. Plug the earphone jack of the laser into the earphone socket of the radio.
Connect the solar cell to the amplifier or stereo, and turn the volume up until you hear a hissing noise, then turn it down slightly until the hiss isn’t noticeable. The volume control should be fairly high, corresponding to an ear splitting level if it was playing music
Aim the laser across the room so it hits the solar cell. You might hear clicks or pops coming from the stereo or amplifier as the laser beam passes over the solar cell. This indicates that everything is working fine at this point. 

Categories: projects

Open GPS Tracker

July 4, 2011 Leave a comment


 The Open GPS Tracker is a small device which plugs into a $20 prepaid mobile phone to make a GPS tracker. The Tracker responds to text message commands, detects motion, and sends you its exact position, ready for Google Maps or your mapping software. The Tracker firmware is open source and user-customizable.

The current supported hardware platform is:

* Tyco Electronics A1035D GPS module
* Motorola C168i AT&T GoPhone prepaid mobile phone
* Atmel ATTINY84-20PU AVR microcontroller

Project requires no interface chips! All you need is a GPS module, a phone, an ATTINY84, a voltage regulator, a PNP transistor, and a few passive components. This is a commercial grade tracker and is currently a second-generation stable beta V0.17.

This version stores messages while out of GSM coverage, and forwards them when it regains coverage.
 

  
Introduction
Welcome to the Open GPS Tracker site. The Open GPS Tracker is a small device which plugs into a $20 prepaid mobile phone to make a GPS tracker. The Tracker responds to text message commands, detects motion, and sends you its exact position, ready for Google Maps or your mapping software. The Tracker firmware is open source and user-customizable.

Project status: Current build is 0.17 assembled 04/24/2008
We currently have second-generation stable firmware and a reference hardware design. All parts are available from Mouser Electronics, and the phone is available from Target, Walmart, or Radio Shack. This site provides the firmware with source code, theory of operation, parts list, and exact assembly and checkout instructions. If you can solder, this is a one-sitting project. No PC board or surface-mount capability is required.

Programmed parts will be available as soon as the firmware is out of beta. We intend to have kits and assembled units available for purchase shortly thereafter. Commercial products are planned, but the firmware will remain open source.

The current supported hardware platform is:

·         Tyco Electronics A1035D GPS module
·         Motorola C168i AT&T GoPhone prepaid mobile phone
·         Atmel ATTINY84-20PU AVR microcontroller
We intend to support more phones and GPS devices in the future.
The Tracker’s features are competitive with, or better than, many commercial products:
·         SiRFstar III receiver gets a fix inside most buildings.
·         Sends latitude, longitude, altitude, speed, course, date, and time.
·         Sends to any SMS-capable mobile phone, or any email address.
·         Battery life up to 14 days, limited by mobile phone. Longer life possible with external batteries.
·         GoPhone costs $10 per month for 1000 messages per month.
·         Configurable over-the-air via text message commands.
·         Password security and unique identifier.
·         Manual locate and automatic tracking modes controlled via text message.
·         Automatic tracking mode sends location when the tracker starts moving,
when it stops moving, and at programmable intervals while moving.
·         Alerts when user-set speed limit is exceeded.
·         Retains tracking messages if out of coverage, and sends when back in coverage.
·         Retains and reports last good fix if it loses GPS coverage.
·         Remote reporting of mobile phone battery and signal status.
·         Extended runtime mode switches phone on and off to save battery life.
·         Watchdog timer prevents device lockup.
·         Firmware is user-customizable with a $35.91 programmer and free software.
In addition to being a GPS tracker, the firmware is easily modified to monitor and control anything from a weather station to a vending machine via text messaging. Please contact me for custom development.
How to build the Open GPS Tracker
The tracker is easy to build on a perfboard. I used a basic one-pad-per-hole perfboard and 26-gauge wire, but 30-gauge would probably be better. All the electronic parts are available from Mouser Electronics. Radio Shack sells the perfboard and the 2.5mm plug for the phone. You could also buy these from Mouser.
If you are building a tracker, please post in the user forum. I am looking for bug reports, pictures, and information about how the tracker works for you. I will provide technical support to people who are building units.
The Mouser Electronics (http://www.mouser.com) order is listed below. This order includes an AVRISP2, which you may not need if you already have an AVR programmer. I’ve included two each of all the small parts, and three of the GPS module connectors. This connector is the only tricky part of the build. It is easy to ruin one, as I did. For testing, you can just insert the 26-gauge wire into the socket on the GPS module, but for permanent assembly you need the connector. The connector has one extra pair of pins, which you should cut off. You will be soldering to the long side and plugging the short side into the GPS unit.
You need to solder to four pins on the GPS header, three of which are right next to each other. Clamp the header with a small vice or a “third hand” clip. Bend the wire into a loop with pliers and attach it to the pin, then carefully solder it. I solder pin 3 and pins 7 and 11 first, putting the wires down low near the plastic separator, then solder pin 9 with the wire up high away from pins 7 and 11. Check for shorts with a meter.
 
I superglued the IC socket and the two rows of three pins for the programming port, then wired those together and installed the rest of the components. Put the 0.1uF capacitor right next to the IC socket. The GPS module is attached to the board with 2-32 size screws, nuts, lock washers, and 1/4 inch spacers, which are not quite long enough. Get 3/8 inch spacers if you mount it this way.
Mouser Part #
Description
Quantity
Price Each
556-ATTINY84-20PU
Atmel AVR microcontroller
2
$2.90
827-AME8811AEATZ
3.3 volt regulator
2
$0.69
522-ZTX1151A
PNP transistor with low saturation voltage
2
$1.51
581-SA105E104M
0.1 uF ceramic capacitor
10
$0.08
581-TAP106K006SCS
10 uF tantalum capacitor
4
$0.50
855-M50-3501242
1.27mm M50 connector for GPS device
3
$1.45
171-0025-EX
2.5mm stereo plug for phone
2
$1.35
571-1-390261-3 or
571-26415994
14 pin IC socket
2
$0.15
604-WP937EGW
Two-color red/gren LED
2
$0.34
604-WP132XID
Red LED
2
$0.12
660MF1/4DC3321F
Resistor 3.32K ohm
5
$0.03
660MF1/4DC4700F
Resistor 470 ohm
5
$0.03
755-1N4148T-77
Switching diode
5
$0.03
12BH431-GR
3 AAA battery holder
1
$0.89
571-41032390
Pin header 40-pin breakaway
1
$1.57
340-V23993-A1035D
Tyco GPS receiver module
1
$61.50
556-ATAVRISP2
AVRISP2 USB AVR programmer
1
$35.91
Microcontroller schematic (scanned from notes)
Power supply schematic for 4.5V battery
Programming plug
GPS module socket, module facing antenna down
Checkout process
When you finish building the project, perform these checks. This will prevent destruction of components and verify that the circuit is built correctly.

Unpowered checks with no batteries, MCU, phone, or GPS installed:

·         Check continuity from the negative battery terminal to MCU pin 14, phone jack ground, regulator center pin, and GPS header pin 9.
·         Check continuity from the positive battery terminal to the input pin of the regulator.
·         Check continuity from MCU pin 1 to the output of the regulator.
·         Check for shorts between all adjacent pins of the MCU, programming header, phone jack, and GPS module. There should be no continuity between any adjacent pins.
·         Check continuity from each pin of the programming header to the corresponding MCU pin.
·         Check continuity from each pin of the phone jack to the corresponding MCU pin.
·         Check continuity from pin 3 of the GPS header to pin 11 of the MCU.
·         Place the GPS header over the GPS module and make sure you have wired the right pins.
The plug is very small and mistakes here are expensive. All the wires should be on the inside row of pins, closer to the metal shield. No wires should be on the outside row closer to the edge of the GPS module.
Powered checks with batteries but no MCU, phone, or GPS installed:
·         Measure voltage between pin 1 and pin 14 of the MCU socket. You should have 3.3V with pin 1 positive.
·         Measure voltage between pins 9 and 11 of the GPS header. You should have close to 3 volts with pin 11 positive.
·         Place a jumper between pins 5 and 14 on the MCU socket. The red “GPS active” LED should light.
·         With the jumper in place, measure voltage between pins 7 and 9 of the GPS header. You should have 3.3V with pin 9 positive.
·         Remove the jumper, and place it between pins 1 and 2 of the MCU socket.
·         Place another jumper between pins 3 and 14 of the MCU socket. The two-color status LED should light red.
If it lights green, it is installed backward and all status codes will be reversed in color.
Reading status codes
The two-color status LED blinks to provide status codes. Status codes are two-digit numbers which assist in debugging. The first digit is always shown in green, and the second digit in red. For example, one green blink followed by three red blinks is code 13. Three green blinks followed by two red blinks is code 32. The status codes are displayed one at a time from a queue, so the event that caused a status code may be over by the time the code is displayed.
Code
Description
11
phone polled
12
send message failed
13
phone poll failed
14
no phone number defined
21
invalid password
31
power on or reset
32
watchdog reset
33
eeprom initialized from defaults
34
remove jumper to reinit
Final checkout and setup
·         Remove one battery, install the Atmel MCU, and put the battery back in.
·         If your MCU is unprogrammed, connect the AVRISP2 to the computer and to the board via the programming header. Both lights in the AVRISP2 should be green.
·         Download the appropriate HEX file for the units (feet, meters, MPH, KPH) you want from the Download link at the top of this page.
·         Program and verify the MCU using AVR Studio or other PC software.
·         The status LED will begin blinking shortly after the programming completes. With no phone attached, you should get codes 31 (power on or reset), 11 (polling phone), and 13 (phone poll failed.) A freshly programmed chip will also display code 33 (EEPROM initialized) once.
·         Charge the Motorola C168i mobile phone. Install the SIM card and activate the prepaid service using the instructions included. Call the interactive voice response system at             1-800-901-9878       and activate a messaging plan (200 messages for $5.00, keywords: buy features, messaging, 200, yes, buy it) to avoid being charged 15 cents per message. You should be able to send and receive SMS messages from the phone keypad.
·         Configure the phone for short (10 second) display backlight (Settings, Initial Setup, Backlight, 10 seconds.)
·         Set the phone to silent mode (Settings, Ring Styles, Style, Silent.)
·         Set message delivery to Phone first (Message, Options, Memory Meter, Select SMS Memory, Phone First.) If you do not do this, Powersave mode will not work!
·         Remove a battery from the tracker’s battery pack. Connect the Tyco GPS unit to the header, checking against the diagram to make sure it is plugged in correctly.
·         Install the removed GPS battery, and then plug the 2.5mm plug into the mobile phone’s headphone jack. The headphone jack is also the data port on this phone.
·         You should get code 11 (polling phone) but no code 13 (poll failed.) If so, your microcontroller is communicating with the phone.
·         If you get code 13, reset the microcontroller by momentarily shorting pins 5 and 6 on the programming header. If you still get code 13, unplug the phone and power cycle it.
·         Removing the GPS battery with the phone connected is not recommended, and will not reset the microcontroller. The phone will partially power the microcontroller through the output line and a protection diode in the chip.
·         When you get code 11, and no code 13, your unit is ready for setup.
·         Please post to the user forum. I want to hear about working trackers, and will provide support for anyone having trouble with one.
·          
Setting the reply address
The GPS tracker stores a reply address, and always sends messages to the reply address. It does not care where the messages come from, because messages sent from email do not include the From address (using AT&T GoPhone service.) The reply address can be a mobile phone number or an email address. Regardless of where commands are sent from, replies go to the reply address.
To set the reply address to a mobile phone number, use a mobile phone to send a text message to the tracker’s phone number:
GPS SETADDRESS 8185551212
where 8185551212 is the mobile number you want tracker messages sent to. The “GPS” must be uppercase. The SETADDRESS can be upper or lower case. After sending the message, the tracker’s phone display should light, the tracker status light should blink code 11, and you should receive a reply saying “COMMAND EXECUTED”.
To set the reply address to an email account, you need your carrier’s Email Gateway number, which is a special phone number used to route text messages to an email account. For AT&T the Email Gateway number is 121. For other carriers, go into the phone’s SMS settings (Messages, Options, Message Setup, Text Messages, Email Gateway) and look up the Email Gateway number. Send a text message to the tracker:
GPS SETADDRESS 121 user@domain.com
where “GPS” is in uppercase, 121 is the Email Gateway, and user@domain.com is the email address. For AT&T service, you can send an email to phone-number@txt.att.net (8185551212@txt.att.net) to send a text message. For other carriers, you will have to look up the correct email address. The tracker will reply “COMMAND EXECUTED.”
Requesting a locate
Once you have set your reply address, you can request a locate. Send the message:
GPS LOCATE
where GPS is in uppercase. The tracker’s phone display will light, the status LED should blink code 11, and the GPS power LED should come on. For the first locate, it will usually stay on for a minute or more. When the GPS light goes out, the status LED will blink code 11 again, and you should receive a reply:
LOCATE POS 34 05.8779 N 118 20.6368 W ALT 377 FT SPEED 0.0 MPH COURSE 11.05 AT 08/04/05 22:31:51 UTC SATS 04
This is a location report from the tracker. The fields are:
·         LOCATE – the report is the result of a manual locate request. There are other types of reports in tracking mode.
·         POS 34 05.8779 N 118 20.6368 W – latitude and longitude in degrees and decimal minutes. You can type or paste everything after POS right into Google Maps (http://maps.google.com) to see a map or satellite view of the location.
·         ALT 377 FT – measured GPS altitude, only accurate for 4 or more satellites (see below)
·         SPEED 0.0 MPH – speed of the GPS unit when the fix was taken. A unit sitting still often reports up to 2 mph.
·         COURSE 11.05 – course in degrees if the unit was moving
·         AT 08/04/05 22:31:51 UTC Year, month, day, hour, minute, second Universal Coordinated Time that the fix was taken
·         SATS 04 – number of satellites providing the fix. Four or more indicates a 3D fix (altitude valid) while three satellites indicates a less-accurate 2D fix.
If you get a valid location report, your tracker works. If you get “GPS TIMED OUT WAITING FOR FIX” the tracker is not in GPS coverage. Although the A1035 gets a fix inside most buildings, steel construction can block the signal. Take the device outside and try again.
If you get “NO DATASTREAM FROM GPS DEVICE” your GPS module is not sending any data to the microcontroller. Check for faulty connections and verify that power is applied to the GPS module when the GPS power LED is lit. Dead GPS batteries can also cause this error, since the microcontroller needs less power than the GPS module.
Securing your tracker
The “GPS” prefix you have been putting before commands is actually a default password. You can and should change it. Anyone who knows your password can change it and take control of the tracker. Unlike commands, the password is case sensitive. To change it, send a text message like:
GPS SETPASSWORD newpass newpass
Where “newpass” is the new password you want to set. It must be between three and sixteen characters, and must be repeated twice after SETPASSWORD. You should get back “PASSWORD CHANGED.” You would then have to send “newpass LOCATE” to request a locate, for example. If you lose your password, you need physical access to the tracker to clear the configuration (see the command reference.) Messages sent without the correct password will be ignored.
Other things the tracker can do
So far you have seen the normal mode, in which the tracker replies immediately to requests. The tracker has two other modes: tracking and powersave.
In tracking mode, the tracker automatically takes GPS fixes, and sends you a message when it starts moving, when it stops moving, when it goes out of GPS coverage, and periodically while it is moving. You can plot the fixes on Google Maps or a similar service to follow the tracker’s movements. You can configure how often the tracker takes a fix and how often it alerts you. You can also set a speed limit and receive an alert if it is exceeded.
In powersave mode, the tracker turns the phone power on and off periodically, allowing the phone battery to last longer than its typical standby time. For example, the phone may be off for an hour and on for ten minutes. In this case, it can take up to an hour for the tracker to reply to messages. You can remotely take the tracker out of powersave mode when you need location reports. Tracking and powersave modes are mutually exclusive; setting one mode clears the other.
The tracker has several configurable options, and a status command that reports the current settings, the phone battery status, the phone signal strength, and the firmware revision. You can set a name which will be prefixed to all tracker replies, so several trackers can report to the same destination. See the command reference for details.
Commands for build 0.17
Commands are sent to the tracker as SMS messages (not EMS/MMS/picture messaging.) All commands must be prefaced by the correct password, or they will be ignored without reply. One command per message. Commands can be upper or lower case, but passwords are case sensitive. All time values are approximate, because the tracker uses a fairly inaccurate clock. Timing values are intended to adjust power versus tracking resolution, not for precise timekeeping. Units of measurement for speed and altitude are set when the firmware is assembled, and cannot be changed without an AVR programmer.
SETADDRESS phone-number optional-email-address
Sets the reply address. Phone-number is sent as the destination in the SMS message, and can be up to 32 digits. Email-address is prefixed to the message, and can be up to 64 characters. To send to a mobile phone, provide only the phone number. To send to an email address, provide the Email Gateway as the phone number, followed by a space and the email address. The Email Gateway for AT&T is 121.
LOCATE
Requests an immediate location report from the tracker. Tracking mode also generates location reports. In POWERSAVE mode, the locate will not occur until the next power-on interval.
Example location report:
LOCATE POS 34 05.8779 N 118 20.6368 W ALT 377 FT SPEED 0.0 MPH COURSE 11.05 AT 08/04/05 22:31:51 UTC SATS 04
 
·         LOCATE – event that caused the report to be sent.
·         POS 34 05.8779 N 118 20.6368 W – latitude and longitude in degrees and decimal minutes. You can type or paste everything after POS right into Google Maps (http://maps.google.com) to see a map or satellite view of the location.
·         ALT 377 FT – measured GPS altitude, only accurate for four or more satellites (see below)
·         SPEED 0.0 MPH – speed of the GPS unit when the fix was taken. A unit sitting still often reports up to 2 mph.
·         COURSE 11.05 – course in degrees if the unit was moving
·         AT 08/04/05 22:31:51 UTC Year, month, day, hour, minute, second Universal Coordinated Time that the fix was taken. This is satellite time and is accurate.
·         SATS 04 – number of satellites providing the fix. Four or more indicates a 3D fix (altitude valid) while three satellites indicates a less-accurate 2D fix.
 
Report causes (first parameter of location report) – all but LOCATE and timeout are tracking mode only.
 
·         LOCATE – manual locate request.
·         STARTED – the tracker has started moving.
·         MOVING – the tracker was moving and continues moving.
·         SPEEDING – the tracker is exceeding the speed limit (whether started or previously moving.)
·         STOPPED – the tracker was moving and has stopped for the specified number of intervals.
·         MOVED – the tracker was not moving when the fix was taken, but has been displaced since the previous fix. Setting the minimum displacement too short will generate spurious MOVED reports.
·         GPS TIMED OUT WAITING FOR FIX, LAST GOOD FIX … indicates the GPS receiver did not receive a valid satellite signal. Setting the fix wait too short will cause this error. The receiver needs at least 35 seconds, and often two minutes, to receive ephemeris if it has been off for over an hour. Steel and concrete buildings, including parking garages, block the signal. If the last good fix is all dashes, no valid fix was received since the tracker was powered up or rebooted.
·         NO DATASTREAM FROM GPS DEVICE indicates the GPS module is not sending data. This is likely either a loose connection or a dead GPS battery.
SALOCATE phone-number optional-email-address
Sets the reply address and requests an immediate locate. The reply address remains changed to the new value. This is equivalent to SETADDRESS followed by LOCATE.
SETPASSWORD new-password new-password
Changes the tracker’s password. The same password must be repeated twice. It is case sensitive. Range: 3-16 characters.
SETNAME tracker-name
Sets an identifier up to 16 characters that will be prefixed before all messages. This is useful when many trackers are reporting to the same address. SETNAME with no value removes the identifier.
TRACKON
Activates TRACKING mode, and takes the device out of POWERSAVE mode if set. The device will respond with a tracking report, and will send unsolicited reports based on its motion. Tracking mode uses a lot more power than normal mode.
TRACKOFF
Takes the device out of TRACKING mode and puts it in NORMAL mode. This command also cancels POWERSAVE mode if set.
POWERSAVE
Activates POWERSAVE mode and takes the device out of TRACKING mode if set. The device will immediately go off the air, and will not accept additional commands until the next power-on interval. Set message delivery to Phone First (Message, Options, Memory Meter, Select SMS Memory, Phone First.) If you do not do this, powersave mode will not work, and you will lose remote control of the device.
POWERON
Takes the device out of POWERSAVE mode and puts it in NORMAL mode. This command also cancels TRACKING mode if set.
STATUS
Requests the status page. The SETTRACK and SETPOWER commands also return a status page showing the new settings.
Example status page:
SPDLMT=0 STOPD=120/2 BLKD=600/2 MOVNG=120/5 PSV=3600/600 3D/FIX/BLKD=72/136/96 MD/MS=200/20/100 BAT=78 SIG=19 WDR=0 V=0.17 Open GPS Tracker
 
·         SPDLMT=0 Speed limit, or 0 if disabled.
·         STOPD=120/2 Stopped fix interval and notify delay.
·         BLKD=600/2 Blocked fix interval and notify delay.
·         MOVNG=120/5 Moving fix interval and notify frequency.
·         PSV=3600/600 Powersave on/off intervals.
·         3D/FIX/BLKD=72/136/96 Four-satellite wait, fix wait, and blocked fix wait. Rounded down to a multiple of four seconds.
·         MD/MS=200/20/100 Moved report distance in 1/1000 of a minute of longitude/latitude. Minimum speed to treat as moving, in tenths of a unit. Minimum speed to accept on first report, in tenths of a unit.
·         BAT=78 Phone battery charge, reported by +CBC command. Range: 0-100
·         SIG=19 Phone signal strength, reported by +CSQ command. Range: 0-31 ?
·         WDR=0 Watchdog reset count. Should remain zero. If the count is nonzero, the processor hung and was restarted by protective hardware. The most likely cause is either a software fault or electrical interference. This should not happen, but I need to know about it if it does. Watchdog reset cancels tracking and powersave modes. Range: 0-255 and will not roll over from 255 to 0. Cleared by reboot.
·         V=0.17 Open GPS Tracker Tracker firmware revision.
SETSPEED <up to three parameters>
 
·         Speed limit, in the same units used to report speed. If this speed is exceeded in tracking mode, the device sends a SPEEDING report. The first time the speed limit is exceeded, and each time the current fastest speed (above the limit) is exceeded, the device sends an immediate report. Otherwise, reports are sent at normal MOVING intervals, but with the tag SPEEDING. Current fastest speed is cleared by TRACKON. Range: 0-255, and 0 disables speed checking.
·         Minimum moving speed, in tenths of a speed unit. (20 = 2 speed units) Increase this to prevent spurious moving reports. Range: 0-255.
·         Minimum moving speed to accept on first fix, in tenths of a speed unit. Speeds between minimum moving speed and this setting are double-checked. Ranger: 0-255.
SETTRACK <up to seven parameters>
 
·         Stopped fix interval, in seconds. Sets how often the device takes GPS fixes in tracking mode, while stopped and in GPS coverage. Range: 0-65535
·         Stopped notify delay, in fix intervals. This determines for how many fixes in a row the device must be stopped, before sending a stopped report and switching to the stopped fix interval. Range: 0-255
·         Blocked fix interval, in seconds. Sets how often the device attempts to take GPS fixes in tracking mode, and with no GPS coverage. Setting this too short can drain the GPS battery. Range: 0-65535
·         Blocked notify delay. This determines for how many fixes the device must be blocked, before sending a blocked report and switching to the blocked fix interval. Range: 0-255
·         Moving fix interval, in seconds. Sets how often the device takes GPS fixes in tracking mode, while moving. Range: 0-65535
·         Moving notify frequency. Sets how often, in moving fix intervals, the device sends a MOVING report. Range: 0-255
·         Minimum displacement for MOVED report. Sets how far the device must be displaced to send a MOVED report. 1000 means one minute of longitude/latitude. Setting this too short will cause spurious MOVED reports. Range: 0-65535
Example: SETTRACK 70 120 2 600 2 120 5 200
Parameters not specified will be left unchanged. The command returns a STATUS report.
Stopped and moving fix intervals can be set short without excessive battery drain, because the GPS module takes a fix in just a few seconds once it has ephemeris. Blocked fix interval should be set longer to prevent battery drain.
SETPOWER <up to five parameters>
 
·         Powersave phone off interval, in seconds. Sets how long to leave the phone off for, when in POWERSAVE mode. The device will not respond to commands during this interval. Range: 0-65535
·         Powersave phone on interval, in seconds. Sets how long to leave the phone on for, when in POWERSAVE mode. The phone must stay on long enough to receive pending commands from the network. If this interval is set too short, you can lose remote control of the tracker, requiring a manual reset. Each incoming command restarts the power-on interval. Range: 0-65535
·         Four-satellite wait time, in seconds. Determines how long the tracker will wait for a four-satellite (3D) fix, before accepting a less accurate three-satellite (2D) fix. This should be less than fix wait time. Range: 0-1023, granularity 4 seconds.
·         Fix wait time, in seconds. Determines how long the tracker will wait for a fix before giving up and reporting a timeout. Range: 0-1023, granularity 4 seconds, lowest useful value is 64 seconds.
·         Blocked fix wait time, in seconds. Determines how long the device will wait for a fix before giving up, while in blocked state. This can be set shorter than the fix time above to prevent battery drain when the tracker is blocked. Setting it too short causes the device to stay in blocked mode after it moves into coverage. Range: 0-1023, granularity 4 seconds.
Example: SETPOWER 3600 600 72 136 96
Parameters not specified will be left unchanged. The command returns a STATUS report.
REBOOT
Reboots the tracker, and if phone rebooting is enabled in the firmware, also reboots the phone. This clears working memory but does not erase saved settings. Equivalent to shorting pins 5 and 6 on the programming connector, or unplugging the phone and removing the batteries.
REINIT
Erases all settings and puts the device into “new chip” state. This wipes out the reply address and password, so the next command must be GPS SETADDRESS. Equivalent to the hardware reinit procedure. Also reboots the phone if phone rebooting is enabled in firmware.
Hardware reinit
This manual procedure erases all settings if you are unable to communicate with the device over the air (usually because you lost the password.) Make sure you are electrically grounded to prevent static damage. You need a jumper of the type used on CD-ROM and hard drives to set master/slave modes. Put the jumper between pins 3 and 4 (middle two pins) on the programming header (bridge MCU pins 7 and 9.) Reboot the device by either applying power with no phone attached, or momentarily shorting pins 5 and 6 on the programming header.
The status LED should blink code 34. When it stops blinking, remove the jumper. The LED will now blink 33 and 31. The device is cleared and ready for a GPS SETADDRESS. The clearing occurs when you remove the jumper.
Status codes – first digit blinks green, second digit blinks red.
 
Code
Description
11
phone polled
12
send message failed
13
phone poll failed
14
no phone number defined
21
invalid password
31
power on or reset
32
watchdog reset
33
eeprom initialized from defaults
34
remove jumper to reinit
Open GPS Tracker: how it works and how to modify it
Too many open source projects give you a pile of code with no explanation. That makes it difficult for newcomers to work on the code. This page will explain how the Tracker works, from general principles to a walkthrough of the source code.

 

GPS and the Tyco A1035 receiver
Wave energy, such as sound, radio signals, and light, travels at a known speed in a known medium. This allows measurement of distance to the energy source by measuring the time required for the signal to arrive.
Suppose you have a long straight track, like a dragstrip or a runway. Put a speaker at each end of the track, a known distance apart. Simultaneously at regular intervals, each speaker generates a short tick. By comparing the arrival times of the ticks, you can find your position along the track.
If you hear the left speaker’s tick two units before the right speaker, then you are one unit to the left of center. If you hear the right speaker’s tick four units before the left speaker, you are two units to the right of center.
You can also determine the exact time the sounds were sent. If it takes ten units of time for sound to go from one speaker to the other, and you are two units to the right of center, there are three more units of time to the right speaker, so the sound was sent three units of time before you heard the right speaker tick.
This is the trivial one-dimensional case: with two speakers you can solve for one spatial dimension plus time. With three speakers (arranged in a triangle, for example) and more complex math, you can solve for two spatial dimensions plus time. And with four speakers, you can find your position in three-dimensional space.
In GPS, the “speakers” are satellites sending radio signals. All the satellites send on the same channel using spread-spectrum techniques, so one radio receiver can receive all the satellites in view, and a chip can sort out the signals. When you read about a “20-channel” GPS, like the A1035 used in the Tracker, it only has one radio. It has 20 decoder channels on the chip, so it can listen to 20 satellites at the same time. If at least four satellites are in view, the GPS receiver can solve for your position in three-dimensional space. With only three satellites, the receiver can get an approximate two-dimensional fix by essentially assuming you are close to the ground relative to the satellites.
In order to find your position, the receiver needs to know exactly where the satellites are. Each satellite transmits its position, calledephemeris, every 30 seconds in a continuous loop. The ephemeris is good for one hour. If the GPS has been off for an hour, it will take at least 30 seconds to get a fix. If the signal drops out, and a few bits are lost, you have to wait another 30 seconds for the data to repeat. So the first fix takes some multiple of 30 seconds. Additional fixes arrive one per second.
The A1035 receiver used in this project is one of the best GPS modules available, but it stil requires a substantial amount of battery power – around 50 ma at 3.3V. It has a microwave radio and a CPU faster than the AVR microcontroller. Leaving the module on would drain the battery in a few hours. The Tracker uses a PNP transistor to switch the module’s power on and off. When off, the module retains its ephemeris data in static RAM, powered by the Vbak wire and the diode. The Tracker can switch the GPS on, get a fix within a few seconds, and switch it off again. After an hour, the ephemeris expires and there will be another 30-second or longer delay.
The A1035 outputs serial data at 4800 bps. This is similar to a PC’s serial port but inverted and at a lower voltage. You can connect the A1035 to a PC using a MAX3232 chip as explained under Development below. The format, called NMEA, is a continuous stream of comma-delimited ASCII lines. The receiver starts outputting as soon as you apply power, although no position numbers appear until it obtains a valid fix.
Other GPSes should also work. I interfaced a Garmin ETrex Vista to the development board through a MAX3232 chip and it worked fine.

 
Short Message Service and the Motorola C168i phone
The GSM wireless standard includes SMS, more commonly known as text messaging. SMS sends 160-byte messages between mobile phones. The network will store and forward messages for a phone which is off or out of coverage. There is a standard set of commands, based on the old Hayes AT command set, for sending and receiving SMS under program control.
SMS is designed to communicate between phones. To send email from SMS, you send to an email gateway, and prefix the email address before your message. Long email addresses limit the length of the message you can send. SMS coming in from email comes from a random-looking number, with no reliable way to reply to it. This requires the Tracker to have a preset reply address, rather than parsing each incoming message and figuring out the reply address.
Most mobile phones today have USB interfaces on proprietary connectors. GSM modules are available with serial interfaces, but they are expensive. The C168i is a welcome exception – a $20 phone with a serial interface on a standard 2.5mm headset jack. The serial interface is CMOS level like the A1035, and can be connected directly to a microcontroller. It can also be connected to a PC with a MAX3232 chip.
The C168i is perfect for microcontroller interfacing, but GoPhone service has a few downsides. One is that it sends a “balance remaining” message to the phone after every message. Some phones, like the Samsung A437, can be set to ignore this, but the C168i cannot. The messages accumulate but appear to cause no harm. To prevent this and other memory leaks, the microcontroller reboots the phone periodically using the AT*SWRESET command. This can be disabled with a #define directive in the program.
Another nuisance is the annoying voice response system I have to use to buy the monthly SMS plan. Hopefully it will be available on the website soon.
The C168i can, in theory, be switched on and off by a +CFUN command. In practice, the +CFUN=0 command does a fine job of switching the transceiver off, but the +CFUN=1 command does not turn it back on. Powersave mode currently uses the AT*SWRESET command to turn the phone back on. This can be changed to +CFUN=1 with a #define, for use with other phones.
Other phones should work as long as they support AT commands on a serial interface. GSM modules should also work, but I don’t have any to test.

 

Atmel ATTINY84 AVR microcontroller
The ATTINY84 is a small but complete computer in a 14-pin integrated circuit. It works well for this application because it has a self-contained clock accurate enough for serial communication, interrupt timers, and nonvolatile memory. The development tools are free and the programmer is cheap. The AVR requires only a battery to run. The board includes the standard 6-pin connector for programming AVR processors.
The Tracker need two serial ports, one for the phone and one for the GPS. The smallest AVR processor with two hardware UARTs is a 40-pin chip, so the Tracker uses software UARTs, setting programmable timers to clock bits in and out. This works fine as long as you only need to communicate with one device at a time.
The AVR can be put into a low-power stop mode and can wake itself up when a timer expires, or can be woken by external input from the phone receiving a SMS. The processor spends most of its time in this state, waking up only to process a message or take a GPS fix. The processor runs at 1MHz for 4800-baud communication. It could run at 8MHz, if you need faster serial I/O. All the timing values would have to be adjusted. There is a setting or “fuse” bit to select the speed.
The circuit
The ATTINY84 runs fine on unregulated battery power, but the GPS module requires a 3.3 volt regulated power supply. The AME8811 is a good regulator for this device because it has a low dropout voltage, has a low standby current, and is available as a TO-92 leaded part. It needs the capacitors to stabilize it against oscillation.
The Tracker needs to switch the power to the module with a PNP transistor. The ZTX1151 is overkill, but I had some around and they have a low saturation voltage. There is also a two-color LED for status, another LED connected to the switched GPS power, and resistors for the LEDs and transistor base. That’s all there is to the circuit.
The program
The code is 5K bytes of assembly language, text strings, and control strings. There is a main program and four interrupts. The four interrupts are:
·         Timer 1 compare A: bit clock for serial send and receive.
·         Pin change interrupt 0: detects start bit of incoming byte.
·         Timer 0 overflow: four-per-second interrupt for countdown timers and blink codes.
·         Watchdog timer overflow: wakes the processor from sleep mode. Returns immediately, and is just used as a wakeup.
Serial receiver
There is a 256-byte serial receive buffer from 0x100 to 0x1ff in SRAM. The serial receiver is activated by the SERIAL_RECEIVE_ENABLE_FROM_{GPS,PHONE} functions. Once activated, the interrupt receives characters and adds them to the buffer at the position set by SERIAL_POINTER. The pin change interrupt detects a start bit, starts the Timer 1, and disables itself. The timer clocks the bits into SERIAL_DATA, writes the finished byte into RAM, increments the pointer, turns off the timer interrupt, and re-enables the pin change interrupt.
The main program calls GET_NEXT_CHAR after setting RECEIVE_TIMEOUT. GET_NEXT_CHAR returns a pending character, waits for a character, or returns with the T flag set if the receiver timed out. The Y pointer keeps track of the main program’s position in the buffer. The program often saves the Y pointer, looks ahead, and then resets the Y pointer. Parsing of the buffer is done “live” while characters are coming in. This works fine as long as the main program stays ahead of the incoming data.
Serial transmitter
SERIAL_PORT selects the I/O line that will transmit data. Calling SERIAL_SEND_BYTE sends one character from SERIAL_DATA. Although the timer interrupt sends the bits, SERIAL_SEND_BYTE waits for completion before returning.
SERIAL_SEND_STRING_TO_PHONE is the string output function, and is analogous to printf() in C. It accepts a control string containing text and a series of special-function codes. The codes can insert SRAM or EEPROM fields, call substrings in program memory, or print numbers in decimal. All the special function codes are documented at the top of the function.
Text and numeric parsing
The functions for parsing text are BRANCH_ON_STRING, PARSE_NMEA_OR_COMMAND_LINE, and PARSE_DECIMAL. BRANCH_ON_STRING takes a control string giving a list of program addresses and strings, scans the input buffer for matching strings, and jumps to the corresponding program label. This is used to identify user commands, phone responses, and NMEA strings.
PARSE_NMEA_OR_COMMAND_LINE parses space or comma delimited fields into SRAM. The flag FLAG_PARSE_NMEA makes it handle the NMEA format with checksum, $ and * characters, and empty fields. With this flag clear, it parses command lines and phone responses. This function also accepts a control string to determine which fields to save and where in SRAM to save them. There is a 64-byte area in memory reused for all such parsing.
PARSE_DECIMAL reads a string containing a decimal number, and returns the 16-bit number. It is used to parse user input and NMEA values where these need to be processed numerically. There are options for integer or dot-one format.
The GPS provides speed in knots and altitude in meters. We need to convert to other units (KPH, MPH, feet) and this is done by UNITS_CONVERT. The function multiplies a 16-bit number by a 16-bit conversion constant, keeping only the high-order 16 bits of the product. This scales the input down, so there are prefix entry points that double or quadruple the input before applying the constant.
All strings in SRAM and EEPROM are null-terminated and have a maximum field length. An eight-character field can hold eight characters of text, or if the string is shorter, it will be null-terminated.

 
GPS locate
The function GPS_LOCATE turns on the GPS module, receives serial data until it gets a valid fix or times out, and then turns off the GPS module and returns with the fix status. It will wait a (shorter) time for a 3D fix, then will wait a (longer) time for any fix including a 2D fix, and then will return failure if no fix is obtained. It parses the GPRMC and GPGGA sentences.
The function waits a preset number of lines after the first valid fix to allow the data to smooth out. It takes a second look if it gets a speed between 2 and 10 knots, or if it gets a position displaced more than MIN_DISPLACEMENT from the last good fix. Without this additional filtering, the tracker generated a lot of spurious MOVED and STARTED messages.
Phone operations
The function DO_PHONE_OPERATION takes a list of phone commands and runs them. Each command is null-terminated and there is a double null at the end of the last command. After each command, the function waits for a phone response and branches according to PHONE_MATCH_PATTERN. Each response has a handler, OK goes on to the next command, and ERROR retries from the beginning. Specific messages are sent using SEND_STRING_OFFSET_0.
Sleep mode
When no commands are pending, the MCU goes into a sleep mode where it stops the processor and main oscillator. Only the watchdog timer continues to run. The MCU will be woken by either a watchdog timeout or a message from the phone. The phone is configured to send a message if it receives a SMS. This message is not actually parsed; it just wakes the MCU and the MCU then polls the phone. The poll interval depends on mode; in tracking mode it is configurable, and in normal mode it polls every 15 minutes if no messages are coming in.
Main loop
Repeat forever
  If tracking mode,
    Get a location fix.
    Decide on the basis of fix status and tracking state whether to send
    a tracking message.
    Update tracking state if it has changed.
  Poll the phone for incoming messages.
  If messages found,
    If not previous failures (CMGL_SAFETY_COUNT)
      Get first message.
      If password valid,
        Call message-handling function based on command.
    Delete first message.
    Set FLAG_NEED_TO_POLL_MESSAGES.
  else (no message found),
    Clear FLAG_NEED_TO_POLL_MESSAGES.
  If phone reset enabled and time to reset phone,
    Reset phone.
    Wait for it to come back online.
    Clear PHONE_RESET_COUNT.
  If callback command pending from message above,
    Execute the callback command.
    Clear the callback pointer.
  Wait for blink codes to finish.
  If FLAG_NEED_TO_POLL_MESSAGES set,
    Go to top of main loop.
  Sleep for POLL_INTERVAL or until interrupt wakes up.
  If wakeup was an interrupt,
    Set FLAG_NEED_TO_POLL_MESSAGES.
    Go to top of main loop.
  else (wakeup was timer expired)
    If in powersave and phone was off,
      Turn on the phone.
      Set state to waking up.
      Set the powersave waking up poll interval.
      Go to top of main loop.
    else if in powersave and phone was waking up,
      Set state to power on.
      Set the power on poll interval.
      Go to top of main loop.
    else if in powersave and phone was on,
      Turn off the phone.
      Set state to power off.
      Go back to sleep.
    else (not in powersave),
      Go to top of main loop.
Download firmware
The current build is 0.17, supporting the ATTINY84, Motorola C168i and Tyco A1035.
Right-click the file and choose Save As…
Note: if you are upgrading from build 0.14, you must change the phone configuration:
Message/Options/Memory Meter/Select SMS Memory/Phone First
Intel hex firmware image, speed in MPH, altitude in feet
Intel hex firmware image, speed in KPH, altitude in feet
Intel hex firmware image, speed in KPH, altitude in meters
Source code in AVRASM2 format
Old version – source code in AVRASM2 format

To assemble from source, you need AVR Studio 4, available here:http://www.atmel.com/dyn/products/tools_card.asp?tool_id=2725

Assembly command:

“C:\Program Files\Atmel\AVR Tools\AvrAssembler2\avrasm2.exe” -fI -l OPENGPS_016.LST OPENGPS_016.ASM
Open GPS Tracker: modification and development
Level converter
The serial port on a PC uses high voltages (+/- 8 volts) with idle negative, start bit positive, and data inverted. CMOS level serial communication among the Tracker components is 0 – 3.3 volts, and inverted relative to a PC’s serial port. To customize and debug the Tracker, you need a serial level converter. The chip is a MAX3232 (Mouser Part No. 511-ST3232EBN, 16-pin DIP, $3.15)
Install a 16-pin socket on a perfboard and attach the five capacitors as shown on the datasheet. The chip requires 3.3 volts in, and generates the high voltages using a charge pump. One chip provides two transmitters and two receivers, but you only need one each for most purposes. I installed screw terminals on mine for easy connection, and LEDs on the outputs of the MAX3232 chip. If I built another one, I would have multiple ground terminals to make it easier to connect everything.
Connect the RS232 side of the converter to your PC serial port. [give pinout] USB serial adapters work fine. Connect power to the converter, go into Hyperterminal or Minicom on the PC, and connect to the COM port directly. Use 4800 baud, 8, N, 1, no flow control. Type a few characters and nothing should appear. Now bridge the CMOS IN and OUT lines on the converter, and type again. Your characters should echo. If this works, the converter is good.
Connecting to the phone or GPS
If you connect the phone through the level converter, you can interact with the AT command interface. When trying to send AT commands manually, this phone suffers from character loss. At first I thought the AT interface is just broken on the C168i, but it works fine if you send a continuous data stream. It has a very short timeout before it stops listening, so you have to type fast and continuously. This is probably excessive power management in the phone. The Tracker frequently gets no response to its first ATE0, but the second attempt works.
Connecting the GPS to the level converter will display the NMEA strings. I used this to try out the GPS module. You can also use the level converter in reverse to interface an RS232-level GPS unit to the AVR microcontroller. I tried this with the Garmin ETrex Vista and the Tracker got a valid fix from it.
Enabling serial debug in the Tracker
Set the #define SERIAL_DEBUG in the Tracker source to enable debug output from PORTA7 (MCU pin 6.) Connect this pin through the level converter to the PC and start the microcontroller with debug firmware loaded. You should get a message “MACHINE STARTED IN DEBUG MODE” at 4800 baud. From there, the microcontroller will copy all phone interactions and responses to the PC. This is essential to debugging the phone interaction.
You can also load the microcontroller with non-debug firmware and “tap” the phone or GPS lines with the level converter. This will get you only one side of the phone interaction, but debug firmware runs slower and might work when production firmware does not.
Adding a command
To add a new command, add an entry to COMMAND_MATCH_PATTERN with the command and address of a new function. Add the function to handle the command and parse any options. This function will be called while the serial I/O is still running and the command is in the buffer, so you cannot send a message directly from this function.
Parse your options into the PARSE_FIELDS area. To send a message, set the address of another function in COMMAND_PENDING. After the phone poll completes, your function will be called from MAIN and you can send a message. The MULTI_SEND functions send most messages.
Alternate uses for the program
The Tracker software can be modified to sense or control a variety of devices. You can easily add commands to turn output lines on and off, read input lines, measure voltages with the ADC, etc. If you need more I/O, the program could be ported to the ATTINY86 or ATMEGA88 devices.
Categories: projects

Car Anti-Theft Wireless Alarm

July 3, 2011 Leave a comment

CLICK HERE FOR BIG PICTURE
            
This FM radio-controlled anti- theft alarm can be used with any vehicle having 6- to 12-volt DC supply system. The mini VHF, FM transmitter is fitted in the vehicle at night when it is parked in the car porch or car park. The receiver unit with CXA1019, a single IC-based FM radio module, which is freely available in the market at reasonable rate, is kept inside. Receiver is tuned to the transmitter’s frequency. When the transmitter is on and the signals are being received by FM radio receiver, no hissing noise is available at the output of receiver. Thus transis- tor T2 (BC548) does not conduct. This results in the relay driver transistor T3 getting its forward base bias via 10k resistor R5 and the relay gets ener- gised. When an intruder tries to drive the car and takes it a few metres away from the car porch, the radio link betw- een the car (transmitter) and alarm (receiver) is broken. As a result FM radio module gene-rates hissing noise. Hissing AC signals are coupled to relay switching circ- uit via audio transformer. These AC signals are rectified and filtered by diode D1 and capacitor C8, and the resulting positive DC voltage provides a forward bias to transistor T2. Thus transistor T2 conducts, and it pulls the base of relay driver transistor T3 to ground level. The relay thus gets de-activated and the alarm connected via N/C contacts of relay is switched on. If, by chance, the intruder finds out about the wireless alarm and disconnects the transmitter from battery, still remote alarm remains activated because in the absence of signal, the receiver continues to produce hissing noise at its output. So the burglar alarm is fool-proof and highly reliable. (Ed: You may have some problem catching the thief, though, if he decides to run away with your vehicle_in spite of the alarm!)
Categories: projects

INVISIBLE BROKEN WIRE DETECTOR

July 3, 2011 Leave a comment
  •                        Portable loads such as video cameras, halogen flood lights, electrical irons, hand drillers, grinders, and cutters are powered by connecting long 2- or 3-core cables to the mains plug. Due to prolonged usage, the power cord wires are subjected to mechanical strain and stress, which can lead to internal snapping of wires at any point. In such a case most people go for replacing the core/cable, as finding the exact location of a broken wire is difficult. In 3-core mcables, it appears almost impossible to detect a broken wire and the point of break without physically disturbing all the three wires that are concealed in a PVC jacket. The circuit presented here can easily and quickly detect a broken/faulty wire and its breakage point in 1-core, 2-core, and 3-core cables without physically disturbing wires. It is built using hex inverter CMOS CD4069. Gates N3 and N4are used as a pulse generator that oscillates at around 1000 Hz in audio range.



    The frequency is determined by timing components comprising resistors R3 and R4, and capacitor C1. Gates N1 and N2 are used to sense the presence of 230V AC field around the live wire and buffer weak AC voltage picked from the test probe.The voltage at output pin 10 of gate N2can enable or inhibit the oscillator circuit. When the test probe is away from any high voltage AC field, output pin 10 of gate N2 remains low. As a result, diodeD3conducts  and inhibitsthe oscillator circuit from o s c i l l a t i n g .   S i m u l t a -neously, the output of gate N3 at pin 6 goes ‘low’ to cut off transistor T1. As ar e s u l t ,   LED1   g o e s   o f f . When the test probe is moved closer to 230V AC,50Hz mains live wire, during every positive half cycle, output pin 10 of gateN2goes height.
       Thus   d u r i n g   e v e r y positive half-cycle of the mains frequency, the oscillator circuit is allowed to oscillate at around 1 kHz, making red LED (LED1) to blink. (Due to the persistence of vision, the LED appears to be glowing continuously.) This type of blinking reduces consumption of the current from button cells used for power supply. A 3V DC supply is sufficient for powering the whole circuit. AG13 or LR44 type button cells, which are also used inside laser pointers or in LED-based continuity testers, can be used for the circuit. The circuit consumes 3 mA during the sensing of AC mains voltage. 
                For audio-visual indication, one may use a small buzzer (usually built inside quartz alarm time pieces) in parallel with one small (3mm) LCD in place of LED1and resistor R5. In such a case, the current consumption of the circuit will be around 7 mA. Alternatively, one may use two 1.5V R6- or AA-type batteries. Using this gadget, one can also quickly detect fused small filament bulbs in serial loops powered by 230V AC mains. The whole circuit can be accommodated in a small PVC pipe and used as a handy broken-wire detector. Before detecting broken faulty wires, take out any connected load and find out the faulty wire first by continuity method using any multimeter or continuity tester. Then connect 230V AC mains live wire at one end of the faulty wire, leaving the other end free. Connect neutral terminal of the mains AC to the remaining wires at one end. However, if any of the remaining wires is also found to be faulty, then both ends of  these wires are connected to neutral. For single-wire testing, connecting neutral only to the live wire at one end is sufficient to detect the breakage point. In this circuit, a 5cm (2-inch) long, thick, single-strand wire is used as thetest probe. To detect the breakage point,turn on switch S1 and slowly move the test probe closer to the faulty wire, beginning with the input point of the live wire and proceeding towards its other end.LED1 starts glowing during the presenceof AC voltage in faulty wire. When thebreakage point is reached, LED1 immediately extinguishes due to the non-availability of mains AC voltage. The point where LED1 is turned off is the exact broken-wire point.While testing a broken 3-core rounded cable wire, bend the probe’s edge in the form of ‘J’ to increase its sensitivity and move the bent edge of the test probe closer over the cable. During testing avoid any strong electric field close to the circuit to avoid false detection.

Categories: projects

Remote control for toy car

July 2, 2011 Leave a comment

Remote ContRol foR toy CaR

RECEIVER CIRCUIT  
     Remote ContRol foR toy CaR s.c. dwivedi Make any battery-operated toy car remote-controlled using  this circuit. The circuit, consisting of an infrared transmitter-receiver pair, uses IR beam transmission  to switch the toy car ‘on’ or ‘off.’ To  operate the toy car, you need to holdthe transmitter in your hand, keeping  it pointed at the toy car which has the  receiver fitted inside, and simply press  a switch provided on the transmitter. The transmitter works off 9V DC while the receiver needs 6V DC.  while the receiver needs 6V DC.  Fig. 1 shows the transmitter circuit.  It is built around two BC558 transistors  (T1 and T2), three BC548 transistors  (T3, T4 and T5), IR LED1 and a few  discrete components.  Fig. 2 shows the receiver circuit.  It is built around IR receiver module  TSOP1738, two BC548 transistors (T6  and T7) and a few discrete components.  In the transmitter circuit, there are  two astable multivibrators. The first, built around transistors T1 and T2, produces a frequency of about 1.2 kHz.  The second, built around transistors  T3 and T4, produces about 38 kHz. IR  LED1 is used to transmit the 38kHz  frequency.  In the receiver circuit, TSOP1738 receives the IR signal transmitted by  IR LED1 of the transmitter circuit. The  output of TSOP1738 is fed to transistorT6 via diode D1. The amplified signal  is further given to relay-driver transistor T7. Relay RL1 energises to control  the toy car. Working of the circuit is simple.  Initially, when no IR beam is falling on sensor TSOP1738, the relay  remains de-energised and the toy  c a r   d o e s n ’ t   m o v e .   W h e n   s w i t c h S1 is pressed, the IR beam falls on  TSOP1738 and its output goes low.  Transistor T6 cuts off and transistor T7 conducts to energise relay RL1 and  move the toy car.  Assemble both the circuits on separate PCBs. Enclose the transmitter PCB  in a suitable cabinet, with IR LED1  affixed on the front side and switch S1  on the top of the cabinet. Keep the 9V  battery inside the cabinet.  Enclose the receiver PCB inside  the toy car, with TSOP1738 fitted such  that the transmitted IR beam directly  falls on it. Fix switch S2 on the body of the car and the relay inside the car.  Use a 6V battery to operate the toy car receiver unit.
TRANSMITTER CIRCUIT

Categories: projects

Flashing LED Project

July 2, 2011 Leave a comment

Flashing LED Project

LED stands for Light Emitting Diode
A kit for this project is available from RSH Electronics.
Download PDF version of this page
This project is designed as an introduction to soldering, identifying common components, using the resistor colour code and placing components correctly on stripboard. The LED flashes at about 3Hz (3 flashes per second). This project uses a 555 astable circuit.


Parts Required

  • resistors: 470, 1k, 220k
  • capacitor: 1µF 16V radial
  • red LED (or orange, yellow or green if you prefer!)
  • 555 timer IC
  • 8-pin IC holder (a ‘DIL socket’) for the 555 IC
  • battery clip for 9V PP3
  • stripboard: 6 rows × 21 holes

Instructions

  1. Solder the 8-pin IC holder in the correct place on the stripboard.
  2. Break the 4 tracks under the IC holder with a track cutter tool. You can allow extra holes if your piece of stripboard is large enough.

    Stripboard with IC holder


  3. Use the resistor colour code to identify the resistors which are marked with coloured bands to show their value.
  4. Insert and solder the resistors in the correct position, they can be put in either way round, but you must line them up correctly with the IC holder.
  5. Identify the other parts, then solder them in the correct position and the right way round. To help you identify the parts please see our page on soldering.

    Stripboard layout for flashing LED


  6. Solder the 2 wire links in place around the IC holder, it is easier to use plastic-coated single-core wire. (The flexibility of stranded wire is not needed for connections like this and the strands can be difficult to push through the small hole).
  7. Finally insert the 555 timer IC and connect a battery!
Categories: projects

Color Sensor

June 20, 2011 Leave a comment

Color Sensor     

              
 Colour sensor is an interesting project for hobbyists. The cir- cuit can sense eight colours, i.e. blue, green and red (primary colours); magenta, yellow and cyan (secondary colours); and black and white. The circuit is based on the fundamentals of optics and digital electronics. The object whose colour is required to be detected should be placed in front of the system. The light rays reflected from the object will fall on the three convex lenses which are fixed in front of the three LDRs. The convex lenses are used to converge light rays. This helps to increase the sensitivity of LDRs. Blue, green and red glass plates (filters) are fixed in front of LDR1, LDR2 and LDR3 respectively. When reflected light rays from the object fall on the gadget, the coloured filter glass plates determine which of the LDRs would get triggered. The circuit makes use of only �AND� gates and �NOT� gates.
When a primary coloured light ray falls on the system, the glass plate corresponding to that primary colour will allow that specific light to pass through. But the other two glass plates will not allow any light to pass through. Thus only one LDR will get triggered and the gate output corresponding to that LDR will become logic 1 to indicate which colour it is. Similarly, when a secondary coloured light ray falls on the system, the two primary glass plates corres- ponding to the mixed colour will allow that light to pass through while the remaining one will not allow any light ray to pass through it. As a result two of the LDRs get triggered and the gate output corresponding to these will become logic 1 and indicate which colour it is.
When all the LDRs get triggered or remain untriggered, you will observe white and black light indications respectively. Following points may be carefully noted :
1. Potmeters VR1, VR2 and VR3 may be used to adjust the sensitivity of the LDRs.
2. Common ends of the LDRs should be connected to positive supply.
3. Use good quality light filters.
The LDR is mounded in a tube, behind a lens, and aimed at the object. The coloured glass filter should be fixed in front of the LDR as shown in the figure. Make three of that kind and fix them in a suitable case. Adjustments are critical and the gadget performance would depend upon its proper fabrication and use of correct filters as well as light conditions

Categories: circuit, projects