ESP32 and LilyGo TTGO T Call

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
kinno
Posts: 32
Joined: Mon Oct 21, 2019 2:06 pm

Re: ESP32 and LilyGo TTGO T Call

Post by kinno » Tue Jul 21, 2020 2:53 pm

@xyic0re,

I do have lots of code for this.

What exactly are you looking to do?

1. Battery powered GPS for flight info?
2. You can do this using this device but it might be a touch heavy. I don't know the carrying capacity of your drones.
3. I would use the ESP-32 to send GPS AT commands on a regular interval and then push the info you need (latitude and longitude) via the modem and over cellular networks.

Is this correct?

xyic0re
Posts: 5
Joined: Tue Jul 21, 2020 9:11 am

Re: ESP32 and LilyGo TTGO T Call

Post by xyic0re » Tue Jul 21, 2020 10:45 pm

kinno wrote:
Tue Jul 21, 2020 2:53 pm
@xyic0re,

I do have lots of code for this.

What exactly are you looking to do?

1. Battery powered GPS for flight info?
2. You can do this using this device but it might be a touch heavy. I don't know the carrying capacity of your drones.
3. I would use the ESP-32 to send GPS AT commands on a regular interval and then push the info you need (latitude and longitude) via the modem and over cellular networks.

Is this correct?
@kinno, thanks for your reply. I think to begin with I will be running the board off of the battery (via the attached battery slot) - just to be sure, this is the board I have - https://www.tindie.com/products/ttgo/li ... -sim7000g/
The plane is reasonably sized so it should have no problem carrying the weight.
Many of the guys are using this device - https://store.trackimo.com/products/3g- ... ps-tracker
Its a gps tracker that lets you see the tracking devices position on the map, and also requires you to pay a monthly subscription for the service. Its also not geek enough, where we could do it ourselves ;)

I would really like to just get the bare minimum up and running on the board, battery powered, and sending gps coordinates every x seconds to the mobile device. It would also be extremely beneficial to be able to poll the device for the coordinate. say for instance txt messaging the device sim with a code, that when received returns the gps coordinates.
From there I will be able to work it to interface with glympse - https://glympse.com/get-glympse-app/ via their api - https://developer.glympse.com/docs/core ... ming-guide

If you have any code that you wouldnt mind sharing just to get the board up and running, as mentioned above that would be really helpful. I would be eternally grateful.
I think to answer your questions above;
1 - yes, to begin with - solar in the future
2 - I think the weight should be fine
3 - yes, I would also like the ability to send the device a txt and it return its location - This device is being used as the backup GPS, the drone has a gps on it. Unfortunately its linked to the main flight controller, and if anything goes wrong with that, either in flight or in a crash.. .thats it, the drone is lost. These drones have been modded to fly via the 4G mobile network.. so cell range and battery capacity are really your only limits.

Xyic0re

kinno
Posts: 32
Joined: Mon Oct 21, 2019 2:06 pm

Re: ESP32 and LilyGo TTGO T Call

Post by kinno » Wed Jul 22, 2020 11:27 am

Xyic0re,

I believe you can actually charge the battery in the device you linked via solar. I think that version already has a port for hooking up a solar panel.

I probably don't have time to go through all the Glympse API docs right now so I most likely will not be able to help with that implementation.

So, we are using the ESP32 Sim7000g device as a sort of backup for your planes.

It is possible to send an SMS and then get a reply on SMS with the coordinates and that would satisfy your backup GPS functionality.

It is also possible to have the ESP-32 connect to a server you control and then interact over the data layer instead of SMS. That would set yourself up for more functionality and is the way I would try to do it. If NB-IOT is available in your area this would be a nice layer to send your data on. If not i think you'll have to use LTE-M.

One thing to consider before you get too deep is perhaps Lora technology. I haven't used it myself but I think it can reach a couple KM in distance and might suit your application better. I don't know how far these planes travel from their controllers. It might be how your controllers currently work. I really don't know too much about these planes.

So, For starters I would recommend this approach.

1. Use the ESP32 Sim7000g device you've linked with a battery with a solar panel hooked up. Get that working on it's own, confirm charging etc.
2. Have the power switch accessible so you can turn the device on when you are about to fly. Need to mention this.
3. Have the device connect via sim7000g to a server you control (digital ocean works well for me). A sort of simple API server. I make these in python using Flask. Also have an MQTT server for the data.
4. Have that device send information (GPS to start) over the data layer to your server. Probably MQTT in a selected interval (10 seconds?)
5. Have the device accept commands so you can get GPS info on demand. Probably MQTT.
6. Once you are going you can add other functionality if needed. Temp/Humidity/Light intensity/Camera/Controllable LED's/Lora/Flight control/etc.

I wonder if the planes use some sort of standardized communication for flight control like modbus or something then you can patch right in and control the plane over NB-IOT or LTE-M. Although the lag might make it not worth while.

Thoughts?

xyic0re
Posts: 5
Joined: Tue Jul 21, 2020 9:11 am

Re: ESP32 and LilyGo TTGO T Call

