Download the program for the device via the Internet.

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

Post Reply
gilanetugila
Posts: 268
Joined: Thu Jul 30, 2020 2:01 pm
Has thanked: 7 times
Been thanked: 1 time
Contact:

Download the program for the device via the Internet.

Post by gilanetugila »

Good evening! I am interested in a simple solution to the problem of downloading a program for the device using the standard modules of the Flowcode program.
Attachments
TCP_WLAN_Webserver.jpg
TCP_WLAN_Webserver.jpg (19.41 KiB) Viewed 1987 times

chipfryer27
Valued Contributor
Valued Contributor
Posts: 769
Joined: Fri Jun 06, 2014 3:53 pm
Has thanked: 185 times
Been thanked: 204 times
Contact:

Re: Download the program for the device via the Internet.

Post by chipfryer27 »

Hi

I'm not sure I understand the request. Is it help in providing Internet connectivity to projects?

If so, there are broadly speaking four ways to do so.

You could use a LAN module where you plug your project into a free router port.
You could use a WiFi module (e.g. esp8266) which connects your project to your WiFi router
You could use a GSM module which connects your project over the cellular network
You could use a microcontroller with inbuilt connectivity such as an esp32 or Raspberry Pi

However you may need to upgrade to v10 to be able to use certain targets. Flowcode v10 is now completely free for non-commercial purposes, includes ALL components and has many "free" chips including certain esp's.

Regards

mnf
Valued Contributor
Valued Contributor
Posts: 1200
Joined: Wed May 31, 2017 11:57 am
Has thanked: 70 times
Been thanked: 440 times
Contact:

Re: Download the program for the device via the Internet.

Post by mnf »

If you want to 'download' a program - then you are limited to targets
(for example the esp32) which can handle OTA updates. Don't expect it to be easy.
It would also be possible on something like a Raspberry Pi - where your 'main program' could download new programs - and run them.

If you are using Arduino = then it's probably a non starter (it is possible to set the fuses so that the running program can modify the program memory - take a look at Arduino Forth) Depending on what you want to modify the program to do - one option would be to write a simple 'interpreter' - for your own language (again nobody said it would be easy - but for simple tasks it would be doable)

As Iain said upgrading to v10 is a very good idea.

Martin

gilanetugila
Posts: 268
Joined: Thu Jul 30, 2020 2:01 pm
Has thanked: 7 times
Been thanked: 1 time
Contact:

Re: Download the program for the device via the Internet.

Post by gilanetugila »

Good afternoon! The flowcode 8 program presents all the possibilities for such "creativity", we can only reveal this well-hidden potential.
Most likely, it is not a program to transfer, but some kind of variable (to begin with).That is, the program of one controller sends a variable to another controller. In another controller, this variable is taken from long-term memory and used in the program body. The program is running, the variable is decreasing. And when this variable becomes equal to "0", a certain device stops working. The user connects the WLAN cable to his router and downloads the variable (there will be several of them, they are different for each device).
Thus, it is necessary 1) controllers get their ip address, for cheapness we will use a dynamic address. 2) you need to see this address on the lcd1602 indicator.3) the device receiving variables also receives its ip address by connecting via cable to the router.4) next, the manufacturer and the user communicate with each other and transmit information about their IP addresses to each other. 5) variables are being transferred.6) the manufacturer prays for the health of the flowcode program developers, and the user for the health of the manufacturer. Everyone is happy.

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: Download the program for the device via the Internet.

Post by kersing »

Sounds very complicated and you are not talking about programming a device, just updating a variable.

Consider using the TCP/IP component (or WLAN) to connect to a named (web)server to request the new value (use a unique ID for each device) and storing the information using the eeprom component.
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

gilanetugila
Posts: 268
Joined: Thu Jul 30, 2020 2:01 pm
Has thanked: 7 times
Been thanked: 1 time
Contact:

Re: Download the program for the device via the Internet.

Post by gilanetugila »

