Show Posts
|
|
Pages: 1 2 3 [4] 5 6 ... 81
|
|
48
|
Using Arduino / Programming Questions / Re: AT+ command problem with SIM20 transceiver
|
on: March 23, 2013, 10:07:52 pm
|
Thanks for the ideas, I think my lack of understanding of the buffer has hit the nail on the head. I did try declaring as a char and a byte, but having the check in the setup is not what I will be using on the project. hen I run the code below , I get +SRDRSSI: 224 OK
and sometimes garbled charachters. The first 2 returns are ok, the third is garbled then its random. even if I change the array to 32 or 255. So I think its the buffer thing. Why I wonder is the buffer size set to 128 ? I cant remember where I grabbed this code from. I dont need to take more than one reading before clearing the buffers and going back to the data mode for sending housekeeping data. But every second or so I want to send all data. ( and in a response to a command from the base unit as an acknowledge ) if I get +SRDRSSI: 224 , in the char serInString array, ( consistantly ) I guess I can parse out the 3 bytes I need ( 2,2, & 4 in this case,) for sending back to the base unit. ( converted to an int ) I want to display in the base unit, the signal strength of both receivers to warn about sending the robot out of range. #include <NewSoftSerial.h> #define RXPIN 14// #define TXPIN 15 // #define SIMBAUD 9600 NewSoftSerial SIM(RXPIN, TXPIN); int serIn; // var that will hold the bytes-in read from the serialBuffer char serInString[128]; // array that will hold the different bytes 100=100characters; // -> you must state how long the array will be else it won't work. int serInIndx = 0; // index of serInString[] in which to insert the next incoming byte int serOutIndx = 0; // index of the outgoing serInString[] array; const int AC2DPin = 17;
void setup() { Serial.begin(9600); SIM.begin(SIMBAUD); pinMode(AC2DPin, OUTPUT); digitalWrite(AC2DPin, HIGH); }
void loop () {
digitalWrite(AC2DPin, LOW); //LOW for sending AT commands, High for transparent data mode delay(120); SIM.println("AT+SRDRSSI?"); // SIM.print("\n"); digitalWrite(AC2DPin, HIGH); delay(10); readSerialString(); //Serial.println ("------------ arduino is doing somenthing else "); printSerialString(); delay(1000); }
void readSerialString () { int sb; if(SIM.available()) { while (SIM.available()){ sb = SIM.read(); serInString[serInIndx] = sb; serInIndx++;
} } }
void printSerialString() { if( serInIndx > 0) { // Serial.print("Arduino memorized that you said: ");
for(serOutIndx=0; serOutIndx < serInIndx; serOutIndx++) { Serial.print( serInString[serOutIndx] ); //print out the byte at the specified index //serInString[serOutIndx] = ""; //optional: flush out the content } //reset all the functions to be able to fill the string back with content serOutIndx = 0; serInIndx = 0; Serial.println(); }
}
|
|
|
|
|
50
|
Using Arduino / Networking, Protocols, and Devices / Re: reliable datagram RF22 library question
|
on: March 23, 2013, 09:14:26 pm
|
|
For testing I am just using the quarter wave vertical, without any form of groundplane for now.
The actual project will have dipoles at least, but at the moment, I am just comparing apples with apples.
The same quarter wave wires on the SIM20 modules ( in fact I noticed after the test that one was only 120mm long instead of 170mm ) at the same power give me 500m range, but as I said I dont trust my setup, and cant use the spreadsheet on my PC.
I will have another look at these modules one day when I have time, but this is a rush job now.
( I worked with diversity combiners in the 60s, and wondered what happened to them since, the first time I noticed them on commercial equipment was on base stations for wireless mics 40 years later )
|
|
|
|
|
51
|
Using Arduino / Programming Questions / Re: AT+ command problem with SIM20 transceiver
|
on: March 23, 2013, 03:39:24 pm
|
|
I have just done a range check and ran out of road, with one unit on my bench ( with I have just noticed, only a 120mm antenna ! ) and me going walkabout. The furthest I could get was 170m away from my desk, through 4 houses and 3 walls, and reception was still solid.
Tommorow I will fit correct length antennas and do the open space test .
I am using SoftEasyTransfer.h and NewSoftSerial.h for data transfer ( at 9600 baud at the moment ) Apart from the error checking and package structure security of Easy transfer, I also have a security code of my own before either end responds.
I am using the modules in transparent mode, and everything except the signal strength ( RSSI) monitoring is fine, but it looks like I have to switch back to AT+ commmands to get them.
I can switch to command mode in the loop, and get the RSSI level with the AT command, but it doesnt go back to receiving when a I go back to data mode?
|
|
|
|
|
53
|
Using Arduino / Networking, Protocols, and Devices / Re: reliable datagram RF22 library question
|
on: March 23, 2013, 11:53:21 am
|
I have given up on these RFM22 modules, and dug out the SIM20 modules, which I am trying to use. I have just done a range check and ran out of road, with one unit on my bench ( with I have just noticed, only a 120mm antenna ! ) and me going walkabout. The furthest I could get was 170m away from my desk, through 4 houses and 3 walls, and it was still solid. Tommorow I will fit correct antennas and do the open space test As this post no longer refers to the title, I have started a new post at http://arduino.cc/forum/index.php/topic,155930.0.html
|
|
|
|
|
54
|
Using Arduino / Programming Questions / AT+ command problem with SIM20 transceiver
|
on: March 22, 2013, 11:57:15 pm
|
I am trying to set up an RF link using 2 SIM20 modules that I had in a drawer. I can use them in the default transparent mode, but I want to set up a network ID etc, which is done by putting the devices into command mode, and writing to them with AT commands. I remember before that I cant just send SIM.println("AT+SRDDATAR=?"); for example ( I am using NewSoftSerial ) as it is ignored I played around with \n and \r and I can sort of get it working with the sketch below, but instead of returning the baud rate response, it returns either 33 or 161 or 67 in a random way each time I reset, (It should be a number from 0 to 7 ) followed by the "sent message" every 2 secs. If I omit the SIM.print("\r\n"); before the AT command line, nothing is printed. I have done a search on AT commands, and it looks like most times the serialPrintln is enough? I dont want to send commands to change either unit if I cant get responses to keep an eye on whats happening, any ideas? I have attached the AT commands manual for these units. #include <NewSoftSerial.h> #define RXPIN 14// #define TXPIN 15 // int AC2DPin = 17; int serIn; #define SIMBAUD 9600 NewSoftSerial SIM(RXPIN, TXPIN);
void setup() { Serial.begin(9600); pinMode(AC2DPin, OUTPUT); SIM.begin(SIMBAUD); digitalWrite(AC2DPin, LOW); //command mode delay(120); SIM.print("\r\n"); SIM.println("AT+SRDUART=?"); if (SIM.available() > 0) { // get incoming byte: Serial.println(" something available "); serIn = SIM.read () ; Serial.println(serIn ); } digitalWrite(AC2DPin, HIGH); // data mode } void loop() { SIM.print("hellohello"); Serial.println(" sent message "); delay ( 2000 ); }
|
|
|
|
|
55
|
Community / Bar Sport / Re: Ouch! Eagle Go Bye-Bye!
|
on: March 22, 2013, 12:25:50 pm
|
|
"walking into an alley and roughed up by some thugs?"
Thats the one, my kids gave me a disk with all the Larrys on, but I just dont have the time for games any more, and that was 25 years ago.
Plus there was no internet to get cheats from then, I remember we were stuck for weeks on the last stage of one Larry, nowdays you can get a hint in seconds.
|
|
|
|
|
56
|
Community / Bar Sport / Re: Ouch! Eagle Go Bye-Bye!
|
on: March 22, 2013, 05:30:15 am
|
|
Come to think of it, I think all those games were stable, and never crashed.
It was the booby traps that made saving often a requirement :-)
|
|
|
|
|