I have a fully built emonTX v2.2 that doesn't use an RF but simply outputs its CT readings to the serial port that are logged to emoncms.
My real purpose behind starting off with the emontx was to get the pv diversion working.
Having invested in the emontx v2.2 I want to be able to use this for pv diversion but also don't want to loose the emoncms logging.
My emontx is already fully built for 3 x CTs, 1 x temp and 1 x Pulse.
Firstly do I need to modify the hardware to get the MK2 trigger working out of the Pulse socket?
Secondly what's the best starting point software to use in my case, today I am logging Grid CT and Solar CT and Temperature.
I guess I'd want to keep those logged, but also log the Diverted power via the 3rd CT.
Is this all possible, or am I trying to do too much.
Re: Starting today to build a Robin Mk2 with an emontx 2.2 - what software version does reporting and divertion
Have you looked at "Choosing an energy diverter?" You should find most of the answers in there.
It's possible that you will be trying to do too much, the only way will be to start with Robin's Mk2i rev6a and then add the third CT and temperature, and see if the workload check complains each time.
Re: Starting today to build a Robin Mk2 with an emontx 2.2 - what software version does reporting and divertion
Two questions :
Do I need to remove the 10K resistor R8 sitting on the pulse reading socket, or can that be left there?
The rev6a seems to have everything I need except for Phasecal, do I need that? Or shall I not worry about the absence of Phasecal on the rev6a.
Re: Starting today to build a Robin Mk2 with an emontx 2.2 - what software version does reporting and divertion
The Mk2 code that I posted recently for the emonTx V3.2 should do virtually everything that's needed. To get this to run on the V2, only the IO port allocations would need to be changed.
That code doesn't support pulse counting but it should be possible to either:
- use the polling mechanism that was in many of my early Mk2 sketches;
- transfer the interrupt-based mechanism from the sketch you're using already.
With its revised structure, the main processor is only lightly loaded, probably around 55%. Meanwhile the ADC is running flat out. All of the Mk2's measurement and control activities takes place within the ISR, so there should be no likelihood of overloading the processor by adding extra tasks within the loop().
When measuring real power, phase-shift has very little effect. I posted a video a while back which showed that a good degree of balance was maintained even with phaseCal set to 5.
Re: Starting today to build a Robin Mk2 with an emontx 2.2 - what software version does reporting and divertion
I don't actually need the pulse counting, just trying to reuse a full populated emontx board to work as monitor and pv router.
Hence I am trying to reuse the Pulse 3.5mm socket that is already mounted on the board as my Trigger output. But this has the 10K R8 across it, which I presume I need to remove so that I can use it as a 3.3v trigger.
rev6a seems to use outputForTrigger = 9 so I guess I will need to use outputForTrigger = 5 if I want to use the Pulse port as the Trigger output. Question is, I can use the interrupt output as the Digital output?
P.S. : emonTxV3_as_Mk2Router_serial_direct seems like a good starting point for me, because I don't need/want the RF and I need to see the data on the serial port directly. Only issue is the fellow who kindly posted this hadn't tested it. Plus I have to adapt it for V2.2
First things first, I think there is no option but to get my immersion wired properly directly to the MCU, currently some bright electrician had the boiler, pump, valves, softner, timer etc all hanging off the same 2.5mm T&E! That's OK, when I'm meant to be using either immersion or boiler, but not when I'm diverting PV.
Re: Starting today to build a Robin Mk2 with an emontx 2.2 - what software version does reporting and divertion
Just had a go at altering the pin declaration from the 3.2 code base to suit the 2.2. Would this be correct?
Tried to keep the variable declarations the same otherwise I will land up having to make a lot of code modifications.
Also wanted to keep this consistent with the Solar monitoring example where Solar CT is in 1, Grid CT is in 2. So am using CT3 for diverted power. There is no CT4 on the emon 2.2 (it's called currentSensor_CT2 in the code!)
/* --------------------------
* allocation of digital pins for use with a emonTx 2.2)
*
*/
const byte triggerControl = 3; // Using the Pulse plug on the V2.2 as the trigger. Remove R8 (10K) and maybe remove the SJ1 too so that you don't supply any power to the Pulse plug.
const byte tempSensorPin = 4; // <-- data input from the DS18B20 sensor
const byte LEDpin = 9; // <-- used as an output for the on-board LED
/* ---------------------------
* allocation of analogue pins for use with a emonTx 2.2)
*/
const byte voltageSensor = 16; // A2 is for the voltage sensor
const byte currentSensor_CT1 = 17; // A3 is CT1 on the emonTx V2 (PV Gen)
const byte currentSensor_CT2 = 18; // set to A4 as not used on the emonTx V2
const byte currentSensor_grid = 14; // A0 is CT2 on the emonTx V2 (Grid)
const byte currentSensor_diverted = 15; // A1 is CT3 on the emonTx V2 (PV diverter)
const byte powerForDallasSensor = 19; // set to A5 as not used on the emonTx V2
Re: Starting today to build a Robin Mk2 with an emontx 2.2 - what software version does reporting and divertion
Looking at
// powerCal is the RECIPR0CAL of the power conversion rate. A good value
// to start with is therefore 1/20 = 0.05 (Watts per ADC-step squared)
//
const float powerCal_grid = 0.045; // for grid power at CT4 (burden = 120R)
const float powerCal_diverted = 0.25; // for diverted power at CT3 (burden = 22R)
const float powerCal_CT2 = 0.25; // for real power at CT2 (burden = 22R)
const float powerCal_CT1 = 0.25; // for real power at CT1 (burden = 22R)
How is this calculated if the burden resistor is 18R (emontx default) or 24R (my build)
What should the powerCal for 24R and the shop sold CTs sensors.
Re: Starting today to build a Robin Mk2 with an emontx 2.2 - what software version does reporting and divertion
To work out powerCal, you'll need to go through the whole of the comments in the rev 6a sketch, and work out the ADC steps per volt and the ADC steps per amp, then multiply them for the value of powerCal.
So the starting value (component tolerances neglected) for voltage is:
240 V input gives 11.6 V output (Ideal adapter) divided down by (10 / (10 + 100) = 1.054 V at the ADC.
1024 ADC steps is nominally 3.3 V at the ADC.
Therefore voltage is 1.363 steps/V.
For Current:
100 A gives 50 mA, which gives 1.2 V across 24 Ω
Therefore current is 3.72 steps/A.
So I make your powerCal to be 0.197 W/step2 for the input with the 24 Ω burden.
Re: Starting today to build a Robin Mk2 with an emontx 2.2 - what software version does reporting and divertion
Thanks a lot for this. I would have never worked that out.
Are my pin numbers right for the emontx 2.2
I started getting a pin confused when emonlib refers to the ct inputs as 3, 0, 1 and voltage input as 2, when all these have diffirent Arduino pin numbers. (not helped by the fact that they don't match with the physical pin numbers of the chip!
Re: Starting today to build a Robin Mk2 with an emontx 2.2 - what software version does reporting and divertion
If you look in the Wiki, there's an annotated photo of the V2 with pretty much everything you would want to know in the way of I/O designations.
Re: Starting today to build a Robin Mk2 with an emontx 2.2 - what software version does reporting and divertion
Thanks for that. Port Map is what I should have been looking for. But that looks OK. Just note sure I should be assigning the unused stuff to the pins that have the special functions like SDA and SCL but we'll soon find out.
Re: Starting today to build a Robin Mk2 with an emontx 2.2 - what software version does reporting and divertion
So after I learnt that the analogue Arduino numbers depend on how you read them.My analogue pin assignments above were all wrong! (but I'm sure you guys knew that and were allowing me to learn - so thank you).
I know my emontx 2.2 using the oem sketch is reading voltage and current correctly after calibration.
My Mk2 router on a emontx 2.2 using Robin's emontx 3.2 sketch modified is reading the Vrms about 47Volts higher.
So what do I start calibrating?
Update : So I adjusted the voltageCal = 0.725 and Vrms now matches what my energy meter is saying.Also adjusted the powerCal values to match the power readings. So it's looking better. Need to work out how to get the power to display decimals.
Re: Starting today to build a Robin Mk2 with an emontx 2.2 - what software version does reporting and divertion
Why is it better to drive the load with an Active Low, rather than an Active High? Is it a timing issue i.e. its faster to get from High to Low, than from Low to High?
Re: Starting today to build a Robin Mk2 with an emontx 2.2 - what software version does reporting and divertion
It's a matter of the available voltage swing and component tolerances, and being able to meet the worst-case conditions.
If you stop to think about it, timing doesn't matter, because all you're doing is pre-arming the trigger IC. As long as it's armed (or disarmed) somewhere in the half cycle after the voltage has risen sufficiently but before the zero crossing, it will take care of triggering the triac, which will happen after the zero crossing and as soon as there's enough gate current.
Re: Starting today to build a Robin Mk2 with an emontx 2.2 - what software version does reporting and divertion
When I first came up with the Mk2 design, there were a lot of details to sort out. Robert checked the drive capability of the Atmega processor and informed me that the best way to control the MOC3041 trigger device was to use an active-low signal via a 180 Ohm series resistor. As so it has always been.
The 180R value is for use with a 5V Arduino. With a 3.3V emonTx, the series resistor needs to be less than this. I have always used 120 Ohms, but this is not guaranteed to work according to the datasheets. If anyone has found that this value has failed to give reliable performance with a 3.3V system, but a lower valued resistor has worked correctly, I would be most interested to hear about this.
Re: Starting today to build a Robin Mk2 with an emontx 2.2 - what software version does reporting and divertion
The MOC3041 only needs 15mA to latch. So your 120R @ 3.3V is supplying it with plenty of current I would have thought. Why did you think it wouldn't work?