EmonTx V2 - Basic trouble shooting steps

My Emon Tx V2 arrived today, and I've put it together this evening.

I've followed the instructions (twice through) for setting up the arduino environment and downloading the libs.

When I try and upload a sketch (emonTx_CT123_Voltage), I get this:

avrdude stk500_getsync

I've tried to check that the programmer I'm using is connected correctly, but can't find the pin details for the FTDI - I'm assuming they're standard?  (I know my programmer work as I'm also using it for some mysensors.org projects)

Also, I can't seem to find any basic electrical checks which can be carried out - over and above the one in the build instructions.

Any basics - like should the led light when I plug in power from the USB socket?

Thanks

James

Robert Wall's picture

Re: EmonTx V2 - Basic trouble shooting steps

That error usually means a connection problem. The correct orientation is to line up the GND pins. GND on the V2 is labelled and nearest the USB socket, on the shop FTDI programmer it's also labelled "GND" and it's the top one when the writing is the correct way up. If your programmer is different to the one from the shop, you need the emonTx V2 schematic, there's a link on the Wiki.

The LED is driven by an I/O pin, so what it does depends on the sketch you've loaded. If you haven't loaded a sketch, nothing will happen (because I don't think the 328P comes with a pre-loaded sketch).

jdr0berts's picture

Re: EmonTx V2 - Basic trouble shooting steps

Thanks Robert,

I've found a link to the schematic, but I can't see anything with the pins labelled - either on the wiki or the schematics in github.

The programmer I have has the following pin labels:

DTR

RXD

TXD

VC

CTS

GND

I've had no problems using those to program a number of Pro Mini boards.

There is a voltage selector, which is currently set to 3v3 - is that correct or should it be 5v?

Thanks

James

Robert Wall's picture

Re: EmonTx V2 - Basic trouble shooting steps

I've deleted your duplicate post. Please look to see if your comment is held in the moderation queue before reposting. It only causes extra work for us moderators. Your browser should show a message if it is.

"but I can't see anything with the pins labelled - either on the wiki or the schematics in github."
Really? They are labelled when I look - though you need to follow the connections on the schematic.
On my shop programmer, the pins are labelled:
RTS
RXD
TXD
5V
3.3V
GND

Obviously - or perhaps not - you must cross-connect TXD to RXD. RTS / DTR is actually used as a reset to the processor. It's probably worth you looking at the Wikipedia page on RS232 to work out what all the signal lines were originally intended for. E.g. DTR originally meant "I'm here" and RTS meant "OK, let me have the data", so broadly similar meanings.
The 3.3 V isn't connected on the emonTx V2 board.
So it looks as if a straight connection with 5 V selected should work. If not, tell us which OS you are using.

jdr0berts's picture

Re: EmonTx V2 - Basic trouble shooting steps

Hi Robert, noted on the duplicate post.

Here's what I have:

Programmer - EmonTx (PIN number)

DTR - Reset (6)

RXD - TXD (5)

TXD - RXD (4)

VC - PWR (3)

CTS - not connected

GND - GND (1)

I've tried it with both 3.3v and 5v, both to no avail, Using Windows 7.1 and Ardunio 1.0.5.

Cheers

James

Robert Wall's picture

Re: EmonTx V2 - Basic trouble shooting steps

I'm not an expert on the various types of programmer, so unless anyone else knows better, let's assume all that is OK.

I've never used Windows 7, I went straight from XP to 8, then quickly dropped it for Ubuntu. Which guide did you follow when you set up your Arduino IDE? Do you see a new port appear when you connect the programmer?

jdr0berts's picture

Re: EmonTx V2 - Basic trouble shooting steps

I believe the programmer is ok - it uses a different driver (CH340), but I've been using it to program an Arduino Uno board and a number of pro-mini boards.

I've just done a clean install of Arduino-1-0-6, and following the guide here for the libraries:

http://openenergymonitor.org/emon/buildingblocks/installing-arduino-libr...

and the following link for the EmonTx V2 firmwave:

http://openenergymonitor.org/emon/buildingblocks/uploading-arduino-firmware

A straight compile gives the following output:

Binary sketch size: 9,546 bytes (of a 32,256 byte maximum)

One thing concerns me - there's an assumption here that my hardware building/soldering skills are upto scratch, is there any guide for some basic checks of the board which I could try - I had a bit of "fun" soldering the RFM12b chip to the board, so wonder if that might have caused any issues?

Thanks

James

Robert Wall's picture

Re: EmonTx V2 - Basic trouble shooting steps

I was assuming that you had checked the voltages as per the build instructions - is that correct? If not, look again at the schematic and check that 5 V (PWR) is available at all the places it should be, and 3.3 V (VCC) is at all the places it should be. Also check that the reset line is a logic HIGH (close to 3.3 V), that the crystal and C7, C8 look OK. Check the RX and TX lines for short to GND, VCC or to each other. If all those points are OK, I think the processor should at least run even if there are faults elsewhere.
Normally, if the RFM12B isn't soldered in properly, the sketch will load and run as far as initialising the RFM12B, then it sticks waiting for a response that never comes.
So if you are still seeing the sync error, that points to it not talking.

The way to solder the RFM12B - OK, I know it's too late now for you - is to solder one pin on one corner only, then check. If it needs to be moved, it's easy to melt that one joint and move it. When you're happy, do the opposite corner and check again. If it's OK still, do all the rest.
Or you can sit it on a bit of double-sided tape to position it before soldering.

jdr0berts's picture

Re: EmonTx V2 - Basic trouble shooting steps

OK, I've run through the following checks:

3.3v at pins 7,20 and RFM12b - all at 3.28v

PWR at P1 -> P4 - all at 5.00v

GND at pins 8 & 22

Tx, Rx have continuity between the atmega and the ftdi header, nothing between either of them, GND or 3.3v

Have continuity across the crystal and pins 9&10, and C7, C8.

Reset line is 3.28v

Which is a relief, and turns to the programmer. I remember having some trouble with the programmer initially, and had to install additional drivers, however my understanding here was that was down to the chinese clone of the atmega328 on the Arduino Uno rather than the driver for the programmer.

Next step is to try the Uno as the programmer.

jdr0berts's picture

Re: EmonTx V2 - Basic trouble shooting steps

I'm still at a loss as to why I can't program via the ftdi header pins. I've ordered and tried a programmer which uses the same chip as the ones sold by OEM, to no avail.

What I have done is take out the atmega chip and place it into the arduino uno board I have, and I can program it, place it into the emonTx and.... it works :)

