ESP8266 WiFi serial module

tracecom

Senior Member
Thanks. Your timing is perfect. I just finished installing NodeMCU 0.9.6 build 20150704 powered by Lua 5.1.4, which I believe is the latest and greatest. I connected the ESP-012E to my local WAP, and ran getip, so I am ready to try something new. Time to start studying Lua, I think.
 

lbenson

Senior Member
Riccardo--thanks for the files. Where does the php program fit in?

tracecom--having read the linked nodeMCU Unofficial FAQ, I would say that there are two things you would have to learn to use lua on this device--the lua language itself, and the event-driven programming style required. I suspect that the latter would be the bigger hill to climb, although for easy things there are apparently many examples available.

The event-driven style is sort of like using interrupts on the picaxe, except that everything you want to do would be done with a separate interrupt handler (callback routine).
 

veewee77

New Member
Can you provide connection and etc. for the conversion from 3.3V to 5V on the TX/RX on the PICAXE?
Thank You!
 

tracecom

Senior Member
Can you provide connection and etc. for the conversion from 3.3V to 5V on the TX/RX on the PICAXE?
Thank You!
If I understand your question, the answer is that you power the PICAXE with 3.3V and the ESP8266 with 3.3V, and no conversion is required.
 

rmeldo

Senior Member
Riccardo--thanks for the files. Where does the php program fit in?
My lua script uploads data to a website periofically. It also gets the time from the website, since the Esp8266 doesn't keep the time when it is disconnected from power. The php files are put on a web server (make sure you change the permissions to executable) and they are called by the esp via the web (the same as typing on a browser: my website.com/time.php)
Riccardo
 

manuka

Senior Member
Chinese firm Espressif have just announced an ESP8266 upgrade! It's titled ESP32 & is currently beta testing.

Although rumoured as somewhat more costly, the new ESP32 offering looks so superior that it may well leave their esteemed ESP8266 in the silicon dust.

Extra: And they're hiring. Anyone pondering such an offshore move may want to contact me, as -by chance- my eldest daughter is Shanghai based (marketing NZ primary produce).
 

Attachments

Last edited:

veewee77

New Member
What is the doce for the Pi end of things?

This is the code for the PICAXE, but could you provide the code you use on the Pi to receive the data from the PICAXE?

I am wanting to do something similar, but I need to be able to interact with several PICAXEs using WiFi.

Each will take instructions from the "master" and do something, and reply with results.

Once I get the Pi to talk to and from the PICAXE via WiFi, I will be on a roll with my project.

DS

First time posting code . Hope I get it right.
Code:
symbol Temp = B.4
symbol Batt_Volt = B.3
symbol TCP_Send = B.2
symbol ID = b6

let ID = 001
TransNum =1


Startup:

pause 5000

serout TCP_Send,T4800_4,("AT+RST",13,10)

pause 5000

serout TCP_Send,T4800_4,("AT+CWMODE=1",13,10)

pause 5000

serout TCP_Send,T4800_4,("AT+CWJAP=",34,"your_ssid",34,",",34,"your_password",34,13,10)

pause 10000

Main:

readtemp Temp,b11

readtemp12 Temp,w4

serout TCP_Send,T4800_4,("AT+CIPMUX=1",13,10)

pause 5000

serout TCP_Send,T4800_4,("AT+CIPSTART=1,",34,"TCP",34,",",34,"1xx.1xx.1xx.1xx",34,",","xxxx",13,10)

pause 5000

serout TCP_Send,T4800_4,("AT+CIPSEND=1,7",13,10)

pause 500

bintoascii b8,b12,b13,b14
serout TCP_Send,T4800_4,(b12,b13,b14)  

serout TCP_Send,T4800_4,(",")

bintoascii b9,b12,b13,b14
serout TCP_Send,T4800_4,(b12,b13,b14)  

pause 5000

'serout TCP_Send,T4800_4,("AT+CIPCLOSE=1",13,10)


Nap 10   '16s nap
rem Nap 11   '32s nap
rem Nap 12  '64s nap


goto main
Lots of work left to do on this code. Consider it a guide , not a finished solution.

