Some Examples from Quick reference not working
today I tried some examples mentioned in the Quick reference for the LoPy
at least two of them are not working:
LoRa (LoRaWAN) returns an Error in line 8
Heart beat RGB LED is not able to switch the color (the led stays blue)
Thanks indeed! Latest information is that it might be gateway related because some other people are experiencing the same issue. Now patiently awaiting the ABP capable firmware and docs :-)
@DarkHawk Thanks a lot for your detailed feedback, please keep us posted.
@Batilan today I visited a lora gateway next to my place and i was able to connect just fine. I was also able to get out of the while loop (I added some blinking codes to see which stage I reach. I was able to register, send and receive. I just have do add something to store whatever I received. But I'm in contact with the gateway owner so I think he will at least see in his logs the message I've send. and I can confirm AppKey, AppEUI and DevEUI have to be in MSB format.
@Batilan We're going to put out an amended version of the docs in the upcoming days, with these and other fixes. Please stay tuned for news about it, and thanks again for your patience.
While you are at it, can you also document the auth tuple for ABP activation?
Also would be good to mention if it should be written in MSB or LSB form.
Maybe extend the comment a little to make clear you obtain these values normally from your LoRaWAN dashboard at your operator (like TTN)
Thanks @DarkHawk, I can confirm you're totally right here, 0xFF means blue, so that line's comment is wrong.
In the LoRa example, the A ... F bytes are definitely not valid written that way. If you wanted Python to pass the example as it is, you'll have to add leading 0x to the hex values, like:
auth = (bytes([0,1,2,3,4,5,6,7,8,9 ,0x0A,0xB,0x0C,0x0D,0x0E,0x0F]), bytes([1,2,3,4,5,6,7,8]), bytes([8,7,6,5,4,3,2,1]))
We are very sorry about the typo, and we're surely taking these issues into account for our next documentation revision.
Glad you got it working :-) However for me it didn't work out yet (I have a gateway at home, so that shouldn't be the issue). Also it seems that people from Pycom and TTN are aware that things might not work and ar working on it (discussed at https://www.thethingsnetwork.org/forum/t/lopy-micro-python-lorawan-nano-gateway-board-with-wifi-ble/1156/15).
I would really like to try ABP activation as that is less prone to timing issues and downlink errors. I didn't see an example for ABP yet.
And I see it is also discussed in the Multitech Conduit topic on this forum by Daniel
@Batilan ok, seems I got it working, just have to get closer to a gateway. I read in the ttn forum a comment from you that the example did not work for you completely but that it seems you got registered. I should see this in the ttn dashboard right?
@Batilan thats where I went first after I read your first comment. I'm in the process to register a device, but still what about the DevEUI? I have to enter some id there, can I just create something randomly ? I would guess if these ID's have to be unique they should be defined somehow.
You might want to have a look at the TTN network: https://www.thethingsnetwork.org/
The wiki: https://www.thethingsnetwork.org/wiki/Home
And their forum; https://www.thethingsnetwork.org/forum/
@Batilan ah ok, I havn't touched the values set for AppKey, AppEUI and DevEUI in the example, I'm completely new in the area of LoRa networks. As far as I've understand now by reading about this, AppKey and AppEUI are more or less defined by me and have to be registered. But the DevEUI should be some unique ID for the board itself, like a Mac address. How to find out the DevEUI's of my two boards?
About the LoRaWAN example: what does your code look like? Did you change the values for AppKey, AppEUI, DevEUI to those that are valid for you? INdeed the current code is invalid in any case because the values in the byte array are not in hex (use something like bytes([0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF]) with the correct values for AppKey, AppEUI, DevEUI for your application and device.
I would also like to see an example for ABP by the way (or at least up-to-date documentation for the lora module).
ok, I got the RGB Led example working. in the example is written:
"pycom.rgbled(0xff) # make the LED light up in green color"
thats just wrong!
pycom.rgbled() expects hex color codes, and 0xFF is blue, like the default color used for the heartbeat.
more color codes can be found here: htmlcolorcodes.com