PIC18F25K22 UART ERROR

For general Flowcode discussion that does not belong in the other sections.
SILVESTROS
Posts: 90
http://meble-kuchenne.info.pl
Joined: Tue Dec 13, 2022 9:04 pm
Has thanked: 24 times
Been thanked: 1 time

Re: PIC18F25K22 UART ERROR

Post by SILVESTROS »

Hi,
thanks for info. Yes , senders are for different players. To avoid mistakes,would you like to send me an example with modifications to below codes, for 2 senders with 2 different IP, and 1 receiver ?
many thanks in advance.
Regards
Attachments
ESP8266-SENDER-PIC18F46K22.fcfx
(37.19 KiB) Downloaded 252 times
ESP8266-RECEIVER-PIC18F25K22.fcfx
(30.78 KiB) Downloaded 253 times

chipfryer27
Valued Contributor
Posts: 1147
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 284 times
Been thanked: 412 times

Re: PIC18F25K22 UART ERROR

Post by chipfryer27 »

Hi

I need to refresh myself with the AT commands to check on how to change the AP IP addresses (in your receiver). It's a one-time command, well, unless you want to change it again:)

No access to Flowcode for the next couple of days or so, but from memory, which may be fading, we had a User Macro that was called to gather your data. In that macro we sampled sensors etc and built up a string to send. When we start to build that string we will first include the "ID".

I forget the name of the string, lets just call it string.

We probably had:-

String="" (this cleared the string for new data)

We then built the string using String = String + whatever etc.

If ID = "1" we would now have:-

String=""
String=String+ID
etc

Nothing needs done in Rx as it simply passes on whatever is received to Excel. Now, the data Excel receives will start with the ID (1,x,y,z etc).

Do note that in the original examples there is no provision to check if it is clear-to-send or if the data was received. You may need to incorporate checks if you have many transmitters.

Regards

SILVESTROS
Posts: 90
Joined: Tue Dec 13, 2022 9:04 pm
Has thanked: 24 times
Been thanked: 1 time

Re: PIC18F25K22 UART ERROR

Post by SILVESTROS »

Hi,
I had made a sketch for 2 codes, long time ago. I send you a copy for sender-receiver in case that you have no access to flowcode. Would you like to note in the codes the modifications , to have data from 2 senders in sequence to one receiver ? thanks.

regards
Attachments
RECEIVER.jpg
RECEIVER.jpg (100.27 KiB) Viewed 8004 times
SENDER.jpg
SENDER.jpg (94.51 KiB) Viewed 8004 times

chipfryer27
Valued Contributor
Posts: 1147
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 284 times
Been thanked: 412 times

Re: PIC18F25K22 UART ERROR

Post by chipfryer27 »

Hi

Both transmitters are exactly the same, we just add in the unique "ID" when you code. We create a new string variable called ID (or even Tx if you want) and this value is different for each transmitter.

For transmitter-1, you could have ID="1" and for transmitter-2 ID="2"

When you build your send string, which from above is called data, we would now have

Data = "" this clears the string for new values
Data = Data + ID this adds the ID to the string, now data=1
Data=Data + "," this adds in a comma to separate the values. Now data = 1,
Data = Data + force
etc
etc

Regards

SILVESTROS
Posts: 90
Joined: Tue Dec 13, 2022 9:04 pm
Has thanked: 24 times
Been thanked: 1 time

Re: PIC18F25K22 UART ERROR

Post by SILVESTROS »

Hi,
I hope to find you well..I would like to make some tests with 6 players ..one transmitter for each player..Data must be send to one receiver...I set different ID in Data string for each transmitter (STA) , to separate data for each player.
What changes must be done to ( ESP_Initialise_Setup ) at transmitter and ( ESP_Setup ) at receiver , to receive data from all players ? Data can be received at the same time from all transmitters, or with sampling and send in sequence ? what about IP of ESPs-8266 ? in which ESPs must be change the default IP ? Is it possible to work the set 6 transmitters --1 receiver with the same IP in each transmitter ? thanks .

