Android Question Controlling the ESP8266 over wifi

ardhuru

Member
Licensed User
Longtime User
Please bear with me, I am a complete novice with B4A.

A few months back, after lookimg at a lot of samples, I designed an app that shows a numeric keypad, and using asyncstreams over bluetooth, transmits a number corresponding to the key that was pressed.

Now, I would like to implement the same thing, but with Wifi. On the reception side, I'll probably use an ESP8266 serial to Wifi module. I feel fairly confident of writing the code for the ESP8266.

So, how do I go about it on the Android? For starters, what would be used in place of asyncstreams? I suspect it would be httputils, but I have absolutely no idea where to start.

I can probably make it happen using a browser, but I'd like to create an app that has my custom buttons, and an interface designed in the abstract designer.

Any pointers would be highly appreciated!
 

freedom2000

Well-Known Member
Licensed User
Longtime User
Sorry, I don't understand your question ?

PIC is a microcontroller
ESP8266 is another one

ESP8266 is wifi enabled so android phone can easily connect to it and communicate

PIC is not Wifi enabled nor bluetooth enabled, so the only solution to communicate with android phone is to go through the USB port

What do you want to do exactly ?

JP
 
Upvote 0

JTKEK

Member
Licensed User
Longtime User
yes i know pic a microcontroller, esp8266 is a wifi module

what i means is, i want to connect esp8266 to a pic via uart
then i want to control using android via wifi

i just ask have any example of pic (c language)
 
Upvote 0

freedom2000

Well-Known Member
Licensed User
Longtime User
yes i know pic a microcontroller, esp8266 is a wifi module

what i means is, i want to connect esp8266 to a pic via uart
then i want to control using android via wifi

i just ask have any example of pic (c language)

Ok for UART communication with PIC it is quite simple :
tutorial here : http://ww1.microchip.com/downloads/en/DeviceDoc/usart.pdf
code exemples here : http://ww1.microchip.com/downloads/en/DeviceDoc/ce437_uart_no_dma.zip and there http://ww1.microchip.com/downloads/en/DeviceDoc/usart.zip

But I remind you that you cannot directly connect Android to PIC with a serial link.
You need first a bluetooth to serial device or a wifi to serial one.

here is an exemple of bluetooth to serial with B4A : https://www.b4x.com/android/forum/threads/android-bluetooth-bluetoothadmin-tutorial.14768/#content
 
Upvote 0

JTKEK

Member
Licensed User
Longtime User
Thanks freedom

ESP8266 has udp and tcp
i want to ask what is different between tcp and udp communication ?

i see from XorandOR use tcp method (tcp socket i think ), what about udp ?
 
Upvote 0

freedom2000

Well-Known Member
Licensed User
Longtime User
Thanks freedom

ESP8266 has udp and tcp
i want to ask what is different between tcp and udp communication ?

i see from XorandOR use tcp method (tcp socket i think ), what about udp ?
UDP sends IP packets without taking care if the packet is received or not
TCP is a full protocol insuring that the packet is really received.

More important : if you really want to be sure that "packet n" is received before "packet n+1" then use tcp
if you don't care to loose one packet, and your packets are short, then use UDP as it is faster than tcp.

To give you an idea think of UDP as a regular mail that you drop in a mailbox. You will never be sure that the letter is received.
This mailbox is reliable and you probably will never loose one letter. But you cannot be sure !
 
Last edited:
Upvote 0

Jayjay

New Member
Licensed User
Longtime User
Hi, All correct, the attached example was scheduled for a module esp8266 as an access point, I just needed the part of the pic16F876A, the functions of the module to drive the GPIO GPIO 0 E 2 are only tests. If you want it as a (station) you have to change the parameters in the file lua. If you need the code for the pic I'll attach. excuse my english.
Hi XorAndOr,
Just received my esp8266-12 but being new to lau have no idea of getting the firmware on your example into the esp8266. With the arduino ide I have been able to get the hello world...blink.. to run. Is there a way to get the wifi app into the 8266 as per your example using the arduino ide?
 
Upvote 0

Michael1968

Active Member
Licensed User
Longtime User
Hi XorAndOr,
Just received my esp8266-12 but being new to lau have no idea of getting the firmware on your example into the esp8266. With the arduino ide I have been able to get the hello world...blink.. to run. Is there a way to get the wifi app into the 8266 as per your example using the arduino ide?

Hi Jayjay,
you can use this ide to programm the esp
http://esp8266.ru/esplorer/

...works perfect for me

michael
 
Upvote 0
Top