-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cellular telemetry using SIMCom modules #4388
Conversation
@potater1 You'll need to exclude this from F3 processors due to limited RAM. |
So does it go like this: btw What does "Travis CI build failed" mean? |
@potater1 Travis CI does unit tests and then builds all targets. It does this for every pull request to make sure the pull request doesn't introduce gross bugs. You can see the results of one of these tests by scrolling to the bottom of this page:
So the SPRACINGF3NEO target failed to build. The reason was As far as excluding the code for F3 processors, yes, you could do it as you stated, or extend what is already existing in
Then, update your changes to only include if
|
This makes me want to refactor the code for the |
@potater1 |
src/main/telemetry/sim.c
Outdated
void detectFailsafe() | ||
{ | ||
if (!failsafeMessageSent && FLIGHT_MODE(FAILSAFE_MODE) && ARMING_FLAG(ARMED)) { | ||
failsafeMessageSent = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe:
if (!failsafeMessageSent && FLIGHT_MODE(FAILSAFE_MODE) && ARMING_FLAG(WAS_EVER_ARMED)) {
Multicopter can disarm after landing.
There are also known cases of disarming plane in flight.
So failsafe without arming is passible and should be perceived as an un-normal situation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok this is changed now.
src/main/telemetry/sim.c
Outdated
requestSendSMS(); | ||
} | ||
if (!ARMING_FLAG(ARMED)) | ||
failsafeMessageSent = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And:
if (!FLIGHT_MODE(FAILSAFE_MODE))
If I understand correctly, when is failsafe sms is send only one.
Maybe when failsafe is enabled send SMS periodicaly using sim_transmission_interval.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah makes sense. I was thinking you might not necessarily want that, and could switch it on manually. But then in most cases it's probably good.
@teckel12 I put the conditional #define USE_TELEMETRY_SIM right after the other USE_TELEMETRY_ ones, under the FLASH_SIZE > 128 condition. |
I renamed the program to SIM, as apparently GSM is just the name of the 2G standard, and doesn't apply to newer networks. It could be called "SIM" or "SIMCom" in the configurator... well who knows maybe it works with other than SIMCom modems too, but we can probably assume people will use a SIMCom one as they seem to be widely available? |
src/main/telemetry/sim.c
Outdated
int len; | ||
int32_t E7 = 10000000; | ||
// \x1a sends msg, \x1b cancels | ||
len = tfp_sprintf((char*)atCommand, "%s%d.%02dV %d.%dA ALT:%ld SPD:%ld/%d.%d DIS:%d/%d SAT:%d SIG:%d %s google.com/maps/place/%ld.%07ld,%ld.%07ld,500m\x1a", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I using this google link the point is not appears. Problem is in ",500m" when I remove this it work well.
But I have better idea:
maps.google.com/?q=@%ld.%07ld,%ld.%07ld
This link is better because it work in internet browser google maps and in application google maps even when there is not internet connection (offline).
@hali9 would it be easier to put the actual sprintf text in the top of the file as either a const or a #define? I do that all the time as it's easier to look at the top then have to search through a potentially large file to find it. Also makes it easier to change if the API changes. Also, it looks like you're missing an API key which depending on how many calls you may find that you're hitting their(google) request limit. EG: OR const char GoogleMapAPIURL[] = "%s%d.%02dV %d.%dA ALT:%ld SPD:%ld/%d.%d DIS:%d/%d SAT:%d SIG:%d %s google.com/maps/place/%ld.%07ld,%ld.%07ld,500m\x1a"; len = tfp_sprintf((char*)atCommand, GoogleMapAPIURL, ............ |
Maybe you could send the map link using OLC? Google Maps does support them and we already have the code for encoding latitude and longitude in common/olc.h |
@wx4cb #define GoogleMapAPIURL or const char GoogleMapAPIURL[] - for me is no problem.
I do not think so. Because the page itself is shown with the indicated area and only the pin is missing. @fiam Thank you for the suggestion, but it seems to me that calculating this is too complicated and rather difficult to understand if you do not use the application. Does this format work also offline? I think that the format @potater1 I tested it today and now it work but when failsafe is gone I still get an SMS.
but when before failsafe sending sms was enabled, this disable it too. |
So I guess the logic would be:
OT question, I'm having trouble with the CLI, when trying to set a list of parameters in the configurator. It fails semi-randomly to recognize a parameter. Happens with the recent development branch commit that sim-dev was branched from. Configurator 2.1.1. |
@potater1 See potater1#1 |
@hali9 Hmm.. in your commit, it looks like it's sending constantly if sending is configured and the "T" message doesn't turn it off. And I'd like to be able to turn off sending in failsafe mode also. Here's an update I made to my version with one state variable and a bit of logic to handle switching on/off in failsafe and out of failsafe. The states are: don't send, send in failsafe mode, and send always. What do you think? |
I have also problem in 2.1.3 but it occurs less. Should this be reported as an issue? Yes. How to setup aac settings to detect crash as >4g and land as 2-4g? You write something like this:
I think this is wrong, because if modem does not sent all body of sms this not read all and get the rest of body in next iteration. |
Yes, I'll get to these in the next commit.
The CLI parameters are cm/s/s.
Yeah, I was trying to avoid adding yet another state variable with this cheap trick. The idea was that the rest of the line would just show up later as an extra line of nonsense which is ignored, unless it happens to begin with a recognized modem response. But I guess instead of readingSMS we can have a readState variable with values "read_line", "read_sms", and "skip_line". It can be done right without an additional variable. I'll get back to this tomorrow, have to go to sleep early! |
And |
@hali9
Yes. I put 900 as the upper limit for now. |
For information, I've tested and its not working without pin ! |
hello guys, I'm using inav 2.2 rc2 with an omniNTX F7 fc and the SIM800L module, I have configured the ports output a UART with GSM telemetry and also the CLI environment variables, however after a few minutes the FC is blocked and I have to restart it It does not send data by GSM. |
I forgot to tell you that I tried the SIM800L module with Arduino and it works perfectly. |
How do You power the SIM module. This module needs a 2A peak power. I am connecting RX, TX, GND to FC and GND, VCC to linear BEC 0,5A and between the 470uF electrolytic capacitor. |
I have connected the module to an external power supply to the FC, specifically, a LIPO of 3.7v and 3A. The connections I have made with the FC are: Module SIM800L with FC (UART4) Module SIM800L with LIPO Battery 3.7v |
@JoseAntonioMG Did you connect the SIM800L ground to the FC ground? |
@fiam No |
@hali9 and @fiam The FC is no longer blocked, I have connected GND from the FC to the GND of the SIM module. However I do not receive messages, I have configured the variables in CLI: sim_ground_station_number = 653226677 The phone number does not have an international prefix, I think it is not necessary to put it. |
If I set the SIM pin to 0000, it does not register in the operator's network (the led of the SIM800L flashes 1 / s) |
When is the SIM800L module initialized with pin 0000? When connecting the FC? or when arming? |
Module is initialze after 10 second delay but send at command need additional about 10s. |
@hali9 But do we have to wait until the module LED flashes once every 3 seconds? |
@JoseAntonioMG No, not wait for register in network. |
Yes you have to have SIM800 ground connected to FC ground, otherwise you will get errors in serial communication. I tried to disable the PIN, it works for me. I just realized that if you use the wrong PIN it will lock the SIM card because it keeps spamming the PIN code to the module constantly. @JoseAntonioMG Do you have an antenna connected? If you have less than great signal quality, it may be that you are able to get on the network but no to send messages without an antenna. Just a piece of wire can make a difference. |
@potater1 Yes, I have an antenna connected and it works fine. I tested the module with Arduino and AT commands and I was able to send SMS without problems and with the PIN deactivated. I've also tried it with pin 0000 and, of course, I have to put the command "AT + CPIN = 0000" to connect to the network and it works. However, it does not work when I connect it to the FC. I am using the UART6 of the FC, (RX FC-> TX SIM and TX FC-> RX SIM). In the configuration of INAV ports I have selected GSM-SMS in telemetry of the UART6 and I have configured the CLI variables as I mentioned in previous posts. One thing I want to emphasize, is that the quadcopter is not armed since I am testing it indoors and the GPS does not take satellites. I do not know if this is a problem. |
@JoseAntonioMG , try sending a SMS to the module, or calling the number when the LED is flashing slowly. Also try leaving |
I have done the test, using a new SIM with another operator and without establishing a PIN. But it does not work, I made a call to the number of the SIM card and I have also sent several SMS with the text "xxx", I put the variable sim_ground_station_number empty en CLI: set sim_ground_station_number = and the variable remains empty after making the call and sending the SMS. |
@JoseAntonioMG That's odd if you're getting the slow flashing LED, but it's not sending messages. A power problem could explain it, but it's ruled out since you're using a battery. Do you have the SIM module ground connected to FC ground directly? Hmm, one possibility is that the FC is not receiving comms from the module, so check SIM TX -> FC RX wire. Also try setting: |
@potater1 Yes, I have connected the ground wire from the FC to the SIM module, as I mentioned a few days ago. Tomorrow I'll try what you tell me, and I'll tell you ... |
Hi @potater1, I've done the test and it does not work. I can ARM the FC, but the SIM module does not send the SMS to the smartphone with the number that is configured in sim_ground_station_number. Is it possible that the UART is not communicating with the SIM module? How can I know if there is communication between UART and SIM? |
I love Long Range quadcopters and that's why, in a short time, I lost 2 quadcopters for not having a localization system for the LTE 2g / 3g network. I have considered the possibility of buying a module independent of the FC, which includes GPS and sends SMS automatically without the need to connect to the FC, but they cost very expensive and they increase a lot of weight. That is why I want to implement this possibility that you are developing in INAV, I think it's great |
@JoseAntonioMG It's possible that the SIM800 registers on the network and sends messages when the connection from SIM800 TX to FC RX is cut. Here's a version that prints the communications with the module to debug: Compile and flash that one and add |
@potater1 it tells me that the page is not found |
@potater1 "404 This is not the web page you are looking for" |
@potater1 I have managed to access, copying the url and pasting into the browser. How is the source code compiled? |
@potater1 On windows I have Cygwin. I can use it to compile INAV |
I'm on Windows also and I use WSL which was easy to set up. |
@potater1 works!!!! I have changed the SIM800L module for the other one that was connected to arduino and it works. It seems that one of the SIM800L modules did not work well |
@potater1 Can you modify the code to support SIM800C? SIM800C is easier to weld |
@SZ-MXK Did you try the SIM800C already and it failed to work? The AT command manual I looked at also applies to the SIM800C so I think the code should work as is(?) |
Telemetry via text messages using SIMCom cellular modules (only SIM800L tested so far).
#3948
Features: