Show Posts
|
|
Pages: [1] 2 3
|
|
2
|
Using Arduino / Programming Questions / XML parsing
|
on: October 28, 2011, 02:30:38 pm
|
|
I have a device that is outputting XML data via a serial line every few seconds. I need to interface an Arduino with it to parse the data and then do some other stuff with the values it gets. This is a standalone portable unit that only exports XML and I don't want to connect a PC or something else to handle the data. I'd like the Arduino to do the parsing if it's possible. The datastream looks like this:
<data><celltemp>5.13581e1</celltemp><cellpres>1.01388e2</cellpres></data>
What is the preferred method for parsing the two number string out of the above text and once I do that, is there a good method for converting 1.01388e2 to 101.388.
|
|
|
|
|
4
|
Using Arduino / Networking, Protocols, and Devices / sending text strings through xbee mesh
|
on: October 07, 2011, 11:20:06 pm
|
|
I've been working my way through Rob Faludi's WSN book, and I have successfully sent text strings from one arduino to another using my series 2 ZB xbee units in transparent mode. I also did his example of having 3 router/endpoint nodes transmitting temperature data to a coordinator with API and displaying the live data on the Processing thermometer graph. But those nodes sensed the temperature from a sensor on their own analog input pins. I have arduino-based loggers with multiple sensors on them that require a more complicated interface than I can achieve with the onboard I/O of the xbee. Currently the loggers just write the data to an SD card, but I'd also like to transmit it via the xbee. How do I go about sending a string of text through the mesh and have it arrive in one piece at the coordinator? Is it simply a matter of saying "Serial.print("23 degrees, 0.58 cm, 4.5 volts") on the serial input of the end node, or do I have to use a special protocol?
|
|
|
|
|
5
|
Using Arduino / Programming Questions / best method for implementing a timer
|
on: September 12, 2011, 10:30:07 pm
|
|
I'm building a device with an Uno that'll have an LCD display showing the length of time (mm:ss) that has elapsed, and then every 5 minutes it'll need to be reset to 00:00 and started again. The catch is that during the period it's showing the time, I also need to be reading a few sensor inputs and outputting some serial data, so I can't simply use a delay for the timer.
Should I just use Timer0 and millis to do some arithmetic, like: if(currentMillis - previousMillis > interval).... so it'll only update the display when a certain interval (1000 millis) has passed, meanwhile the main loop will keep looping and doing other stuff.
or is there a timing library that would be easier to help keep track of seconds and minutes? I'll also have a DS1307 RTC onboard, so should I just poll that every loop to get the current time and then do the math like above?
|
|
|
|
|
7
|
Using Arduino / General Electronics / Re: how to get a stable 5v reference
|
on: July 20, 2011, 12:27:59 pm
|
So use the 5V 1A switching regulator, will be a very stable 5V source for your 25mA plus the arduino's 30mA. Use the analog devices SPI ADC that's been posted previously with 6 sample & hold inputs & get 6 conversions at the same time.
Do you happen to know the part number of that ADC? I've been searching for days and haven't found one with 0-5v input and multiple channels.
|
|
|
|
|
9
|
Using Arduino / General Electronics / Re: how to get a stable 5v reference
|
on: July 19, 2011, 09:14:11 pm
|
|
I need to power some pressure sensors that require a stable 5v excitation voltage. The sensor outputs an analog voltage that's proportional to pressure being exerted on the sensor. Currently I'm using the the ADC of the ATmega328 to sample the sensor output. Eventually I'll probably use a separate ADC chip because I want better than 10-bit resolution. Each sensor draws about 5ma, and I could have up to 5 sensors on one board. So if I could find an ADC chip that provided a 5v reference capable of supplying enough current and could read a voltage from 0 to 5v, then that would solve my problem.
|
|
|
|
|
10
|
Using Arduino / General Electronics / how to get a stable 5v reference
|
on: July 19, 2011, 08:11:39 pm
|
|
I need to generate a precise 5v on my Arduino Uno board. I know the onboard regulator isn't very precise, and I've measured too much variation between the 5 different Uno boards I have. So how should I go about it? It seems like most precision voltage references need at least 6v so it can regulate it down to 5v. So do I need to use a DC-DC boost converter to boost the onboard Uno 5v up to something like 9v and then use a reference IC to generate the precise 5v?
|
|
|
|
|
11
|
Using Arduino / Project Guidance / controlling a hundred solenoids
|
on: June 13, 2011, 10:06:58 pm
|
|
I've got a project where I need to control around 100 solenoids to regulate airflow in and out of many dozen containers in an air sampling experiment. I'm thinking of buying some used solenoid banks on ebay because they are cheaper than new, and they come with handy quick connect fittings for the air tubing. But I'm wondering what's the best way to control that many solenoids? How are those banks usually controlled? Would one Arduino Mega be able to handle it with the help of something to increase the outputs? Is there something else I can use besides solenoids to shut dozens of air lines on and off?
|
|
|
|
|
13
|
Using Arduino / Programming Questions / Re: serial string to integers
|
on: May 03, 2011, 03:28:59 pm
|
|
It's working now, except that the serial data from my sensor apparently has a couple non-numeric characters before the actual numbers I want to read, along with a carriage return after them, and that seems to be throwing things off. Is there a way to filter out non-numeric things when populating the string during the myserial.read part?
I just captured several lines of the raw serial data from the sensor using a program on my PC called RealTerm to save it to a text file. I'm attaching a picture of what the raw sensor data looks like when viewed with notepad. Note the strange character at the beginning of each line and the little box after 642, which I guess is a carriage return.
|
|
|
|
|
15
|
Using Arduino / Programming Questions / Re: serial string to integers
|
on: May 03, 2011, 12:46:51 pm
|
Thanks for the help. I'm posting the code I have so far, but I'm getting the following error on the line with the sscanf function: _5TMtest_2:25: error: cannot convert 'String' to 'const char*' for argument '1' to 'int sscanf(const char*, const char*, ...)' My code: #include <NewSoftSerial.h>
NewSoftSerial mySerial(8, 9); int x,y,z; String readString;
void setup() { Serial.begin(1200); mySerial.begin(1200); Serial.println("5TMtest-2"); // so I can keep track of what is loaded }
void loop() { while (mySerial.available()) { delay(1); if (mySerial.available() >0) { char c = mySerial.read(); //gets one byte from serial buffer readString += c; //makes the string readString } } if (readString.length() >0) { Serial.print("readString = "); Serial.println(readString); //so you can see the captured string sscanf (readString, "%d %d %d", &x, &y, &z); Serial.print("first= "); Serial.println(x); Serial.print("middle= "); Serial.println(y); Serial.print("last= "); Serial.println(z); } readString=""; }
|
|
|
|
|