-->
Page 1 of 1

Sending data : bluetooth => esp8266

PostPosted: Fri Sep 25, 2015 9:47 pm
by jasonconvenant
Hi,
It's the first time I'm using ESP8266. I made this choice because I need to monitored sensors with my android phone but its bluetooth is really bad then I have had the idea to use wifi.
I just need to send data continuously every 10ms, Data like this "#483;43;533;566~".
Is it possible to send continuously ? I did not look for yet but if you have a similar project, please tell me or give me the adress.
Then my question is, Do I have to make a webserver and send a request everytime with my android app ? Or can I just send data continuously with another protocol and receive them with my android app ?
Thank you very much.

Re: Sending data : bluetooth => esp8266

PostPosted: Tue Sep 29, 2015 12:00 am
by Neurogami
Yes, it is possible to send data at set intervals.

I've been experimenting and set up a demo program that reads a value from a photoresistor and sends the data both as an HTTP GET request and as an OSC message.

I'm using the Arduino IDE for this with a OSC library I found.

This is a stripped-down version (no OSC, just a loop for HTTP GET):
https://gist.github.com/Neurogami/598648dfb0f6372ad376


Basically, though, you use setup)( to get connected to your wireless network, and then in loop() you build yur URI and send whatever HTTP request you want. Then delay() for some period of milliseconds.

Now, the thing that receives that request needs to understand HTTP GET requests. It need not be a full-blown Web server but has to do at least than much.

A problem with that is in knowing the IP address of your phone and making sure the ESP8266 code uses it. Phone IPs can change (though some devices will let you set a static IP).

Plus, if your phone app is handling an HTTP request every 10ms you may find it getting a bit warm and the battery draining. (I think; this might not be as CPU intensive as I'm guessing.)

This is where using OSC over UDP might be a better choice.

I'm pretty sure this is the Arduino library I'm using:

https://github.com/sandeepmistry/esp8266-OSC

Here's a simple example: https://gist.github.com/Neurogami/088fb292454f9be9fa92

Hope this helps.

Re: Sending data : bluetooth => esp8266

PostPosted: Fri Oct 09, 2015 1:05 am
by jasonconvenant
Hi,
Sorry to reply you only now, I was busy and I didn't remember my password lol

Thank you very much even if I don't know about udp, tcp, http get (data in the url?!)
I read some pages, I think I should use UDP (since I dont need confirmation as Im doing with bluetooth).
Im gonna learn a bit about OSC.

Then you think the wifi choice is not good for my application ? Bluetooth should be more low power than wifi to make a real time monitoring ?
Another problem, I only found tutorials which are made for using an existing wifi network but I want use it as a access point. (only arduino + esp8266 on a bike and moving then no wifi network) Or I misunderstood and the fixed IP address is not real one.

Thank you.