PDA

View Full Version : ESP8266 - transfer some bytes PC<>PIC over wifi



flotulopex
- 26th December 2023, 23:06
Hi there,

I'd like to transfer a config ".TXT" file (it's a bunch of 100 bytes or so) from my PC to a PIC over wifi.

So first things first: power it up and find some AP to connect to.

BTW, this is the very common module I have, the ESP-01S:
9520


My first action is to get connected to the wifi, but I always get an error message when trying to list the networks (I can see at least five APs on my mobile):

9522


Has this "ERROR" something to do with the firmware? There are so many versions out there (mine looks already old...2015...) that I don't know where to look at for a start....

flotulopex
- 27th December 2023, 15:09
Okay, for now, I'm trying to get started with this piece of info https://www.instructables.com/Getting-Started-With-the-ESP8266-ESP-01/

🤞

Ioannis
- 28th December 2023, 22:05
Have you found what caused the Error?

Very interesting instructable link. Thank you!

Ioannis

HenrikOlsson
- 29th December 2023, 08:46
Have you tried with CWMODE = 3?

Also, see this:

https://stackoverflow.com/questions/55083806/esp8266-atcwlap-gives-generic-error-message-with-no-details

flotulopex
- 29th December 2023, 10:41
Have you found what caused the Error?

Unfortunately, no.

Still searching....

flotulopex
- 29th December 2023, 10:43
Have you tried with CWMODE = 3?

No. I'll give it a try when I'm back from office.

HenrikOlsson
- 29th December 2023, 15:15
I tried with an old module I had laying around.
I got the same issue no matter which CWMODE. But in the Stackoverflow post I linked to user urbanSoft (so all credit to him) writes:

That AT+CWLAP returns an error without any prior connection is desired behaviour.
The doc states that "AT+CWLAP connects an ESP station to a targeted AP with the last Wi-Fi configuration."

Since there is no last Wi-Fi configuration an error is returned.

So I tried that by connecting it to my network using AT+CWJAP="myssid","mypassword" and after that CWLAP worked as expected.

My module is really old with stock firmware. AT commands have changed and been added over the years so don't expect any and all examples you find on the internet to just work if they don't match the firmware.

amgen
- 29th December 2023, 15:52
do anyone want to try the ESP8266 programmed to be serial to WIFI 'bridge' ?? This is a few years old but all the info and files seem to be available.
Here is the link for github page

https://github.com/jeelabs/esp-link/blob/master/README.md


I would post about any issues I had or suggestions if anyone wants or needs that.

flotulopex
- 29th December 2023, 16:45
Have you tried with CWMODE = 3?

...as you suggested, I tried with mode 3 and:

9526

Thank you very much Henrik :wink:

flotulopex
- 29th December 2023, 16:53
do anyone want to try the ESP8266 programmed to be serial to WIFI 'bridge' ??.

Amgen, what exactly is a "bridge"? Is it what I actually want to achieve = send (small amount of) data, both ways, between a PC and a PIC over Wifi?

amgen
- 29th December 2023, 17:17
Amgen, what exactly is a "bridge"? Is it what I actually want to achieve = send (small amount of) data, both ways, between a PC and a PIC over Wifi?

Yes, instead of bridge, could use 'connection'......... what program or app would you use on the PC to receive and send data?

flotulopex
- 29th December 2023, 21:06
what program or app would you use on the PC to receive and send data?

Don't know yet.

I think I'm going to use some kind of mobile Terminal app or, if possible, a web browser or even make one by myself with MIT App Inventor which I'm already on my way but using Bluetooth for now which I'll need to change to wifi, obviously.

9528

I've no idea what will be the simplest and fastest to achieve...

It's really just about to send some data to a PIC, have the PIC acknowledging and storing if datat is okay. Voilą.

flotulopex
- 29th December 2023, 21:11
...can't edit my previous post.... so here is the picture ment to appear:

9529

amgen
- 29th December 2023, 22:20
I found that web browsers block from trying to access your internal network like putting 192.168.X.X into the address bar ...... But, old Hyper Terminal will connect and do send/receive except it intermingles the send/receive characters.
When you get to start testing...... my PIC18f2525 sends serial out every second (helps when connecting and checking functioning)
9530

HenrikOlsson
- 30th December 2023, 13:09
Quick note about something I re-learned yesterday.
It started when I tried to update the firmware of my ESP-01 module, it only has 4Mbit of FLASH so it did not work. Dug out an ESP-12F module and loaded 2.2.1.0 onto it. Flashing it worked fine but I could not get it to "work". Then I remembered...

Somewhere in the firmware history the default UART-pins for AT command have changed from GPIO.0/3 to GPIO.13/15.

GPIO.0/3 are still used to PROGRAM the thing but AT commands are now accepted on GPIO.13/15.

