Connect ESP32 LoRaWAN device with sensors to AWS
RutuThakar opened this issue · 11 comments
Hi!
Please guide me how can I use my ESP32 LoRaWAN device to connect to AWS and make it communicate through gateway as specified in this workshop: https://iotwireless.workshop.aws/en/300_device/150_examples.html
Device : ESP32 LoRaWAN OTAA
Thanks!
Regards,
Rutu
Hi RutuThakar, thanks a lot for you question! With ESP32 devices it's typically up to you which data to send from the LoRaWAN device and how to encode them.
In such cases, I recommend you to look at these guidelines: https://github.com/aws-samples/aws-iot-core-lorawan/tree/main/transform_binary_payload#how-to-build-and-deploy-a-new-binary-decoder-for-your-lorawan-device
They will enable you to build and deploy a binary decoder for your specific implementation.
Could you share more details about your use case and which kind of telemetry you intend to send from your LoRaWAN device? Thanks!
Thanks for your reply!
I have LoRaWAN ESP32 board which has Temperature Humidity and light sensors connected to it and I want to connect that device to AWS. I already have LoRaWAN gateway connected to AWS and I want this device to send information about all sensors to gateway and get all those information in my AWS Account.
H Rutu, a question to better understand how we can help you:
have you already implemented the software on your ESP32 board which reads temperature Humidity and light sensors value and sends this data using LoRaWAN? Or is you question related to how to implement this software on a device side?
Hi Rutu,
I have deleted you previous message because it contained sensible information (i.e. AppKey of your LoRaWAN device).
The problem you describe may be caused by a mismatch between DevEUI, AppEUI and AppKey you use in your ESP32 code and a configuration you performed in AWS IoT Core for LoRaWAN when registring your device.
Could you please double check if you follow the guidelines from https://iotwireless.workshop.aws/en/300_device/300_configureiotcorlorawan/300_createdevice.html as you create your wireless device and values are matching those in your code?
Hi Rutu, kindly ask you to react to my last message, if the issue is still relevant.
Hello Asvand
I have a similar problem.
I used a RAK Gateway non Basic Station to connect to AWS.
It intermediated through Chirpstack and connected successfully to AWS SNS
THen I connected a device to the Gateway and managed to send Hello World into AWS
Then I realised that it would be difficult to get to AWS IOT Core through that system.
So I have bought a second RAK Gateway 7258, with AWS Basic Station compatible and I have connected it to AWS IOT Core for Lorawan
My problem now is that, with the same arduino code, I do not manage to connect the ESP32 with Lorawan to AWS IOT Core for Lorawan.
Can you please help me?
It has been almost 8 months in the proccess and a bit stuck
Thanks
Emilio
Hi Asvand
managed to connect device but for some reason, payload in binary base64 instead of decimal.
CAn you help me correct?
How do I store payload in s3 or other AWS database?
{
"WirelessDeviceId": "49b2d193-d6c6-41d0-b87a-9dbd27d3de34",
"PayloadData": "SGVsbG8sIHdvcmxkIQ==",
"WirelessMetadata": {
"LoRaWAN": {
"ADR": true,
"Bandwidth": 125,
"ClassB": false,
"CodeRate": "4/5",
"DataRate": "5",
"DevAddr": "0044f01f",
"DevEui": "0002030405060708",
"FCnt": 182,
"FOptLen": 0,
"FPort": 1,
"Frequency": "868300000",
"Gateways": [
{
"GatewayEui": "ac1f09fffe051e29",
"Rssi": -19,
"Snr": 10
}
],
"MIC": "60b8e7e0",
"MType": "UnconfirmedDataUp",
"Major": "LoRaWANR1",
"Modulation": "LORA",
"PolarizationInversion": false,
"SpreadingFactor": 7,
"Timestamp": "2021-09-12T11:16:05Z"
}
}
}
Hi Emilioher,
thanks for using AWS IoT Core for LoRaWAN. To your questions:
managed to connect device but for some reason, payload in binary base64 instead of decimal.
CAn you help me correct?
That's an expected behaviour. AWS IoT Core for LoRaWAN will encode the binary payload from your device in Base64, as documented here: https://docs.aws.amazon.com/iot/latest/developerguide/connect-iot-lorawan-destination-rules.html
To process binary payload, you will need to perform base64 decoding. You will find a library for base64 decoding in almost any programming language. Samples for base64 decoding is for example here: https://github.com/aws-samples/aws-iot-core-lorawan/blob/main/transform_binary_payload/src-payload-decoders/python/sample_device.py
Which programming language do you use?
How do I store payload in s3 or other AWS database?
To store the payload in S3, you could use AWS IoT rule action for S3: https://docs.aws.amazon.com/iot/latest/developerguide/s3-rule-action.html or action for Kinesis Data Firehose : https://docs.aws.amazon.com/iot/latest/developerguide/kinesis-firehose-rule-action.html
Hi Asvand.
Thanks a lot for the help.
I use Arduino ide for sketches in an esp32.
Trying to connect 8 sensors to 13 esp32 nodes, and send their readings to AWS IOT Core for Lorawan for storage, and further analitycs when data accrued. It is a smart agriculture project.
I would like, with time, use images from ESP Cam, drone and satellite imaging to combine with sensors data, and with AWS IA services improve farming tecnique.
THen do you recommend S3, Kinesis Firehouse or Dynamo DB for this purpose?
Brgds
Emilio
Hi Emilio,
sounds like a great project! It's hard to provide any useful recommendation based on a generic use case requirement. I am happy to share my thoughts on which AWS services you could use, however kindly ask to make a question more specific. I will close this ticket and ask you to create a new entry in the https://github.com/aws-samples/aws-iot-core-lorawan/discussions with your question. Thanks
Andrei