2RELAY on Core2 v1.13.6
-
I'm trying to use 2x 2RELAY modules on a Core2, is this possible?
I've tried everything, but I can't access the modules. I've tried with just one of them, via Arduino and via UIFLow, which says that the module is probably not attached.I saw that it's possible to change the I2C address of the modules, but how do I do this, one at a time?
Thanks for any help...
-
Hello @cryptospok
I suggest you try with one 2Relay module first.
Make sure the 2Relay module is stacked properly and makes good contact with the M5Core2. You'll need to remove the gray bottom and the battery of the M5Core2 first as described here.
Thanks
Felix -
Hello @cryptospok :
It worked well on my hardware. In the example I will send you, you can alternate the address between 0x25 (default) and 0x30. If the M5 is disconnected while the address is set to 0x30, you will have a problem.This can possibly be solved by writing the address to the EEPROM and retrieving it at startup.
Best regards,
Roberto. -
-
-
Hi Felix,
I removed the original battery and the gray part, bought the M5GO2 to replace it, but now I'm not even using it.
I'm trying with just one module, but when I use the examples (I tried with my code and it didn't work either), I get the message that the module is not attached... I tried with each of them individually.Thank you.
-
Hi @Robertof,
Did you use UIFlow1?
I didn't find the 2RELAY module in UIFlow2.
I'll try to reproduce your tip and see if it works.Thanks!
-
Hi @cryptospok .
In my tests, I received that error when there was a conflict with the I2C address.
I used Uiflow V1.13.6; it’s a short text for 2Relay, and I also had trouble finding it.
I’m sending you the modified version that includes storing the I2C address in EEPROM.
If you need to save the state of the relays, you can also store it in memory.
Saludos
Roberto -
Hi @cryptospok .
-
This post is deleted! -
Hi @Robertof,
I reproduced and understood your code, but as you can see in the images, nothing happens.
I'm also using UiFlow 1.13.6, it seems that there is some error in the module library...
I'm testing with only one 2RELAY module at a time, but both have the same problem.
I think the connection is fine... if I put the battery module underneath, the Core2 works without the USC-C connection, that is, with the attached battery (M5GO2 module).
Could there be an update in the Core2 firmware?Thank you very much for your help!
-
Hello @cryptospok
something is very strange. Try a simple internal I2C scan and see if the 2Relay module shows up.
- Without any 2Relay module stacked the result should be: [52, 56, 81].
- With one 2Relay module stacked the list should be something like: [37, 52, 56, 81].
Note: I don't have an 2Relay module so I cannot test this myself.
Thanks
Felix -
Hi @felmue,
With one 2RELAY module, the result is: [52, 56, 64, 81, 102] and without is [52, 56, 64, 81]...
Sorry, I'm just starting with this...
Thank you very much... -
Hello @cryptospok
ok, I sorted the list w/o 2Relay out. I was testing with an M5Core2 v1 initially and it looks like you have an M5Core2 v1.1. So I re-run the test with an M5Core2 v1.1 and with that I get the same result [52, 56, 64, 81] as you without 2Relay.
So that would mean your 2Relay for some reason is using I2C address 102 (decimal) which is 0x66 (hex).
Try to run below code and hopefully that will work.
Thanks
Felix -
@felmue, the screen shows numer 1, only...
-
Hi @cryptospok
“It is correct that it gives you 1, it is the firmware version (I have the same version), now you can breathe easy. In the example I sent you, change all the 37s to 102 and the texts 0x25 to 0x66. It should work. -
Hello @cryptospok
like @Robertof says -
1
is the firmware version. At least now you know your 2Relay is alive, your M5Core2 can finally talk to it, and which I2C address it is using. (And if you are ever in doubt again, you can use the I2C scan method again to find its current I2C address.)Thanks
Felix -
This post is deleted! -
@Robertof ab @felmue, thank you very much!
Now everything works!I finally understood what was going on... I did some tests and then I managed to put an address in one module, then in the other and then I can access both at the same time. One of them was at 0x32 and the other at 0x33. I need 4 relays for my project... now the conditions acquired by a BME688 will change the states of the relays.
You helped a lot, not only to solve my problem but also to understand the process.
Success and health to you all!
-
Hello @cryptospok
you are welcome. I am glad to hear you got it working the way you wanted.
And you!
Thanks
Felix