Steven Grobler in Discussions
上次活动时间: 2024-5-10

I have a LORA node up-linking data to a Thingspeak channel via The Things Network (TTN). Sometimes it stops sending data and I reboot it by logging into my console on TTN and sending a re-boot down-link message to the node. Is there any way I can transmit a downlink message to the node direct from Thinkspeak? how to reboot a LORA node if it stops sending data? Is there an API call to trigger the downlink? If so, you can trigger from ThingSpeak via MATLAB analysis code using webwrite aor webread. Thanks Christopher, thanks for that - there is indeed an API for TTN. I shall investigate that further and I'll post back here with what I find... regards, Steve The TTN API documentation gives the following example of a downlink to the end device dev1 of the application app1 using the webhook wh1. curl --location \ --header 'Authorization: Bearer NNSXS.XXXXXXXXX' \ --header 'Content-Type: application/json' \ --header 'User-Agent: my-integration/my-integration-version' \ --request POST \ --data '{"downlinks":[{ "frm_payload":"vu8=", "f_port":15, "priority":"NORMAL" }] }' \ 'https://thethings.example.com/api/v3/as/applications/app1/webhooks/wh1/devices/dev1/down/push' I've tried to enter that information into my ThingHTTP, using my own parameters for dev1, app1, wh1 etc, including the Authorisation header with the bearer key from TTN and the Content-Type header. I do not know what to insert for the User-Agent header, so left that out. I tried sending the command from a CMD window in Windows 11, using curl as below, but I get a "-1" response, indicating a failure, and TTN does not receive the downlink either... Maybe the User-Agent header is essential . Any suggestions? curl "https://api.thingspeak.com/apps/thinghttp/send_request?api_key=my-api-key" User agent is not needed (thoug it can he helpful for statistics on our side). The -1 for ThingHTTP usually means authorization problem. You could check though by making the ThingHTTP just do something simple like update a channel. For flexibility, I would recomend you use a MATLAB analysis. Its a little harder to trigger from a device, but you can have a React set up from a channel, and when the device updates the channel, then the react will trigger the code. You get a lot more flexibility in what you can send from MATLAB code instead of the ThingHTTP UI. And its easier to develop and test code: if you have MATLAB desktop or usinging MATLAB onlineor the MATLAB AI chat playground (the last two have a free tier if needed). You can use webread or webwrite in your code to call other API's. weboptions can help wih the authorization and setting other headers. The playground can help you write the code also. thingspeak ttn reboot downlink
Multiplexer in MATLAB Answers
上次活动时间: 2020-12-19

Hello, First question, is "Deploy to Hardware" option when implementing model on Raspberry Pi B+ V1.2 with Simulink support for Raspberry Pi Hardware, meant to deploy the program in a way that it should run even when RPI is restarted? Because I'm experiencing issue when my application designed in Simulink stops working (can't tell if fully or partially) when i restart my RPI (power loss etc.) The application reads sensors over 1-wire, does some basic math and then sends data to ThingSpeak over wifi. All IP configuration is correct, I can bring up terminal on Matlab, I can deploy program, it works as intended. Now problematic part, say for any reason i turn off RPI power and turn it on again. RPI will boot up, it has valid internet connection, i can bring up terminal from Matlab yet previously deployed application will refuse to work (judging by the fact that 0 data is sent over to ThingSpeak). Is that behaviour intended (model not starting on RPI after reboot)? If yes, how do i make it run automatically? If no, what are the steps to troubleshoot this issue?

关于 ThingSpeak

The community for students, researchers, and engineers looking to use MATLAB, Simulink, and ThingSpeak for Internet of Things applications. You can find the latest ThingSpeak news, tutorials to jump-start your next IoT project, and a forum to engage in a discussion on your latest cloud-based project. You can see answers to problems other users have solved and share how you solved a problem.