Post by xyic0re » Wed Jul 22, 2020 11:49 am

Hi Kinno, thanks for your reply. There are some guys that have flown the plane between islands in hawaii, so they are quite capable.
I think I am pretty set of just using the board to send its gps coordinates over sms for the start, and once I have a handle on how the code does this and become more familiar with working with micropython (or which ever language is needed), then I can expand on the functionality and adapt it further if needed.
If you have some code that does just that, would you mind sharing it with me?

Many thanks
Xyic0re

kinno
Posts: 32
Joined: Mon Oct 21, 2019 2:06 pm

Re: ESP32 and LilyGo TTGO T Call

Post by kinno » Wed Jul 22, 2020 12:42 pm

Xyic0re,

I don't use the SMS functionality at all but I can probably give you a good foundation and the supporting docs in order for you to make it happen. If, I find time I could assist as well, but, don't count on that.

I will reply in more detail once I find a bit of free time. I just wanted to let you know I'm working on it.

To get you started, there is a section of code in this thread I use to interact with the Simcom modem via AT commands. I would review that as it's critical to your project. I would also get your device to the point of a REPL communication and perhaps do some simple things like control GPIO, LED's etc. You'll need to be pretty familiar with the Micropython / ESP-32 ecosystem in order to support this project and help others. You can use the daily pre-built firmware for ESP32's.

Here is the AT command manual for simcom7000g btw. Read up on the SMS section. You'll need to know this. https://simcom.ee/documents/SIM7000E/SI ... _V1.03.pdf

Talk soon,

Happy Flying. :lol:

xyic0re
Posts: 5
Joined: Tue Jul 21, 2020 9:11 am

Re: ESP32 and LilyGo TTGO T Call

Post by xyic0re » Thu Jul 23, 2020 10:08 am

Thanks, I thought I would just get into it, so I grabbed uPyCraft and headed over to - https://github.com/Xinyuan-LilyGO/LilyG ... ython_LoBo
I will try to get familiar with the device from here. I notice they have a platformio example over there too - https://github.com/Xinyuan-LilyGO/LilyG ... hingsboard
I haven't worked with C so that would be something new for me, shouldn't be too difficult, although if the performance and battery life running micropython isnt an issue and I am able to do everything that I want to, I would rather stick with python.

Btw I notice there is not boot/flash button on the board - is there something I need to do to be able to flash it, or just flash away?
I have managed to flash the board, but when I unplug it and plug it in again, it wants to be reflashed.
Another question, sorry. When I'm trying to test either GPS or GSM - do I need to have a battery in the device if I am already connected via USB?

I've since made some progress:

Code: Select all

Waiting for AT command response....I (2107) [PPPOS CLIENT]: AT COMMAND: [AT..]
I (2132) [PPPOS CLIENT]: AT RESPONSE: [..OK..]
I (2232) [PPPOS CLIENT]: AT COMMAND: [AT+CFUN=4..]
I (2298) [PPPOS CLIENT]: AT RESPONSE: [..OK..]
I (2298) [PPPOS CLIENT]: GSM initialization start
I (2898) [PPPOS CLIENT]: AT COMMAND: [AT..]
I (2922) [PPPOS CLIENT]: AT RESPONSE: [..OK..]
I (3022) [PPPOS CLIENT]: AT COMMAND: [ATZ..]
I (3049) [PPPOS CLIENT]: AT RESPONSE: [..OK..]
I (3149) [PPPOS CLIENT]: AT COMMAND: [ATE0..]
I (3172) [PPPOS CLIENT]: AT RESPONSE: [ATE0...OK..]
I (3272) [PPPOS CLIENT]: AT COMMAND: [AT+CFUN=1..]
I (3305) [PPPOS CLIENT]: AT RESPONSE: [..OK....SMS Ready..]
I (4405) [PPPOS CLIENT]: AT COMMAND: [AT+CPIN?..]
I (4429) [PPPOS CLIENT]: AT RESPONSE: [..+CPIN: READY....OK..]
I (4529) [PPPOS CLIENT]: AT COMMAND: [AT+CREG?..]
I (4553) [PPPOS CLIENT]: AT BAD RESPONSE: [..+CREG: 0,0....OK..]
W (4553) [PPPOS CLIENT]: Wrong response, restarting...
seems there is something wrong (I dont have a battery in the device, just USB)
Last edited by xyic0re on Thu Jul 23, 2020 12:14 pm, edited 1 time in total.

kinno
Posts: 32
Joined: Mon Oct 21, 2019 2:06 pm

Re: ESP32 and LilyGo TTGO T Call

Post by kinno » Thu Jul 23, 2020 11:31 am

xyic0re,

Enjoy the plunge!

If you are looking for alternatives to what you've posted I will share what I use.

IDE: Pycharm - There is a free community edition. I really like this IDE. Look up how to install esptool, mpfshell, rshell in pycharm.
For Flashing the board with the firmware - esptool.
For Loading your program - rshell or mpfshell.
I use the daily prebuilt firmware from here instead of the lobo firmware as it is out of date.
I have written everything in python. I have not needed C at all.

