YourproductSmarter / KISSLoRa-demo

demo apps for KISSLoRa
MIT License
15 stars 26 forks source link

Broken? #5

Open GitGeorgeDB opened 7 years ago

GitGeorgeDB commented 7 years ago

When only the battery is attached: both blue LED and RGB LED (in blue) are on for a few mS, hardly visible. When connected to USB, with battery: green LED lights up, red LED lights up (but goes out after a minute or so, meaning battery is full, I'd say). The RGB flashes 20 times in about 10 seconds.

And that is it. Whatever position of the rotary encoder: the RGB LED flashes 20 times (in blue), and only when connected to USB.

Any ideas? It is really too bad that I can't use it now, was really looking forward to using LoRa...

GitGeorgeDB commented 7 years ago

Reflashed the firmware, that was all succesful, which means that a big part of the board IS working. But, the behavior is exacty the same: in all modes of the rotary encoder the RGB LED flashes 20 times in blue when the gadget is turned on. It did work on the event, it was commisioned and I have seen it working. I have switched it off, detached the battery and transported it safely. Put in the battery a few hours later... and the behaviour is as described.

GitGeorgeDB commented 7 years ago

Serial monitor, which again shows that a great deal of the gadget is working, shows:

Join not accepted: denied Check your coverage, keys and backend status.

Sending: mac join otaa Response is not OK: no_free_ch Send join command failed

I'd say that only a part of all functionalities determined by the rotor switch do something wit LoRa, but I get these errors in each an every mode.

Roos-AID commented 7 years ago

Looking at the code, there is a problem, if there is no network coverage, the ttn.join(); method call at line 259 is never ending, so the main program KISSLora-demo_app never regains control.

The ttn.join() and subsequent lines should be modified to detect that the join fails after eg. 5 attempts and then the program could continue for modes 3 to 9. According to the documentation the ttn.join method call (see https://github.com/TheThingsNetwork/arduino-device-lib/blob/master/docs/TheThingsNetwork.md#method-join) first parameter could contain a retry count, but I could not get this to work yet.

Regards,

Rob

Francien99 commented 7 years ago

From what you describe, your gadget does not seem broken at all, mine had the same behavior when I did not have network coverage. I went to a different place (really close to a LoRa gateway) and everything started working just fine.

Like Rob says, without coverage none of the programs (in "KISSLoRa-demo_app.ino") work. If you would like to use the programs without LoRa, I have found a (very ugly) solution: simply comment out lines 186 until 268 (in "KISSLoRa-demo_app.ino").

I have tested this and it works for my gadget. This will stop LoRa (and thus program 0,1 and 2) from working, but it does allow you to use program (rotary switch positions) 3 until 9. This way, you can at least test the sensors, battery and such. And play with part of the gadget at home ;-).

With regards to LoRa coverage: this is also affected by height (of your gadget), the less buildings and such between you and the gateway, the better (tie your gadget to a weather balloon and it will receive gateways with 300 km distance!). If the building you're in is higher then the ones around you, it might be worth trying to receive LoRa from your roof.

ghost commented 7 years ago

Yeah the code ends up in an infinite loop from which it cannot escape if there is no Lora network to connect too. It will wait forever not giving even a single sign of life so long as it cannot reach the Thing network. Only when it does will it continue into the main program and respond to input..

Lora's coverage is kind of exaggerated apparently so a LOT of LoraKISS badges are now without functionality.

GitGeorgeDB commented 7 years ago

Although I can't judge for the code (good that you guys found out), I came to the same conclusion that all is working fine. Not that I'm near a LoRa gateway, unfortunately (I thought of creating one or buying one, but that's all still quite expensive), but indeed my situation is exactly the same as in issue #2. I got the same output when I look at the terminal window. With the above, all is explained. Room for improvement ;-)

One thing might still be broken (?): When on USB, the green LED is on and the red LED is on for a while (charging). When turning the gadget on, the RGB LED flashes 20 times in blue. But when on battery only, the RGB LED and the blue LED are on for a few mS, like the battery is dead... Does everyone have that behaviour, as when that is normal, you have no idea that the gadget is working at all while on the battery...

Roos-AID commented 7 years ago

The behavior is as correct. If there is no USB connected, then the RGB LED flash is not activated.

If there is network connection, then you see the blue led flashing when transmitting. Regards, Rob

GitGeorgeDB commented 7 years ago

So, all fine, but room for improvements in the code and/or access to a LoRa Gateway. Too bad they're still so expensive, would have been happy to provide such a gateway.

jpmeijers commented 7 years ago

The code has been changed to give up trying to connect to a TTN gateway after 10 retries. It will therefore continue running the rest of the app, without (successfully - it will try though) sending the data over LoRa.

You can update you KISS LoRa gadget with the latest code here.

GitGeorgeDB commented 7 years ago

Great! Thanks a lot for that! I'll flash the controller this weekend.

I hope there will soon me some simple project to create a cheap LoraGateway, so I can provide access for a part of Amsterdam. The devices though still tend to be a bit expensive, everything is relative, at this moment...

Roos-AID commented 7 years ago

I tested the new code, but the retries function seems to be broken, it remains looping if there is no network. If I manually comment out the ttn.join(retries,10000) then the rest of app gets executed. Will do some more research later on.

GitGeorgeDB commented 7 years ago

I commented out that whole IF-clause, compiled it and flashed the controller. No luck. What I described in the initial post in this thread, I still have reason to believe part of my gadget is broken: I can flash the controller and the controller is able to blink the RGB LED in blue 20 times. When connected to a USB-port, I can see the messages in the terminal window. The green LED burns, and the red LED burns while loading. So far so good.

However, the moment I remove the USB cable, no LED burns anymore. I switch the gadget on and off, have set the rotary encoder to each and every setting, etc. When in the midst of flashing 20 times as described above and when I remove the USB cable, the flashing stops as well. When I switch on the gadget, the blue LED and the RGB LED in blue is on, hardly noticable, for a few mS. And that's it...

When I feed 5V to the power adapter plug, the green LED burns (although I thought that was to indicate a USB connection?) and the RED LED burns for a short while (I guess till the battery is fully loaded). I'd say now, when it can blink the RGB LED in blue 20 times while connected to USB, it should also be able to do this on the battery... It looks like a dead battery, but the battery measures 4,19V (measured with an ultra cheap multimeter).

mnigten commented 7 years ago

From what i read your LoRa is working fine. I thought i had the same issues. After testing the examples every sensor is working. Just because you have no network coverage the KISSLora-demo_app doesn't give you much yet.

Francien99 commented 7 years ago

image This is the meaning of the red and green LED (at the bottom/ left side of the gadget).

@GitGeorgeDB (and others with similar issues): if you haven't already done so, may I suggest the following:

If you did try, and it failed to do what was expected, it might help to post the results here.

Francien99 commented 7 years ago

PS: I have found this place, with great LoRa connection (gateway inside the building): http://kaasfabriek.nl/

During "open inloop" hours on Thursday night and Saturday afternoon, anyone can walk in and come use the LoRa gateway. Especially on Thursday night, you can often find smart people with LoRa experience there.

mnigten commented 7 years ago

Great. I only saw the github page of kaasfabriek and did not know about this place. Looks great. For sure i will take a look some day before they have the summerstop on 24th of july till the 1st of september :)

jpmeijers commented 7 years ago

Please make sure you are using TheThingsNetwork library v2.5.3 or newer. The infinite join loop on line ttn.join(retries,10000) was fixed upstream in the library yesterday.

GitGeorgeDB commented 7 years ago

That definitely solved the problem, now it is a matter of finding a gateway. I tried two times around De Balie in Amsterdam, I see that some sort of a connection is made (last connection is then a couple of minutes ago), so things are working fine, but I have not been able to find that page that was used at A&E where you could see the temperature, etc., etc. My bad, but I can't find it anyware in the docs, or it is related to the connection and therefore the information isn't shown. I made all changes as advised above and put both the appEui and appKey (in the sketch), that are related to my device.

However, I'm glad the other parts now work, indeed, there is nothing wrong with my device. Might just be that the range at De Balie is a bit short (I was sitting in the sun about 50 meters from the place itself, I'd say that would be close enough when it regards LoRa...).

And before I forget: thanks everybodu for the advise and changes made like the ones above!

jpmeijers commented 7 years ago

@GitGeorgeDB go to https://commissioning.thethingsnetwork.org/ and click on View your data.

Also have a look at this troubleshooting section: https://github.com/YourproductSmarter/KISSLoRa-demo/blob/master/COMMISSION_AT_HOME.md#troubleshooting

jderriks commented 6 years ago

The commissioning site has (sadly) been removed. Now you have to use the ttn console: https://console.thethingsnetwork.org/applications And look at the device data on that page.

My kiss-lora worked fine after I took it to a place near a gateway. Never updated it. Look at https://www.thethingsnetwork.org/map for gateway locations. And try from a high location near the window.