Jeelink as RFM12Pi alternative

I recently ordered my first package of base station (RaspberryPi with RFM12Pi) and sensors (EmonTX and EmonTH) to start experimenting with the system. 

The system was setup relatively easily, and is working fine for about a month. Nice job on the ready to install images.

One of the issues for me, was that the low write image, was lacking some of the features of the full EmonCMS.

Since I have a Debian Box running 24/7, I installed full EmonCMS there and used the Raspberrry only to forward data.

Then I started thinking about using a receiver directly in the Debian box and free the Raspberry for another use.

From what I read in the forum, Jeelink is a good choice, since is basically the same hardware, so I got one.

I must say, that I was not familiar with Arduino and flashing sketches etc. I first tried to upload the compiled firmware with avrdude but verifying failed (a different bootloader?). Anyway I managed to compile and upload RF12_Demo_atmega328.ino from here with Arduino Ide and Jeelib 11 (using the latest Jeelib I didn't receive anything). 

Jeelink is working ok now, but I am experiencing several lost packets from the emonTH. Maybe like 1 in 3, but pattern isn't clear. Some times I get a few in a row, every minute, other times 5 minutes pass without a packet from emonTH. I had emonhub log in debug mode in parallel and the same time RFM12Pi on the Raspberry seems to receive more, if not all the EmonTH packets, as far as I can see. The emonTX packets seem to be received normally every 10 seconds by both. Maybe Jeelink is more sensitive to data collisions? Any ideas on the cause? Is there anything I could tweak on the Jeelink? 

Thanks

bond79's picture

Re: Jeelink as RFM12Pi alternative

To be more precise I parsed the logs of emonhub, and here is what I got:

In a period of around 25 minutes, RFM12pi got 24 packets from emonTH and 115 packets from emonTX

Jeelink got 9 packets from emonTH and 114 packets from emonTX

For around 5 minutes, I had completely turned off emonTX to avoid intereference and in that period, RFM12Pi got 4 packets and Jeelink got 2 packets. So that doesn't seem to be the problem

I also moved the emonTH right beside the Jeelink to rule out range issues, but nothing changes. The emonTX that doesn't have a problem, is much further away.

I see a similar issue here:

https://twitter.com/Openenergymon/status/412269692112629762

My nodes are also 868 Mhz.

pb66's picture

Re: Jeelink as RFM12Pi alternative

There is a way to adjust the frequency slightly which I have never needed to use so am not really familiar with it and it is just a theory.

It is there to tune the devices for optimum performance, countering any component tolerances etc, I suppose it is possible your jeelink and emonTH are at opposite ends of the band your devices are occupying. 

See fine tuning here http://jeelabs.net/projects/jeelib/wiki/RF12demo . But I beleive this will only work with RF12demo.12.

Before that have you confirmed all the devices are fitted with actual 868MHz RFM12B's as a 433MHz RFM12B will operate as a 868MHz device but at a reduced range? The differences can be seen here http://openenergymonitor.org/emon/buildingblocks/rfm12b-wireless

Also are the antenna the same length ?

Paul

pb66's picture

Re: Jeelink as RFM12Pi alternative

Also to help with diagnosis rather than using 2 machines or parsing the logs afterwards, if you set up the Jeelink as a 2nd rfm device in emonhub you can see both devices live on the same pi.

Assuming the jeelink is the only usb device connected so it id is likely to be /dev/ttyUSB0 you could add

[[Jeelink]]
        Type = EmonHubJeeInterfacer
        [[[init_settings]]]
            com_port = /dev/ttyUSB0
            com_baud = 9600
        [[[runtimesettings]]]
            group = 210
            frequency = 868
            baseid = 15
            pause = out

to the [interfacers] section of the emonhub.conf, no need to restart. (check over the values I've used though)

The last line "pause = out" will allow you to see the packets arrive and get processed but they will not be passed to the reporters and therefore will not duplicate the data arriving on the RFM2Pi in emoncms. 

using "tail -f /var/log/emonhub.emonhub.log you should see the 2 devices receive identical packets in tandem.

Paul

bond79's picture

Re: Jeelink as RFM12Pi alternative

Thanks for the response.

Since first posting, I did some reading, and I flashed the Jeelabs RF12demo (I had to change the code to remove the "OK" from the response for it to work with emonhub), to fine tune the frequency of the Jeelink, but even a small change, resulted in breaking both EmonTH and EmonTX reception. 

Right now reception of packets is around 50-70% packet loss for EmonTH.  

EmonTX reception is perfect, no difference from RFM12pi.

I know all the devices I ordered are 868. I checked the link and indeed, all of them are missing the capacitor, so the hardware is 868Mhz. All antenas are around 80mm, so 1/4 wave length for 868Mhz and I have tried to place them parallel to each other. 

I have ordered a second emonTH anyway, to expand my measures, so when it arrives I will test if there is an issue with the first emonTH. I have also ordered the USB-UART programmer to be able to upload sketches and debug the emonTH. Is there a way in emonTH to fine tune the frequency?

Thanks

Robert Wall's picture

Re: Jeelink as RFM12Pi alternative

The other way to increase the range is to reduce the bandwidth, i.e. reduce the data rate.

A couple of days ago I tried an emonTx V3 to an emonGLCD. Both are 868 MHz with 82 mm antennas, running on standard settings except that I set the frequency to 433 MHz. The range: about 200 mm!

pb66's picture

Re: Jeelink as RFM12Pi alternative

As far as know there is no provision in the emonTH sketches to fine tune the frequency, it probably wouldn't be too difficult to add something if the need arose though. But based on your findings above and the fact I don't recall anyone having to do this previously, It's looking less likely to help.

Comparing against a second emonTH is definitely the best way forward if have one on order.

Is the Jeelink running at the same baud as the rfm2pi ?

Using the USB-UART programmer as a alternative power source for the emonTH will be a good test too.

Both OEM gateway and initially emonhub were designed to interact with just the OEM version of the RF12demo sketch that didn't transmit the "OK", Since learning the original JeeLib versions and the later OEM RFM69 variant of the RF12demo transmit "OK" emonhub has been changed (in testing branch) to be compatible with both standards. So future editing of the "OK" responses won't be necessary.

Paul

bond79's picture

Re: Jeelink as RFM12Pi alternative

If I use the RFM12Pi sketch (RF12_Demo_atmega328.ino) on the Jeelink, it is running also at 9600, same as the RFM12Pi.

When I use the RF12demo from Jeelabs, it is set at 57600. In both cases I haven't seen any noticeable difference.

Thanks for the help. I will report with more, when I have the second emonTH, to test.

bond79's picture

Re: Jeelink as RFM12Pi alternative

I tested with the second EmonTH. Jeelink is receiving almost all it's packets when it's close.

When moved 10 meters away with 2 walls in between reception falls relatively to the RFM12Pi, to about half to 3/4 of the packets.

The first emonTH is about 1/5 to 1/4 of packets received with the Jeelink compared to RFM12Pi.

I also tested with the USB UART but my data is not complete enough to tell if it made a difference.

Anyway it seems to be a reception/sensitivity issue of the combination of Jeelink and emonTH and not some setting that can be corrected easily, so I will settle with what I have.

Thank you for the help

jasonwxwcn's picture

Re: Jeelink as RFM12Pi alternative

The higher air data rate, the shorter range. We have test the RFM12 module. In the air data 9600bps, the Line in sight range is about 100 meters. 

We have found a USART module with 100mW at 868MHz., the range is about 1000 meters. pls check this:

http://www.appconwireless.com/PRODUCTS/showproduct.php?lang=en&id=7

bond79's picture

Re: Jeelink as RFM12Pi alternative

Reducing the RF12 rate improved the situation greatly. Right now Jeelink is receiving all the packets.

I had tried it before when Robert mentioned it above, but at the time, I didn't realize, I would have to change the rate both in the Jeelink and all the transmitters (emonTX, emonTH), so it wasn't working correctly.

Anyway, I added this command to the setup portion of all the sketches, right after the rf12_initialize command

rf12_control(0xc657);

I found it somewhere in the forum and according to this it sets the rate at 3.918kbps.

Since our data is a few bytes, is there any downside to reducing the data rate? Why isn't a lower rate the default setting?

Thanks for the tip jason

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.