Go Down

Topic: Arduino due and the ESP8266 (Read 9224 times) previous topic - next topic

skielpad

Dec 09, 2014, 09:57 pm Last Edit: Dec 09, 2014, 09:58 pm by skielpad
Hey guys,

I am doing this cool project with the new ESP8266 wifi module. The idea is that I want to make an insole for people with balance problems, the insole has 5 analogue pressure sensors, the data of these sensors have to be send over a wifi network to an online interface. So I thought it would be fun to work with this new ESP8266 wifi module, and I can tell you: it isn't. The module is giving me headaches.

So I was working with my Arduino Uno, and after some time I found out that you have to plug it in this way to configure the ESP:

TX of the ESP ---> TX of the Uno
RX of the ESP ---> RX of the Uno

Okay great, I could configure the chip. But this way I couldn't load data on my arduino, to actually set in operating modus. So when I turned the connections around (TX to RX and RX to TX), I couldn't use my serial port anymore for debugging, which is horrible. And I couldn't get it to work.
There is a way I can switch easily between the modes with the Software Serial, Hardware Serial and two AND-ports. Demonstrated in the ugly picture below:



But I was thinking, it would be much easier to do it with the arduino due, as it has 4 different serial inputs. Great, so I bought me one and it doesn't work.

I've been used to working with the Uno for basic stuff, but I don't understand the serial ports of the due yet. I've read in this forum post: http://www.esp8266.com/viewtopic.php?f=8&t=471, that you have to bridge the TX0 and RX0 of the due to another serial pairs, because the TX0 and the RX0 are the "echo" of the communication. Could someone explain me what I should do to connect the ESP to the serial pairs in two ways?
On the one side I want the TX of the ESP connected to one TX of the Due and to one RX of the Due, and the RX of the ESP connected to one RX of the Due and one TX of the Due.

This way I should be able to use the Serial Monitor while I am coding the ESP.

Greetings. :)

rogerClark

If you are just sending AT commands to the ESP8266, just attach it to the next available serial port, i.e the TX1 and RX1

So that TX on the Due goes to RX on the module etc.


If you want to upload new firmware to the ESP8266 you are almost certainly going to need to use an external USB to Serial adaptor, unless you modify the esptool-py uploader, as I doubt a simple pass though program in the Due would work (though I could be proved wrong)

BTW. If you want to use a Uno, you could use Software serial, however, I suspect your module defaults to 115200 baud which is more than Software Serial can manage.

