Microcontroller › AVR › Interfacing ESP8266 with an ATmega16/32
- This topic has 5 replies, 4 voices, and was last updated 5 years, 7 months ago by
Ashutosh Bhatt.
-
AuthorPosts
-
April 24, 2016 at 12:31 am #4430
Pranav Sewpersad
ParticipantHello guysI am in desperate need of help with interfacing the esp8266 with an avr microcontroller. I have learnt how to use the esp8266 with a terminal software via a usb to serial module where i can set it up as a sever, connect devices to the module and communicate using the AT commands. I also setup the microcontroller to communicate via usart (with the specs needed to communicate with the wifi ,module) and was tested using hyperteminal. When I am sending the AT commands as strings to the module from the microcontroller nothing is happening(the module should send back "OK" or ERROR. How do I go about sending the AT commands to the wifi module from the micro? I have uploaded the code i am testing with below/** Uart9600TxRx.c** Created: 4/20/2016 1:09:32 AM* Author: Pranav*///Uart working for bytes at baud of 9600 Tx and Rx#include <avr/io.h>#include <avr/interrupt.h>#include <util/delay.h>#include <string.h>#ifndef F_CPU#define F_CPU 16000000#endifvolatile char rec;void usart_msg(char *c){while (*c != 0) //— Check for nullUartTx(*c++); //— Increment the pointer}void Usart_Init(){UCSRB = (1 << RXEN ) | (1 << TXEN );UCSRC = (1 << URSEL ) | (1 << UCSZ0 ) | (1 << UCSZ1 );UBRRL = 103 ;UBRRH=0;UCSRB |= (1 << RXCIE );}void UartTx(char send){UDR=send;while (!(UCSRA & (1<<UDRE)));}int main(void){Usart_Init();DDRC=0XFF;DDRB=0x00;PORTB=0xFF;sei();char send;//int x=0;//SOME AT COMMANDS TO SETUP THE ESP8266 AS A SEVERusart_msg("AT");usart_msg("AT+CIPMUX=1");usart_msg("AT+CIPSEVER=1,1003");while(1){}}ISR (USART_RXC_vect){//char Rec;//PORTC=0xFF;_delay_ms(1000);if(UDR=='O'){PORTC=0xFF;}rec=UDR;//UDR=rec;//return(rec);}April 24, 2016 at 8:41 am #13889Ashutosh Bhatt
Participantthr may be problem with baud rate. try to set exact baud rate between AVR uC and ESP8266
September 24, 2017 at 5:27 pm #14664Anonymous
GuestHey, am sorry couldnt find the solution to it. But i need a little help. I am actually working on a project which includes use of esp8266. i am confused abt how i start.. please guide me if possible. Like how to interface esp8266 with microcontroller (i am using atmega328p). Wanna know the concepts and the other hardware if required. like do i need to even program esp along with atmega?
September 25, 2017 at 9:23 am #14665Ashutosh Bhatt
Participantfirst connect ESP8266 with PC / laptop through serial to USB converter and test it with AT commands through PC
September 25, 2017 at 12:56 pm #14667bivash
ParticipantI am also gatting same problem and already I checked with pc, Its worki
October 19, 2017 at 1:17 pm #14673Ashutosh Bhatt
Participanteven I am having problem with ESP8266. it does not respond to direct AT commands given through PC
-
AuthorPosts
- You must be logged in to reply to this topic.