Good evening! Yes, you are right, the values of variables will be updated via the Internet. Dragging the program back and forth will complicate the task.
And about your "“Integrity is doing the right thing, even when no one is watching.”― C.S. Lewis" I have the impression that you are using his statements incorrectly. And I've already heard it from you once...If only you could quote Christian companions, scientists, engineers, inventors, politicians...And the statements of the storyteller are not appropriate in this episode.
Or do you use his statements because he is a science fiction writer and this inspires you to solve impossible, fabulous tasks?

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: Download the program for the device via the Internet.

Post by kersing »

I've already heard it from you once...
Have you heard about signatures? That is mine. Has been for a long time. It will be displayed on all my messages on this forum, no matter what the content.
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

chipfryer27
Valued Contributor
Valued Contributor
Posts: 769
Joined: Fri Jun 06, 2014 3:53 pm
Has thanked: 185 times
Been thanked: 204 times
Contact:

Re: Download the program for the device via the Internet.

Post by chipfryer27 »

Hi
Have you heard about signatures? That is mine.
In my opinion your signature is rather apt.

Getting back to the FC subject, to do remote firmware upgrades then as Martin mentions you are limited in choice, but if only to send variable / status updates then as Kersing mentions your description does sound rather complicated, perhaps over complicated?

It is not too difficult to create a chart that will allow a device to communicate with another device to swap information or to send information to a host.

Examples in the forum include communicating with ThingSpeak, communicating with PushingBox, setting up / using MQTT broker, point-to-point communications and also updating your own records held either in Excel or MySql.

Unless you specifically need to capture the individual IP addresses of clients, perhaps for some logging feature, I'm not sure why you would need to do this or even display the address at all unless part of some "status" message displaying progress. If sending to your own database/device you would most likely be sending some ID along with data as Kersing mentioned above, and if to ThingSpeak (for example) you would be using a unique API-key to identify your device.

Using DHCP simplifies things but of course your target will need a static address if your own "server". Using WiFi is more convenient if available.

Roughly, your clients will

Decide when it is time to communicate
Create / open a connection to target
Transfer data
Close connection

As mentioned there are examples in the forum and if you can be a little more specific in what you want to achieve then we can probably help further.

Regards

gilanetugila
Posts: 268
Joined: Thu Jul 30, 2020 2:01 pm
Has thanked: 7 times
Been thanked: 1 time
Contact:

Re: Download the program for the device via the Internet.

Post by gilanetugila »

Good afternoon! You wrote that using Wi-Fi would be more convenient than WLAN. I agree that it will be more convenient for the consumer, but not easier than WLAN, because you will need to use either one of the esp32 or esp8266 modules, or invent something yourself, plus all sorts of laptops and phones that will automatically connect to this WI-FI source. And for WLAN, you probably only need an RJ45 connector, well, maybe even a tightening with resistors and power.
As for why it is better to use a dynamic address: you do not have to pay for it, there are no servers yet-there are two controllers between which you need to transfer variables. And then there will be a permanent address - there will be those who want to conduct some kind of "hacking experiment"... And so the communication session ended and that's it.
I read your letter and did not understand anything, as well as the comments "Examples on the forum include communicating with ThingSpeak, communicating with PushingBox, configuring/using the MQTT broker, point-to-point communications, as well as updating your own records stored either in Excel or MySQL." I got the impression that I approached a large mountain with a burning desire to disassemble it, but I only have a small children's shovel in my hands.
I'll see what else there is on this topic in the forum and the network, and then how the engineering curve of capabilities and accessibility will lead.
Maybe you can tell me which words to search for, so that it is more effective.

chipfryer27
Valued Contributor
Valued Contributor
Posts: 769
Joined: Fri Jun 06, 2014 3:53 pm
Has thanked: 185 times
Been thanked: 204 times
Contact:

Re: Download the program for the device via the Internet.

Post by chipfryer27 »

Hi

I think some confusion in terms. When I mentioned WiFi I meant WLAN (wireless local area network).

I assume you have internet connectivity on site with the client(s) so it would be easy for client(s) to connect to that router and pass traffic. If the router doesn't offer "WiFi" access then you could potentially use a cable connection between client and router (RJ45 patch lead or a Cat5 / Cat5e / Cat6 fixed cable).

If the router is already providing a WiFi signal then with a strong password for the SSID (name of the WiFi signal) potential hackers won't find it too easy to gain access. Anyone wishing to gain access would need to know the name of the SSID (which you can hide) and the password. Depending on your router, you can only let known MAC addresses connect, further improving security.

You could go down the route of writing your own "stack" to handle the communication protocols but far easier to use an existing module, either a LAN module (physical cable to router) or WiFi such as the esp8266 module. I think the esp8266 will be cheaper than the LAN module simply due to popularity. These modules do all the hard work for you and can either be set with a fixed IP or obtain one dynamically from the router.

So to clarify, will you be using an existing router to allow your clients to talk to your host? If so will it be WiFi or LAN connection?

If there is no router do you intend creating your own LAN (either WiFi or physical cable)? This could be one module (e.g. 8266) that allows others to connect to it.

I agree that at first it can seem quite daunting trying to understand how to connect, but it really isn't too difficult once you establish what infrastructure they will connect over, what data must be sent and what / who will do with the data.

If you can tell me what your goal is I can offer further advice.

For example if you had an existing router connected to the internet you could

Update a "host" service such as ThingSpeak.
Send "Push" messages to mobile phones or email alerts via a service such as PushingBox
Use a MQTT Broker service
Create a point-to-point link between client and whatever / wherever and pass variables etc

With no internet connection you obviously can only communicate locally.

Again you could use a MQTT broker but hosted locally either on a PC or microcontroller such as a Pi
Create point-to-point links and pass variables etc

Many things can be done once you establish what it is you actually need to do.

Regards

gilanetugila
Posts: 268
Joined: Thu Jul 30, 2020 2:01 pm
Has thanked: 7 times
Been thanked: 1 time
Contact:

Re: Download the program for the device via the Internet.

Post by gilanetugila »

Good evening! Yes, I confused the WLAN and just the LAN...IYes, I have the option to connect with a cable from the router or via WI-FI. Only I don't remember my password or my router login. Do I need to know them for our project? If necessary, then I will contact the support service.
Have just looked at my version of the program, there is an ESP8266 module there. And this is the only module (of those that are in the program and the store, the rest must be specially ordered).
And you say that you can use it to send sms. This is very promising and even useful in this project. But! I'm afraid that it will have the same story as the spi module, it seems to be there, but it doesn't work. I wanted to know if you have already worked with this module? does it have the same problems as with the spi module? If you have worked with it and it has no problems with compilation and other problems, let's use it. Do we only need this module or another controller?
Happy holidays! World Engineering Day is celebrated annually on March 4, starting in 2020. This is a professional holiday for engineers, scientists and inventors!

chipfryer27
Valued Contributor
Valued Contributor
Posts: 769
Joined: Fri Jun 06, 2014 3:53 pm
Has thanked: 185 times
Been thanked: 204 times
Contact:

Re: Download the program for the device via the Internet.

Post by chipfryer27 »

Hi

Happy holiday to you too, but I wish I knew of it earlier. I'd have went to the pub rather than work :)

I'm getting a better picture of what you are trying to achieve and yes, I've done it and also shared in the forums too.

The esp8266 is a "go to" module for me to provide connectivity for PIC's etc. Very cheap and easy to use. It connects via the UART and I have no issue in using them. Well not quite true. There is a long standing bug in a macro and Kersing very kindly modified the component for me. It is easy enough to work around the bug though if the response is specifically required (usually not).

Do a search for PushingBox. It's a gtreat service. Free for relatively modest use. Once you sign up you can create an "action" and by that I mean if you "trigger" then it will send a Push message or send an email. These are just examples and many more actions are available. It doesn't send "SMS" as such, you download an app to your phone and it's this app that receives "push" notifications. You can have it on your PC too.

To trigger, you obtain a unique API-Key which is just a big string. When you send this string to their server it recognises your unique api-key and performs the action you want.

Your router may have the SSID and Password attached to it, maybe on a sticker or such like. It may also have a "reset" button that takes it to default settings. It really is a lot more convenient to use WiFi rather than a cable, so try and gain access.

Have a good think on what you want to do, in terms of what your client does, when and why it needs to transfer data, where the data will go, what will happen to the data once received, will the client expect a reply, and any additional features such as sending an alert (e.g. PushingBox or similar).

Regards

gilanetugila
Posts: 268
Joined: Thu Jul 30, 2020 2:01 pm
Has thanked: 7 times
Been thanked: 1 time
Contact:

Re: Download the program for the device via the Internet.

Post by gilanetugila »

Good evening! I'm currently accessing my WI-FI-trying to figure out my username and password or how to get them. You wrote that some kind of application should be installed on the computer. That is, to send and receive SMS, I need to use a computer. This is not a good idea. I thought, let's say, to enter these messages into the program and when an event occurs, the esp8266 module will send everything by itself having only access to the network, well, I suppose I have to read the received messages, but to send I need esp8266, a router, a computer, a program on the computer, a layer between the computer and the chair. Some kind of quest...Then it turns out that it is not the module itself that sends and receives the message, but some kind of server that is working today, not tomorrow.

Maybe I misunderstood. I once watched a little video about this module and it described these technical perversions...

As for how the data will be sent. Well, probably the approximate procedure will be as follows: when the time is right, the client turns on his device, presses the power button on the esp8266 module integrated into the device, then this module sends an SMS in which: 1)the device number is located 2) IP address 3) receives an SMS that I am ready or not ready to send data 4) data in the form of encrypted variables is transmitted to the user. 5) The user module sends confirmation of receipt of variables.(this may happen after getting all the variables at once or separately)

chipfryer27
Valued Contributor
Valued Contributor
Posts: 769
Joined: Fri Jun 06, 2014 3:53 pm
Has thanked: 185 times
Been thanked: 204 times
Contact:

Re: Download the program for the device via the Internet.

Post by chipfryer27 »

Hi

There is no need for a PC unless you want to use one to receive data / push messages.

To be very clear, for a module to send and receive SMS messages you would need a GSM module with a valid SIM card, not LAN / WLAN. Entirely different technology.

The messages to a mobile phone / PC I mentioned were "Push" messages and for that you download an app to your phone / PC. The esp8266 would simply connect to a server and send a unique key. The server service then does the rest.

To use an esp8266 to send you have three options depending on your intent.

You could have another esp8266 configured as a host, allowing your clients to connect directly with it using their inbuilt WiFi. You would have a range of up to 50m between them (info obtained from another forum member tests).

Connect over a LAN which allows greater distance

Connect to a remote location via the internet and for that you need internet connectivity from a router.

From your description is sounds to me like:-

You will have a Host located remotely from clients.
Client will connect over the internet with host.
Client / host will swap data

I'm not sure why you would physically need to turn on devices, nor why you need to gather IP addresses. I foresee big problems if your user tries to communicate and you are not ready to receive at exactly the same time (i.e. within a few hundred milliseconds of attempt).

Have a search for MQTT broker as this may offer what you need. Basically each presence can subscribe / publish to others. Alternatively use point-to-point. Your host device needs a fixed/static IP address and this is preprogrammed into clients. Clients then connect to your host and swap data.

Regards

gilanetugila
Posts: 268
Joined: Thu Jul 30, 2020 2:01 pm
Has thanked: 7 times
Been thanked: 1 time
Contact:

Re: Download the program for the device via the Internet.

Post by gilanetugila »

Good afternoon! Yes, you are right, you should not contact SMS messages in such volume yet. It is enough to receive an SMS from a client once, and then receive and send messages through the es8266 module-enter several variables in advance, they will correspond to certain messages that can be read on the lcd screen and then send or receive them.

I will purchase esp8266 modules in the near future. As for the permanent ip address, well, I have it constant during the time the router is on, and I have it on all the time. And so it makes no sense to buy separately until there are no users and the device itself.