regards

chipfryer27
Valued Contributor
Posts: 1147
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 284 times
Been thanked: 412 times

Re: PIC18F25K22 UART ERROR

Post by chipfryer27 »

Hi

I need to check back on things. I can't remember if we used static addresses (but don't think so). From memory, your receiver will assign an IP to each transmitter once it connects to the SSID so no need to worry about that.

The only issue is the number of clients (transmitters) that can connect to an access point (receiver). I think the ESP8266 is limited to 4 clients so that would only allow 4 x transmitters.

I think the ESP32 has a limit of 8 though, so perhaps use that as the receiver?

Another option could be to use a separate router with all ESP8266's connecting via it. That would be an easy option to implement and would allow dozens of devices to communicate.

Regards

SILVESTROS
Posts: 90
Joined: Tue Dec 13, 2022 9:04 pm
Has thanked: 24 times
Been thanked: 1 time

Re: PIC18F25K22 UART ERROR

Post by SILVESTROS »

Hi,
I would like to make some tests to collect data from 12 senders at same time.. how to change IP in every ESP8266 that act as STA ? ...so I'll set a different IP for every sender to make pairs with corresponding receivers..to use if it possible in a peer to peer network..how to connect these 12 receivers (each receiver has its own USB UART board ) to send data to PC ?

regards

chipfryer27
Valued Contributor
Posts: 1147
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 284 times
Been thanked: 412 times

Re: PIC18F25K22 UART ERROR

Post by chipfryer27 »

Hi

What you are proposing is now significantly different to the original project.

First issue is that Excel Data Streamer only supports a single connection (i.e. one receiver) at a time (as far as I can make out), therefore the project as you propose is a non-starter.

If you use a separate WiFi Router, you could have pretty much as many transmitters as you wish talking to one receiver that acts as the interface to the PC/Excel.

Say your WiFi Router has an SSID of "GameDay" and had a Gateway address of 192.168.1.1 and gives out addresses in the range 192.168.1.2 - 254

You would set the Rx ESP8266 module to be a client connecting to "GameDay" with a fixed / static IP address of 192.168.1.2

All Tx modules would be set to connect to "GameDay" and optain an address automatically (you only need to change the target SSID from what you already have). You would of course have included the Tx ID as discussed in previous posts. Then change the IP address the Tx modules connect to, to that of the Rx module, 192.168.1.2.

That is pretty much all you need to do.

Actually, using a WiFi router, if your PC connects to that too then you may not need the receiver module at all.

Regards

SILVESTROS
Posts: 90
Joined: Tue Dec 13, 2022 9:04 pm
Has thanked: 24 times
Been thanked: 1 time

Re: PIC18F25K22 UART ERROR

Post by SILVESTROS »

Hi,
many thanks..actually it works with wi-fi router..
Now I made a second pair sender-receiver to test max.range of ESP-8266. The first pair with IP 192.168.4.1 works well . In the second pair sender-receiver I was changed the IP of two ESP-8266 with AT command (AT+CIPSTA_DEF="192.168.4.2","192.168.4.2","255.255.255.0") for sender(STA) , and (AT+CIPAP_DEF="192.168.4.2","192.168.4.2","255.255.255.0) for receiver(AT) . It works until "waiting for Data". but I get no Data...What's wrong for that pair?.. Also I was changed the IP in sender code ( Ret=WLAN_ESP8266:Client Connect(0,"192.168.4.2",80) at ESP_Initialise_Setup )..SSID and password must be changed also ? thanks.

Regards

SILVESTROS
Posts: 90
Joined: Tue Dec 13, 2022 9:04 pm
Has thanked: 24 times
Been thanked: 1 time

Re: PIC18F25K22 UART ERROR

Post by SILVESTROS »

Hi,
I found it...There was a problem with one ESP-8266 module. I set up two pairs with different IP , and I'll test max. range of ESP-8266 in open air.

regards

Post Reply