Need help communicating between mutltiple arduinos with Parallax 27982 433's
UMLstudent
Posts: 3
Hello forum!
I'm scratching my head trying finish my senior project. I'm trying to program a robot controlled by 2 arduino UNO's with Parallax 27982 433 transcievers, one on the RF controller and the other on the robot. It was recommended to use the "Virtual Wire" for the use of these transcievers. There is feedback too so i will be using Bi-directional serial communication. Wondering if anyone has experience that could be of help....
the issue i'm having is that the 27982's only have 1 "data" pin... whereas the arduinos have seperate TX and RX
-Paul
I'm scratching my head trying finish my senior project. I'm trying to program a robot controlled by 2 arduino UNO's with Parallax 27982 433 transcievers, one on the RF controller and the other on the robot. It was recommended to use the "Virtual Wire" for the use of these transcievers. There is feedback too so i will be using Bi-directional serial communication. Wondering if anyone has experience that could be of help....
the issue i'm having is that the 27982's only have 1 "data" pin... whereas the arduinos have seperate TX and RX
-Paul
Comments
Since i will be using the arduino that has seperate TX and RX and the Parallax only having a Bi-direciton Data pin... would i need to use diodes on the arduino to make sure noise does not come into the other direction?
-Paul
Edit: found the schematic
http://forums.parallax.com/showthread.php?83144-How-to-connect-PSC-to-computer-s-serial-port
So it is not practical to just set the TX/RX of the parallax, say to RX, by setting the appropriate bit in the software... then starting the transmission? This NPN/PNP looks like its on seperate Tx/Rx pins....
-NissanTracker
It's all about glomming "libs" that somebody else did.
They have "input/output" (I/O) pins, but after that the phone goes dead.
Some people feel that it'd be an achievement to bring the Propeller down to the abysmal arduina kultur of "libs" and their equally mindless "shields", but the OBEX isn't there yet.
The OP seemed, at first, like he needed an insight as to the XCVR's ops, so I correctly laid out the situation (i.e. change the I/O pin's I-or-O status), but he wants a "lib".
As to libraries being "Black holes" the source code is part of the library and can be modified at will. (like an object)
Ergo, the process of changing an I/O pin from an input to an output, or vice versa, necesssary knowledge, is a concept unfamiliar.
Frickaduina-this "shield" and Frackaduina-that "lib" and buy (buy into) the arduina doin'-mille-nothing.
1) I made a mistake, my wife told me not to bring it.
2) I'm never flying Delta again!!
Arduinos are just another type of hardware and can do different things than stamps and propellers in different ways.
Why is an elementary exercise, changing the status of an I/O pin, alien to the OP and, since, a few others who have started subjects hinging on this very "dilemma"?
It's not me. It's the world of arduina and the sum of the doin'-mille-nada: it "works" cuz, uh, someone else did the work.
Hey, gotta spare "lib", man?
I see a simple method, too, IF the top-level code can be devised, to react on the RSSI to prepare to go into receive mode, then using the RX/TX before going into send mode.
But..... as of yet, no-one has devised the idea of single-line RX/TX serial, which even the BS1 was capable was able to to assign any pin to digital input, digital output, PWM, serial data (at TTL level) and analog I/O. The Arduino code (so-far,) has specific lines from the ATmel chip, assigned as either digital, analog, or serial Input, and Serial Output. This doesn't mean the code cannot be devised. At the risk of insulting Parallax, even the Basic Stamp's PBasic is NOT the chip's native language. PBASIC is a front-end, which converts the program written into PBASIC to machine code.. Same as the Arduino's AVR front-end, converts the 'C++' derivative into native machine code for the ATmel chips. Welcome to the world of Libraries, Compilers, and development packages. (Am I still on here?)
No reason to insult one platform, or another.. Granted the Propeller, Basic Stamps, PIC, Arduino are all competing, But they CAN share code & knowledge! Let's not lock things down to MicroChip's level, with the PIC and companies like Innovation-First did with the VEX platform. Let's get a little open source in here.
The issue is that you're looking for Arduino code to handle the half-duplex serial I/O on a single I/O pin. This is a Parallax forum and is intended for support of Parallax products. We can provide examples for the Parallax microcontrollers and we can explain how the various products work in generic terms, but you, the user, has to take responsibility for the actual coding for the microcontroller you want to use like the Arduino. We can't support this and that microcontroller, each of which does things in a different way. There's neither enough people here on the forums nor is there enough time to become competent or even conversant on all the different microcontrollers. For help with the Arduino coding, you're really dependent on the Arduino forums and their on-line libraries. Sorry.
gelfling6,
The Stamps don't compile to PIC or SX instructions. The Stamp Editor compiles into PBasic interpretive code (byte codes). The PIC or SX that's on the Stamp module has an interpreter pre-programmed into the microcontroller chip. Similarly, the Propeller Tool compiles into Spin interpretive code and the Propeller chip has a ROM which contains the Spin interpreter which gets automatically loaded into a cog to start things off once the compiled Spin program is loaded from the EEPROM or attached PC.
You can't program a Stamp using native PIC or SX instructions. With the Propeller, you can combine Spin with native instructions in a program although the native code has to be loaded into its own cog to execute. Spin code doesn't call assembly code and assembly code can't call Spin code although they can talk to each other through shared (hub) memory.
(I don't know why you cannot access your direction register and change it on the fly, please don't explain.)
It requires, nonetheless, an output pin to control the T/R SEL.
Maybe somebody will come along with some "new school" IC, something more "elegant" (ralf!), or somesuch, that matters not, but I worked this out on the bench with what I have on hand. I can vouch for it.
pinMode()
Description
Configures the specified pin to behave either as an input or an output. See the description of digital pins for details.
Syntax
pinMode(pin, mode)
Parameters
pin: the number of the pin whose mode you wish to set
mode: either INPUT or OUTPUT
This would indicate to me you can change pin directions.......on the fly. It did take about a minute to find this and then I had to read it......difficult concepts.
{I confess, I've spent time in the House of Arduino by choice.)
Rick
Well, I guess you'll have to re-write the "virtual wire" for this specific case before any of your fellows catch on. But, please, post that in the arduina forum.
PE - Do them up a "lib", or whatever. Hey, I don't own this joint, make an attachment, it's support for a Parallax product, I shouldn't care.
Hate grave digging posts but im desperate. I am using the BOE edcational shield for arduino and the 27982. I need a pair of these to communicate. Now even the shield has port 0 for rx and port 1 for tx . I dont want to damage my rf module so I ask if i still need to add the additional circuitry you guys suggested above ?
Or will just the software part of shifting ping mode between rx and tx work ?
/leo
Again, we cannot help you with the Arduino programming or interpreting the many I/O libraries for the Arduino. The 27982 works with the Stamps and with the Propeller and there is sample code available for the Stamps.
( And thanks for the prompt reply)
I had a few follow up questions :
1) I used 4.7k resistors wouldnt going any higher risk introducing noise to the signal between arduino and parallax due to low signal strength ? I not should i use higher resistances ?
2) I dont intend to use any arduino libraries as there are none for 27982. I prefer converting the BS2 code as i was working on it initially. Any tips on where i should start going about this. As in creating a 1:1 translation of bs2 code to arduino code . for starters the pulsout command. Searching for coe examples im lost . any single post u suggest i start from
3) When would i want to start bothering with RSSi and PDN pins ?
1) Your choice. CMOS is voltage-sensitive, not current sensitive, so the main concern is RC delays due to having to charge the capacitances involved (wiring and gates). For short runs (a few inches), 10K or even higher is not unreasonable.
2) Start with the Basic Stamp Syntax and Reference Manual for definitions of what the various Stamp statements and operators do. For the most part, they're pretty straightforward. You could also look at the BS2_Functions object in the Propeller Object Exchange. This is a library for the Propeller, written in Spin, that implements most of the Basic Stamp statements as subroutine calls. You could use it as a model.
3) Don't bother unless you're just curious about what they do.
While i was waiting for your reply , I proceeded to hunt for some help on my own.
This is my current setup
I hope the schematic i attached in the previous post is correct and not faulty!!!
Now though these forums are for parallax products only ..but you are the only one even bothering to reply to my questions hence i ask it here.
I came ac-cross this tutorial http://arduino.cc/en/Tutorial/SoftwareSerial which is to see if the RF modules are even communicating.
Now i adapted this code slightly. Here it is ( i split between transmitter and receiver for a start)
For Transmitter
#include <ctype.h>
#define bit9600Delay 84
#define halfBit9600Delay 42
#define bit4800Delay 188
#define halfBit4800Delay 94
byte rtselect = 9;
byte datapin = 8;
byte SWval;
void setup() {
pinMode(rtselect,OUTPUT);
digitalWrite(rtselect,HIGH); // When rtselect is 0 module is in receive mode . When rtselect is 1 module is in transmit mode.
digitalWrite(13,HIGH); //turn on debugging LED
if (rtselect==HIGH)
{pinMode(datapin,OUTPUT);}
if(rtselect==LOW)
{pinMode(datapin,INPUT);}
SWprint('h'); //debugging hello
SWprint('i');
SWprint(10); //carriage return
}
void SWprint(int data)
{
byte mask;
//startbit
digitalWrite(datapin,HIGH);
delayMicroseconds(bit9600Delay);
for (mask = 0x01; mask>0; mask <<= 1) {
if (data & mask){ // choose bit
digitalWrite(datapin,HIGH); // send 1
}
else{
digitalWrite(datapin,LOW); // send 0
}
delayMicroseconds(bit9600Delay);
}
//stop bit
digitalWrite(datapin, HIGH);
delayMicroseconds(bit9600Delay);
}
void loop()
{
SWprint(toupper(SWval));
}
FOR RECEIVER
#include <ctype.h>
#define bit9600Delay 84
#define halfBit9600Delay 42
#define bit4800Delay 188
#define halfBit4800Delay 94
byte rtselect = 9;
byte datapin = 8;
byte SWval;
void setup() {
pinMode(rtselect,OUTPUT);
digitalWrite(rtselect,HIGH); // When rtselect is 0 module is in receive mode . When rtselect is 1 module is in transmit mode.
digitalWrite(13,HIGH); //turn on debugging LED
if (rtselect==HIGH)
{pinMode(datapin,OUTPUT);}
if(rtselect==LOW)
{pinMode(datapin,INPUT);}
SWprint('h'); //debugging hello
SWprint('i');
SWprint(10); //carriage return
}
void SWprint(int data)
{
byte mask;
//startbit
digitalWrite(datapin,HIGH);
delayMicroseconds(bit9600Delay);
for (mask = 0x01; mask>0; mask <<= 1) {
if (data & mask){ // choose bit
digitalWrite(datapin,HIGH); // send 1
}
else{
digitalWrite(datapin,LOW); // send 0
}
delayMicroseconds(bit9600Delay);
}
//stop bit
digitalWrite(datapin, HIGH);
delayMicroseconds(bit9600Delay);
}
void loop()
{
SWprint(toupper(SWval));
}
Observation 1 ) Based on what I read for the parallax datasheet : A constant HIGH is used to synchronize,two RF modules which I changed ( in the tutorial if was Low)
Observation 2 ) I made it difficult to alter between transmit and receive the module as a safety precaution.
Ideally I should be getting an output on my computer console as the receiving boebot is connected to my system . I know its too much to hope , but well it didnt .
Could you tell me where I could be going wrong ?
Thank you : I will be sure to acknowledge you in my maters thesis
I can't help you with the debugging of your Arduino code. Sorry.
The schematic looks ok.
Or do i need to refer directly to TRM 433LT datasheets for that info. If so will it be directly applicable to our module.
As for the code im not asking for debug . Im just asking if i am going on the right path in terms of choosing the library.
Tyvm.
/leo