Standalone RFbee

hi this is jun.

i ordered RFbee to use it without serially connected host MCU.
so ATmega168 on Rfbee does not only control the wireless module but also give command to the device connected.

speakjet-RFbee --------- RFbee

do you have simple test code(blink led) to share?

best,

jun

Hi jun,

Sorry for the late reply,

Yes, ATmega168 does not only control the wireless module but also can use as an Arduino.

Do you mean using RFBee to control the local led or the remote led?
If local, you can add several lines of code to RFBee.pde, for example:


#define LED_GREEN 5 //PD5 on RFBee
#define LED_RED 6 //PD6 on RFBee

void setup()
{

pinMode(LED_GREEN,OUTPUT);
pinMode(LED_RED,OUTPUT);

digitalWrite(LED_GREEN,HIGH);
digitalWrite(LED_RED,HIGH);


}

void loop()
{

}

If you want to control LED connected to the remote RFBee, then you need to do send the protocol data defined by yourself to the remote RFBee. And you need to add some code to the firmware on remote RFBee to parse the data, and then do corresponding control on the LED.
We are planning to add this function in firmware version v2.0, though v1.1 is about to release :slight_smile:

May this helpful to you, and please feel free to ask any question.

Regards,

-Icing

hi icing thanks for the reply.
what i meant for was conrolling LED remotley from the other RFbee.
would it be possible to have the code? or should i wait for version 2.?

best,

jun

Hi jun,

I got what’s your mean.

I think you’d better not wait for our version 2.0. They could be released one moth or two moth later, as the v1.1 has not finished yet :wink: .

Anyway, I can help you to get that function based on the current firmware.

Which version are you using now? Are you familiar with coding on Arduino?

Regards,

-Icing

i’m using RFbee V1.1 and Arduino 18.
i understand pretty much codes in the arduino site but the RFbee firmware is too hard for me.

the final goal is to eliminate host MCU in my project to minimize the cost and size.
analogRead(0) from RFbee1 --------- Rfbee2 led intensity
would be nicer exmaple for me but once blink led got working then i may find my way to do it.
could you recommend me ISP programmer which has proper spacing fitting into RFbee?

thank you for your help!

jun

I have used the adafruit xbee board and a standard ftdi programming cable to talk to one. I kinda like the little board they have, it does level conversion and power regulation, and not much else.

Icing can correct me, but I believe there is a 6pin icsp (not populated) that a standard atmel programmer could be used with. I have used both the adafruit and the Usb uart from seeed to program the 168.

The board needs pwr, gnd, and the pins come out. It will be 3.3 volts unless you use a level converter.

The standard arduino tools work with it, select nano 8mhz 168 and it works fine with either setup.

Rich

Jun,

the RFBee is basically an Arduino with a radio, so you can run any sketch you would run on an arduino on an RFBee.
The tricky part is to use the radio, however it is not so hard as you might think.

To be able to program the RFBee you need to have a way to connect your PC/Laptop to the RFbee.
Easiest solution is of course a UartSB board or a Xbee shield, however if you already have an Arduino/Seeeduino you can use that too.
(its a special trick, but it is possible :wink:)

Once you have the serial connection with the RFBee it is possible to program it and build your setup.

Like any other arduino sketch the code runs in the “loop()” function.
In your case you will want the main loop of the sender to read the analog value and then transmit the value using the transmitData() function. The receiving RFBee will only use receiveData

so on the sending RFBee something like:

void loop()
{
int val = analogRead(analogPin); // read the input pin
Serial.println(val); // debug value
message[1]= (byte) val & 0x00FF;
message[0]= (byte) val >> 8;
transmitData(message,2,0,0);
}

and on the receiving RFBee something like:

void loop()
{
byte rxData[CCx_PACKT_LEN];
byte len;
byte srcAddress;
byte destAddress;
byte rssi;
byte lqi;
int result;

if ( digitalRead(GDO0) == HIGH ) { // we have received data
result=receiveData(rxData, &len, &srcAddress, &destAddress, &rssi , &lqi);
if ((result == OK) && (len==2)){
int val=rxdata[0]<< 8 | rxdata[1];
// and there is your value again which you can use to control the led…
analogWrite(analogPin, val);
}
}

}

Hope this helps,

Hans

Hi jun,

I’v posted a demo on controlling the remote Relay Shield by RFBees based on the code of firmware v1.1. And you can get it here:
http://code.google.com/p/rfbee/downloads/list

Regards,

-Icing

thank you very much Rich, Hans and Icing!
i’ll give it a try and will post lateron.

jun

have a question about rfbee 1.1, is it possible to configure rfbee to work on 433 base freq ?
cc1101 support this band but what about this device.

thanks!

In theory it can do it by configurating the registers. But the RF front circuit is designed for 868M - 915M frequency. So the quality of the RF signal will not good if it works in 433M.

does someone make this code work for the receiver rfbee?

void loop()
{
byte rxData[CCx_PACKT_LEN];
byte len;
byte srcAddress;
byte destAddress;
byte rssi;
byte lqi;
int result;

if ( digitalRead(GDO0) == HIGH ) { // we have received data
result=receiveData(rxData, &len, &srcAddress, &destAddress, &rssi , &lqi);
if ((result == OK) && (len==2)){
int val=rxdata[0]<< 8 | rxdata[1];
// and there is your value again which you can use to control the led..
analogWrite(analogPin, val);
}
}

Whatever I do, arduino tells me rxdata is not declared in this scope- I’m pretty confused.

Gundorf,

The C language is pretty sensitive to letter casing, so “rxData” is not equal to “rxdata”.

Cheers,

Hans

aaaaaaaaaaaarrrrrrr!!!

silly mistake, thank you ;=)