Germany
Offline
Full Member
Karma: 0
Posts: 184
|
 |
« on: September 20, 2012, 09:20:57 am » |
Hello, I have bought this 433MHz ASK transceiver link kit. Now, with Arduino, I want to send signals with these modules. At first, to analyse, I've built the following: Receiver: Vcc to 5V, GND to GND, out-Data to pin10(shouldnt matter which pin to use) Transmitter: Vcc to 5V, GND to GND, in-Data via a button to 5v and a in-data via a resistor to GND (look picture)  That means: - I press the button: transmitter gets 5V as input- I dont press the button: transmitter gets 0V as inputThen I wrote a simple program to check what is received (because it's ASK modulation, it should be 5V or 0V (proved with analog in)) I used "digitalRead" and looked for changes, that means, in the loop , i have: void loop() { int nowstate = digitalRead(pin);
if (nowstate != laststate) { Serial.println(micros()); laststate = nowstate; } } The results are the x-values for a graph  Why is it always up and down when I send nothing? How can I receive/send signals and read them? Thank you
|
|
|
|
« Last Edit: September 20, 2012, 10:13:17 am by karlok »
|
Logged
|
using Arduino Uno Rev 3
|
|
|
|
Massachusetts, USA
Offline
Tesla Member
Karma: 108
Posts: 6611
|
 |
« Reply #1 on: September 20, 2012, 10:43:55 am » |
16 mS cycle time is 62.5 Hz. If the pulse width is actually 8.333... milliseconds instead of 8.0 then you are probably picking up interference from something running off 60Hz AC.
Because the receiver only detects "signal" or "no signal" it is sensitive to any noise in that frequency range. That's the trouble with using $5 radio sets.
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Boston area, metrowest
Offline
Brattain Member
Karma: 270
Posts: 17040
Available for Design & Build services
|
 |
« Reply #2 on: September 20, 2012, 12:53:37 pm » |
Look into using VirtualWire library to send/receive messages. Works great with 433 MHz modules.
|
|
|
|
|
Logged
|
|
|
|
|
Anaheim CA.
Offline
Edison Member
Karma: 34
Posts: 2404
Experienced old Whitebeard with a Full head of Hair...
|
 |
« Reply #3 on: September 20, 2012, 08:44:22 pm » |
I suspect more likely that the OP's scope ground lead wasn't well connected. The 433 MHz radios are virtually un affected by 60HZ 'interference' and not quite AM but On Off Keying and the rF part of the receiver are relatively insensitive to anything more than 10 - 20 MHz away from the intended (Tuned) frequency. They are super-regenerative receivers with an RF stage to prevent the regen oscillator (detector) from radiating as much junk as a "normal" Super-regenerative receiver would. Although Extremely sensitive for the power radiated by the transmitter they suffer from being "Broad as a barn door" in other words while having 10uV sensitivity they also have 50 to 100 KHz wide detection windows especially if mistuned and that can be metal near the receiver coil and or antenna on some.
Doc
|
|
|
|
|
Logged
|
“The solution of every problem is another problem.” -Johann Wolfgang von Goethe
|
|
|
|
Australia
Offline
Full Member
Karma: 6
Posts: 216
|
 |
« Reply #4 on: September 20, 2012, 10:14:26 pm » |
They also need regular data transitions in order for the receivers data slicer to be able to figure out what is a 1 and what is a 0. Most that I have played around with need a minimum transition rate of around 90 bps or more, otherwise the recievers AGC thinks that there isnt any input signal , and starts winding the gain up. The IF bandwidth seems to be 2 -3 Mhz wide on most.
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Boston area, metrowest
Offline
Brattain Member
Karma: 270
Posts: 17040
Available for Design & Build services
|
 |
« Reply #5 on: September 20, 2012, 11:29:29 pm » |
Virtualwire takes care of all that. The transmitter sends out bytes to give the receiver a chance to get in sync, then it sends the manchester encoded data. Very nice library. http://www.open.com.au/mikem/arduino/VirtualWire.pdf
|
|
|
|
|
Logged
|
|
|
|
|
Seattle, WA USA
Offline
Brattain Member
Karma: 336
Posts: 36462
Seattle, WA USA
|
 |
« Reply #6 on: September 21, 2012, 09:13:57 pm » |
in-Data via a button to 5v This is supposed to be connected to the pin that is providing the data to transmit. Why is it connected this way?
|
|
|
|
|
Logged
|
|
|
|
|
Germany
Offline
Full Member
Karma: 0
Posts: 184
|
 |