gilanetugila
Posts: 268
Joined: Thu Jul 30, 2020 2:01 pm
Has thanked: 7 times
Been thanked: 1 time
Contact:

Re: Download the program for the device via the Internet.

Post by gilanetugila »

Good afternoon! I read a little bit about the esp866 module today, it turns out that everything is not so simple here either-in the sense that there are several of them and they have their advantages and disadvantages. Now I'm trying to determine which one is more suitable. But despite the fact that this thing can do a lot, it depends on the fact that someone has stopped producing these modules - the idea is so-so, do you know if anyone has tried to implement the functionality of this module by soldering and manufacturing boards so that everything works like on an esp8266 board? I just somehow came across a purchased power supply module, I was looking for an error for two weeks...the malfunction appeared, then everything worked fine-most likely either the track on the board was cracked or the soldering was bad. I replaced the module with my own power supply-everything worked. Naturally, I did not buy modules after that.

chipfryer27
Valued Contributor
Valued Contributor
Posts: 769
Joined: Fri Jun 06, 2014 3:53 pm
Has thanked: 185 times
Been thanked: 204 times
Contact:

Re: Download the program for the device via the Internet.

Post by chipfryer27 »

Hi

I've bought quite a few ESP8266 modules from various sources including the cheap online marketplaces. Generally speaking I've had little trouble, but on occasion the "cheap ones" had problems attributed to build quality and were returned for refund. Reviews from other buyers are a good guide to what you can expect.

I've only ever used the modules so can't really comment on implementing the chip itself in a design.

One thing to note though is that they seems to come with random versions of their firmware. Two from same supplier could have different versions.

First thing I do is update to the latest and this isn't too troublesome to do and I've posted before on obtaining and installing.

Regards

gilanetugila
Posts: 268
Joined: Thu Jul 30, 2020 2:01 pm
Has thanked: 7 times
Been thanked: 1 time
Contact:

Re: Download the program for the device via the Internet.

Post by gilanetugila »

Good evening! Thanks for the tip about the firmware for esp 8266 modules.

chipfryer27
Valued Contributor
Valued Contributor
Posts: 769
Joined: Fri Jun 06, 2014 3:53 pm
Has thanked: 185 times
Been thanked: 204 times
Contact:

Re: Download the program for the device via the Internet.

Post by chipfryer27 »

Hi

Once you obtain, let me know and I'll look out the links regarding upgrading to latest. I've been a bit busy recently and haven't had as much forum time as I'd like.

Regards

gilanetugila
Posts: 268
Joined: Thu Jul 30, 2020 2:01 pm
Has thanked: 7 times
Been thanked: 1 time
Contact:

Re: Download the program for the device via the Internet.

Post by gilanetugila »

Good afternoon! Here's where the thought came: the instructions for the esp8266 modules say that their signal reception and transmission range can reach up to 100 meters. I will have 2 modules, one will receive, the other will send. With your help, I hope to connect one to my router. And how and where do I connect another esp8266 module. Do they have the ability to scan the network and connect to another network if neither the username nor the password is known? Otherwise, the experiment will not be clean-the modules can communicate with each other without using a router.

chipfryer27
Valued Contributor
Valued Contributor
Posts: 769
Joined: Fri Jun 06, 2014 3:53 pm
Has thanked: 185 times
Been thanked: 204 times
Contact:

Re: Download the program for the device via the Internet.

Post by chipfryer27 »

Hi

Broadly speaking:-

Option 1 - Module to Module, no router

In this scenario there is no router and the modules will communicate between themselves. One module is setup as an access point. This module then broadcasts a WiFi (SSID) signal and any other module within range can connect to it. You are free to choose any name for your SSID and set a password. Only devices that know the SSID and password can connect (e.g. other esp8266s, mobile phones or PCs).

Other esp8266s are set to be clients and are setup to connect to your SSID. Usually you will preprogram connection details (SSID / password) but you can instead have them scan the area for SSIDs, choose one, enter the password etc. This however is a LOT of work and eats up resources. Far simpler to just preprogram.