On version 2.2.1.0 CWLAP works in CWMODE=1 and CWMODE=3 without first connecting to an existing network. It also has AT commands for managing MQTT (don't know when those commands were added).

I have a command reference dated 2020 which includes the MQQT commands but no longer contains the command CWMODE. Instead it references CWMODE_DEF and CWMODE_CUR however neither of these work. Online documentation here (https://docs.espressif.com/projects/esp-at/en/release-v2.2.0.0_esp8266/AT_Command_Set/index.html) is back to just CWMODE.

So yeah, it's a bit of a mess....

flotulopex
- 31st December 2023, 09:24
There's quite a jungle of firmwares available for these ESP modules.

Which one should I use? Which one will allow me to "simply" send and receive a few bytes back an forth between a PC and a PIC?

If I already have a project doing the same (transferring bytes) but using Bluetooth HC-05 modules, will I be able to replace these Bt modules by the Wifi ones and it will work like 1:1 or is it not possible?

amgen
- 31st December 2023, 15:32
There's quite a jungle of firmwares available for these ESP modules.

Which one should I use? Which one will allow me to "simply" send and receive a few bytes back and forth between a PC and a PIC?

That is what I found about these 8266's. Plus I wanted to just deal with the serial/data/programming with the PIC and not have to add all the CWxxx's in the communications back and forth. So, the Jeelabs thing did that...... Programming these 8266 is about the same with different methods, I used the Espressif tool to put 4 files at the specified locations on the 8266. The Jeelabs page has files for the 8266-1 and -12. Sometimes had to flash 2 times to get the program to take..... after programmed, you open the onboard web page to make all the network settings.... then everytime it is powered up, it automatically hooks to the network you had set it for and waits for a connection and then automatically sends and receives serial stuff. Plus, you can access your PIC from local or anywhere in the world with internet. I was looking for others ideas for the routines/programs on the PIC plus apps or program on PC for easy simple comms for simple micro-controllers.
9531

flotulopex
- 1st January 2024, 17:58
Amgen,

Would you please share the firmware you've installed?

I tried so many that didn't work....

flotulopex
- 1st January 2024, 18:10
BTW, ESPRESSIF seem to have a firmware, the ESP-WROOM-02 Series that should fit the ESP8266 according.

https://docs.espressif.com/projects/esp-at/en/release-v2.2.0.0_esp8266/AT_Binary_Lists/ESP8266_AT_binaries.html


It looks very easy to download the firmware to the module since one can choose between multiple .bin files (for the "experts" I presume) or a single .bin file (for th rookie I am :D)

The download process runs well with the ESP8266 FLASCH DOWNLOAD TOOL v3.9.5 but once the download is done, an error will always occur - must be some data copy check that doesn't accept the final result.

So, still stuck and searching....

amgen
- 1st January 2024, 18:56
If this comes through, here is the zipped 4 files to load and the screen shot for the locations they have to programmed to. I believe all this is still on Jeelabs git pages.
I'm sure you know that the program files need to be referenced in the folder you have put them.
'
one more edit for you...... if I remember?!@#...... had to check/box the 'DOUT' ... it was little tricky but once you get it it goes easy
'
9535

flotulopex
- 2nd January 2024, 08:59
Thanks a lot Amgen, I'll give it a try tonight.

Until then, just a question about your addresses: are these really correct?

9536

...or does it just doesn't make any change if they have one trailing zero less?

amgen
- 2nd January 2024, 14:46
from the Git page.........
'
https://github.com/jeelabs/esp-link/blob/master/FLASHING.md
'
https://github.com/jeelabs/esp-link/blob/master/README.md

9537

flotulopex
- 2nd January 2024, 18:53
Okay, thanks to amgen, I finally successfully flashed my module.

But, still nothing works and sending AT+GMR will return...nothing at all.

Maybe my three modules are just defect...

I think I'm going to leave this by side for a while, go get a beer, and have some fun with something else and come back later :D

amgen
- 2nd January 2024, 19:53
hey man,...... YOU DON'T USE AT STUFF........
What you do next is......1) power up 8266... (3 volts)
2) Look at your live WIFI network list for the ESP device and hook up your computer/laptop to that network, I put screen shot-
3) that opens the onboard web page for all the settings and type of access point (you can figure out) or I will share what I did
4) restart the device with your UART TX,RX connected to pic...... open say Hyperterminal connection type TC/IP winsoc
5) connect to your network ..... 192.X...... or 172.XX.......... port 23
6) once connected, you can send and receive at the baud you have set
....... suggestion, program PIC to serout some crap say once/second,...... then when you connect you can tell if shit is working
.
.
9538
.
https://www.youtube.com/watch?v=y5qZrrovpuw

flotulopex
- 2nd January 2024, 20:57
I just realized I was using the flasher version 3.9.5 from the beginning.....

I found version 2.3 and guess what, all my modules are now updated successfully and I can check this via AT commands :wink:

9539

Amgen, I'm now going to read your previous post carefully.