« Reply #7 on: September 23, 2012, 04:28:43 pm » |
Unfortunately, Virtualwire didnt work. The output was like this: " Sent Timeout " So, it didnt receive an answer However, I want to know HOW the signal is transmitted at all. This is supposed to be connected to the pin that is providing the data to transmit. Why is it connected this way? Thats what i did later, too. I wanted to test if a signal is transmitted I expected that the receiver gives 5v at data out if 5v is supplied to transmitter's data in and receiver has 0v at data out if transmitter gets 0v at its data in (but it is NOT !??) --- I tried the following: rx/tx modules at one arduino (have only one) and the following code : (written myself) // <CODE>; Freitag, 31. August 2012
#include <SoftwareSerial.h> SoftwareSerial mySerial(10, 9); // RX, TX // i dont use rx=10 because I want to see how it looks like in a graph
int pin = 8; // RX pin int ledpin = 13; int laststate = 0; unsigned long ausgabe; // micros() nach 70min UEberlauf -> genug Zeit unsigned long ausgabe_ = 0; unsigned long micros_ = 0; byte i = 0; boolean oddnow = false;
void setup() { Serial.begin(9600); Serial.println("pulse_in raw^2, <v2.4>; 31.8. - 23.9. 2012\n");
pinMode(ledpin, OUTPUT); digitalWrite(ledpin, LOW);
pinMode(pin, INPUT); //digitalWrite(pin, HIGH);//pullup
mySerial.begin(9600); mySerial.println("Hello, world?"); }
void loop() { unsigned long myc = micros();
if (Serial.available()) mySerial.write(Serial.read());
if ((myc - micros_) / 100 >= 1000 * 1000 * 5) // 5 Sekunden { micros_ = myc; // mySerial.write(i); //just test;dont execute i++; }
int nowstate = digitalRead(pin);
if (nowstate != laststate) { oddnow = !oddnow; ausgabe = myc;
Serial.println(ausgabe);
if (oddnow) // only every second time { unsigned long diff = ausgabe - ausgabe_; if ((diff < 7000) || (diff > 12000)) // if dutycicle is MUCH different { //Serial.print(" D = "); //Serial.println(diff); // bewirkt anderen Duty-Cycle falls zu hauefig angewendet digitalWrite(ledpin, !digitalRead(ledpin)); } }
ausgabe_ = ausgabe; laststate = nowstate; } }
So basically a led changes it state (on->off / off->on) if dutycyle(?) changed . AND it worked. I know, that it is a very bad technique but it shows that it could work. What happens here?: Why does the receiver has an output 0V / 5V changing rapidly ?
|
|
|
|
« Last Edit: September 23, 2012, 04:32:05 pm by karlok »
|
Logged
|
using Arduino Uno Rev 3
|
|
|
|
Global Moderator
Boston area, metrowest
Offline
Brattain Member
Karma: 270
Posts: 17040
Available for Design & Build services
|
 |
« Reply #8 on: September 23, 2012, 04:35:55 pm » |
Unfortunately, Virtualwire didnt work. ... I tried the following: rx/tx modules at one arduino (have only one) I have never seen anyone getting seperate Tx and Rx components working on one arduino. They need to be on seperate Arduinos.
|
|
|
|
|
Logged
|
|
|
|
|
Australia
Offline
Full Member
Karma: 6
Posts: 216
|
 |
« Reply #9 on: September 23, 2012, 05:52:33 pm » |
The Vitualwire Library only supports half duplex transmission. ie you can only send or receive, but not both at the same time. So you will need 2 Arduinos to implement vitualwire. Its extremely hard to implement full duplex Manchester coding in software in the one Microcontroller.
|
|
|
|
|
Logged
|
|
|
|
|
Germany
Offline
Full Member
Karma: 0
Posts: 184
|
 |
« Reply #10 on: September 24, 2012, 09:08:11 am » |
Actually, I don't know if the signal is Manchester encoded. The seller told me that it doesn't use encoding/decoding functions. Does it has to use any kind of encoding or could I do it myself, that means: sending encoded data and receive and then decode it manually.?
I still want to know WHY there are these up and downs in what I recorded of the receiver (referring to the graph).
|
|
|
|
|
Logged
|
using Arduino Uno Rev 3
|
|
|
|
Australia
Offline
Full Member
Karma: 6
Posts: 216
|
 |
« Reply #11 on: September 24, 2012, 05:31:55 pm » |
9600 bps is right at the upper limit of those receivers, and you would do better by trying 4800 bps or less. Also, if the receiver and the transmitter are physically close to each other, lime 1 M or less apart, the receiver will overload from the transmission, so place them a bit further apart.
|
|
|
|
|
Logged
|
|
|
|
|
Germany
Offline
Full Member
Karma: 0
Posts: 184
|
 |
« Reply #12 on: September 25, 2012, 08:44:53 am » |
Hello, or could I have to use a pull down(?) resistor to avoid a read from random data that is not actually given out by the rx?  So maybe if the receiver doesn't give me anything at its pin, there might be read a wrong voltage. (referring to "bouncing buttons") or is it very different between different modules? By the way: I think, am really sure, that the up and downs in the raw read graph output were caused by the lack of a pulldown. I checked the following: read the value digitalRead(  of pin 8 without anything but a cable put in pin8 - not more, thats all. Then touched the cable, moved it and the values changed rapidly (I think that is what is understood by " BOUNCING"). ~
|
|
|
|
|
Logged
|
using Arduino Uno Rev 3
|
|
|
|
Seattle, WA USA
Offline
Brattain Member
Karma: 336
Posts: 36462
Seattle, WA USA
|
 |
« Reply #13 on: September 25, 2012, 09:05:46 am » |
Then touched the cable, moved it and the values changed rapidly (I think that is what is understood by "BOUNCING"). No, that is a floating pin. Bouncing refers to switches making intermittent contact as they open and close. or could I have to use a pull down(?) resistor to avoid a read from random data that is not actually given out by the rx? No. The receiver is holding the pin HIGH or LOW as appropriate. Your issue is likely to be that your cheap transmitter and/or receiver are not immune from electrical interference - before or after the data is converted to over-the-air form and before or after it is converted back from over-the-air form. That is why those radios have such low baud rates and range, and are generally not advised for serious transmission of critical information.
|
|
|
|
|
Logged
|
|
|
|
|
Germany
Offline
Full Member
Karma: 0
Posts: 184
|
 |
« Reply #14 on: September 25, 2012, 11:33:23 am » |
Ok, that sounds bad. However, thank you for the explanation.
Have you any idea what could that be, that is interferencing with the signal?
It is difficult to find simple remotes (ASK without encoding) that are reliable.
|
|
|
|
|
Logged
|
using Arduino Uno Rev 3
|
|
|
|
|