emonTx Not remembering sketch

I am still on a very steep learning curve but cannot find an answer to this - I am sure the solution will be simple but it has stumped me.

I have succeeded in uploading Tx_SimpleRFM12B_Demo to my EmonTX.

I can see all the inputs and feeds in Emoncms and they update happerly. Still continues while powered up but the programmer removed.

However if I power down and power up the board (with no programmer attached) the feeds stop updating until I reload the sketch.

Not sure if it another problem, but there is no activity at all on the LED.

Thanks for your support, Tony.

Robert Wall's picture

Re: emonTx Not remembering sketch

"Still continues while powered up but the programmer removed."

You do have an external 5 V supply connected to the mini USB connector, don't you? Because the a.c adapter is not a power supply, it measures the a.c voltage but it does not supply power to operate the emonTx.

I think I'm barking up the wrong tree there because is wouldn't continue without a power supply, but it's the only way I can think that the emonTx loses its brain, other than a faulty processor.

Tony Antique's picture

Re: emonTx Not remembering sketch

Hi Robert

Yes, I have an external 5 volt supply connected to the mini USB all the time, including when I am programming the EmonTX. I only loose the feeds when I disconnect and re connect it.

Tony.

calypso_rae's picture

Re: emonTx Not remembering sketch

What happens if you run a simple sketch such as blink.ino on your emonTx (with pin 13 changed to pin 9 for the LED)?  I would expect the LED to start blinking whenever power is applied to the board.

If this works OK, then maybe something strange is going on between the processor and the RFM12B module.  If the RF chip does not respond for some reason, sketches can lock up.

Tony Antique's picture

Re: emonTx Not remembering sketch

I've looked a bit further - did say I am on a steep curve.

After power up this morning connected programmer and looked in Arduino serial monitor to see the sketch is running - so my problem is the EmonTx is not reconnecting with my Raspi.

Blink.ino works fine no power down / up problem. This presumable confirms the above.

Where do I go now?

Paul Reed's picture

Re: emonTx Not remembering sketch

What settings have you made in the emonTX sketch & the RaspberryPi config, can you list both.

ie

emonTX sketch
define freq =    (have you removed the leading #)
nodeID =
networkgroup =

RaspberryPi
Frequency =
Network Group =
RFM2Pi node ID =

Paul

Tony Antique's picture

Re: emonTx Not remembering sketch

Hi Paul,

Sorry for the delay getting back to you.

  1. Are you saying I should remove the leading # from the sketch. If I do I get a string of error messages from the emonTx sketch.
  2. Where should I find the RaspberryPi sketch?
  3. I am not sure what is happening, but I have just changed my wireless connection on my Raspi to Ethernet and the sketch is now running.

Why is life not simple!

Tony. 

Robert Wall's picture

Re: emonTx Not remembering sketch

Tony,

1. No - that's what we call a preprocessor directive and it really is "#define"   (I think Paul was suggesting that you might have wrongly removed the '#' thinking it meant that line was a comment.)
What it does is substitute "RF12_868MHZ" wherever "freq" appears in the sketch. That means when you set or change 'freq', you only have to do it in one place. What you don't need to know (and I had to look up!) is that in another file that's included when your sketch is compiled, another '#define' changes "RF12_868MHz" into "2". The reason we use "RF12_868MHz" rather than "2" is it is much more meaningful to us humans.

I don't have a RPi so I can't help with 2 or 3.

Tony Antique's picture

Re: emonTx Not remembering sketch

Hi Robert

Thank you for the explanation.

I am not sure if I should start another tread but I am having problems compiling 'emontx_temperature_power'

I keep getting the error message <no matching function for call to 'DallasTemperature::DallasTemperature(OneWire*)'

I have DallaTemperature.h loaded.

Any ideas where I am going wrong?

Thanks Tony.

Robert Wall's picture

Re: emonTx Not remembering sketch

If you look at the top of the sketch file, you'll see a list "THIS SKETCH REQUIRES:"

Have you downloaded and installed all those libraries (and then restarted your IDE)?  If not (and I suspect you're missing the OneWire one) then you need to get them and install as per the instructions. I say that because some require the directory to be renamed - the README should make that clear if it applies.

Tony Antique's picture

Re: emonTx Not remembering sketch

Thanks Robert

I have done that but the link to Dallas MaximumTemperature list 17 versions. I have tried three but without any luck. Do you have any idea which one?

The sketch references:-

#include <avr/wdt.h>

#include <JeeLib.h>

#include "EmonLib.h"
#include <OneWire.h>
#include <DallasTemperature.h>

When I load the sketch from the Arduino IDE Open button it only includes <emontx_lib; print_to_serial and the emontx_temperature_power> sketches.

So I have copied <DallasTemperature.h, JeeLib.h, Onewire.h > into my sketchbook saved version of emontx_temperatre_power directory. They all now appear in my opened sketch tabs, but I still get the error. Also I have failed to find any version of avr/wdt.h on my hard drive!

Thanks Tony.

Robert Wall's picture

Re: emonTx Not remembering sketch

I think you've missed the bit about libraries in general!

When I load the sketch from the Arduino IDE Open button it only includes <emontx_lib; print_to_serial and the emontx_temperature_power> sketches. That is correct, that is all it should have in there.

The libraries need to be installed elsewhere. Where exactly depends on your operating system. The instructions for Linux are here: http://openenergymonitor.org/emon/buildingblocks/installing-arduino-libr...
I run Windows and I've got mine in a totally different place:  ...\My Documents\OpenEnergy\Software\libraries  and I've got the IDE set up with the sketchbook location (in Preferences) set to that "Software" directory.

In my libraries directory I've got this lot:

You could equally put them in with all the other libraries under Arduino IDE.

Your wdt.h should have been installed with the Arduino IDE. You should find it under the Arduino IDE. Mine is at C:\Program Files\Arduino_IDE\arduino\hardware\tools\avr\avr\include\avr\wdt.h

Checking on the Dallas version...  It looks as if things have been shuffled around. I appear to have got mine from here: https://github.com/milesburton/Arduino-Temperature-Control-Library 
 

Tony Antique's picture

Re: emonTx Not remembering sketch

Hi Robert

You were absolutely right, I had screwed up. Reinstalled Arduino IDE and now all works.

The error I made was confusing the two libraries - the Arduino library and the sketchbook library. I am afraid it was not helped with trying to use Sketch> Import Library> Add Library does not accept zip files with '-' or spaces in the name. To change to '_'  causes the problem. I'm sure I am not the first to do this.

Thank you very much for your help and patience.

Tony.

Paul Reed's picture

Re: emonTx Not remembering sketch

Tony Antique - Where should I find the RaspberryPi sketch?

Hi Tony, I never said RaspberryPi  'sketch', I said RaspberryPi 'config', which can be accessed from your emoncms site in your web browser. The top left menu item should be 'Raspberry Pi', which details the Raspberry Pi RF configuration settings.

It is essential that the EmonTX and the Raspberry Pi are communicating with each other at the same frequency, in the same Network Group, and use a different NodeID to each other.

Robert is of course correct that the leading # should not be removed (I wondered if you had, because others have made this mistake).

Paul

Tony Antique's picture

Re: emonTx Not remembering sketch

Hi Paul

Many thanks for your advice.

Tony

Comment viewing options

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