In the above scenario you are limited in range. 100m may be under ideal line-of-site conditions with appropriate antenna. Walls will decrease range. Another forum contributor did get 50m outside though.

The modules only need a few instructions to connect and send data between themselves.

Option 2 - Module to Router

In this scenario you have an existing router. Modules are setup as clients and connect to the router (SSID / password). All communications pass through the router. Clients can either connect to the same router or if the router provides internet access then they could be anywhere in the world.

Usually you will preprogram connection details (SSID / password) into the esp8266s but you can instead have them scan the area for SSIDs, choose one, enter the password etc. This however is a LOT of work and eats up resources. Far simpler to just preprogram.

Again the modules only need a few instructions to connect.

Benj shared a routine that checked if the modules were connected to a SSID and if not entered a routine to setup the connection. This setup was done via a mobile phone or PC. Although this reduced the need for components and greatly simplified the process, it's still resource heavy if using a chip with limited capabilities. If possible preprogram.

Chips communicate with the modules over UART. I usually use "AT" commands to send the instructions as this allows full control.

The following link documents another forum contributor creating a point to point link using esp8266s. One module gathered sensor data and sent to another module. The "receive" module passed the data to a PC for collection in Excel. Many pages to read through and within it provides links to update esp8266 firmware and example code that could be used as a framework.

https://www.flowcode.co.uk/forums/viewt ... f=3&t=1774

Regards

gilanetugila
Posts: 268
Joined: Thu Jul 30, 2020 2:01 pm
Has thanked: 7 times
Been thanked: 1 time
Contact:

Re: Download the program for the device via the Internet.

Post by gilanetugila »

Good evening! Thank you for the information! Today I purchased ESP8266 ESP-12E V3 Nodemcu-CH340 WI-FI modules. In the near future I will try to solder to the pile. You said that you need to update the firmware (or if V3 is not necessary?). Can this be done by connecting the module with a cord from the micro usb connector on the module to the USB connector of the computer or in another way? And connect the controller to the module via the uart bus(RS232).

chipfryer27
Valued Contributor
Valued Contributor
Posts: 769
Joined: Fri Jun 06, 2014 3:53 pm
Has thanked: 185 times
Been thanked: 204 times
Contact:

Re: Download the program for the device via the Internet.

Post by chipfryer27 »

Hi

Unfortunately I have very little experience with the 12's only the 01such as these

https://www.amazon.co.uk/AZDelivery-ESP ... 0aWM&psc=1

I think they may share the same command code though. If so then the link I shared above to the articles will document commands to check versions etc and you should be able to use the "AT" commands as documented.

I might have a couple of 12's hiding in a drawer. If I find them I'll have a play, but that will be at the weekend (assuming I find them). Really cannot comment on the USB capabilities as I haven't used them.

Sorry I can't be of much help at present.

Regards

Edit.....

I think the 12's were used in the post I linked to.

gilanetugila
Posts: 268
Joined: Thu Jul 30, 2020 2:01 pm
Has thanked: 7 times
Been thanked: 1 time
Contact:

Re: Download the program for the device via the Internet.

Post by gilanetugila »

Good afternoon! I haven't started soldering or connecting the controller, screen, buttons,ESP8266 module, power supply yet-I'm just buying what I need. It's okay that you have an example (lesson) on version 01, tomorrow I'll try to purchase ESP 8266-01 to make it easier. And I'll leave version 12 for later, because for now I only need to transfer variables from one controller to another via wi-fi. I also wanted to know if, in principle, these modules have the ability to transmit a voice message?

chipfryer27
Valued Contributor
Valued Contributor
Posts: 769
Joined: Fri Jun 06, 2014 3:53 pm
Has thanked: 185 times
Been thanked: 204 times
Contact:

Re: Download the program for the device via the Internet.

Post by chipfryer27 »

Hi

I think it depends on what you mean. The issue is if the microcontroller is powerful enough for the task of holding an actual conversation in real-time.

Regards

Post Reply