I should mention my hardware setup.
In addition to a regular Picaxe programming cable I have the TX pin on the ESP-01 connected to a FTDI board which connects to a terminal program on the Windows computer.
This lets me see all the output from the ESP-01 in real time. This makes finding errors much quicker. The Picaxe does not connect to the TX pin on the ESP-01.
 

tracecom

Senior Member
This thread seems to be about all things ESP, so hopefully my question won't be seen as hijacking.

I have done quite a lot of experimenting with ESP8266 modules, especially the ESP-01. I want to add an external antenna to an ESP-01, and did so as seen in the photograph below. (I know that there are ESP modules with external antenna connections, but want to use an ESP-01.) However, my experiment did not succeed; the F antenna continued to radiate despite the removal of the SMD capacitor from the ESP8266 chip to the antenna, and despite the hole drilled through the F antenna. I theorized that there was capacitive coupling between the coax and the F antenna which caused the F antenna to continue to radiate, so I trimmed away the F antenna, and confirmed that the RF field was very much diminished.

However, now the 8266 is operating erratically and is unresponsive to AT commands. I don't think that I physically damaged the chip or any other components on the PCB. My question is whether or not the absence of an antenna might have damaged the 8266 and/or the EPROM. Any insight or opinions are welcome.

ETA: I reattached the antenna coax, and the ESP-01 module resumed normal operation. Opinions/insight are still welcome.

ESP-01 Coax Attached (lo res).png
 
Last edited:

BeanieBots

Moderator
Running any transmitter without a tuned antenna can cause all manner of problems.
The issue is related to the voltages that can develop at the RF output and the power drawn by the RF amplifier.
No antenna is comparable to a short circuit on the output. (many CB units were destroyed by being switched on with no antenna fitted).
What you may have experienced is a collapse of the internal power supply giving erratic behaviour.
 

1968neil

Senior Member
This thread seems to be about all things ESP, so hopefully my question won't be seen as hijacking.

I have done quite a lot of experimenting with ESP8266 modules, especially the ESP-01. I want to add an external antenna to an ESP-01, and did so as seen in the photograph below. (I know that there are ESP modules with external antenna connections, but want to use an ESP-01.) However, my experiment did not succeed; the F antenna continued to radiate despite the removal of the SMD capacitor from the ESP8266 chip to the antenna, and despite the hole drilled through the F antenna. I theorized that there was capacitive coupling between the coax and the F antenna which caused the F antenna to continue to radiate, so I trimmed away the F antenna, and confirmed that the RF field was very much diminished.

However, now the 8266 is operating erratically and is unresponsive to AT commands. I don't think that I physically damaged the chip or any other components on the PCB. My question is whether or not the absence of an antenna might have damaged the 8266 and/or the EPROM. Any insight or opinions are welcome.

ETA: I reattached the antenna coax, and the ESP-01 module resumed normal operation. Opinions/insight are still welcome.

View attachment 19031
The esp8266 is a multilayer board thats how they get it so small, Its quite possible that the antenna is on a feed thru to another layer, im sure ive seen a pcb layout diagram on the web maybe worth seeing if you can locate it and see exactly where the printed circuit is routed. I use these modules in numerous home automation scenarios because the range is superb even on the stock antenna, the other versions of this module with an antenna socket strangely do not perform quite so well without a lot of careful antenna tuning using a spectrum analyser which i am lucky enough to have access to thankfully, A good clean power supply is also paramount for reliable operation.

Regards
Neil
 
Last edited:

tracecom

Senior Member
Running any transmitter without a tuned antenna can cause all manner of problems.
The issue is related to the voltages that can develop at the RF output and the power drawn by the RF amplifier.
No antenna is comparable to a short circuit on the output. (many CB units were destroyed by being switched on with no antenna fitted).
What you may have experienced is a collapse of the internal power supply giving erratic behaviour.
That makes sense. Thanks.
 

tracecom

Senior Member
The esp8266 is a multilayer board thats how they get it so small, Its quite possible that the antenna is on a feed thru to another layer, im sure ive seen a pcb layout diagram on the web maybe worth seeing if you can locate it and see exactly where the printed circuit is routed. I use these modules in numerous home automation scenarios because the range is superb even on the stock antenna, the other versions of this module with an antenna socket strangely do not perform quite so well without a lot of careful antenna tuning using a spectrum analyser which i am lucky enough to have access to thankfully, A good clean power supply is also paramount for reliable operation.

