Wireless IoT modules from Pycom
SiPy - Sigfox
This experiment starts by upgrading the firmware (1.6.13.b1) for Europe. Note the ID and PAC (Porting Authorization Code) shown in the final dialog (there does not seem to be a way to copy these easily).Use the REPL to get the ID and PAC from the module:
from network import Sigfox
import binascii
sigfox = Sigfox(mode=Sigfox.SIGFOX, rcz=Sigfox.RCZ1)
print(binascii.hexlify(sigfox.id()))
print(binascii.hexlify(sigfox.pac()))
Note the RCZ1 parameter. This depends on your region, so if you are doing this outside Europe, first check the online documentation for the correct parameter.Open a browser and go to https://backend.sigfox.com/activate. Click the Pycom button/logo, enter the ID & PAC and create an account (in that order). You will receive an email inviting you to set a password, do so and you’re in.
Now send some data to the Sigfox cloud backend:
import socket
s = socket.socket(socket.AF_SIGFOX, socket.SOCK_RAW)
s.send('Hello')
It takes a few seconds before the last call returns with the number of bytes sent (5).In the Sigfox backend click the ‘Device’ tab. Your device should now be visible (check the ‘Last seen’ column, it should show a time and date close to when you are doing this). Click on its ‘Id’ (the six digit number) to get access to the message we just sent (there will be a ‘Messages’ link on the left side of the screen, click it). The data is displayed as a string of hexadecimal values. To convert this to ASCII click ‘Device Type’ at the top of the screen, then click on your device (but not on a link in the ‘Group’ or ‘Name’ column) to bring up a pop-up menu. Select ‘Edit’ and then, under ‘Payload display’, choose ‘Display in ASCII’ and click the ‘Ok’ button. Navigate back to your messages and they should now be readable.
Trick: convert the device Id to decimal (e.g. 4D2AC4 -> 5057220), then insert it in this link https://backend.sigfox.com/device/[id-in-decimal]/messages and use it. It will save you many mouse clicks.
Note that Sigfox is limited to 140 12-byte messages per day, so use your quota wisely.
Read full article
Hide full article
Discussion (0 comments)