But the new AT firmware (I can't remember the version number) I think is defaulted to 9600 and also has an AT command to change this rate.


Of course, you don't really need either the Due or the Uno, because the ESP8266 is a microcontroller in its own right, with SPI and I2C as well as an ADC. However it depends which module you have, as to how many GPIO pins are available.

I have some ESP-03 modules which only have 3 GPIO's available, which may not be enough for you.
I have some ESP-07's on order which have more pins available on the edge of the board and I just ordered some ESP-12's from Aliexpress (yesterday)

http://www.aliexpress.com/store/product/new-esp8266-ESP-12-wifi-module-ESP8266-serial-WIFI-coexistence-module-AP-STA-AP-STA-WIFI/323553_32239125397.html

I'd suggest that you order some ESP-12 modules and start to learn the ESP SDK API ;-)
As a device to fit in an insole is going to need to be as small as possible

In relation to your use of the ESP.  Are you aware it has a very high power requirement. Normally mine draw 200mA pretty much all the time. This will flatten any reasonable size battery quite quickly.

Depending on your application, you may be better off using an NRF24L01, and some other low power microcontroller (I suspect the Uno etc is going to take too much power to be viable)



Freelance developer and IT consultant
www.rogerclark.net

skielpad

Hey Roger,

thanks for your input. The new AT firmware is defaulted to 9600 indeed, I tried SoftwareSerial before but I noticed that when I used AT+GWLAP (for listing the nearby wifi networks), the output was missing bytes. This is why I wanted to try if with a hardware serial this problem could be fixed.

I have the ESP-01 modules myself, on which I don't think the GPIO's are connected. And I am not profound enough in electronics yet to figure this out myself.

And this project is due this tuesday, so I think I will hook it up with xbees for now. :(

For the powersupply, I heard about this problem more often. But I am able to communicate with it through my serial port and I saw this post stating that with the mirco it is also able to power the ESP: http://contractorwolf.com/esp8266-wifi-arduino-micro/



rogerClark

On the ESP01 there are 2 GPIO's but from from my experimentation you can't really use them, because GPIO0 is used to tigger the upload mode and must be high during restart for normal operation

I forget the other GPIO on the ESP-01 I think its GPIO2 but anyway, if the other GPIO on the ESP-01 module is low on reset, it also seems to do something to the device.

It seems to constant output loads of data to the serial port.

I suspect its debug info in Chinese, but no one seems to know what this is or even what the data rate is.


I initially bought some ESP-01's because I didnt know what to buy, but then saw that ESP-03 seems to be better, so I ordered some, but I then found out that the analogue input is not routed to a pin on the 03 so I ordered a ESP-12 which I think has the ADC pin (TOUT) to a pad on the outside.

I need the analogue input, so I've currently had to solder directly to the chip, which is not idea.

Depending on what you are trying to achieve, you many not even need the Due, you can download the compilor as a linux VM from expressif and there is also a Windows version (though I've not got it to work for me)

Also as an aside, you may be interested in the STM32 aka Maple mini boards, which are 72Mhz and appear to run around as fast as the Due and are only $5
Albeit the port that we have to Arduino IDE for these is really only a Beta, but its worth looking at (see the thread in the microcontrollers forum)
Freelance developer and IT consultant
www.rogerclark.net

Eddiie

On the ESP01 there are 2 GPIO's but from from my experimentation you can't really use them, because GPIO0 is used to tigger the upload mode and must be high during restart for normal operation

I forget the other GPIO on the ESP-01 I think its GPIO2 but anyway, if the other GPIO on the ESP-01 module is low on reset, it also seems to do something to the device.
I have an ESP01 and am trying to get GPIO2 to work, but it always stays high even after putting it low.
Any I missing something?

It seems to constant output loads of data to the serial port.

I suspect its debug info in Chinese, but no one seems to know what this is or even what the data rate is.
I got an ESP-05, tried the cloud update, bricked it.   
Lots of garbage on the serial port.   After much Googling found to set port speed/baud rate to 57000  (yes, 57000)   the garbage turns into text.    It is the bootloader.     So, I assume the garbage at the bootup process of any ESP  is the bootloader at speed 57000,  then firmware loads and speed changes.

I initially bought some ESP-01's because I didnt know what to buy, but then saw that ESP-03 seems to be better, so I ordered some, but I then found out that the analogue input is not routed to a pin on the 03 so I ordered a ESP-12 which I think has the ADC pin (TOUT) to a pad on the outside.
Yeah, same here, ESP05 was my first.    No idea why they make them.  No way to flash new firmware except through cloud update which bricks it.    I tried taking the chip off the board to flash, but wound up getting the board too hot and SMD stuff went floating away.   Never been so mad over $3.00!


Frederic_Plante

#5
Jun 22, 2015, 05:02 am Last Edit: Jun 22, 2015, 06:00 am by Frédéric_Plante
Hi friends, I would like to point out this link.

https://github.com/esp8266/Arduino


Cause you can program your esp device using Arduino software and language.

The ESP8266 is a powerful little device, If you turn to devices like ESP-12 or ESP-201, and some others, you get pretty much the same amount of Digital IO, but only one analog in. You have PWM, SPI, I2C emulation at up to 450khz, OW, so pretty much every thing an Arduino has, plus WIFI build in, and 4 meg of storage space.

ESP-201 is my favourite beast check picture below




In the worst case scenario, you can hook a bunch of i2c port extender to the ESP01, and add GPDIO and GPAIO. The I2C network is held high when not in use, so when you power up the ESP, the GPIO0 is not low, and does not boot in the mode getting a new boot-loader from the serial port.

The project is going forward very fast, I suspect that the ESP "patch" for the Arduino IDE will be pretty much 100% compatible with an Arduino board before the end of this year, and it is already very impressive

There is also a programming language that come with NodeMCU, that is call Lua, that is also pretty cool. It's in console mode, like old Commodore 64, so you can program the beast as you go along, and/or load some program from the storage. the advantage is that you redirect the programming input, that is Serial usually and program the thing using telnet, so you can use Rx/Tx like special GPIOs, giving you 2 extra GPIOs,

https://github.com/nodemcu/nodemcu-firmware

This community is also growing very fast, and libs and examples are almost falling from the sky.

Of coarse, the AT command default mode work very well, but I think it does not handle the GPIOs unless you get a modified boot-loader. I find that the device can do so much more then just that, what is the use of 15 GPIOs if you only use Rx/Tx?
As we fight our way northward into the great unknown, only that one thing remains certain...

Frederic_Plante

I need the analogue input, so I've currently had to solder directly to the chip, which is not idea.


Hey Roger, You will hate this one, The TOUT analog input  max voltage is 1.8v. ;) If the NodeMCU Lua language talk about, "adc33" It's cause they put the right voltage divider between the module and the holding board. So if you hook straight on the chip, you will have to go for max 1.8v
As we fight our way northward into the great unknown, only that one thing remains certain...

rogerClark

Frédéric

One on board I did solder directly to the IC but I thought the max voltage was still 1.0V

But I gave that board to someone as a prototype, so I'm not able to verify this ;-(
Freelance developer and IT consultant
www.rogerclark.net

Frederic_Plante

If you only send 1v I would be surprised if you brooked it.
As we fight our way northward into the great unknown, only that one thing remains certain...

Go Up