how get the images from the flying drone to the phone or cloud - arduino

we are doing a project on image processing using a camera,raspberry pi3 and a gsm module. Above mentioned things are with a flying drone. I can send a notification message to a mobile using gsm module if required object detected on the cam. But we store that image to view on a webpage or through a mobile app easily. while it's flying it can't connect to the internet. So can you suggest a solution to get those images when it is inside our home wifi range.(any how we can get the images from sd card but i need to get those as soon as possible it detected the wifi) . Thanks in advance

You could consider using "tethering", a.k.a. "Personal Hotspot" in Apple parlance, on your mobile phone.
Basically, you would enable the Personal Hotspot on your iPhone and allow your RPi to connect to it via Wifi. You would have to check your setup, but my iPhone takes IP address 172.20.10.1 for itself and dishes out IP addresses to clients which are the same but with the 1 replaced by a small number under 13.
You can see from here how to setup your RPi to automagically connect to your Hotspot whenever in range. You could also consider fixing a static IP address when on that network, so you know where the RPi will show up for sure.
You would then ensure that Apache, or maybe lighttpd which is lighter weight, is running on your RPi.
Then, your app on the RPi would store its image as image.jpg in Apache's DOCUMENT_ROOT directory, probably /var/www/html/image.jpg but check.
Now, on the iPhone, start Safari and browse to:
http://172.20.10.N/image.jpg
where N is a small number. You should see your image and be able to save it to DropBox or Photos or iCloud Drive for others to see.
Of course, once your RPi is connected to your iPhone's hotspot, it can FTP or ssh copy the image to any website or other server on the Internet it has access to itself.

I have understood your question also I have cheapest solution to build your project. you will be needing 3 modules
ESP8266 (Wifi module)
SD card logger
Camera module(go with your choice, try ESP8266(But I have not tried it))
Combining all these can get your work done. But most instructing part is When connected with wifi it should transmit video to webpage or app and when not connected should log video to SD card
Below is my try to solve your problem, if you have any doubts feel free to ask your question.
ESP8266 is an WiFi module, you can connect it with an hot-spot or an router, similar to any WiFi device's on successful connection it throws 200,OK failing will throw 404 or so. Technically just like any TCP devices it will work. You can connect, disconnect, send and receive data continuously using software(using code you write).
0-code for camera unit starts
1-try connecting WiFi && start the camera and start logging into SD card //InCase if WiFi module takes longer time than usual to connect, this will prevent data from losing
2-if connection failed - continue writing to SD card
3-else(connection made) - start streaming the data && stop the SD card logging and save the file and create a new empty file so that we can save on next connection out without wasting data.
4-check for connection status in regular interval (goto step2).
5-on any external inputs(like click an image)
most important thing: code for your camera interface should work independent from the flight controller code.
-NandhaFrost

Related

Failed to make requests to ESP8266 Webserver from an android app

