help programing a PING/Xbee wireless system
UWSP
Posts: 15
I have been working on a project for a college in my town, how I exactly got this project I am still not sure. What we are doing is monitoring drainage sewers for depth and temperature for a start. My boss would like data to be collected every 15 minutes and eventually sent to a computer. This is where I need some assistance. We were thinking that we could store the data to EEPROM and then once a day (or possibly more depending on how much data EEPROM will handle) send it using a XBee Pro 60m transceiver to a computer hooked up to XBee and put it right into PLX-DAQ.
So my question is
A. Is this able to be done, and if so...
B. How do I have say, a PING take data every 15 minutes and store it to EEPROM, but to different locations each time
C. How can get the data from EEPROM to get sent out the XBee
Just looking for some commands to use. I know that I will probably have to use DATA, WRITE, and READ probably, but other than that I am not certain.
Thanks in advance!
So my question is
A. Is this able to be done, and if so...
B. How do I have say, a PING take data every 15 minutes and store it to EEPROM, but to different locations each time
C. How can get the data from EEPROM to get sent out the XBee
Just looking for some commands to use. I know that I will probably have to use DATA, WRITE, and READ probably, but other than that I am not certain.
Thanks in advance!
Comments
You don't give any indication of your programming or project experience, but you'll generally have to answer these questions:
1. How will you use the PING? I assume you'll be measuring the depth of an open ditch. Have you done any hands-on experiments with the device?
2. Yes, writing to EEPROM uses the WRITE command. Yes, you can determine which location to store data in. Check the Help Files for WRITE in the programming environment.
3. Have you experimented with the XBEE radio? Will it give you the distance you need to the computer? Have you done any experimentation with serial commuication of any kind?
4. Does the timing have to be super accurate? Timing an interval is fairly easy. If you need a time-stamp, you'll also have to look into real time clocks.
As to how to move forward, I'd suggest the following:
- get a PING, hook it up and learn how convert the measurement into a useful range for your project.
- spend a few minutes learning how to write and then read the EEPROM
- connect the Stamp to a PC with a serial link. Use a cable to start. Use Hyperterminal on the PC end to start with. Write a Stamp program to send data to the PC. Move on to the XBee, if it meets your needs.
- If required, get a real-time clock and learn to read its value. A DS1302 works well.
Cheers,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tom Sisk
http://www.siskconsult.com
·
You write your program that way. You use READ / WRITE / STORE and you either keep a variable with the address of the next place to write data or you can initialize the data storage area to values (that you choose) that mean "empty" and you search for the next available "empty" area when you have data to store.
C) You write your program that way.
Parallax does sell a Memory Stick Datalogger that is designed to work with a Stamp and stores data on a USB memory stick. These can hold many gigabytes and could hold years of data. You could use one of these to hold your data, one file per day, and the xBee link would just be used to copy the information from any specific file to the PC. Your program would be written to periodically check the xBee for a valid connection, then look for a particular sequence of characters (a command of your choosing) followed by a date (like "20100706"). The program would then read the contents of a file by that name and send it to the xBee to be transmitted to the PC.
First you have to learn how to program the Stamp. You go through the "What's a Microcontroller?" tutorial, work as many exercises as you can. You look at existing sample code for the PING and for the xBee. The BS2pe is specifically designed for datalogging and has the largest EEPROM of the Stamps although you may just as easily use other Stamp models. There are some examples of datalogging using this. Study them. The tutorials come with the Stamp Editor in the help files or you can download them from Parallax's download web page.
' {$STAMP BS2}
' {$PBASIC 2.5}
time VAR Word
DO
PULSOUT 15, 5
PULSIN 15, 1, time
DEBUG HOME, "time = ", DEC5 time
time = time ** 2251
DEBUG CR, "Distance = ", DEC4 time, " cm"
PAUSE 100
LOOP