EmonTX Shield v2 - troubleshooting

Hi everyone,

I've taken the plunge with OpenEnergyMonitor and started by getting an emontx shield v2 and 1 CT clamp, plus radio chip. (No AC-AC yet - will add later. And no nanodes or base stations in the system, so I'm using the serial monitor to check output from the board, rather than radio).

Was really impressed by how quickly the kit arrived! I've soldered all the non-SMT components and attached it to the Arduino.

I've uploaded the emonTxShield/Shield_CT1234 sketch.

This runs, but I don't think the readings are correct. I've tested this by attaching the clamp around the lead to my kettle to start with. The readings don't seem to change appreciably when the kettle is on, so I'm sure something isn't right! Here's an example of the output of the script with the CT connected to CT input 1:

19 0 32 0
19 0 32 0
23 0 34 0
18 0 34 0

This doesn't change if the kettle is on or off. If I disconnect the CT from the jack, then here are the kind of readings I get:

0 0 34 0
0 0 34 0
0 0 35 0

If I plug the CT into each port in turn, then I do see a big spike in readings for the relevant port. Here's an example of me plugging the CT into port 4 (with the clamp not round anything):

0 63 32 0
0 55 32 0
0 444 32 5473  <--- Here is where I plugged into CT4
0 1 31 3543
0 0 32 764
0 0 33 139
0 0 32 45
0 0 32 22
0 0 32 22  <--- CT4 is still plugged in here, and the readings seem to stabilise after the initial spike

I think something's probably not right, and I guess the most likely problem is with hardware (eg. how I've soldered the board). My question is, what is the best procedure for testing this? Are there any sensible checks I can do with a multimeter, or simple tests I can run? All the soldering I've done looks okay to theye.

I had a look through other forum posts, and I noticed there's lots of talk about tests that can be done with Robin's tools. These look like a good place to start. I've run RawSamplesTool. This works fine in debug mode (with demo values). But when I switch debug off, it appears to hang, with output looking like this --- and there's no more output after the countdown begins (eg. nothing after '4' below):

In NORMAL mode ...

SUPPLYVOLTAGE = 4962, VIn NORMAL mode ...

SUPPLYVOLTAGE = 4940, V_RATIO = 1.42, I_RATIO = 0.38
millis() now = 11
recordingMayStartAt 5011
4

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

Thanks in advance for help with any of this!

Tom K

 

 

tomkerswill's picture

Re: EmonTX Shield v2 - troubleshooting

Hi everyone,

Following the last email, I've fixed most of my problems by resoldering the joints on CT3. That seemed the best place to start, because the readings from that jack were consistently weird.

It's now working great, with all the readings spot-on.

I do still have the problem with Robin's RawSamplesTool hanging during the countdown. I was able to get the script to run without hanging once, by pressing the reset key and keeping on doing this until on one of the runs it completed successfully - but I guess that could be a bug in the script rather than a hardware error. 

Thanks - looking forward to doing more experimenting with this!

Tom

Robert Wall's picture

Re: EmonTX Shield v2 - troubleshooting

Robin will no doubt comment on his RawSamplesTool. I'm not totally familiar with all of them, but some require the ac voltage input to work properly.

In case you were wondering about the high values when you plug the c.t. in (and warning - don't unplug or leave unplugged the c.t. while it's on a cable that's energised, you could get a nasty high voltage, 22 V if the internal protection is working and much higher if it isn't), that's due to the d.c. component that's there initially before the software high pass filter settles and removes it.

tomkerswill's picture

Re: EmonTX Shield v2 - troubleshooting

Thanks Robert - Ah, okay, that makes sense. Re: the RawSamplesTool - ah, yes maybe it's because of my lack of AC-AC connection. I know that lots of people are using the tool fine, so it must be something that I haven't done that is making it freeze --- perhaps it's waiting for the AC-AC input.

Tom

Robert Wall's picture

Re: EmonTX Shield v2 - troubleshooting

Is there not a descriptive comment at the top of the sketch? Robin usually puts quite clear instructions there. Failing that, look up the page where he first posted the tool.

Oh dear, it took me longer to find the page than to spot the clue: "it records all voltage and current samples that are taken during one complete cycle of the mains." Can you tell (maybe from looking at the sketch) how it tells when a cycle of mains begins and ends? Maybe the comment that begins at line 68 is worth reading?

tomkerswill's picture

Re: EmonTX Shield v2 - troubleshooting

For anyone else reading, here is a link to the page with the tools:

http://openenergymonitor.org/emon/node/1757

And the description at the top of the file reads:

*
* Tool to display the raw samples generated by an Arduino.  Starts in' debug' mode
* which uses synthesized values for voltage and current.  For normal operation,
* commment out the '#define DEBUG' statement a few lines down.
*
* Pauses after each set of measurements has been taken.  Press spacebar, then [cr],
* to repeat.

The code that I'm reading (rawSamplesTool) doesn't have a comment on line 68, but I think what you're saying is that if there's no voltage, it's never going to be able to tell when one cycle ends, so it's just going to sit there forever waiting for a voltage change. I can't quite see this on the code, but I guess that must be what's happening.

I'll have a look through and see if there are any scripts that might help with a CT-only setup...

Tom

 

Robert Wall's picture

Re: EmonTX Shield v2 - troubleshooting

I was looking at the later "improved" version. The comment is on line 141 in the version you are using.

tomkerswill's picture

Re: EmonTX Shield v2 - troubleshooting

Okay - so here's a copy of the comment on line 141. It looks like the countdown should run over a few seconds, and at the end of this, the recording process starts:

/*  Allow the system to run for several seconds so that the filtered
*  voltage waveform can settle down.  This info is needed for determining
*  the start of each new mains cycle.  During this period, a countdown
*  is displayed.
*
*  After the settling period has expired, raw samples taken during
*  one complete mains cycle are stored in an array.  The capacity of the
*  array needs to be sufficient for the number of sample pairs that may
*  appear.  A 100 x 2 integer array will probably suffice.
*
*  At the start of the following cycle, the data collected during the
*  previous cycle data is sent to the Serial window. 
*/

... The code that determines the end of the cycle checks for a polarity change:

if ((polarityNow == POSITIVE) && (polarityOfLastReading == NEGATIVE))

... And I guess this condition is never satisfied, so the program runs in an infinite loop.

It would be useful to have a guide to troubleshooting emonTxv2 shield in a CT-only setup. I'll have a look through the other programs and see if I can find any that are useful for debugging this kind of problem, and will try and get a guide together to make this process easier.

Tom

Comment viewing options

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