Sending data from Arduino to ESP8266 - Page 1
Forum section: electronics / general

author: 2slow4me
author_rank: Newbie
timestamp: October 06, 2017, 02:25:46 am
content: Hey guys, got a quick question. Now, last time i asked how to use the CC3000 module, and most people said "go to ESP8266" so i did. 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 = junk2) Serial.write(temperature) on Arduino with Serial. read() on ESP = junk3) Serial.write(lowbyte) +Serial.write(highbyte) with Serial.Read = junkI 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.

author: kripton2035
author_rank: Super Contributor
timestamp: October 06, 2017, 06:23:56 am
content: on the esp8266, as there are almost no I/O available, the issue is to uns i2c everywhere.so you can use one bmp250-280 barometric-temprature-humidity i2c sensor to get your valuesthen on the same, i2c bus, use an easy to find i2c to lcd module on ebay for around $1so all your sensors will be connected directly to the esp8266, and no more fuzzing with the I/Os not available on the esp8266.

author: 2slow4me
author_rank: Newbie
timestamp: October 06, 2017, 06:30:58 am
content: The problem is delivery of any component to Serbia will take two weeks at least, and i have no such time. I barely found an ESP to borrow. id rather just find a way to use UART to send the data from Arduino to ESP. Basically, i want to send 3 integers to from Arduino to ESP. Im out of money (student, nearly spend all of my money, and with the border taxes which are here very random even on 1$ shipments, ) and out of time to complete my project, this is the solution which i feel will take me the least time.I got the Arduino reading sensor data, and the ESP sending stuff to dweet, i just need to send the right stuff

author: kripton2035
author_rank: Super Contributor
timestamp: October 06, 2017, 09:00:18 am
content: try to print something simple like "AAA" and see what comes to the rx port of the esp8266may be it's only baud, or parity or ?it should definitely work like that. it's only a software problem.

author: Psi
author_rank: Super Contributor
timestamp: October 06, 2017, 09:31:59 am
content: its probably a clock issue, something isnt running at the speed you (or it) thinks it is.Stick the arduino in a loop. 'count' 1 to 384.Set the arduino baud rate to (count * 300)Send a string with some text followed by (loop variable*300), eg first loop will be something like test1add a delay of 100ms.now watch for the data on esp to see if the string "test" ever appears in the junk data.If it does, the number after test is the baud rate.If you find this works then you can be sure that one of your devices has its clock setup wrong somewhere.

author: picandmix
author_rank: Frequent Contributor
timestamp: October 07, 2017, 08:01:32 pm
content: Quote from: 2slow4me on October 06, 2017, 02:25:46 amWas in a similar situation some months ago looking to use the ESP 8266 with the Arduino Uno but still to unable to find a straight forwards working example anywhere on the web, strange ?

author: Psi
author_rank: Super Contributor
timestamp: October 08, 2017, 11:43:22 am
content: i have some code here somewhere that allow flashing of a STM32 over wifi using the esp8266custom windows reflashing app ----- WIFI network ----- ESP8266 ---- uart link ---- STM32 uart in boot modelet me know if you want to see any of the code.Now that i think about it, I have a vague recollection there was something a bit weird about getting the uart working.Actually no, i remember what that was. it was getting the esp8266 into uart parity mode, which is required for stm32 bootloader.So that isn't relevant to you

author: ebclr
author_rank: Super Contributor
timestamp: October 08, 2017, 11:47:24 am
content: Be carefulArduino is 5V, esp8266 is 3.3V and is obsolete. ( now esp32 take the place )

author: Psi
author_rank: Super Contributor
timestamp: October 08, 2017, 11:50:38 am
content: Quote from: ebclr on October 08, 2017, 11:47:24 amHoly shit. i just looked at the specs of the ESP32. Wow.

author: kripton2035
author_rank: Super Contributor
timestamp: October 08, 2017, 12:11:21 pm
content: Quote from: ebclr onTodayat 14:47:24for me esp8266 is not obsolete. esp32 and esp8266 are two different chips, the esp32 is far superior, but we can do many projects with an esp8266. oh, and esp32 is 3.3v too.

author: hamster_nz
author_rank: Super Contributor
timestamp: October 10, 2017, 05:51:24 am
content: Quote from: kripton2035 on October 08, 2017, 12:11:21 pmI would back ebclr up on this, the ESP8266 is obsolete. If I had some lying around for a project I would use them, but I wouldn't bother ordering any more for my bits box.In fact I have just been shipped 5 of these:https://www.aliexpress.com/item/WEMOS-LOLIN32-Lite-V1-0-0-wifi-bluetooth-board-based-ESP-32-esp32-Rev1-MicroPython-4MB/32831394824.htmlWith the latest ESP32 revision, and a Lithium battery interface, 500mA Max charging current, onboard USB/serial interface, and less than US$5. You are saving only $2.50 using the ESP8266, and you can spend that much on a USB/Serial adapter.Here's a table of the differences between the two:(fromhttps://www.cnx-software.com/2016/03/25/esp8266-and-esp32-differences-in-one-single-table/)