Dear All,
I'm falling in love with this board and I'm working on a pedal board to control all my music instruments via MIDI USB.
My project involves 6 I2C OLED SSD1306 128X64 screens to show the preset related to each pedal.
I want to use the Nano 33 IOT but I have to make work the i2c multiplexer to end this project.
The strange thing is that the i2c is working well and the scanner sketch reveal the internal IMU, the multiplexer, etc... If I connect one oled screen, it works very well.
I don't understand why, I tried the same sketch on a Due, Mega and other boards and everything works.
Any suggestion?
Without a schematic I can only take a SWAG and say you have wrong values or missing pull up resistors and or wires to long.
Dear Gilshultz,
I use a DFRobot I2C Multiplexer breakout board https://www.dfrobot.com/product-1780.html, I choose this because it is compact and easy to connect to oleds with a 4 pin cable.
Cables are 10cm from the board to multiplexer and 10cm from multiplexer to oleds.
If you want I can post the code even if I know that it works with all the other Arduino I tried.
I was wandering if there is something special in the Nano 33 IOT I2C?
#include <Wire.h>
#include <U8g2lib.h>
#define NUMSCREENS 6
#define TCAADDR 0x70
U8G2_SSD1306_128X64_NONAME_F_HW_I2C display128x64(U8G2_R0, U8X8_PIN_NONE);
struct display
{
U8G2 *display;
uint8_t i2cnum;
const u8g2_cb_t *rotation;
};
display OLEDS[NUMSCREENS] = {
/*{ &type, TCA I2C index, orientation, shared }, rotazione: U8G2_R0 contatti sopra, U8G2_R2 conttatti sotto*/
{&display128x64, 0, U8G2_R2},
{&display128x64, 1, U8G2_R2},
{&display128x64, 2, U8G2_R2},
{&display128x64, 3, U8G2_R2},
{&display128x64, 4, U8G2_R2},
{&display128x64, 5, U8G2_R2}
};
void tcaselect(uint8_t i)
{
if (i > 7)
return;
Wire.beginTransmission(TCAADDR);
Wire.write(1 << i);
Wire.endTransmission();
}
void setup()
{
Serial.begin(115200);
while (!Serial);
for (uint8_t i = 0; i < NUMSCREENS; i++)
{
tcaselect(OLEDS[i].i2cnum);
OLEDS[i].display->begin();
OLEDS[i].display->setDisplayRotation(OLEDS[i].rotation);
OLEDS[i].display->setFont(u8g2_font_logisoso28_tf);
OLEDS[i].display->setContrast(100);
OLEDS[i].display->firstPage();
do
{
OLEDS[i].display->setDrawColor(1);
OLEDS[i].display->setCursor(0, 32);
OLEDS[i].display->print("Screen");
OLEDS[i].display->print(i);
} while (OLEDS[i].display->nextPage());
}
}
void loop()
{
}
I suspect there is nothing wrong with the multiplexer, and that the problem is the way your code is handling multiple oled screens (sharing the same object for all 6).
Can you please explain why you believe the multiplexer is the cause of the problem? What other Arduino did you test the circuit on? Do you realize that the nano 33 is a 3.3V device, not a 5V device? What pull-up resistors do you have on the i2c lines and where are they connected?
Hi PaulRB,
I don't think the multiplexer is the problem. I think that Nano 33 IOT works in another way compared to other Arduinos with I2C and I don't understand why.
I also tried what is suggested form DFRobot with this multiplexer https://wiki.dfrobot.com/Gravity__Digital_1-to-8_I2C_Multiplexer_SKU_DFR0576
and it doesn't work as well but just on the Nano 33 IOT.
PaulRB, sharing the same object for all 6 works very well, it is an objects array.
As you can see in the specs of the multiplexer can be used with 5V and 3,3V in fact I used with Arduino Due, Mega, Uno, Portenta H7, etc...
I also tried to supply power from an external source thinking that the Nano couldn't supply enough power for all oleds and multiplexer, but it didn't work.
I don't see how it could be the cause of your problem, but I feel I must point something out:
display OLEDS[NUMSCREENS] = {
/*{ &type, TCA I2C index, orientation, shared }, rotazione: U8G2_R0 contatti sopra, U8G2_R2 conttatti sotto*/
{&display128x64, 0, U8G2_R2},
{&display128x64, 1, U8G2_R2},
{&display128x64, 2, U8G2_R2},
{&display128x64, 3, U8G2_R2},
{&display128x64, 4, U8G2_R2},
{&display128x64, 5, U8G2_R2}
};
Your struct array is 100% pointless.
It contains 6 identical copies of a pointer to the same oled object.
It contains 6 identical copies of the constant U8G2_R2.
It contains an integer which is exactly equal to the array index, so is not needed.
PaulRB, you should be completely right.
I found this code online, I tested it and it worked and so I used it.
It worked except for this Nano 33 IOT board. I don't understand why and how to solve it. I will be very happy to change the sketch and let it work.
Unfortunately I don't have a Nano 33 iot. But I don't know and have not heard of any reasons why it would not work the same as other Arduino in this respect. @gilshultz asked about pull-up resistors, did you try any? Do you know if there are any on the multiplexer or the oleds?
The ATSAMD21 is a normal processor. It is also used in the Arduino Zero and most MKR boards. There should be no problem.
I'm thinking about voltages, power, crosstalk, spikes, and so on.
A schematic of the DFRobot I2C multiplexer is here: https://github.com/Arduinolibrary/Gravity_Digital_I2C_Multiplexer
It seems to have pullup resistors for every I2C bus. That is okay.
But what is that voltage regulator doing there ? It is a SPX3819M5 with a low voltage drop, but I think that is a design mistake.
Can you show a photo of your project ?
Do you use cables with the 4 wires together ? Please split all your wires. The SDA may not be next to the SCL. That is another design mistake.
Do you have a multimeter ? Can you select a (sub) I2C channel and then measure all the voltages ? The SDA and SCL should be near 3.3V.
Dear All,
I solved it.
Nothing related to anything about cables, circuits, ecc...
I just missed to add the Wire.begin(); in the setup.
Sorry for bothering you!
I don't know how it works without the Wire.begin() with Arduino Due, Megan etc...
Thanks a lot for your help and Seanson Greetings!!!!
@PaulRB you were right about the code, I simplified it and it works very well!!!
Thanks for sharing. I'm glad you found the problem.
Indeed, that was missing. We should have seen that ! The points go to you
Sometimes a library that uses the I2C bus has the Wire.begin()
in its library, some libraries have special code for certain Arduino boards, and sometimes the I2C bus that is used should be assigned when creating the object and sometimes in the setup()
function. There are enough possibilities that it behaves in a different way on other boards.
Thanks Koepel,
I lost my mind finding the bug than I found the solution when I tested the I2C scanner and it was working properly and also the serial monitor was working well. Instead, my sketch had problem with both: I2C and serial monitor. I compared the code and when I saw the missing line I nearly cried .
Anyway, now my project is going fast.
It is hard to be a maker, but it so satisfying when you find the solution.
Happy Christmas!
Paolo
i have question, can 5V one channel relay be use in arduino nano 33 iot?
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.