emonTX shield issue

Hello,

I've received my OpenEnergyMonitor kit, I've soldered the shield, and modified RF12.cpp file. After solve some issues with libraries, I've uploaded the default sketch for the shield (with the emontx_lib in a second tab). Compile is ok, and sketch uploaded. After upload (I upload with de shield plugged), green led at the shield turns on (no blink). If I unplug USB and plug again, green led isn't on, and in my Arduino UNO "L" red led turns on (no blink).

I supose I'm doing something wrong, because green led at the shield must blink, but not, It's still (no blink) and if I unplug and plug USB no will turn on.

Here is my RF12.cpp http://pastebin.com/NsxFd4Nn

And this is the sketch I'm trying: http://pastebin.com/mUvXMYKJ

 

Any idea? 

Thanks in advance!

Robert Wall's picture

Re: emonTX shield issue

I suggest you test your assembly with the standard example sketch from Github. That is proven. If the example sketch does not function, then either you are not understanding what it should do or you have an assembly fault somewhere. If it does work and does what you expect, then the problem lies with your sketch.

KiZD's picture

Re: emonTX shield issue

Thanks!

with the sample, I can see this on Serial Monitor just after upload sketch (no CT plugged):

em
OpenEnergyMonitor.org
Node: 15 Freq: 868Mhz Network: 210
9774 9733 9733 9677
6 22 22 10
18emonTX Shield CT123 example
OpenEnergyMonitor.org
Node: 15 Freq: 868Mhz Network: 210
9765 9740 9740 9642
36 38 39 40
36 41 43 41
34 39 39 42
33 34 39 40
54 46 47 48
35 41 43 42
35 38 41 43
...

but if I unplug/plug again, nothing happens, and in screen:

emonTX Shield CT123 example
OpenEnergyMonitor.org
Node: 15 Freq: 868Mhz Network: 210

and stops there, no void loop.

If I press reset at Arduino, again the same

emonTX Shield CT123 example
OpenEnergyMonitor.org
Node: 15 Freq: 868Mhz Network: 210

and no more.

 

Sketches (only changed freq and nodeID)

emonTxShield_CT1234 http://pastebin.com/8zNhf45p

emontx_lib.ino http://pastebin.com/19U6xY3D

 

In the other hand, I have a Raspberry Pi with the RFM12 module, and minicom shows something like:

 -> 4 b
> 0s
-> 4 b
> 0s
-> 4 b
> 8b

> 0s
-> 4 b
> 0s
-> 4 b
> 0s
-> 4 b

But no input is added in emoncms. I can add inputs via json, but nothing about RF.

 

Thanks

 

KiZD's picture

Re: emonTX shield issue

Hello again,

I've seen that after upload sketch, when I can see correct data in Monitor, green led in the shield blinks, and green led blinks too in the Arduino (TX), but after unplug and plug again, no void loop, no green led blinks in the shield, and in the Arduino, red L led instead TX.

Robert Wall's picture

Re: emonTX shield issue

That seems to me to be a problem with the Arduino rather than with the shield, which is giving believable readings (I expect numbers like that from digital noise from the processor). Is power being supplied by the USB lead? If no, then I think the serial link is blocking. You can prove that by commenting all the Serial.print statements in loop(  ), if it continues flashing the green LED (and transmitting), then it is the serial port that is causing the sketch to stop. You could look into "if (Serial)" in the Arduino documentation to see if that would help. I've no experience with native Arduinos, so I can't help much more. I also don't have a RPi, so the same applies there.

KiZD's picture

Re: emonTX shield issue

Hello,
Serial.print commented, no data over serial monitor, but green led bliks. Desconnect USB, connect again, and no more blinks, same red "L" led in Arduino. Using external power adaptor, the same.
Better to buy an emonTx (not a shield)? better support perhaps?

Thaks in advance!

Robert Wall's picture

Re: emonTX shield issue

Calypso_rae mentioned a day or two ago that he's experienced problems with the RFM12B not initialising. Plus I understand some versions of the Arduino perform a reset when you connect the serial port. Try introducing a delay of a couple of seconds at the top of setup( ) before anything else to allow the RFM12B to establish itself before the sketch initialises it.

KiZD's picture

Re: emonTX shield issue

Thank you very much for your interest, it's a little frustrating and your help is very appreciated.

Delay didn't help,  after upload green blinks, after, "L" led in Arduino.

When green led is on (suppose working) no input shown at emoncms, so double fail. EmonTx and emonBase is more like "working out the box"?

 

Thanks!

Robert Wall's picture