So I have an ESP device that is connected to my WiFi network. It runs a web server and now I want to make requests to this webserver from my android app. So I tried a couple of things and none got satisfied.
Things I tried and why not suitable for me.
Setting up mDNS:
Can't use it since android doesn't really do mDNS it fails in the lookup.
Setting a Static IP:
This approach will fail if the routers' gateway is changed. (at least that's what I believe).
(Can anyone elaborate on this ^. AFAIK if you want to make a static IP you need to match the given gateway with your router's gateway, So if I configured esp board for my router, it might not work with someone else's router.)
Setting a WebSocket connection:
To do this also need the hostname which is IP again.
Asking IP from user:
Since this is going to be a product I can't ask the user to provide the IP address in the mobile application. It leads to a lack of user experience.
I still hope that there should be another way of handling this case which I'm not aware of. I'm actually dying to get this done and I need you guys to help me with this.
It sounds like you are over complicating stuff here.
Step 1. Connect esp board to your wifi (i guess you have figured this out)
step 2. check what lan address your board has connected to, for this is usually just use
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
step 3. start your wifiserver at port 80
WiFiServer(80);
step 4. in your android app, or any other platform(i recommend using browser in computer while simply testing if it works or not) type url: local_ip_address_that_you_got_above/mygetrequest?value1=1
step 5. Listen for incoming clients and intercept the get value that you will recieve in the header in fashion of "GET /mygetrequest?value1=1"
step 6. done :)
If you want to skip the process of implementing all of it from scratch you can get full source code of my example server described above at: https://spacerival.com/lounge/2614/arduino-server but i do highly suggest you to implement it on your own and not just copy paste that source code, since you wont learn much at all to be fair
So after trying all day long, I came with a solution. This is a bit of a workaround as I was lost. So What I did was I created a Soft AP with a small web server that returns the LocalIP. So my esp is working on both AP and STA modes right now.
How it works is simple
ESP runs with a small webserver with /getLocalIP endpoint.
ESP opens a SoftAP for the user to connect. The user connects with the
SoftAP.
The user will be asked to enter credentials for the desired
WiFi.
After connecting to the desired WiFi mobile app will request a
for 192.168.4.1/getLocalIP (AP's IP Address).
Since ESP is already connected to the WiFi this endpoint will send the WiFi.localIP() to the app.
So now the app has the LocalIP.

How to switch connection between cloud and local network in ESP8266

I would like to understand it is possible to switch the ESP8266 connection between the cloud and WiFi LAN.
There are two paths to control the sonoff switch, connected to a wifi router. In case the phone is connected to the router, Path 1 acts as LAN network and ESP8266 can be controlled even without internet. In case I am not at home and would like to control the switch remotely via cloud, path 2 would be followed. Thus, I could get the best of both worlds.
From all the examples that i have seen so far ESP8266 could be operated in only one mode at one point of time, either Lan or cloud (both via the WiFi router).
So kindly help me with the switching code/logic, that will wait to work upon the commands provided via LAN mode if there are none left. Now it should work upon the instructions after switching to cloud mode and finally return to LAN mode after sometime and so on.
For security reasons your Sonoff device should not be reachable from the internet directly - ever. It should only be accessible within your local (home) network. That's your path 1.
To enable path 2 - without affecting the Sonoff device at all - you need a way to build a VPN from your smartphone to your local network. For the node it will look like all traffic is coming from your local network even though you are actually connecting into it from remote.
A fairly simple and cost-effective way to achieve this is to run PiVPN on a Raspberry Pi. See e.g. this video for instructions: https://www.youtube.com/watch?v=15VjDVCISj0

Problems connecting to nodemcu via johnny-five

I'm really having trouble connecting to my ESP8266. I was working with this setup for long time now and I didn't have to flash my boards. Now after having to use a different wifi i needed to flash the board. After doing the following
Updating to the newest ConfigurableFirmata
Using FirmataBuilder to download fitting firmata
Uploading the Firmata to the ESP8266
I can't connect via Johnny-Five anymore (getting the usual timeout error). I couldn't narrow down what it exaclty is (and I have been trying all day) but these are things that I have noticed (Using ConfigurableFirmata directly as well as using firmatabuilder and StandardWifiFirmata, all with the same behaviour)
an open Hotspot gets created even though I'm in Client Mode
when scanning for ports I do find the Module connected to my Wifi (Serial Monitor in Debug tells me the same too) but no open port is found, even though it's specified in the firmata.
I just can't narrow down the reason. I hope you guys can.
OK,
this was a simple user mistake. But since I lost a whole day searching for the error and I think others might too, I'll share my mistake here.
As I pointed out I created the Firmata as Client (thinking its a client to my Hotspot). But you will have to create it as a server (as you want to connect to the board)
It's as simple as that. If you are on http://firmatabuilder.com/ make sure you choose TCP Server if you want to connect to your board.

Espressif Wifi not connecting or showing AP

First of all, I won't go into details, cause there are a lot of them, and I dont want to write (a too long) essay. There is TL;DR section at the end, because I have a specific question, but maybe some additional info can help.
I have a device that is made of a GRU (glass room unit) and espressif (esp8266).
GRU and esp8266 communicate via serial, with GRU as master. GRU is programmed with an internal tool, and I can monitor everything on it, including the info it gets from esp8266.
There is a test/development device, that has espressif on top of the GRU, so I can easily take it off, reprogram/reconfigure it, and put it on.
Espressif is inside of a GRU, and downloading stuff to flash is a real pain. There is whole process including a OS switch (from Win7 to Linux and back). Console output on espressif cannot be done, or at least not in the time frame I have.
For esp8266 I use non-os SDK V2.0.0_16_08_10.
Espressif can be configured with downloading a configuration to flash, or via UDP (over a network if connected, over its AP if its not connected).
Algorithm for Wifi:
1. Try to connect to a network from configuration
2. If it succeeds, raise a flag for that
3. If it fails, enter dual (STATION+AP) mode and raise a flag for that
The reason espressif is not always in dual mode is that it affects multi-cast operations.
Configuration over network is done by a Java aplication I wrote.
Scenario 1
I've configured a wifi router, configured all (x19) of the devices (espressif in devices that is) to connect to its network. When I turned them on, they would connect one by one. The ones that didn't entered dual mode and could be configured via the app.
All well.
Scenario 2
I've wanted to test the system in real world, so I reconfigured them to connect to the our firms network. Additionally when I was already going thru the whole process I've downloaded latest firmare to flash.
I expected that they would connect or enter dual mode and create their own APs. But they did not.
I tested then the code and configuration on espressif whose console output I could monitor, and everything worked.
I tested then the code and configuration on the test device, and it worked again.
I've then redownloaded the code and configuration to one device, and it didn't work.
TL;DR
I have two devices, espressif on a GRU and espressif inside of a GRU. Both connected to one network. Esp on a GRU work for another, Esp inside of a GRU doesn't work for that other network.
They have identical code and configuration, so it shouldn't be a software issue.
Does having espressif inside of a device jams its signal enough that it can't go trough? Device is not big (5x5x2cm).
UPDATE 1:
While I was writing, the espressif inside of a GRU managed to connect to network. I then restarted it so I can check that it can do it again, and it can't connect again.
It took me about 10 minutes to write the whole question.
There are two things that seem to have caused the problem.
When I removed gpio_init(), network stuff became faster, much much faster. Everything on it, connecting to AP, creating AP etc...
I've changed my config and wifi code, so that it now stores the ap and station config to flash via API.
I only check if its internal config is the same as mine from flash. If it isn't, it saves it. Now, I only control the current opmode.

Downloading data to a PIC micro from the web

I have a client that would like a small PIC board that plugs into a PC's USB as a dongle in HID mode. It would basically just transfer small amounts of data over RF to another device across the room.
They would like the data to come from the web. ie. user clicks a link in their browser which wakes up the PIC board and begins a download to the PIC device without the need for another application to visibly popup in front of the user.
I would think this can't be done without the setting up the browser preferences and assigning a custom application to recognize the data file. The security issues with a link initiating this kind of flow of events must be too great unless I'm missing something.
Has anyone done something like what I described above?
You could write a small piece of software that runs in the background on the PC (e.g. a Windows service), and:
Interfaces to the PIC device via USB
Provides a web interface on port 80 or probably some other port, which the browser can then connect to.
If the PIC device is network connected (e.g. has an Ethernet connection, and its own IP address on the network) then the PIC device could provide a web interface to control it. I don't know how feasible it is to fit a small web server onto a PIC though--that would be a tight fit.
Yeah that sequence of events doesn't seem too kosher. Perhaps a browser plugin or a program running on the PC that handles communication between the PIC and web would be better?

Resources