Regards
Neil
Thanks. After I removed the coupling capacitor, I checked the F antenna; it was at DC ground. However, I don't know where else pin 2 from the 8266 might go. I will look for the ESP-01 PCB layout.
 

manuka

Senior Member
The powerful (& perhaps too much in many cases!) ESP8266-01 indeed has near paint blistering range, so perhaps clarify why this external antenna hack need has arisen. Coax feed line losses become significant at 2.4GHz too. With so many cheap ESP8266 variants surely another type better suits ?

If you've obstructions in the signal path perhaps just raise the module up above them, or even consider a WokFi style approach. A smartphone app such as WiFi Analyzer can help with signal auditing- microwaves bounce all over the place & "sweet & sour" spots may not be where you expect.
 

tracecom

Senior Member
The powerful (& perhaps too much in many cases!) ESP8266-01 indeed has near paint blistering range, so perhaps clarify why this external antenna hack need has arisen. Coax feed line losses become significant at 2.4GHz too. With so many cheap ESP8266 variants surely another type better suits ?

If you've obstructions in the signal path perhaps just raise the module up above them, or even consider a WokFi style approach. A smartphone app such as WiFi Analyzer can help with signal auditing- microwaves bounce all over the place & "sweet & sour" spots may not be where you expect.
Thanks. I have an ESP-05 that has an external antenna connector, but there's no easy way to flash the firmware, and my code depends on some AT commands that are not available in the ESP-05 that I have. I have built a yagi and a collinear and want to test them against the MIFA that's on the ESP-01. I am an experimenter and a writer, so I try things for the same reason what'shisname climbed that hill in Tibet.
 

manuka

Senior Member
-what's his name climbed that hill in Tibet.
"Because it's there" - Mt. Everest climber George Mallory 1924 (Our Kiwi national hero - Edmund Hillary + Nepalese mate Tenzing- became the eventual victors in 1953.)

Although I've not done this (preferring ESP-01 & ESP-12 type Dev. Boards), diverse accounts say the ESP-05 can be flashed - Googling shows "-cut the short trace between VCC and GPIO0 (2nd pin on the edge nearest to RDX module pin) and solder a thin wire, plus some hot glue to hold it in place.

Even though it seems like you're up for a tinkering challenge I'd still recommend simply testing the merits of placing the entire ESP-01 at the dish focal point & aiming at the target! Although home made Yagi's at 2.4 GHz have high gain, even a simple dish can usually better them.
 

Attachments

nasi

New Member
What is the doce for the Pi end of things?

This is the code for the PICAXE, but could you provide the code you use on the Pi to receive the data from the PICAXE?

I am wanting to do something similar, but I need to be able to interact with several PICAXEs using WiFi.

Each will take instructions from the "master" and do something, and reply with results.

Once I get the Pi to talk to and from the PICAXE via WiFi, I will be on a roll with my project.

DS
I have used php to collect data from the esp01.
if you go to php.net you will see stuff related to UDP sockets and you can send bytes of data that way and process it.

for example

// UDP SEGMENT
if(!($sock = socket_create(AF_INET, SOCK_DGRAM, 0)))
{
$errorcode = socket_last_error();
$errormsg = socket_strerror($errorcode);
die("Couldn't create socket: [$errorcode] $errormsg \n");
}
//echo "Socket created \r\n";

if( !socket_bind($sock, "0.0.0.0" , 8889) )
{
$errorcode = socket_last_error();
$errormsg = socket_strerror($errorcode);
die("Could not bind socket : [$errorcode] $errormsg \n");
}
echo "Socket bind OK \n";

//echo "\n";
//Receive some data
$r = socket_recvfrom($sock, $buf, 65535, 0, $remote_ip, $remote_port);
//echo "$remote_ip : $remote_port -- " . $buf . '\n';
$data = substr($buf,0,65535);
echo "".$data. "\r\n"; // OUTPUT DATA TO CONSOLE

socket_close($sock);
 
Top