[SOLVED] Help Needed with Ubidots Get example code - Ethernet

Thank you guys for the awesome support.

I’m loving how easy it is to remotely control I/O pins on the Arduino/Particle devices using your service.

Your platform has a lot going for it after playing around with it in more depth over the last 2 weeks.

Looking forward to getting to use it more now that the library is all taken care of.

1 Like

@SolarDude great my friend! :smile:

@Metavix @aguspg

Hey guys I have been testing the new code we have been working on and it will only run for around 20-30 mins before stopping. I’m not sure why but it does not work for very long.

I added the GET function to your older code also which is stable and it also stops working after a short period of time also, like 20 - 30 mins.

When I remove the single GET function from both the old and new versions of code they run just fine without errors. Meaning the Arduino stays connected and sending data forever as long as the net connection is available.

The memory for the latest code with the GET call is only 44% , the older code is around 55% memory usage.

Can you run some test on your end and see if your seeing the same problem?

Just combine the send all function and then do a GET variable request and see how long it runs before it stops sending data over to Ubidots?

@solardude i will check it my frind give me some minutes

@SolarDude I’m back my friend, you can try now? with the newest version? I fixed a little thing and added a function to see free ram space, call it betwen get fucntion like this:

client.getValue(id);
Serial.println(client.freeRAM());

And show me the serial response please :smiley:

@metavix

I updated the .cpp + .h files with your latest code with the freeRam() function.

But not matter what I do when I add that freeRam() line of code it will not compile because it says its not a function of the class Ubidots. See below:

I even tried to just add the freeRam() function to the basic GETexample that comes with the library but the same error happens.

I’m positive I have updated the library .cpp + .h files with your latest code.

Any ideas as to why I’m seeing the compile errors?

@Metavix

I also just deleted a bunch of variables so I’m only sending 5 now and deleted some code to reduce memory usages to see if that keeps things running smoother for longer. I’ll report back.

yes i know, is my error is client.freeRam() sorry :smiley:

Ahh I should have known it was a class feature I was missing :blush:

I figured out how to run the RAM code anyways and it was always saying 1015 free RAM and it never went down from that point. So I do not think its a low RAM issue based on what I was seeing but it’s hard to tell whats really causing it. It happens at different intervals every time so its hard to tie down what’s causing the lockups.

So what I ended up doing was enabling the 8 second watchdog timer on the Arduino so when the sketch does lock up it is reset within 8 seconds which is keeping it always online now and that is the goal.

I ended up using a Teensy 2.0 as a 2nd micro controller to handle the relay / switch state so it only changes the switch state every 5 mins. Having the switch only change states every 5 mins keeps the switch from getting flipped off if the watchdog timer does go off and rests the Arduino which does pull all its pins LOW on a reset which would trigger the relay to turn OFF if it was ON before the Reset.

So having a 2nd microcontroller hold the switch in a state and only change every 5 mins will almost eliminate the switch from going low if a watchdog rest happens since it only take the sketch a few seconds to connect to the internet + send data + read the Ubidots switch state after the reset.

That allows me to deploy the system in a reliable hands off solution right now.

My future work will be on the Particle Photon & Electron and think those libraries are pretty solid which should make life a bit easier :smile:

Thanks for all your help @aguspg @Metavix

1 Like

@SolarDude Nice I like it, by the way you can post here the watchdog code, because it will be useful for all

Thank you and have a nice day