Re: emonTX shield issue

If you remove the shield, and load (say) the "blink" sketch (or write your own!), do you observe the same behaviour?

KiZD's picture

Re: emonTX shield issue

If I load the example sketch, and change the led number (to use the shield's one), unplug, plug... and keep working.

Robert Wall's picture

Re: emonTX shield issue

So let's get this right: when you use the example sketch for the shield from Github which has the correct IO port for the LED on the shield, it works?

KiZD's picture

Re: emonTX shield issue

When I use the sample sketch for the shield, only change ID and freq, and led works ok, unplug and plug, and doesn't work and no void loop. When I use Arduinos's sample (basic>blink), change de led to the shield's one, works fine, unplug/plug, and keeps working.
I think that I'm going to buy emonTx (not the shield) and nanode...

Robert Wall's picture

Re: emonTX shield issue

Ah, now I understand. I suggest you wait a little longer before you spend more money. I still think the problem might lie with the RFM12B. If you use the Github shield sketch but comment out everything concerning the RFM12B, do you still have the problem?

What were the problems that you had with the libraries? Did you set up your system according to this?

KiZD's picture

Re: emonTX shield issue

I'm at work now and I can't test it now. I think that libraries are ok, if didn't I supose that could not compile.

Related with libraries, I've seen that a had to modify (and I did) a function in RF12.cpp file:

"If you're using an Arduino Uno (ATmega328) add the following to the #elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega328__) section of void rf12_set_cs(uint8_t pin) function in RF12.cpp file:
if (pin==5)
{
   cs_pin = 5;         //PD5
  #define SS_DDR      DDRD
  #define SS_PORT     PORTD
  }
If you're using an Arduino Leonardo (ATmega32u4) add the following to the #elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega328__) section of void rf12_set_cs(uint8_t pin) function in RF12.cpp file:
if (pin==5)
{
   cs_pin = 6;         //PC6
  #define SS_DDR      DDRC
  #define SS_PORT     PORTC
  }
"

I have seen the emonTx guide (not the shield one), and nothing is said about this modification, and if I'm not wrong, It uses the same library and a ATmega328 (like my Arduino)

Do I have to do this modification or not? ...I will tray without edit anyway.

KiZD's picture

Re: emonTX shield issue

I've read it again, and only have to edit the library if I'm going to use other shield over the emonTx shield, so perhaps this is the mistake. I don't know what happens if I edit the library but don't use another shield else; I suppose that must work anyway, but who knows.

...I hope that so much, and everything was ok (...but my English) 

Robert Wall's picture

Re: emonTX shield issue

The full details of the modifications you need to the library and/or hardware are in the Wiki. "RFM12B Slave Select (SS) Solder Jumper Setting". Which you choose will depend on what other hardware you have.

KiZD's picture

Re: emonTX shield issue

If I comment "rf12_initialize(node, freq, networkGroup);  " I can plug/unplug and green led keeps working.

Robert Wall's picture

Re: emonTX shield issue

Carefully check the RFM12B module. The connections on the module should line up exactly with those on the PCB. Check that the solder has flowed into the joints and there are no solder bridges between adjacent pads.

Robert Wall's picture

Re: emonTX shield issue

Don't worry about your English - it is much better than my French.

For the hardware links, because you do not have another shield, you must:

1. For the RFM12B Slave Select (SS) solder jumper setting, connect the solder jumper to 10 by connecting the middle pad to the left pad shown in this image.

2. For the RFM12B Interrupt solder jumper setting, because you have an Arduino Uno, you must connect the right hand solder jumper to Digital 2.

In the RF12.cpp file, because you have an Arduino Uno, find the function "void rf12_set_cs(uint8_t pin)" (near to line 149).  Change that function to become

void rf12_set_cs(uint8_t pin)
{
#if defined(__AVR_ATmega32U4__)     //Arduino Leonardo
  if (pin==10) cs_pin=6;      // Dig10, PB6    
  if (pin==9)  cs_pin=5;      // Dig9,  PB5
  if (pin==8)  cs_pin=4;      // Dig8,  PB4           
#elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega328__) || defined (__AVR_ATmega328P__) // ATmega168, ATmega328
  if (pin==10) cs_pin = 2;      // Dig10, PB2
  if (pin==9) cs_pin = 1;       // Dig9,  PB1
  if (pin==8) cs_pin = 0;       // Dig8,  PB0
  if (pin==5)
  {
     cs_pin = 5;         //PD5
    #define SS_DDR      DDRD
    #define SS_PORT     PORTD
  }

#endif
}

 

KiZD's picture

Re: emonTX shield issue

Hello,

a friend has checked resistors and solder points, and everything seems to be ok. He has suggested a fail RF12 module. Is there any way to check it? I bought another RF module, but I don't feel capable of desolder and solder again.

Jumper settings are OK, and checked with library as original and edited. 

Robert Wall's picture

Re: emonTX shield issue

The part I cannot understand is, when you leave the serial monitor/USB connected, the RFM12B appears to not lock up, even though you do not detect any messages in the Raspberry Pi. That says to me it is not totally dead.

Sorry, but I don't know of a way to check the RFM12B. I've asked Glyn Hudson to look at this thread, he should know more than me and maybe he can suggest a solution. I think without professional desoldering tools, you would not be able to remove the RFM12B without damaging the main PCB.

KiZD's picture

Re: emonTX shield issue

When I upload the sketch, and green led blinks, I can see valid data over the monitor (if I use a temp sketch, for example, I can see how changes the temp), but I suppose that that is what is sent to serial, but it doesn't mean (I suppose) that this data is sent to RF correctly. But as you say, not seems to be locked just after upload sketch. Perhaps some "kind of thing" that allows RF to initialize is sent when uploading.

I can bring the board to my work to somebody desolder the RF pcb, but better another sollution.

When I got some time, I would like to try the other RF12 pcb connected to an Arduino, and see if my RF12B Pi Board receive some data (help welcome!)

calypso_rae's picture

Re: emonTX shield issue

Back in March, I was struggling to get any kind of RF link to work.  At that time, I didn't know about the pair of test sketches that Glyn had put onto Github.  When I eventually managed to get a pair of simple sketches working for myself, I posted them on a thread that I'd already started, Simple test Rig for RFM12Bs (on Tue, 05/03/2013 - 16:55)

These two sketches (RF_checker_tx.ino and RF_checker_rx.ino) require no libraries other than Jeelib and are as simple as they can be.  If the LEDs at both ends are flashing in synch, then the RF link is working.

Might be worth giving these sketches a try before reaching for the soldering iron ...

 

Robert Wall's picture

Re: emonTX shield issue

Ah, but KiZD can only do that at one end, the other is a Raspberry Pi and that needs a different script to read the data. I think the receiver LED should respond though.

KiZD's picture

Re: emonTX shield issue

Hello,

As Robert said, I only have an Arduino, emonTx shield, RF12B PCB and RF12BPi board (...and a Raspberry Pi). I'm waiting to receive an Arduino mini (it was cheaper than a spare Atmega328PU), but it cames from Asia, so... a couple of weeks.

I'm going to have a look at Martin's corner, perhaps I can find in his firsts RF12Pi posts some test related that could help me.

I have ordered an emonTx (not the shield), wich I will receive next week. In my "final" setup I want to measure three mains and optical meter, and spare plugs in the kitchen, but I didn't want to buy all boards at the beginning without any testing; but I can't stop at this point with any good test; I have spent a lot of money and this has to work.

 

Thanks!

calypso_rae's picture

Re: emonTX shield issue

OK, so the various physical parameters (voltage, current, meter flashes etc.) are conditioned via the emonTx shield.  The relevant signals are sampled/captured by the Uno and the resulting data is transmitted by RF via the RFM12B board.  I think I understand this part OK.  For the purpose of checking the operation of the RF link, the Uno could simply be running my RF_checker_tx.ino sketch, or any other similar tool.

The equipment at the receiving end is "RF12B PCB and RF12BPi board (...and a Raspberry Pi)."  I've not used any of these items myself, but is there not some simple means by which a specified data byte in each transmitted message can be made to toggle an LED on and off (or some equivalent indication as to what's happening within the RF paylaod)?  That's all my RF_checker_rx.ino  does.

