Extend contact closure from one site to another


#142

Might you want to access my Particle account so you can play around without me in the middle?

We’re expecting an ice storm tonight, so I’ve got to go in to town for beer! How can I PM you with Particle login info in case you want to play around on your own until I get back? In any case, don’t give up on me yet! I should be back between 3:30 and 4:00 Eastern.


#143

Miraculously, the controlRelay function is now working (WTF?). I executed a 1ON but when I check RelayState it returns ‘0’. That should tell you something, methinks.

56%20PM


#144

Back now. Any more ideas guys? The Electron at the pump remains unpingable, no events posted, fails diagnostics with “unreachable.”


#145

Hi Brian,

Sorry I’ve been tied up in meetings all day.

Discussing this on the forum is perfectly fine. No need to switch to email unless you just prefer it. I got your account credentials. I’m wondering if the cell reception is just really poor for some reason. Perhaps the flash worked because you were there and had the door of the enclosure open to flash it(just a thought). I’m honestly at a bit of a loss as to what else could be causing this behavior. It has been a very long time since I worked with Electrons. Can you check the signal strength of the module in Particle’s Console? Seems like you should be able to but not sure on that.

At this point I am leaning towards this being more of a Particle cloud connectivity issue than anything with the code or hardware. Wonder if it wouldn’t be a bad idea for you to create a post on community.particle.io and see if you can get anything constructive there as far as poor connectivity.

Ugh. Sorry to hear about the ice storm. Those are terrible, we get them here to. It’s just been cold and snowing so far(11 degrees last night). Was not fun getting up this morning and taking care of cows.

Keep us updated Brian.


#146

I had Device OS 0.8.0 rc11 on there for a while so I could see the signal strength in Device Vitals. It held steady at “fair” (door closed, I was at home). I will re-flash 0.8.0 so I can see Vitals again. I’m attaching yet another view of the diagnostic stats. Not sure how the SIM tests can report ‘healthy’ if the signal strength is so low that the server can’t even ping it.

But back to the ‘controlRelay’ function; how can a ‘1ON’ call to that function return a ‘1’ yet a Get to ‘RelayState’ fail. I don’t understand what that’s got to do with signal strength. Logic suggest to me that there is some problem with communications between the Electron and the relay board.

Any possibility that the thing is in an infinite loop?

Thoughts?


#147

Hi Brian,

The code is really very simple. Not much of anything to go wrong(I see no way an infinite loop could occur where the device got hung up). I do however see why the variable for the relay status is not changing. Updated and fixed that here:
https://go.particle.io/shared_apps/5beca17efe9dc34504001498

I added the relayState variable before the function. I was only updating relayState when the board received an event from the other board. The board is now checking relay state in the loop and updating the variable so it should now change even if the relay state is changed through the function rather than a publish from the other board.

I’m not sure why the device is not responding to pings but I’m not sure how often the Electron actually checks in with the Particle cloud. If it is not all that often(once a minute) then it’s possible pings would fail because the device does not maintain connection to the cloud(that’s simply not how cloud devices work, they connect on interval rather than maintaining a connection).


#148

Particle Functions and Variables work best when they appear first in Setup().
I’ve been told they have the best chance to properly register that way.

You shouldn’t need to set relayState each trip trough Loop() (the last change made).
That makes me think System Threading might help.

I made a few additions here, my changes are indented significantly for clarity (for Well Site, not tank):
https://go.particle.io/shared_apps/5becbbc6fe9dc3ec69001793
The first line:SYSTEM_THREAD(ENABLED) is the only thing that’s really different.

It takes several minutes for the Electron to complete it’s Flash. Don’t monkey with it for ~5 minutes after a flash.

I also added a function that I’ve used in the past to test a remote Water Well during IoT installation.
Enter the Number of Minutes that you want the Pump to run from the Particle Console-
image

If that function works, you know it’s not a problem with the relay board.

If you think Cellular Signal Strength is the issue, you can press the Mode button. It will blink green indicating the Signal Strength.


#149

Wow, you know some stuff Ryan. But here’s what I got when I tried to flash your code:

Processing the_user_app.ino
Checking library NCD2Relay…
Installing library NCD2Relay 1.0.8 to lib/NCD2Relay …
Library NCD2Relay 1.0.8 installed.
make -C …/modules/electron/user-part all
make[1]: Entering directory ‘/firmware/modules/electron/user-part’
make -C …/…/…/user
make[2]: Entering directory ‘/firmware/user’
Building cpp file: src/the_user_app.cpp
Invoking: ARM GCC CPP Compiler
mkdir -p …/build/target/user/platform-10-msrc/
arm-none-eabi-gcc -DSTM32_DEVICE -DSTM32F2XX -DPLATFORM_THREADING=1 -DPLATFORM_ID=10 -DPLATFORM_NAME=electron -DUSBD_VID_SPARK=0x2B04 -DUSBD_PID_DFU=0xD00A -DUSBD_PID_CDC=0xC00A -DSPARK_PLATFORM -g3 -gdwarf-2 -Os -mcpu=cortex-m3 -mthumb -DINCLUDE_PLATFORM=1 -DPRODUCT_ID=10 -DPRODUCT_FIRMWARE_VERSION=65535 -DUSE_STDPERIPH_DRIVER -DDFU_BUILD_ENABLE -DSYSTEM_VERSION_STRING=0.7.0 -DRELEASE_BUILD -I./inc -I…/wiring/inc -I…/system/inc -I…/services/inc -I…/communication/src -I…/hal/inc -I…/hal/shared -I/rtos/FreeRTOSv8.2.2/FreeRTOS/Source/include -I/rtos/FreeRTOSv8.2.2/FreeRTOS/Source/portable/GCC/ARM_CM3 -I…/hal/src/electron -I…/hal/src/stm32f2xx -I…/hal/src/stm32 -I…/platform/shared/inc -I…/platform/MCU/STM32F2xx/STM32_USB_Host_Driver/inc -I…/platform/MCU/STM32F2xx/STM32_StdPeriph_Driver/inc -I…/platform/MCU/STM32F2xx/STM32_USB_OTG_Driver/inc -I…/platform/MCU/STM32F2xx/STM32_USB_Device_Driver/inc -I…/platform/MCU/STM32F2xx/SPARK_Firmware_Driver/inc -I…/platform/MCU/shared/STM32/inc -I…/platform/MCU/STM32F2xx/CMSIS/Include -I…/platform/MCU/STM32F2xx/CMSIS/Device/ST/Include -I…/dynalib/inc -Isrc -I./libraries -Ilib/NCD2Relay/src -I. -MD -MP -MF …/build/target/user/platform-10-msrc/the_user_app.o.d -ffunction-sections -fdata-sections -Wall -Wno-switch -Wno-error=deprecated-declarations -fmessage-length=0 -fno-strict-aliasing -DSPARK=1 -DPARTICLE=1 -Wundef -DSTART_DFU_FLASHER_SERIAL_SPEED=14400 -DSTART_YMODEM_FLASHER_SERIAL_SPEED=28800 -DSPARK_PLATFORM_NET=UBLOXSARA -fno-builtin-malloc -fno-builtin-free -fno-builtin-realloc -DLOG_INCLUDE_SOURCE_INFO=1 -DPARTICLE_USER_MODULE -DUSER_FIRMWARE_IMAGE_SIZE=0x20000 -DUSER_FIRMWARE_IMAGE_LOCATION=0x8080000 -DMODULAR_FIRMWARE=1 -DMODULE_VERSION=5 -DMODULE_FUNCTION=5 -DMODULE_INDEX=1 -DMODULE_DEPENDENCY=4,2,207 -DMODULE_DEPENDENCY2=0,0,0 -D_WINSOCK_H -D_GNU_SOURCE -DLOG_MODULE_CATEGORY="“app”" -fno-exceptions -fno-rtti -fcheck-new -std=gnu++11 -c -o …/build/target/user/platform-10-msrc/the_user_app.o src/the_user_app.cpp
the_user_app.ino: In function ‘int pumpWaterNow(String)’:
the_user_app.ino:124:57: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
the_user_app.ino:130:17: warning: no return statement in function returning non-void [-Wreturn-type]
In file included from …/wiring/inc/spark_wiring.h:47:0,
from ./inc/application.h:40,
from src/the_user_app.cpp:1:
…/wiring/inc/spark_wiring_cloud.h: In instantiation of ‘static bool CloudClass::function(const T&, Types …) [with T = char [17]; Types = {int (*)(String)}]’:
the_user_app.ino:20:76: required from here
…/wiring/inc/spark_wiring_cloud.h:191:9: error: static assertion failed:

In Particle.function, name must be 12 characters or less

     static_assert(!is_string_literal<T>::value || sizeof(name) <= USER_FUNC_KEY_LENGTH + 1,
     ^

…/build/module.mk:267: recipe for target ‘…/build/target/user/platform-10-msrc/the_user_app.o’ failed
make[2]: Leaving directory ‘/firmware/user’
make[2]: *** […/build/target/user/platform-10-msrc/the_user_app.o] Error 1
…/…/…/build/recurse.mk:11: recipe for target ‘user’ failed
make[1]: Leaving directory ‘/firmware/modules/electron/user-part’
make[1]: *** [user] Error 2
…/build/recurse.mk:11: recipe for target ‘modules/electron/user-part’ failed
make: *** [modules/electron/user-part] Error 2


#150

You must be compiling for Firmware 0.7.0
No problem, just shorten the Name.

Change previous:
Particle.function(“PumpWaterNOW_min”, pumpWaterNow);
TO
Particle.function(“Pump_min”, pumpWaterNow);


#151

OK gents, after spending two hours clearing trees that had fallen across our roads during last night’s ice storm, I was able to make it to the well and discovered the problem with the NCD/Electron board assembly: the Electron had no power, i.e. no LEDs of any kind. The red LED on the relay board showed that it had power from the external transformer, but apparently the Electron was not getting power from that board and, therefore, it exhausted the Li-Po battery.

I brought the Electron home and connected it to my Mac via USB and proved that the Electron appears OK and the red charging LED shows that the battery is now being recharged.

I ran diagnostics against the Electron and got the same results as before (Electron unresponsive but SIM OK), proving that the results of the SIM test are not a valid indication of the status of the cellular link as there clearly was no connection at all.

Current thinking is that there is an issue with the relay board’s ability to communicate with or, at least, to power the Electron.

Note that there is no GSM service at my home so I can’t get the Electron to handshake with the cloud from here, but once the Li-Po is fully charged I’ll take it back to the well, plug it back into the relay board and see if the Electron’s new function can check the relay’s status.

If the Electron cannot communicate with the relay board, would you not conclude that that board went south for some reason? If so, how quickly can I get a replacement?


#152

Hi Brian,

How are you powering the relay board at the well site? Are you using one of our 120VAC to 12VDC power supplies?

While the Electron may have cellular connectivity issues it should still power up when installed in the relay board and power connected to the relay board with no LiPo connected. If it does not power up at all then the 5VDC regulator circuit on the board is not providing power to the Electron nor to the driver chip on board which actually turns the relay on and off.


#153

I am using the power supply that came with the relay board. The relay board powered the Electron just fine for a long time. I added the Li-Po only after I upgraded the OS to 0.8.0 for reasons we’ve all now learned. After I went back to 0.7.0 I left the Li-Po in place.


#154

Try disconnecting the LiPo so only the relay board is powering the Electron. See if the Electron has any LED indication at all it is being powered without the LiPo.


#155

Did that earlier. Nothing.


#156

I hope to head back to the well later this hour. If still no power from the relay board and no communications between the two PCBs, I will swap the Electron assigned to the well with the one at the tank in order to determine if the issue is with the Election or the relay board.


#157

Hi Brian,

If you’re not getting any power indication on the Electron when plugged into the board and LiPo is disconnected then there is something wrong with the 5VDC regulator circuit on the relay board and it will need to be repaired. You can fill out the RMA form here to return it here for repair:
https://ncd.io/contact-us/product-returns/


#158

Got called away for a while to fix a printer problem at our local watering hole. Before that, though, I plugged the Electron back into the relay board and voila! it lit up without battery attached. Very strange. Anyway, the Electron did link up with cellular service and handshake with the cloud server, but only very briefly. I think the issue at that time was all the ice on all the trees between it and the nearest cell tower. Ice is melting off now and reception should improve soon, if it hasn’t already. Stay tuned to this channel…


#159

Hey Travis. Plugged the Electron in again and once more, no power from the relay board. So the issue comes and goes. Can you arrange to ship me another board ASAP (and bill me). I’ll return the one I have via RMA and you can credit me when you receive it. I can’t wait for a new one until after you receive the old one.


#160

Hi Brian,

Best I can do is provide a cart with the board in it here:
https://store.ncd.io/kc/6maf
I can’t ship one and bill you unfortunately, our system just doesn’t allow that.


#161

Confused. You guys billed me for The last one I bought upon ship. The you received the damaged one back a couple of days later, you then credited Kevin Huck who paid for that damaged one.