hy .can anyone help me to connect an rfm12b module dip version on an arduino uno v3 ?? i need to transmit and recieve data between 2 rfm12b modules connected at arduino uno v3 boards . i'm quite new in this things, and i can really need a little bit of help
RFM12Bs are SPI devices, so they should be connected using the SPI pins (10, 11, 12, 13 for the UNO). Depending on how you're using them, you might also need an interrupt pin.
any schematics ???
ok. i've made the connections . now how i can program this 2 modules ,to test if it works ?
BogdaNnil:
ok. i've made the connections . now how i can program this 2 modules ,to test if it works ?
Download a library and follow the examples.
rfm12b module dip version
Can you provide a link to the DIP module you're referring to. I've only seen smt
modules, not DIP.
For s.w., you might look at the library here,
http://lowpowerlab.com/blog/2012/12/28/rfm12b-arduino-library/
There is also a library for RFM12 from jeelabs, but it seems to have a lot of problems.
mine works at 433 MHz and the oscilator is about 16 MHz
how can i fix the errors ?? i get on the line "RFM12B radio;" an error ... it's not declared
BogdaNnil:
how can i fix the errors ?? i get on the line "RFM12B radio;" an error ... it's not declared
By giving much more information such as a vague error and line of code. Post the full code, the full error message and a link to the library you are using.
You need to install the lowpower labs RFM12 library, and then reference it
as they indicate. The following page tells how to install 3rd party libraries,
The DIP package is much easier to interface to than the SMT package with those
little side-on pads, which fall off easily if you overheat them when soldering.
this is the code
// Simple RFM12B sender program, with ACK and optional encryption
// It initializes the RFM12B radio with optional encryption and passes through any valid messages to the serial port
// felix@lowpowerlab.com
#include <RFM12B.h>
#include <avr/sleep.h>
// You will need to initialize the radio by telling it what ID it has and what network it's on
// The NodeID takes values from 1-127, 0 is reserved for sending broadcast messages (send to all nodes)
// The Network ID takes values from 0-255
// By default the SPI-SS line used is D10 on Atmega328. You can change it by calling .SetCS(pin) where pin can be {8,9,10}
#define NODEID 2 //network ID used for this unit
#define NETWORKID 99 //the network ID we are on
#define GATEWAYID 1 //the node ID we're sending to
#define ACK_TIME 50 // # of ms to wait for an ack
#define SERIAL_BAUD 115200
//encryption is OPTIONAL
//to enable encryption you will need to:
// - provide a 16-byte encryption KEY (same on all nodes that talk encrypted)
// - to call .Encrypt(KEY) to start encrypting
// - to stop encrypting call .Encrypt(NULL)
uint8_t KEY[] = "ABCDABCDABCDABCD";
int interPacketDelay = 1000; //wait this many ms between sending packets
char input = 0;
// Need an instance of the Radio Module
RFM12B radio;
byte sendSize=0;
char payload[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890~!@#$%^&*(){}[]`|<>?+=:;,.";
bool requestACK=false;
void setup()
{
Serial.begin(SERIAL_BAUD);
radio.Initialize(NODEID, RF12_433MHZ, NETWORKID);
radio.Encrypt(KEY);
radio.Sleep(); //sleep right away to save power
Serial.println("Transmitting...\n\n");
}
void loop()
{
//serial input of [0-9] will change the transmit delay between 100-1000ms
if (Serial.available() > 0) {
input = Serial.read();
if (input >= 48 && input <= 57) //[1..9] = {100..900}ms; [0]=1000ms
{
interPacketDelay = 100 * (input-48);
if (interPacketDelay == 0) interPacketDelay = 1000;
Serial.print("\nChanging delay to ");
Serial.print(interPacketDelay);
Serial.println("ms\n");
}
}
Serial.print("Sending[");
Serial.print(sendSize+1);
Serial.print("]:");
for(byte i = 0; i < sendSize+1; i++)
Serial.print((char)payload*);*
-
requestACK = !(sendSize % 3); //request ACK every 3rd xmission*
-
radio.Wakeup();*
-
radio.Send(GATEWAYID, payload, sendSize+1, requestACK);*
-
if (requestACK)*
-
{*
-
Serial.print(" - waiting for ACK...");*
-
if (waitForAck()) Serial.print("ok!");*
-
else Serial.print("nothing...");*
-
}*
-
radio.Sleep();*
-
sendSize = (sendSize + 1) % 88;*
-
Serial.println();*
-
delay(interPacketDelay);*
}
// wait a few milliseconds for proper ACK, return true if received
static bool waitForAck() { -
long now = millis();*
-
while (millis() - now <= ACK_TIME)*
-
if (radio.ACKReceived(GATEWAYID))*
-
return true;*
-
return false;*
}
and this are the errors
sketch_jun08a:29: error: 'RFM12B' does not name a type
sketch_jun08a.ino: In function 'void setup()':
sketch_jun08a:37: error: 'radio' was not declared in this scope
sketch_jun08a:37: error: 'RF12_433MHZ' was not declared in this scope
sketch_jun08a.ino: In function 'void loop()':
sketch_jun08a:66: error: 'radio' was not declared in this scope
sketch_jun08a.ino: In function 'bool waitForAck()':
sketch_jun08a:85: error: 'radio' was not declared in this scope
Always start with the 1st error.
This one indicates you either don't have the library installed in the correct
place, or else you didn't look at the library examples to see how to correctly
declare an instance of the radio.
Also, always wrap your code using the '#' icon --> ``
solved .
Does anyone know to program the Arduino ? i really need a little bit of help
there is a solution to measure the distance between two rfm12b modules connected at 2 arduino uno boards?
A tape measure?
AWOL:
A tape measure?
i don't know ... that's i asked how to do it ... so far i tried to calculate the time for sending and recieveng ack ,removing modules from each other,but the wave is transmitted with the same speed and at 1 meter and at 40m ,so I can not measure the distance, even if I took the reference speed, the speed of light.
doesn't anyone know ?
The Arduino is about a billion times too slow to measure something moving at
the speed of light.
The Arduino is about a billion times too slow to measure something moving at
the speed of light.
109?
Nah.
A thousand (without hardware assistance) or maybe a million.
I still think a tape measure, or if cost is a consideration, a length of string is hard to beat.
Besides, we don't know what the measurement accuracy criteria are.
another issue .i have 2 laptops .on one ,i've programmed the modules , it works very fine ,but on the other one ,does not work at all . any solution ???