Go Down

Topic: API Get on Arduino Uno connected to ESP8266 (Read 4182 times) previous topic - next topic

PaulRB

Get that i2c backpack for the LCD. They are very cheap. Then you can connect the LCD to the esp-01.

How does the user select a news item and what is the ultrasonic range sensor for?

BassoTara

Ideally the user should be able to scroll and select news using buttons. The ultrasonic sensor starts the process: when it senses someone is near, the Uno should ask the ESP to send the GET request.

PaulRB

#17
Jul 08, 2017, 04:41 pm Last Edit: Jul 08, 2017, 04:45 pm by PaulRB
You could use an inexpensive PIR sensor for that. The PIR sensor could be connected to an input of the i2c expander, like the buttons. There is no need for complex pulse width measurements with a PIR sensor, so the i2c expander can work with it. The i2c expander connects to the esp-01. Uno no longer needed in this project and much complex programming avoided.

BassoTara

I had already seen it, but we already had an Ultrasonic Module so we thought we could use it. We could definitely consider buying a PIR if it's simpler, but generally we prefer to use what we already have so we don't have to wait for something else to be shipped ad delivered.

PieterP

#19
Jul 08, 2017, 09:41 pm Last Edit: Jul 08, 2017, 09:41 pm by PieterP
I'd suggest getting a Wemos ESP8266 board (or get an I/O expander), but if that's not possible, you'll have to use the Uno as a "smart port expander". Did you read Robin2's Serial input basics?
Just connect them using a serial connection (just like when using AT commands) and come up with a protocol to send the text. Use some start/end markers to make it easier (e.g. SOH then the number (index) of the headline, then STX then the headline text and finally ETX or EOT).
To select an article the Arduino can respond with the number of the corresponding headline.

Pieter

BassoTara

Thanks Pieter, I'll try it and ask again if I have problems

BassoTara

Hey guys!

Thanks to your help we managed to (almost) complete the project. We used an I2C communication between ESP and Arduino Uno, with ESP as Master and Arduino as Slave.
The ESP sends the news titles to the Arduino, which shows them on the LCD display and waits for the user to choose one.
The ESP continuously asks the Uno if it has something to send, and the Uno sends "10" if it has nothing, otherwise it sends the id of the selected article.

This is working perfectly.

The second part is a bit tricky. We needed to find a way to establish a communication between the ESP and the Android App we created; we kinda found a workaround which implies POSTing the selected article on myjson.com and adding a GET function in the Android app to get the article from that same website.
This is working for us, but I'm not sure if it's what we're supposed to do, or if we have to find a way to make the ESP (or the Uno) and the mobile app directly communicate.

Do you guys think our solution is acceptable? Is there a way we could have done it easily using direct communication?

PaulRB

#22
Jul 18, 2017, 10:45 pm Last Edit: Jul 18, 2017, 10:50 pm by PaulRB
Could you get the esp to act as we server and display the chosen article on a page which the android device could access with the android app, or much more simply, it's browser. But then this is an educational opportunity, and if you were looking for simplicity, you could have downloaded a ready made RSS browser app from Google play!

Go Up