My process is this:

1. Plug in ESP-32 device to computer via USB. Look up its port (Windows would be something like COM4 - use device manager).
2. Download the latest pre-built firmware on this site for esp32. I use the regular one (GENERIC).
3. Flash that image with esptool
----- These instructions are on the download page I believe -----
4. Use mpfshell or rshell to get a repl.
5. load your programs via rshell or mpfhsell.
6. CTRL+D or the physical reset button will run your program (micropython runs boot.py then main.py)
8. Debug
9. Repeat 4 through 8.

This is simple and off the top of my head. But basically this is my process.

Hope this helps in some way.

xyic0re
Posts: 5
Joined: Tue Jul 21, 2020 9:11 am

Re: ESP32 and LilyGo TTGO T Call

Post by xyic0re » Thu Jul 23, 2020 12:20 pm

Hi Kinno, thanks. Yup I quickly found my way back to the terminal.
I have been using the esptool to flash the firmware
and ampy to put rm ls etc.
and then a repl terminal (Im on windows at the moment on this pc, so I'm using terminus)
I have been using the lobo firmware as described on that github example. You suggested it is out of date, and said you use the one from here? By that do you mean from this forum site? does it include everything needed for the board?
I have made some lights flash etc and since then thought I would take a look at the GSM stuff.
I have that example from the github running( https://github.com/Xinyuan-LilyGO/LilyG ... oBo/gsm.py ), but I seem to get some AT command error.. not quite sure what it is though. I am only plugged in via USB (no battery, although it doesnt look like that is the issue)

Code: Select all

Waiting for AT command response....I (2107) [PPPOS CLIENT]: AT COMMAND: [AT..]
I (2132) [PPPOS CLIENT]: AT RESPONSE: [..OK..]
I (2232) [PPPOS CLIENT]: AT COMMAND: [AT+CFUN=4..]
I (2298) [PPPOS CLIENT]: AT RESPONSE: [..OK..]
I (2298) [PPPOS CLIENT]: GSM initialization start
I (2898) [PPPOS CLIENT]: AT COMMAND: [AT..]
I (2922) [PPPOS CLIENT]: AT RESPONSE: [..OK..]
I (3022) [PPPOS CLIENT]: AT COMMAND: [ATZ..]
I (3049) [PPPOS CLIENT]: AT RESPONSE: [..OK..]
I (3149) [PPPOS CLIENT]: AT COMMAND: [ATE0..]
I (3172) [PPPOS CLIENT]: AT RESPONSE: [ATE0...OK..]
I (3272) [PPPOS CLIENT]: AT COMMAND: [AT+CFUN=1..]
I (3305) [PPPOS CLIENT]: AT RESPONSE: [..OK....SMS Ready..]
I (4405) [PPPOS CLIENT]: AT COMMAND: [AT+CPIN?..]
I (4429) [PPPOS CLIENT]: AT RESPONSE: [..+CPIN: READY....OK..]
I (4529) [PPPOS CLIENT]: AT COMMAND: [AT+CREG?..]
I (4553) [PPPOS CLIENT]: AT BAD RESPONSE: [..+CREG: 0,0....OK..]
W (4553) [PPPOS CLIENT]: Wrong response, restarting...

kindmartin
Posts: 20
Joined: Sun Apr 26, 2020 7:30 am

Re: ESP32 and LilyGo TTGO T Call

Post by kindmartin » Thu Aug 13, 2020 5:15 am

kinno wrote:
Mon May 11, 2020 5:52 pm
rdagger wrote:
Mon May 11, 2020 5:37 pm
kinno wrote:
Thu May 07, 2020 5:20 pm
Yes for sure. I have the entire project running on micropython. I made my own module for interacting with the modem Simcom 7000g in my case via AT commands through the UART of the ESP32. It took me a while but it is very stable right now, especially with the new uasyncio lock and event features.
Please provide a link to the board you are using.
Do you have any code you could share?
Thanks.

Here is the latest version of the board I am using. I am actually on an earlier development prototype of this but it should be identical in terms of capability and code.

https://www.aliexpress.com/item/4000832675119.html

I have a ton of code written for this. Anything in particular you want? I would say the AT command code I might be able to post here or relevant portions of that particular module.

Hi Kinno, I just got a couple of ttgo tcall and i would like to use from a uPy REPL those AT commands to start learning the how to's. can you drop here some code examples or hints? im mostly use Mu code and and uPy ftp thread lib to transfer via ftp the code.

thanks in advance.

M

kinno
Posts: 32
Joined: Mon Oct 21, 2019 2:06 pm

Re: ESP32 and LilyGo TTGO T Call

Post by kinno » Wed Aug 19, 2020 11:08 am

I am pretty swamped right now. However, I wanted to quickly let you know I have read this and that there is code throughout this thread that will help you that I have posted. I think the majority of how I interact with the simcom through the UART is already in this thread.

I will circle back when things calm down and I can put 20 min to 30 min into this for you. In the meantime try the previous code I have posted. If there are very specific questions I may be able to help.

Good luck! :D

Post Reply