So, I'm a little way further along and haven't had much chance to play yet - I get 4 readings, and with only the ac-ac psu plugged in (i.e. no CT's) it settles on a value of around 33. I don't understand the config required yet in emonhub for the datacodes bit, so that looks like the next, that said, without being able to program the board, making the changes to the calibration etc is going to a bind!

Cheers

James

jdr0berts's picture

Re: EmonTx V2 - Basic trouble shooting steps

HI there,

I'm not sure I'm any further forward here. I've tried the following:

1) removing the ATmega chip, placing it in a breadboard and connecting just those pins referened above.

2) Tried a different programmer using the same chip as the one in the OEM shop

3) Tried a Mac to do the programming

4) Checked the voltage on all pins with the programmer connected, giving:

1  - 3.28
2  - 3.4
3  - 3.39
6  - 5.09
7  - 3.28
15 - -0.3
16 -
17 - 0.77
19 - 0.73
20 - 3.28
23 - 1.63
24 - 1.63
25 - 1.63
26 - 1.63

However, none of these make any difference, I still can't program the ATmega over the FTDI interface on the EmonTX V2 board.

is there anything else can I try/test ?

Cheers

James

Paul Reed's picture

Re: EmonTx V2 - Basic trouble shooting steps

Have you a Arduino Uno board laying around? If so, you try popping the Atmega chip in and try programming it from there.

Paul
 

jdr0berts's picture

Re: EmonTx V2 - Basic trouble shooting steps

Hi Paul,

I have managed that, and got it working so I've ruled out the chip - however for modifying the sketch it's not ideal, also calibration looks difficult, so I'd like to try and get it working through the emontx board....

CHeers

James

Paul Reed's picture

Re: EmonTx V2 - Basic trouble shooting steps

Aahh, just spotted your comment re the UNO a few posts earlier!

Paul

Robert Wall's picture

Re: EmonTx V2 - Basic trouble shooting steps

Can we check what you have and what you can and cannot do?
You have an emonTx, not an emonTx Shield.
You have a programmer not from the OEM shop.
With the programmer connected, the supply voltages are believable (5V & 3.3 V on the emonTx).
You cannot program with the processor in the emonTx V2, using the programmer + FTDI.
You can monitor the serial output from the processor using the Arduino IDE.
You can program the same processor in an Arduino Uno board, but that does not use the programmer.
If you momentarily short the reset line to GND (programmer not connected), the processor resets.

If it's not an issue with the reset line itself, I think the finger of suspicion still points at the programmer and/or the drivers. I'd look at checking the timing between issuing a reset on DTR - assuming of course that it is issuing a reset - and attempting to send the data.

jdr0berts's picture

Re: EmonTx V2 - Basic trouble shooting steps

HI Robert,

To answer your questions:

I have an EmonTX V2

I have a programmer not from the OEM shop - it's a CP210x based chip.

With the programmer connected, voltages are as the post above.

I cannot program using the programmer +FTDI

I cannot monitor the serial output - I just get a single extending blank line.

 

I have now managed to get the board programmed using the Programmer + IDE - by holding pin 1 on the chip to GND until the compile has finished, the programmer connects and uploads!

I noticed the board had DTR instead of RTS like the OEM shop programmer, so tried connecting that to the rest PIN on the FTDI header, but that didn't work either. I don't know what I'm looking for in terms of debugging the timing on DTR.....

So I'm a little further forward at least..

Robert Wall's picture

Re: EmonTx V2 - Basic trouble shooting steps

I think the simple answer is a programmer from the Shop. Obviously it's your decision, but that will give you the convenience of not having to remove the processor from the board to program it, (and remove the danger of a bent pin) and it will allow you to use the serial output for debugging or whatever.

jdr0berts's picture

Re: EmonTx V2 - Basic trouble shooting steps

I'm now able to program the chip whilst it's on the EmonTX board - I just have to reset it manually, and as you say, I don't have the benefit of the serial output.

Had I realised at the time I ordered everything else, I'd have ordered a programmer and saved the hassle.

I can't quite bring myself to pay £13 for a programmer :|

jdr0berts's picture

Re: EmonTx V2 - Basic trouble shooting steps

Another step forward - updated the driver, and reduced the baud to 9600 and now seeing the serial output.

Onto calibration. (Happy to move the next batch of questions to a separate thread here...)

I've set const int CT3 = 0; as I'm only using 2 CT's, with only CT1 connected for the time being

With a kettle 3000W connected and an ac-ac adaptor I get the following output:

3 0 0.36

This compares to the power meter of Voltage: 236.5, Current: 11.23A, Power: 2687W

1) To calibrate, I need a cable with the live or neutral exposed - do I need to wind this around the CT - the photo's show this, but no mention is made in the text, and if so - how many times?  Do I then need to use the number of windings in any calculation anywhere?

2) In
ct1.voltageTX(xxx.x, y.y);
does xxx.x refer to the voltage, or calibration coeffiicent - on [1] the comment on the code refers to a coefficient, but in the text below, it talks about voltage - as the figure is very close to a voltage I'm seeing on a multimeter/power meter. - I've set it to 228.268 for the time being.

3) Phase shift calibration - How do I view the power factor, is this the same as emontx.power1 variable, if not, what do I need to output so I can see it?

[1] http://openenergymonitor.org/emon/modules/emontx/firmware/calibration

Robert Wall's picture

Re: EmonTx V2 - Basic trouble shooting steps

The CT is designed for a single turn primary, but you can multiply the current by using more than one turn. Therefore, your 3 kW kettle should show 11.23 A with one turn, 22.46 A with 2 turns, etc.

On that page, x's, y's & z's refer to the coefficients.