Using a simple RF checker tool at the transmit end is surely an excellent way to check all subsequent components in the data path, such as emonCMS.  Suitable test data can then by synthesised without the bother of setting up all the right physical conditions. 

 

KiZD's picture

Re: emonTX shield issue

I've loaded RF_checker_tx.ino in emonTx Shield. As I don't have at the moment another Arduino, I can't do the test, but I don't have the red "L" led at Arduino when I unplug/plug.  I don't know what does it mean.

calypso_rae's picture

Re: emonTX shield issue

OK, so you've loaded this sketch into your Arduino.  The emonTx Shield does not have a processor and is not playing any part in this test.  The sole purpose of this test is to check that your RF link is working. 

If a simple example sketch such as blink.ino runs correctly on your Arduino, then my RF_checker_tx.ino sketch should be running correctly too.  You should be able to see the on-board LED blinking in both cases.  If the LED is not blinking when the  RF_checker_tx program is loaded, that could be because the RFM12B has not been connected correctly.  The Arduino needs to get an answer from the RFM12B whenever one is expected, otherwise the sketch will wait for ever and nothing will happen.

Note:  In each of my checker sketches, the LED_pin is defined as "5".  For a Uno, the on-board LED is driven from digital pin 13, so you will need to change the LED_pin definition to "13".  Otherwise, the on-board LED will not blink.

