I have attempted to use my emonTx V3 running the Diverting surplus PV Power: PLL sketch. At this point I do not have anything attached to the triac output although I have an SSR that I intend to use. Nor do I have a temperature sensor.
The sketch is written for the V2 so pin assignments need to be changed.
Here is mine:
// Arduino I/O pin usage
#define VOLTSPIN 0
#define CT1PIN 1
#define CT2PIN 2
#define LEDPIN 6 // was 9
// #define SYNCPIN 6 // this output will be a 50Hz square wave locked to the 50Hz input
// #define SAMPPIN 5 // this output goes high each time an ADC conversion starts or completes
#define RFMSELPIN 10
#define RFMIRQPIN 2
#define SDOPIN 12
#define W1PIN 4 // 1-Wire pin for temperature
#define TRIACPIN 5 // triac driver pin terminal block next to reset - was 3
Initially I used the pins detailed in the Wiki but the radio link did not work. I looked at a working sketch for the V3 and found that the RFMIRQ and RFMSEL were different to the Wiki and the same as the V2 sketch. I have also commented out references to SYNCPIN and SAMPPIN within the sketch.
After uploading the sketch and using the serial monitor all looked okay with the expected readout. My Raspberry Pi emoncms and emonGLCD both looked good. Then I disconnected my laptop from the emontx and the radio stopped working! Connect it back again and it's working again.
So I guess that the programmer is holding a pin high or low and as soon as I disconnect.......
Can somebody help me out please?
Re: Diverting surplus PV Power: PLL using emonTx V3
Is JP2 shorted so the emonTx v3 is able to power from AC adapter ?
Paul
Re: Diverting surplus PV Power: PLL using emonTx V3
Hi Paul, thanks for your input.
Yes, JP2 is shorted. The Tx v3 works fine using the standard sketch powered from the AC adapter.
Re: Diverting surplus PV Power: PLL using emonTx V3
I'm looking at that for you. I'm not getting past line 448 - SDO is not going high so it sticks there forever waiting.
Re: Diverting surplus PV Power: PLL using emonTx V3
Thanks Robert, I appreciate it.
I am surprised that this has not come up before. Is there nobody out there who has tried the emonTx V3 with that sketch?
John.
Re: Diverting surplus PV Power: PLL using emonTx V3
There seems to have been little interest in MartinR's sketch - even before the V3. I don't understand why. My best guess is people don't understand it and are frightened by the low-level commands used for setting up the radio and temperature measurement etc.
Unfortunately, Ciseco don't appear to have gone into any great detail about the interconnections between the processor and the RFM12B, apart from saying D8 is needed to turn on the wireless (which appears not to help).
BTW, RFMIRQPIN appears to be unused.
Re: Diverting surplus PV Power: PLL using emonTx V3
Thanks for your insight.
The theory of the sketch from a superficial point of view to me looks very elegant, I hasten to add that my actual understanding of it is pretty poor, however, from a practical point of view I thought the implementation looked straightforward.
My lack of knowledge is betrayed by the fact that, apart from the pin reassignments, I just expected it to work on the V3
re RFMIRQPIN: Oh, right. It has been defined but not incorporated in the sketch.
Re: Diverting surplus PV Power: PLL using emonTx V3
It ought to work, and others have reported it working, on the V3. But the situation is slightly confused by the use of the RFu 328, which appears to connect the RFM12B and the ATMega 328 slightly differently to the V2. I'm going to have to read up on the SPI library and take the JeeLib library apart to see exactly what happens in there.
What's also puzzling me is the problem that I have is totally independent of whether the programmer is connected or not - and that's not what you report, so I'm wondering whether there are two separate problems. I may have a slightly different RFu328? One thing you could check: can you comment out all serial output and see what happens then when you disconnect the programmer? It just might be that unhandled serial output is blocking the radio.
Re: Diverting surplus PV Power: PLL using emonTx V3
Thanks for your help.
With all serial.print statements commented out the result remains the same.:-(
Re: Diverting surplus PV Power: PLL using emonTx V3
The RFu-328 schematic seems to confirm the pin numbers in the v3 wiki are correct
Is it possible to retry those settings whilst the serial prints are still commented out and without the programmer attached ?
maybe the serial activity or programmer presence prevented the RF alone from working
The D8 instruction is far from clear but as the schematic shows D8 at the "3rd 7-way row of pads" which are not physically connected to a RFM12B it may be safe to assume that applies only to the alternative SRF module.
Paul
Re: Diverting surplus PV Power: PLL using emonTx V3
Paul, nice one, that works for me. I'd PM'd John earlier to say I'd gone down with a cold and had a non-functioning brain, so I haven't looked at the problem.
But note, RFMIRQPIN although defined is not used in the sketch - in RFu_jeelib/RFu_RF12.cpp I believe it's called RFM_IRQ and it's set to 2 but there's a note saying that it can be hooked anywhere subject to some other changes.
John,
Does your SSR work with an input that only swings to 3.3 V? And what load does it put on the output? Why I mention that is the dc supply derived from the ac-ac adapter is strictly limited in the current it can supply, and if you need more than 9.3 mA (11.5 mA if you don't have a temperature sensor) then you need a separate 5 V supply to power the emonTx V3.
Re: Diverting surplus PV Power: PLL using emonTx V3
No worries Robert, sorry to hear your not feeling 100%.
It will be interesting to hear if it works for John also, as his symptoms were slightly different, Do you know if it was just the pin mapping or if the serial prints and/or programmer effect the RF? I don't have a v3 to try unfortunately.
I really don't know my way around the RFu_jeelib/RFu_RF12.cpp but thought this line set the (unused) IRQ pin to 3, no ?
A note for anyone else adopting this adaptation, the TRIACPIN is originally digitalpin 3 and that pin needs to be freed up for RFMIRQPIN, John has disabled SAMPPIN and reassigned TRIACPIN as digitalpin 5.
Just out of interest do you think this sketch could be stretched utilize all 4 of the v3's ct's ?
Paul
Re: Diverting surplus PV Power: PLL using emonTx V3
I'll only answer the bits my brain is up to!
"but thought this line set the (unused) IRQ pin to 3, no ?" - YES, I told you my brain wasn't working. :-( . . . [that's my runny nose]
Wouldn't you use D2 for the triac and leave D5 for the temperature, should you want it? Unless you want D2 for the pulse input (though I can't say it's a lot of use other than as a cross-check / proof that it's working properly, unless you're trying to synchronise this with the meter's energy levels).
Dan Woodie did 3 CT's @ 60 Hz: http://openenergymonitor.org/emon/node/2679 with a reduced sample rate, so it may well do it, otherwise dropping the number of samples a bit (that's where SAMPPIN & SYNCPIN come in) should do the trick.
I am a bit concerned that John is apparently seeing a quite different cause, which I can't explain other than the serial output was blocking the radio, but even that is back-to-front and it doesn't appear to be the case anyway. Mine is now sending RF with or without the programmer connected - but before the change to RFMSELPIN it didn't work at all, programmer or no programmer. We'll see what he says.
Re: Diverting surplus PV Power: PLL using emonTx V3
Yes, you're right using digitalpin 2 for TRIACPIN would be much better, as changing W1PIN from D4 to D5 would then retain the temp sensing . I guess A5 will still need to be assigned because of R24 so the sketch would need a small mod to provide a "PWRPIN"
SAMPPIN & SYNCPIN could be assigned digital pins 9 & 10, it looks like both are available for assignment and although not available at the connectors they are available at the test points marked as "Dig 9" & "Dig 10" (next to the reset button & below the ISP conn).
So a pinout could look like...
I suppose it is possible if John has a v1.1 RFu then the connected programmer may influence the RFM12B's nINT/VDI pin via the linked RST line (v1.1 only).
Paul
Re: Diverting surplus PV Power: PLL using emonTx V3
Many thanks. Living in Australia I am also out of sync with the rest of the known world!
I have amended as per your earlier post Paul. The symptoms have changed insomuch that there is now no radio even with programmer connected to emonTx and pc connected to programmer. (Although LED - pin6 - flashes periodically).
RFMSELPIN 4
RFMIRQPIN 3
Paul, your latest post the table now shows RFMIRQPIN connects to PIN 4 and no mention of RFMSELPIN.
How do I know if I have a v1.1 RFu?
John.
Re: Diverting surplus PV Power: PLL using emonTx V3
Hi John, not sure what happened to the table I did check it more than once (but clearly not very well) It was supposed to read...
Analogue pin assignments
Did you try unplugging the programmer as well? the LED flasking suggests the sketch is running and therefore probably executing the "send" code but the rfm12b is not actioning it. Possibly due to the programmers presence.
I don't think you will be able to determine the version without sliding the pcb out to see the number on the RFu-328, see in the top RH corner here and bottom left corner here. If you bought it recently it's unlikely to be a v1.1.
Paul
Re: Diverting surplus PV Power: PLL using emonTx V3
SOLVED!
Thanks for that table - it focused the mind.
Original problem was that I had RFMSELPIN as 10 - it did still not work when changed correctly to 4 but what I omitted to change was the pin assignment for W1PIN!
Paul and Robert thanks for all your help.
The table should be offered as a standard to help avoid similar cross wires in the future.
John
Re: Diverting surplus PV Power: PLL using emonTx V3
I've got a better idea - I'll add the table and modified sketch to MartinR's PLL Diverter article.I've added the table to MartinR's Diverter article.
Re: Diverting surplus PV Power: PLL using emonTx V3
Would it be worth also including a link back here or a brief explanation of "PWRPIN (temp sensor power)" since it's not mentioned anywhere in the original sketches?
Paul
Re: Diverting surplus PV Power: PLL using emonTx V3
Doh! I told you my brain wasn't working. It's a good point, that of course didn't exist on the V2. (Also, MartinR said his original - not published - design used temperature to switch diversion, so he didn't use the tank thermostat, hence the 'diverted energy' really meant that, not "energy available for diversion" which is what it means if the tank 'stat turns diversion off.)