Page 1 of 1

Hello Robot: esp8266 softap controller

Posted: Sun Dec 28, 2014 3:57 am
by costaud
ESP8266 is a suitable choice for wifi controller in softap mode.

It has multiple interface so that we can transfer wifi data to spi, uart, i2c ,i2s,infrared remote ,even sdio(more complicated).

This is a example for this kind of application to turn wifi command into uart serial.

The realization is very simple, that esp8266 works in softap mode , smart phone connect to the softap and send udp command to a certain port.
Then send the corresponding uart command to the driver mcu.

Move ! Make your own project !

UART CONFIG:

Code: Select all

 WRITE_PERI_REG(UART_CONF0(uart_no),    UART_PARITY_EN
                                   | UART_TXD_INV      //the mcu receive a inversed uart signal
                                   | UART_RXD_INV      //the mcu send a inversed uart signal
                                   | EVEN_BITS
                                           |( ONE_STOP_BIT << UART_STOP_BIT_NUM_S)
                                           | (EIGHT_BITS << UART_BIT_NUM_S));


    //clear rx and tx fifo,not ready
    SET_PERI_REG_MASK(UART_CONF0(uart_no), UART_RXFIFO_RST | UART_TXFIFO_RST);
    CLEAR_PERI_REG_MASK(UART_CONF0(uart_no), UART_RXFIFO_RST | UART_TXFIFO_RST);

    //set rx fifo trigger
    WRITE_PERI_REG(UART_CONF1(uart_no), (50 & UART_RXFIFO_FULL_THRHD) << UART_RXFIFO_FULL_THRHD_S
                               |   (0x10 & UART_RX_TOUT_THRHD) << UART_RX_TOUT_THRHD_S
                               |   UART_RX_TOUT_EN);

    //clear all interrupt
    WRITE_PERI_REG(UART_INT_CLR(uart_no), 0xffff);
    //enable rx_interrupt
    //CLEAR_PERI_REG_MASK(UART_INT_ENA(uart_no), 0x1ff);
    SET_PERI_REG_MASK(UART_INT_ENA(uart_no),UART_RXFIFO_TOUT_INT_ENA);//UART_RXFIFO_FULL_INT_ENA);


UDP INIT:

Code: Select all

   
    LOCAL struct espconn ptrespconn;
    ptrespconn.type = ESPCONN_UDP;
    ptrespconn.proto.udp = (esp_udp *)os_zalloc(sizeof(esp_udp));
    ptrespconn.proto.udp->local_port = 1025;
    espconn_regist_recvcb(&ptrespconn, user_devicefind_recv);
    espconn_create(&ptrespconn);


8.png
8.png (349.91 KiB) Viewed 5122 times
6.png
6.png (310.63 KiB) Viewed 5122 times

2.png
2.png (484.74 KiB) Viewed 5122 times

3.png
3.png (474.03 KiB) Viewed 5122 times
4.png
4.png (493.51 KiB) Viewed 5122 times

7.png
7.png (399.19 KiB) Viewed 5122 times


001.gif
001.gif (2.09 MiB) Viewed 5122 times
002.gif
002.gif (4.05 MiB) Viewed 5122 times

003.gif
003.gif (5.53 MiB) Viewed 5122 times
004.gif
004.gif (1.37 MiB) Viewed 5122 times

005.gif
005.gif (3.12 MiB) Viewed 5122 times
006.gif
006.gif (5.67 MiB) Viewed 5122 times

007.gif
007.gif (4.99 MiB) Viewed 5122 times
008.gif
008.gif (1.31 MiB) Viewed 5122 times

Re: Hello Robot: esp8266 softap controller

Posted: Sun Dec 28, 2014 4:19 am
by rudi
hi costaud
nice robot project - txs for share and udp init example, same likewise i had search viewtopic.php?f=16&t=74
as a udp server..

allways surprise us with good projects ;-)
would be cheer for a small video szene - do you have a youtube channel ?
;-)

best wishes
rudi ;-)

Re: Hello Robot: esp8266 softap controller

Posted: Tue Dec 30, 2014 5:13 am
by dexterash
costaud wrote:ESP8266 is a suitable choice for wifi controller in softap mode.
It has multiple interface so that we can transfer wifi data to spi, uart, i2c ,i2s,infrared remote ,even sdio(more complicated).

This is a example for this kind of application to turn wifi command into uart serial.

The realization is very simple, that esp8266 works in softap mode , smart phone connect to the softap and send udp command to a certain port.
Then send the corresponding uart command to the driver mcu.

Move ! Make your own project !

A little offtopic: What hexapod is that? Do you send commands directly to the robot's MCU?