Next you will need to find out how to extract data from RF messages that are received at your "RF12BPi board".   I've no idea how to communicate with this board, but it can't be all that difficult.  Hopefully someone will be able to help at this stage ...

 

Robert Wall's picture

Re: emonTX shield issue

I've asked Paul Reed, who knows about the Pi, he says he'll have a look here this evening.

Paul Reed's picture

Re: emonTX shield issue

Hi KiZD

I can't help with the Arduino/Shield side of things, but we could try a few things with the Raspberry Pi, to try and find out what is going on.

Firstly, check the status of your rfm12pi module;

$ sudo service rfm12piphp status

does it say that the 'Log is turned off' and that the service is 'running'?

If so, try turning the logging on by;

$ sudo service rfm12piphp restart log

and then have a look at the log by;

$ tail -F -n 40  /var/log/rfm12piphp.log

..and you should then see the configuration details of your RasPi module, frequency, etc, followed by a stream of data being received in real time. I've shown my log below.

To exit the log type Ctrl-C and to switch off the logging type;

$ sudo service rfm12piphp restart

Can you copy your log and post it so Robert, Robin and myself can try and assist further.

Paul

--------------------

$ tail -F -n 40  /var/log/rfm12piphp.log
MESSAGE RX:> 15i
BASEID SET CORRECTLY
DATA RX:
MESSAGE RX:> 8b
FREQUENCY SET CORRECTLY
DATA RX:
MESSAGE RX:> 210g
GROUP SET CORRECTLY
DATA RX:
DATA RX: 10 28 2 21 0 0 0 47 95 220 6
DATA RX: 18 201 5 56 12
DATA RX: 10 33 2 21 0 0 0 69 95 220 6
DATA RX: 10 55 2 20 0 0 0 102 95 220 6
DATA RX: 10 39 2 21 0 0 0 49 95 220 6
DATA RX: 10 42 2 21 0 0 0 31 95 220 6
DATA RX: 10 48 2 20 0 0 0 49 95 220 6
DATA RX: 18 201 5 39 12
Sending remote dataDATA RX: 10 50 2 20 0 0 0 96 95 220 6

 

KiZD's picture

Re: emonTX shield issue

Thank you all

I've received an emonTx (not the shield) and another RF module. I've desoldered RF, and solder the new one, but this time using little pieces of wire. Sketch runs ok, and data is received. Turn off, turn on... and keeps running; so there was some issue with the RF. I'll try to check it using another Arduino and the test sketch posted above.

 

 

Thanks!!!

geurink33's picture

Re: emonTX shield issue

Hello,

 

I have a same kind of problem. When i give the tail command its gives everything corretly.

Group set correctly

data rx: (in a to small square) 0001

root@raspberrypi:/home/pi/RFM2Pi# tail -F -n 40 /var/log/rfm12piphp.log

DATA RX:
MESSAGE RX:> 8b
FREQUENCY SET CORRECTLY
DATA RX:
MESSAGE RX:> 210g
GROUP SET CORRECTLY
DATA RX:
DATA RX:
MESSAGE RX:> 8b
FREQUENCY SET CORRECTLY
DATA RX:
MESSAGE RX:> 210g
GROUP SET CORRECTLY
DATA RX:
MESSAGE RX:> 8b
FREQUENCY SET CORRECTLY
DATA RX:
MESSAGE RX:> 210g
GROUP SET CORRECTLY
DATA RX:
DATA RX:
MESSAGE RX:> 210g
GROUP SET CORRECTLY
DATA RX:
DATA RX:
MESSAGE RX:> 210g
GROUP SET CORRECTLY
DATA RX:
MESSAGE RX:> 8b
FREQUENCY SET CORRECTLY
DATA RX:
MESSAGE RX:> 210g
GROUP SET CORRECTLY
DATA RX:

when i connect the same EmonTX on Arduino and look at the serial monitor i get all the data

regards Frans

 

 

Comment viewing options

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