Power factor is available - it is a member of the EnergyMonitor class - as ct1.powerFactor (etc).
(The useful members are realPower, apparentPower, powerFactor, Vrms, Irms.)

There's a much more detailed explanation of both the calibration theory and the calibration procedure in Building Blocks.

jdr0berts's picture

Re: EmonTx V2 - Basic trouble shooting steps

OK, I'm not sure if I have a problem I need to look at in more detail before I get into detail calibration.

With the kettle connected, the following outputs are generated on the serial output:

emontx.power1 = 3 (presumably this is 3kw and is rounded up and would need to be multiplied by 1000 in emoncms)

emontx.power2 = 0 (expected, CT not connected)

ctl.Vrms = 0.36 (to get this to a meaningful voltage I need to multiply by 655.555 in emoncms?)

Cheers

James

Robert Wall's picture

Re: EmonTx V2 - Basic trouble shooting steps

I think you do have a problem - those are not the right numbers at all. Have you changed any of the calibration coefficients?

The 'native' values generated by the calcVI method are:
realPower - W,
apparentPower - VA
powerFactor - decimal number,
Vrms - V,
Irms - A
All are stored as double precision decimal numbers.
So given your 3 kW kettle, I'd expect the default Serial.print(...) to write 2687.00, 2687.00, 1.00, 236.50, 11.23 respectively - or numbers not wildly different from those.

For transmission in the emontx wrapper:
Vrms is multiplied by 100 (and temperature - not coming from calcVI of course - by 10).
Thus in emonTx, I'd expect 2687, 0, 0, 0, 23650, 217   [21.7 °C if you have a sensor, else 0]

emontx.power1 is in watts (not kW), so you are reading nothing in effect.
Worse, emontx.Vrms = ct1.Vrms*100; - so that too is reading nothing.
How are you powering the emonTx? You cannot be using the AC adapter. Either you are not looking at the correct numbers, or you've changed something you didn't intend to.

