Static IP wifi with UIFLOW 1
-
Hi,
Is possible to assign a static ip using UIFLOW? with arduino i can, but with uiflow i´m not able. i would to try with uiflow because with arduino i´m having problems using two TOF units with the hub. In uiflow works perfect but would need static ip to receive UDP commands.Thanks
-
Static IP?
TOF units are I2C devices so require I2C addresses.
What hub are you trying to use as you need a PAHub that will change the addresses to 0x70 to 0x76 (I think) -
Hi, sorry, i didn´t explain correctly. My problem is that with arduino i can not control properlly the pahub and get readings from the TOF modules, but i can set an static IP. What i need is to send and receive UDP commands to and frm the M5 Core (the values of the readings and orders over relays).
With UIFllow, i can manage the PaHUB correctly, but i can not have a static ip in order to send the UDP commands to tjat specific unit.
There are several units on the network.For the moment, i´, doing UDP broadcast and i will play with specific commands for each unit, but i was wondering if is possible to assign a static IP. All the units are the same, they will do the same job/same code so update them would be much easier with static ips instead of having specific code for each of them.
-
No every I2C unit connected to the core MUST have its own I2C address and must be called separately.
-
@Danalux - If I may, I'd like to restate your situation and then make a (hopefully useful) small suggestion. Please correct me if the following is wrong:
If I'm understanding you, you have two totally separate problems and, having tried two separate programming environments, have found that each environment allows you to solve only one of the problems - but you want to solve both problems at the same time to get your project to work.
Problem (A): you have two ToF units which have been connected to a PaHUB and then the PaHUB is connected to an M5 Core. You need to be able to configure the PaHUB in order to talk to the two ToF units without them getting confused, but just using the normal I2C library is not working, there is some extra magic that is required.
Problem (B): you want to talk to the completed project from another device using UDP over your network connection (this "project controller" is possibly a desktop computer, possibly another microcontroller, it does not matter which, we just care that it wants to use UDP). You want to give the M5 Core a static IP address so that the project controller knows where to send the messages in order to know that it is talking to the correct device.
When you use UIFlow, you can solve (A) but not (B). When you use Arduino, you can solve (B) but not (A).
Normally, (B) is a very standard sort of thing to want to do (it is very very common to want to set a static IP address no matter what hardware or what programming environment your project is using), whilst (A) is rather tricksy (not that many people have to use a PaHUB or similar, if only because many I2C devices allow you to change the I2C address, which makes it easier to use two identical sensors on one gadget).
So you are - very reasonably - hoping that UIFlow ought to be able to solve (B), the more commonly encountered problem, hence your original question: does anyone know how to set a static IP address when writing a program using UIFlow.
Now, assuming that you agree that I've just described the situation accurately, I'm sorry to say that - I do not know how to set a static when using UIFlow! Sorry.
BUT as you say you are using Arduino as an alternative, you might like to read this article from Adafruit, which explains how the chip inside the PaHUB works and provides an example of how to use it from an Arduino sketch. Using this, you should be able to use the PaHUB and the two ToF units from your Arduino sketch. If you plug everything in and then run the "scanner" sketch you should see how to make your sketch work.
Failing that, as I don't know UIFlow, I'd suggest looking at how your local network is controlled. If you can't set a static IP then the M5 Core is presumably picking up an IP adrress from a DHCP server on the network, very probably one within your Router. Your DHCP server ought to be able to always give the M5 Core the same address, one that you select and therefore one that you can tell to the project controller. As long as the devices are always being used on your local network that will have a very similar effect to setting a static IP. Not 100% the same, but often Just Good Enough.
-
Oops, sorry, forgot to give the URL for the Adafruit tutorial!
https://learn.adafruit.com/adafruit-tca9548a-1-to-8-i2c-multiplexer-breakout?view=all
-
@sgllama Now that makes more sense.
For the data collection side of things I have an MQTT server set up on my host device which is set with a fixed IP address.
All my. controllers don't need fixed IP address, their IP address are irrelevant.
The important thing is that the MQTT code sends to the fixed IP address host.The TOFs.
Ok so you need to have the code/libraries to both access the TOF sensors and the Host PAHUB controller.
I once wrote a guide on how to connect 2 TOFs via a PAHub to an M5Stack controller but it looks to have gone missing.
This is how the TOFs must be configured in UIFLow2.
Here is the Project Zone Link just for reading the 2 Time of Flight Units. https://uiflow2.m5stack.com/?pkey=bf8abdb1dd8c4e47b52de320c9206ecc
-
@sgllama i could not explain better! Thanks!.
Finally i´m doing with UIFlow, and sending broadcast UDP orders. Every Core unit will have its own orders. About the router option that will give always the same IP address to same mac devices, i have to take a look at that option.
The problem that i´m facing now is that when i want to receive an UDP packet, the loop program gets waiting until a packet arrives.