Extend contact closure from one site to another

Ryan: yes, Travis’s code, unchanged from day one. And it has worked before.

Travis: You may have missed my earlier post about PaperTrail. Your PaperTrail code would not compile. So I’m still running your original code on both Electrons. Yes, there was a time a week or so ago that the float switch closed, the pump ran for an hour and a half and then opened. All completely hands off.

Note that now the Electron at the tank has stopped sending anything (unless the Particle Cloud is hosed up and failing to report). But it was calling for the pump to be turned on earlier but without affect.

What does data type 256 translate to?

Found out why the Electron at the tank (let’s call it #1 from now on) stopped sending anything: I re-flashed Travis’ original firmware for #2 and it ended up on #1. Over and over again. Don’t know why that happened. I used the original Particle Build links. The Device IDs remained unique and correct. But once I got the correct file back on #1 it started sending '1’s again. Still don’t understand the 256 events on #2; had never seen them before.

Hi Brian,

If for some reason the command to read the inputs does not successfully execute then the read inputs function will return 256 and then that will be published. This essentially indicates that there is a hardware problem of some sort on the board.

So is everything working now or is the relay on #2 still not turning on?

The relay is not turning on, Travis. I’m about to get a big black eye here. I just removed all power from the components at the well (battery and external power supply) and re-applied it, just in case doing so might clear some error condition, but no change in behavior.

The current on the link from the NCD relay to the pump controller was less than an amp when I tested it a few days ago, but if there had been some kind of surge that exceed the relay’s 10 amp rating and, as a result, the relay “fried”, shouldn’t I still see the R1 LED come on? Note that the 256 error did not occur until well after I first noticed that the R1 LED was not lit and relay had not closed (at that time, that Electron was sending zeros). I can’t recall what specific action caused the 256’s start to appear, but likely it was after I re-flashed your app firmware OTA.

Hi Brian,

For testing purposes I added some additional diagnostics to the Well Pump board code. Flash board #2 with this code:
https://go.particle.io/shared_apps/5bec4747fe9dc33f77000971

Now if you open Particle’s console you will see a variable for that board that is the relay state. It will also publish an event every time it receives an event from board #1. This will tell us if it is seeing the other board’s events and whether or not it is turning on/off relay 1.

Brian,
What is the exact control scheme as installed?
It was assumed that your previous hardware switched a motor starter or Contactor for the well.
The NCD relay should do the same.
What voltage is the NCD relay making/breaking , and what device is the NCD relay output going to exactly?

There shouldn’t be any reason for the amperage required by the Well Starter’s Coil to change.

Are you positive that you are changing the Target Device in Particle’s WebIDE each time you flash either Electron ? That’s a common mistake that we all make.

The good news is, you are getting several years worth of experience and troubleshooting from your very first Particle Project. You’ll be an expert in no time :smile:

1 Like

Will do! Stay tuned.

How true (about the experience):joy:. I really have to thank you all again for being so patient and helpful. I really want to learn how to write code and invent something of my own some day.

To your questions: yes, I’ve been very diligent about changing the target device. I’ll try to explain how I finally got the code for #2 onto #2 rather than #1 once I capture a couple of screenshots to share.

You are 100% correct about the earlier hardware configuration, and all I did was take the two wires that used to connect to the radio system (which was nothing more than a relay, i.e. a device to provide contact closure) and connected them instead to NCD relay #1’s COM and NO terminals. And there was one occasion when the whole thing worked perfectly. In the Console I saw Electron #1 at the tank start sending 1’s and, an hour and a half (or so) later start sending 0’s again. During the 1’s period, the red R1 LED on NCD board #2 was on and the tank filled with water.

To your voltage question: I had the well contractor come out a week or so ago to verify that I understood which wires were feeding the pump controller. He put one of those testers that clips around a wire onto one of the leads and read 122 volts. When I later used my own multimeter to measure voltage across the two wires, it read 246 volts. I am not an electrician so I don’t know what to make of that, but the bottom line was that the amperage was less than 1, so I felt quite safe in connecting the wires to the relay.

Here ya go Travis. Does this tell you anything? The log is populating at about one entry every 2 seconds.

Sorry Brian,

I had a typo in the code where I was publishing the data. Try this in the pump board:
https://go.particle.io/shared_apps/5bec513bfe9dc3e248000a80

Also there should be a variable now so try refreshing variables to see what the relay status is.

I also added a manual control function. It will show up under functions on the right side of the Particle Console where Variables is. The function is called controlRelay. To use it to turn the relay on just click control relay and in the text field enter 1ON to turn on relay one and 1OFF to turn off relay one.

I believe the relay board is functioning normally but the board at the tank is not since it’s still publishing 256 because it can’t read it’s inputs.

First attempt to flash “Unsuccessful.” Trying again…

Second attempt successful. Screenshot:


And another:

Note the “No functions found”

Since “getting” RelayState, no more entries in the event log. Not responding to pings.

Ok Brian,

Try this one on the pump board. That function should work. If it doesn’t show up try refreshing the page. That is all copied from known working code.
https://go.particle.io/shared_apps/5bec56a0fe9dc3ec69000b22

Particle says that the flash was successful (don’t know how it could be if the Electron is “unresponsive” and won’t respond to pings. But regardless, there is still no function appearing and no events being logged. Still no ping response and same results when running diagnostics.

I just re-read the last sentence in your earlier message: “I believe the relay board is functioning normally but the board at the tank is not since it’s still publishing 256 because it can’t read its inputs.” The 256’s were being generated by the board at the pump. The board at the tank is still publishing 0’s now (I had turned the pump on manually using my bypass switch earlier this AM and the tank is now full).

For whatever it may be worth:


Note that the photo seems to imply that the control wires are connected to relay terminals 3 and 4. That’s just a consequence of parallax error. They are properly connected to terminals 2 (COM) and 3 (NO).

I think you’re right. I don’t think the code is flashing to the board at the pump for some reason. You might need to go to the site where it is and flash it and watch the LED on the module. It should flash magenta when new code is being flashed.

I’m on my way. If it won’t flash over the air, you’ll have to tell me how to do it via USB. I suspect that it’s the same as flashing a different OS version which I’ve learned how to do, but I’ll need a binary file, right?

Very strange: the events just started to populate again, but still no function. About to jump in the car.

It worked! Saw magenta and now see the function. I’ll try turning on the relay. Stay tuned.

"Bummer! Failed to call controlRelay:

But at least I don’t see any more 256’s…

Been meaning to ask: this ongoing dialog here on the forum is about two miles long so far. Would it be more appropriate, perhaps, to use email? Or is this the best channel to allow all interested parties to engage or learn? If we should stay on the forum, should I start a new topic specifically focused on trouble-shooting this problem?

Interesting: it seems as if every time I query a variable or execute the function, the Electron stops responding to pings and shows as unresponsive when running diagnostics. But eventually it reappears. Might those activities cause the firmware to consume a massive amount of processor time such that it cannot also perform its other duties in a timely fashion?

Update: the Electron just started population zeros again, at 3-second intervals, yet it still fails to respond to pings and can’t fetch the variable. So very frustrating!