(I've just spotted a bad mistake in the sketch comments in this area - I've emailed Trystan:
//AC RMS voltage - convert to integer ready for RF transmission (divide by 0.1 using emoncms input process to convert back to two decimal places). It should say multiply by 0.01.)

Do you have a multimeter to check voltages on the emonTx?

And Happy Christmas to you - worry about this tomorrow!

jdr0berts's picture

Re: EmonTx V2 - Basic trouble shooting steps

Thanks Robert - Happy Christmas to you too!

I've downloaded and uploaded an untouched (with the exception of the frequency) sketch - and still show the same result.

I've tried the EmonTX powered with both a USB cable from the USB power plug in the OEM shop, and also from the programmer - same result.

I do have a multimeter.

Robert Wall's picture

Re: EmonTx V2 - Basic trouble shooting steps

OK, let's deal with the voltage first. You should measure approx. 11.5 V ac between the GND terminal or battery -ve and the metal tag on the back of the ac input socket. If you don't, there's something wrong with your ac-ac adapter.
You should also have about 1.65 V dc across the same two points. If you don't, there's something wrong with the bias network for that input (R11, R12 (both 470k), C10)
You should have approx 1 V ac across R14 (10k).

If you do have all those voltages, (you are using emonTx_CT123_Voltage.ino from the emonTx V2 directory https://github.com/openenergymonitor/emonTxFirmware/tree/master/emonTxV2, aren't you?) using the serial output in the Arduino IDE, what do you see immediately after you power up? You should see something like this:

emonTX CT123 Voltage example
OpenEnergyMonitor.org
Node: 10 Freq: 433Mhz Network: 210
16406 15175 16054 319.36
190 169 181 259.11
6 5 7 258.42
8 2 4 258.50
0 2 3 258.44

I've got all 3 CT's enabled, but the voltage calibration is set for a different adapter! And don't worry about the silly values while it settles - that's quite normal.
You are looking for a sensible (not necessarily accurate) voltage as the last number on the line.

Another (complementary) route would be to use Robin's http://openenergymonitor.org/emon/sites/default/files/minMaxAndRangeChec... Load and run that, and you should see something like:

ready ...
The Min, Max and Range ADC values for analog inputs 0 to 3:
0 508 508; 0 507 507; 0 862 862; 0 514 514
507 509 2; 507 509 2; 31 981 950; 513 515 2
507 510 3; 507 509 2; 32 981 949; 512 515 3
507 510 3; 507 509 2; 32 981 949; 513 515 2
507 509 2; 507 509 2; 32 981 949; 513 515 2

Those are CT2, CT3, Vac & CT1 respectively.

jdr0berts's picture

Re: EmonTx V2 - Basic trouble shooting steps

Voltage appears to be a problem....

12.8v AC - GND point and tab on the AC socket (Tab furthest inboard / right next to the "ecological" scren print text)
1.62v DC - GND point and tab on the AC socket (Tab furthest inboard / right next to the "ecological" scren print text)
11.5v AC - the two inline tabs on the AC socket

R14 - 0.0v
R12 - 1.61v
R13 - 0.0v
R11 - 1.61v

I've looked closely and checked the joints and all appear to be ok.

Serial Output at sketch startup:

emonTX CT123 Voltage example
OpenEnergyMonitor.org
Node: 10 Freq: 868Mhz Network: 210
-24219 -26018 -27686 296.20
8804 7894 6151 137.32
1053 52 191 47.33
116 0 0 15.84
9 0 0 4.55
1 0 0 1.82
0 0 0 1.03
0 0 0 0.78

It then settles...

Using the MinMax sketch:

ready ...
 The Min, Max and Range ADC values for analog inputs 0 to 3:
   0 512 512;     0 511 511;     0 514 514;     0 511 511
 513 514   1;   512 512   0;   513 514   1;   510 511   1
 513 514   1;   512 512   0;   513 514   1;   510 511   1
 513 514   1;   512 512   0;   513 514   1;   510 511   1
 513 514   1;   512 512   0;   513 514   1;   510 511   1

and when checking the voltage across GND and AC socket:

 513 514   1;   512 512   0;   502 514  12;   510 511   1
 513 514   1;   512 512   0;   446 502  56;   510 511   1
 513 514   1;   512 512   0;   428 447  19;   510 511   1
 513 514   1;   512 512   0;   423 429   6;   510 510   0
 513 514   1;   512 512   0;   421 423   2;   510 510   0

 

jdr0berts's picture

Re: EmonTx V2 - Basic trouble shooting steps

I've just checked all of the resistances with a multimeter, some interesting results (I've put the setting on the multimeter in brackets to protect my sanity)

1x 100k = 100k (200K)

1x 100 ohm = 100 ohm (200)

3x 18 ohm = 18 ohm (200)

However:

8x 470k = 285k (2000k)

2x 10k = 10 ohm (200)

 

jdr0berts's picture

Re: EmonTx V2 - Basic trouble shooting steps

Major progress...

I replaced the so called 10k resistors with actual 10k resistors...

I now get a meaningful voltage reading (247.38) and power figures (37 with my soldering iron).

I also noticed that the 2nd 10K resistor R1 is also connected to the reset pin.... and the programmer now works as it should without me needing to manually reset the chip immediately after compilation has finished.

Just to tidy up the soldering mess on the board and re-visit the calibration (which now I'm getting meaningful readings, makes a bit more sense!).

Cheers

James

Robert Wall's picture

Re: EmonTx V2 - Basic trouble shooting steps

The 470k resistors are effectively two in parallel (they are joined at the other end too, by the power supply!) so that's OK. (and the inputs are all nicely biased to half way, so they must be reasonably right (i.e. equal!). You meter pulls the AC input down from 512 to 420, so that's expected and OK.

But a big problem with the 10 k. There's no way that either should read 10 Ω. We're mainly concerned about the one next to the AC input, but even though we're not interested in the 10 k on the pulse input, that too should not read 10 Ω either. And reading 0 V ac across R14 when the adapter is connected corroborates this. Can you carefully check that there are no whiskers of copper or solder shorting it? Is the marked value correct, i.e. is the colour code (brown, black, orange, gold) the same as the pictures? A stupid question hopefully, but I've got to ask! 10 Ω would be brown, black, black, gold. As both are wrong and the same, this has to be the most likely cause. If it appears to be OK, much as I don't like to suggest this because of the risk of damaging the PCB, can you lift one end and check it in isolation?

Robert Wall's picture

Re: EmonTx V2 - Basic trouble shooting steps

Humpf! I was busy typing while you were typing yours - at least you came to the same conclusion and you're away and in business?

Where did you get the resistors from?

jdr0berts's picture

Re: EmonTx V2 - Basic trouble shooting steps

Thanks for your help Robert.

I'm now in business, just spent the last hour calibrating 2 CT's. I'd be interested in how close I've got the calibration and whether it can be made closer across between them.

The resistors - when I started the build, I made a mistake with the 18ohm resistors and fitted one of the others, luckily I had a stash of resistors so grabbed a couple of what I thought were 10k ones.... however, there's only 3 gone from the strip, so most likely, I picked the 10ohm up instead!

I've got the following calibration settings and corresponding output:

ct1.voltageTX(223.75, 1.7);
ct1.currentTX(1, 111.41);
ct2.voltageTX(222.99, 1.7);
ct2.currentTX(2, 111.1);

CT1 Real Power: 2486.94 Apparent Power: 2468.59 Power Factor: 1.01 Vrms: 224.95 Irms: 10.97
CT2 Real Power: 2481.18 Apparent Power: 2462.75 Power Factor: 1.01 Vrms: 224.21 Irms: 10.98

Is that reasonable, or is it worth spending a bit more time getting it closer - I'm using a 3kw kettle - would another source be any better - I've tried a 28w light, but that gives huge differences so I'm guessing there's a threshold at which the accuracy comes in.

Also, I'm using a plug-in watt meter - I'd imagine I'd get better results from my multimeter (Academy?), but not sure I'm brave enough....

Now to setup emoncms for solar..... type 2 if I understand correctly!

Thanks again

James

Robert Wall's picture

Re: EmonTx V2 - Basic trouble shooting steps

What you can/should use for calibration depends critically on the accuracy of your "standard". The ultimate standard is your energy supplier's meter, and we've had reports of people getting to within 1% of that by carefully tweaking the calibration over time. You need to compare specs for your plug-in meter and your multimeter to decide which is the best to use. Unless you have a particularly good multimeter (i.e. in the £1000 area) you're not going to be able to get within 1% on power. I've not done a comparable study on plug-in power meters, the only one I could find that mentioned accuracy in the spec claimed 1% on voltage and current and 2% on active power.

jdr0berts's picture

Re: EmonTx V2 - Basic trouble shooting steps

OK - I'll compare against utility meters over the next few days and see how they figure.  I watched the readout on the inverter and it seemed reasonably close.

One thing I have noticed is that the solar PV output never drops to zero, always stays around 9w or thereabouts - Is there anyway of setting a threshold in emoncms, or the sketch, or does it point something else?

Cheers

James

Robert Wall's picture

Re: EmonTx V2 - Basic trouble shooting steps

Is it +9 W or -9 W? If -9 W, that's about right for it's residual 'stay alive' consumption that you'll see overnight. If it's +9 W, then it seems as if you've got some pick-up somewhere. This isn't unusual, it's only 0.04% of full scale (assuming you're set up for 100 A max reading). If it is constant and it worries you, you could subtract that in the sketch.

jdr0berts's picture

Re: EmonTx V2 - Basic trouble shooting steps

Having just downloaded the CSV to check values - it's both....

I'm guess the pick-up is most likely due to the close proximity to the 2nd CT and other live cables as they've both been placed inside the consumer unit.

I'm now seeing a high consumption - washing machine, tumble drier, and a correspondingly higher residual consumption on the solar CT.

CHeers

James

Robert Wall's picture

Re: EmonTx V2 - Basic trouble shooting steps

It probably is pick-up from adjacent cables. Although small, it is measurable (see the report on the CT for the numbers). Spacing - especially from where the secondary winding is inside the body of the CT, is your friend here.

Comment viewing options

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