Arduino Forum

Using Arduino => Microcontrollers => Topic started by: 2slow4me on Oct 06, 2017, 04:29 am

Title: Sending data from Arduino to ESP8266
Post by: 2slow4me on Oct 06, 2017, 04:29 am
Hey guys, got a quick question. Now, i want to do the following: my Arduino collects sensor measurements (float Temperature, float Pressure, float Humidity), and i want to send them over UART to ESP8266 and receive them so that i can send them on dweet. Now, you might ask yourself "Why don't you just connect the sensor to the ESP?". Well, i'm planning on hooking an 16x2 LCD on the Arduino so i can relay the data there as well. Now, i've tried several codes for both the Arduino and the ESP, and all i keep getting on the ESP is junk ( 8 digit temperature in Celsius for example).

I tried:

1) Serial.print(temperature) on Arduino with Serial.read() on ESP = junk
2) Serial.write(temperature) on Arduino with Serial. read() on ESP = junk
3) Serial.write(lowbyte) +Serial.write(highbyte) with Serial.Read = junk

I assume there's something i'm doing wrong or missing, so i would need some help. I hope someone can provide some quick and easy code samples for me to try since i noticed ESP8266 (i have ESP-01 with the 8 pin in 4x2 layout version) are very common and a lot of people use them. Thanks in advance guys.
Title: Re: Sending data from Arduino to ESP8266
Post by: Erni on Oct 06, 2017, 01:56 pm
Here's a starting point.
I ones made a two way com between Arduino and ESP8266 using I2C

https://github.com/ (https://github.com/Erni38/Erni/blob/master/ESP8266/webserver_twi.ino.ino)
Title: Re: Sending data from Arduino to ESP8266
Post by: dhunink on Oct 06, 2017, 04:34 pm
Did you checked the baudrate of both devices? Jabber is commonly the result of not matching baud rates between devices.
Title: Re: Sending data from Arduino to ESP8266
Post by: ElCaron on Oct 06, 2017, 07:26 pm
Who wants to take the bet that the Arduino-AVR is completely unnecessary here?
Title: Re: Sending data from Arduino to ESP8266
Post by: PaulRB on Oct 07, 2017, 09:31 am
Who wants to take the bet that the Arduino-AVR is completely unnecessary here?
Yes, of course it is. Just get an i2c backpack for the LCD and an i2c temp/humid/pressure sensor such as bme280.